For a per-object setting, use the user-defined value first

CURA-4186

In a per-object setting, if there is user defined value, use that first.
If the value is default, then evaluate it with the normal routine.
This commit is contained in:
Lipu Fei 2017-08-25 12:19:05 +02:00
parent 414901ae84
commit a320784a6d

View file

@ -3,6 +3,7 @@ from typing import Any, Optional
from UM.Decorators import override from UM.Decorators import override
from UM.Settings.Interfaces import PropertyEvaluationContext from UM.Settings.Interfaces import PropertyEvaluationContext
from UM.Settings.ContainerStack import ContainerStack from UM.Settings.ContainerStack import ContainerStack
from UM.Settings.SettingInstance import InstanceState
class PerObjectContainerStack(ContainerStack): class PerObjectContainerStack(ContainerStack):
@ -17,6 +18,13 @@ class PerObjectContainerStack(ContainerStack):
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
global_stack = CuraApplication.getInstance().getGlobalContainerStack() global_stack = CuraApplication.getInstance().getGlobalContainerStack()
# Return the user defined value if present, otherwise, evaluate the value according to the default routine.
if self.getContainer(0).hasProperty(key, property_name):
if self.getContainer(0)._instances[key].state == InstanceState.User:
result = super().getProperty(key, property_name, context)
context.popContainer()
return result
# Handle the "limit_to_extruder" property. # Handle the "limit_to_extruder" property.
limit_to_extruder = super().getProperty(key, "limit_to_extruder", context) limit_to_extruder = super().getProperty(key, "limit_to_extruder", context)
if limit_to_extruder is not None: if limit_to_extruder is not None: