mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Robustly get layer height even if quality has none
If the quality profile doesn't define a layer height (which it currently always has) then this should still get the proper layer height. It proceeds properly down the stack now. Contributes to issue CURA-2737.
This commit is contained in:
parent
57b0275384
commit
16491d8d23
1 changed files with 15 additions and 9 deletions
|
@ -478,21 +478,27 @@ class MachineManager(QObject):
|
||||||
#
|
#
|
||||||
# This is indicated together with the name of the active quality profile.
|
# This is indicated together with the name of the active quality profile.
|
||||||
#
|
#
|
||||||
# \return The layer height of the currently active quality profile.
|
# \return The layer height of the currently active quality profile. If
|
||||||
|
# there is no quality profile, this returns 0.
|
||||||
@pyqtProperty(float, notify=activeQualityChanged)
|
@pyqtProperty(float, notify=activeQualityChanged)
|
||||||
def activeQualityLayerHeight(self):
|
def activeQualityLayerHeight(self):
|
||||||
if not self._global_container_stack:
|
if not self._global_container_stack:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
quality = self._global_container_stack.findContainer({"type": "quality_changes"})
|
quality_changes = self._global_container_stack.findContainer({"type": "quality_changes"})
|
||||||
if quality and quality.hasProperty("layer_height", "value"):
|
if quality_changes:
|
||||||
print(quality.getProperty("layer_height", "value"))
|
value = self._global_container_stack.getRawProperty("layer_height", "value", skip_until_container = quality_changes.getId())
|
||||||
return quality.getProperty("layer_height", "value")
|
if isinstance(value, UM.Settings.SettingFunction):
|
||||||
|
value = value(self._global_container_stack)
|
||||||
|
return value
|
||||||
quality = self._global_container_stack.findContainer({"type": "quality"})
|
quality = self._global_container_stack.findContainer({"type": "quality"})
|
||||||
if quality and quality.hasProperty("layer_height", "value"): #This depends on layer_height always being present in the quality.
|
if quality:
|
||||||
#If it isn't, there is no way we can find the layer_height while excluding any layer_height in the user profile.
|
value = self._global_container_stack.getRawProperty("layer_height", "value", skip_until_container = quality.getId())
|
||||||
return quality.getProperty("layer_height", "value")
|
if isinstance(value, UM.Settings.SettingFunction):
|
||||||
return 0
|
value = value(self._global_container_stack)
|
||||||
|
return value
|
||||||
|
|
||||||
|
return 0 #No quality profile.
|
||||||
|
|
||||||
## Get the Material ID associated with the currently active material
|
## Get the Material ID associated with the currently active material
|
||||||
# \returns MaterialID (string) if found, empty string otherwise
|
# \returns MaterialID (string) if found, empty string otherwise
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue