41 Commits

Author SHA1 Message Date
Nino van Hooff
89f0970a88 Remove trailing whitespace from Python files 2020-05-29 14:30:33 +02:00
Jelle Spijker
120541a8db
Updated comments in Models
Converted doxygen style comments to reStructuredText style in the files
 found in Cura/cura/Model directory recursively  using the script
dox_2_rst.py (provided in the Uranium repo). Comments were manually
 checked and changed if needed.

 Note: dox_2rst.py struggles with decorated functions.
2020-05-08 18:59:38 +02:00
Kostas Karmas
d5cfca4df0 Fix loading machine specific materials
The container registry was incorrectly being searched with a
variant_name == None, which always returned an empty printer-specific
materials list. As a result, the generic material settings were always
being loaded if there was no variant specifically indicated inside
the fdm_material file. The printer specific values were consistently
being ignored.

This commit fixes that by removing the search with a variant_name==None
which correctly returns the printer-specific materials list while
loading the materials from the variant nodes.

CURA-7087
2020-01-13 13:44:51 +01:00
Nino van Hooff
38935a1d02 Fix selecting a new material for a base file on container deletion
CURA-7023
2019-12-10 13:53:26 +01:00
Jaime van Kessel
00078fd659
Remove a bunch of unused imports 2019-11-08 13:38:42 +01:00
Jaime van Kessel
870db0641b
Ensure that machines with 1.75mm filament select the right preferred material
CURA-6950
2019-11-05 13:11:49 +01:00
Jaime van Kessel
9d9d82dc24
Make logging when using a fallback for preferred material more explicit
CURA-6950
2019-11-04 16:58:57 +01:00
Jaime van Kessel
1284d9fe8d
Fix setting prefered material on machine creation
The previous check would occasionaly set duplicated materials
2019-10-30 11:27:46 +01:00
Lipu Fei
66bc20eab1 Revert incorrect material handling code in VariantNode
CURA-6921
2019-10-22 14:53:14 +02:00
Lipu Fei
43fa4337f9 Fix merge conflicts 2019-10-15 13:08:00 +02:00
Lipu Fei
577365cf96 Fx containerAdded handling in VariantNode
CURA-6889
2019-10-15 08:20:25 +02:00
Lipu Fei
cc64fb0a93 Fix variant handling in VariantNode
CURA-6863
2019-10-14 14:19:18 +02:00
Lipu Fei
8b913f4009 Merge remote-tracking branch 'origin/master' into CURA-6863_duplicated_material_oddness 2019-10-14 12:23:49 +02:00
Remco Burema
26a7de5a27 Fix boolean check.
part of CURA-6863
2019-10-14 11:02:58 +02:00
Remco Burema
4277ede64f Fix 1/2 of the duplication material bug.
The material is added multiple times to the variant nodes, and overwriting it with the eventual right one was going wrong.
This does not solve it entirely (because the less specific one still ends up selected _initially_ because it gets added first, and the order can't be guaranteed.
part of CURA-6863
2019-10-14 01:01:19 +02:00
Nino van Hooff
d60b26db15 None-check for material diameter.
Fixes a crash for materials which don't have that metadata-entry,
such as an empty material (UM2)

CURA-6873
2019-10-10 09:27:23 +02:00
Ghostkeeper
54c1980f78
Fix preferring correct diameter over correct preference
If the diameter doesn't match up, then the print fails. If the preference is not held up, then it chooses some random material and the user will understand what it chose.

Done during Turbo Testing and Tooling because a test was failing.
2019-10-04 17:35:38 +02:00
Jaime van Kessel
85ed22de4c
Add some profiling decorators to the ContainerTree 2019-10-04 13:29:22 +02:00
Ghostkeeper
649ca99fe0
Only match on printer-specific materials, not variant-specific too
If a submaterial doesn't exist for the current variant node but it does exist for a different variant node, then it would not be found in the variant-specific materials and then would be looked up in the printer-specific materials. It then depends on the order in which findInstanceContainersMetadata returns things for whether the actual printer-specific material is selected or a different variant-specific material is selected. No longer now, because the variant name is specified to be absent so it may not match on variant-specific profiles any more.
Maybe this even gives us a small performance gain when combining these dictionaries, since there are now like 80% fewer profiles in that query.

Contributes to issue CURA-6831.
2019-10-02 08:55:13 +02:00
Ghostkeeper
0b610ccd58
Fix getting correct metadata entry for variant name
Turns out that the material profiles deserialise the variant to the 'variant_name' metadata entry, not just 'variant'. This caused it to find no variant-specific material profiles at all anywhere. It would always fall back to the machine-specific names.

Contributes to issue CURA-6831.
2019-10-02 08:55:12 +02:00
Ghostkeeper
b245be6970
Remove has_machine_materials metadata
It's not behaving as expected here. For instance, Ultimaker 3 wasn't specifying has_machine_materials and thus only the base materials would get loaded, but clearly the Ultimaker 3 has materials specialised for it.
Whether or not a printer has materials specialised for it is now determined by whether the specialisations exist in the material files. So we don't need the metadata entry any more. It seemed to have not been in use anyway, except by one printer which specified that has_machine_materials is true. I've now made it behave as if it's always true.

Contributes to issue CURA-6831.
2019-10-02 08:55:04 +02:00
Jaime van Kessel
d548404dfd Fix typing issues 2019-08-29 16:23:10 +02:00
Ghostkeeper
0398c404fb
Update tree when material gets deleted
Contributes to issue CURA-6600.
2019-08-27 18:01:35 +02:00
Ghostkeeper
f5ca29c7aa
Emit materialsChanged from the variant when a material gets added
This allows the material models to update themselves.

Contributes to issue CURA-6600.
2019-08-27 18:01:35 +02:00
Ghostkeeper
9297890d78
Fix typing of approximate diameter and add typing to function for it
Seems I forgot to add typing and that's biting my bum right now.

Contributes to issue CURA-6600.
2019-08-27 17:21:22 +02:00
Ghostkeeper
fcab800a8d
Add function to find preferred quality profile
Not for global yet, so it doesn't appear as if anything is loaded yet.

Contributes to issue CURA-6600.
2019-08-26 17:50:46 +02:00
Ghostkeeper
9bcf2698d5
Log warning when preferred material can't be found
Contributes to issue CURA-6600.
2019-08-22 17:02:09 +02:00
Ghostkeeper
9dca6c0127
Return empty node if preferred node couldn't be found
Or any node, really. There must now always be a subnode.

Contributes to issue CURA-6600.
2019-08-22 16:52:38 +02:00
Ghostkeeper
46cf7aafa9
Encode empty containers in container tree if necessary
You can now be assured that there is ALWAYS at least one child node, except for child nodes of intent profiles which don't exist.

Contributes to issue CURA-6600.
2019-08-22 16:44:52 +02:00
Ghostkeeper
999e19940e
Also don't add any materials added later if there are no materials
Keeps it consistent.

Contributes to issue CURA-6600.
2019-08-22 15:43:16 +02:00
Ghostkeeper
6f77c8735c
Don't load any materials for printers that don't have them
For instance the Ultimaker 2 shouldn't display any materials.

Contributes to issue CURA-6600.
2019-08-22 15:37:05 +02:00
Ghostkeeper
295ad564c0
Add function to find preferred material for configuration of printer/nozzle
This is supposed to replace the material manager's getDefaultMaterial function.

Contributes to issue CURA-6600.
2019-08-22 15:34:24 +02:00
Ghostkeeper
6c6dd0efad
Add signals to signal that a material got changed or removed
The material models need to know this.

Contributes to issue CURA-6600.
2019-08-22 09:25:25 +02:00
Jaime van Kessel
6e5b0bb609 Fix the filtering of materials based on exclude_materials
CURA-6600
2019-08-07 17:03:41 +02:00
Ghostkeeper
accc4ccd21
Only remove excluded materials that were added
Contributes to issue CURA-6600.
2019-08-07 09:50:53 +02:00
Ghostkeeper
8e49991087
Resolve circular imports
Some of these are only used for the type checks.

Contributes to issue CURA-6600.
2019-08-06 17:04:29 +02:00
Ghostkeeper
8ec1c31b58
Don't make parent a common property
Instead we use properly-typed and appropriately-named variables in each of the sub classes.

Contributes to issue CURA-6600.
2019-08-06 16:31:57 +02:00
Ghostkeeper
24346fc8e3
Don't add materials forbidden by the printer definition
Contributes to issue CURA-6600.
2019-08-06 15:21:52 +02:00
Ghostkeeper
bc3300baa8
Assume that the tree is always constructed after metadata has been loaded
Safe assumption, since the tree can only start constructing after the stacks are loaded.

Contributes to issue CURA-6600.
2019-08-06 15:13:29 +02:00
Ghostkeeper
b46d4eb2b5
Have variant nodes build their own children
When a variant and a variant love each other...

Contributes to issue CURA-6600.
2019-08-06 15:11:16 +02:00
Ghostkeeper
9fda7bd0b9
Rework container tree structure
This sets up a few new classes, subclasses of ContainerNode.

This is intended to simplify the current structure in the QualityManager.

Contributes to issue CURA-6600.
2019-08-05 17:39:19 +02:00