mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Add support for global quality profiles
Instead of using one of the extruder profiles as global quality, use proper global qualities. Contributes to CURA-2646
This commit is contained in:
parent
2bff94ba9f
commit
e82b2c0f80
@ -82,8 +82,9 @@ class QualityManager:
|
|||||||
# \param material_containers (Optional) \type{List[ContainerInstance]} If nothing is specified then
|
# \param material_containers (Optional) \type{List[ContainerInstance]} If nothing is specified then
|
||||||
# the current set of selected materials is used.
|
# the current set of selected materials is used.
|
||||||
# \return the matching quality container \type{ContainerInstance}
|
# \return the matching quality container \type{ContainerInstance}
|
||||||
def findQualityByQualityType(self, quality_type, machine_definition=None, material_containers=None):
|
def findQualityByQualityType(self, quality_type, machine_definition=None, material_containers=None, **kwargs):
|
||||||
criteria = {"type": "quality"}
|
criteria = kwargs
|
||||||
|
criteria["type"] = "quality"
|
||||||
if quality_type:
|
if quality_type:
|
||||||
criteria["quality_type"] = quality_type
|
criteria["quality_type"] = quality_type
|
||||||
result = self._getFilteredContainersForStack(machine_definition, material_containers, **criteria)
|
result = self._getFilteredContainersForStack(machine_definition, material_containers, **criteria)
|
||||||
@ -218,7 +219,7 @@ class QualityManager:
|
|||||||
result = []
|
result = []
|
||||||
for container in containers:
|
for container in containers:
|
||||||
# If the machine specifies we should filter by material, exclude containers that do not match any active material.
|
# If the machine specifies we should filter by material, exclude containers that do not match any active material.
|
||||||
if filter_by_material and container.getMetaDataEntry("material") not in material_ids:
|
if filter_by_material and container.getMetaDataEntry("material") not in material_ids and not "global_quality" in kwargs:
|
||||||
continue
|
continue
|
||||||
result.append(container)
|
result.append(container)
|
||||||
return result
|
return result
|
||||||
|
@ -769,8 +769,13 @@ class MachineManager(QObject):
|
|||||||
|
|
||||||
if extruder_stacks:
|
if extruder_stacks:
|
||||||
# Add an extra entry for the global stack.
|
# Add an extra entry for the global stack.
|
||||||
result.append({"stack": global_container_stack, "quality": result[0]["quality"],
|
global_quality = quality_manager.findQualityByQualityType(quality_type, global_machine_definition, [], global_quality = "True")
|
||||||
"quality_changes": empty_quality_changes})
|
|
||||||
|
if not global_quality:
|
||||||
|
global_quality = self._empty_quality_container
|
||||||
|
|
||||||
|
result.append({"stack": global_container_stack, "quality": global_quality, "quality_changes": empty_quality_changes})
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
## Determine the quality and quality changes settings for the current machine for a quality changes name.
|
## Determine the quality and quality changes settings for the current machine for a quality changes name.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user