Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'cura/Settings/ExtruderManager.py')
-rwxr-xr-xcura/Settings/ExtruderManager.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py
index 9e17ce028d..1c01b1fc8a 100755
--- a/cura/Settings/ExtruderManager.py
+++ b/cura/Settings/ExtruderManager.py
@@ -16,6 +16,7 @@ from UM.Settings.InstanceContainer import InstanceContainer
from UM.Settings.SettingFunction import SettingFunction
from UM.Settings.ContainerStack import ContainerStack
from UM.Settings.Interfaces import DefinitionContainerInterface
+from UM.Settings.PropertyEvaluationContext import PropertyEvaluationContext
from typing import Optional, List, TYPE_CHECKING, Union
if TYPE_CHECKING:
@@ -620,6 +621,22 @@ class ExtruderManager(QObject):
return value
+ ## Get the default value from the given extruder. This function will skip the user settings container.
+ @staticmethod
+ def getDefaultExtruderValue(extruder_index, key):
+ extruder = ExtruderManager.getInstance().getExtruderStack(extruder_index)
+ context = PropertyEvaluationContext()
+ context.context["evaluate_from_container_index"] = 1 # skip the user settings container
+
+ if extruder:
+ value = extruder.getRawProperty(key, "value", context = context)
+ if isinstance(value, SettingFunction):
+ value = value(extruder, context = context)
+ else: # Just a value from global.
+ value = Application.getInstance().getGlobalContainerStack().getProperty(key, "value", context = context)
+
+ return value
+
## Get the resolve value or value for a given key
#
# This is the effective value for a given key, it is used for values in the global stack.