ExtruderManager.py 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. # Copyright (c) 2016 Ultimaker B.V.
  2. # Cura is released under the terms of the AGPLv3 or higher.
  3. from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant #For communicating data and events to Qt.
  4. from UM.FlameProfiler import pyqtSlot
  5. from UM.Application import Application #To get the global container stack to find the current machine.
  6. from UM.Logger import Logger
  7. from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
  8. from UM.Scene.SceneNode import SceneNode
  9. from UM.Settings.ContainerRegistry import ContainerRegistry #Finding containers by ID.
  10. from UM.Settings.InstanceContainer import InstanceContainer
  11. from UM.Settings.SettingFunction import SettingFunction
  12. from UM.Settings.ContainerStack import ContainerStack
  13. from UM.Settings.DefinitionContainer import DefinitionContainer
  14. from typing import Optional
  15. ## Manages all existing extruder stacks.
  16. #
  17. # This keeps a list of extruder stacks for each machine.
  18. class ExtruderManager(QObject):
  19. ## Signal to notify other components when the list of extruders for a machine definition changes.
  20. extrudersChanged = pyqtSignal(QVariant)
  21. ## Signal to notify other components when the global container stack is switched to a definition
  22. # that has different extruders than the previous global container stack
  23. globalContainerStackDefinitionChanged = pyqtSignal()
  24. ## Notify when the user switches the currently active extruder.
  25. activeExtruderChanged = pyqtSignal()
  26. ## Registers listeners and such to listen to changes to the extruders.
  27. def __init__(self, parent = None):
  28. super().__init__(parent)
  29. self._extruder_trains = { } #Per machine, a dictionary of extruder container stack IDs.
  30. self._active_extruder_index = 0
  31. Application.getInstance().globalContainerStackChanged.connect(self.__globalContainerStackChanged)
  32. self._global_container_stack_definition_id = None
  33. self._addCurrentMachineExtruders()
  34. ## Gets the unique identifier of the currently active extruder stack.
  35. #
  36. # The currently active extruder stack is the stack that is currently being
  37. # edited.
  38. #
  39. # \return The unique ID of the currently active extruder stack.
  40. @pyqtProperty(str, notify = activeExtruderChanged)
  41. def activeExtruderStackId(self) -> Optional[str]:
  42. if not Application.getInstance().getGlobalContainerStack():
  43. return None # No active machine, so no active extruder.
  44. try:
  45. return self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()][str(self._active_extruder_index)].getId()
  46. except KeyError: # Extruder index could be -1 if the global tab is selected, or the entry doesn't exist if the machine definition is wrong.
  47. return None
  48. @pyqtProperty(int, notify = extrudersChanged)
  49. def extruderCount(self):
  50. if not Application.getInstance().getGlobalContainerStack():
  51. return 0 # No active machine, so no extruders.
  52. try:
  53. return len(self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()])
  54. except KeyError:
  55. return 0
  56. @pyqtProperty("QVariantMap", notify=extrudersChanged)
  57. def extruderIds(self):
  58. map = {}
  59. for position in self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()]:
  60. map[position] = self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()][position].getId()
  61. return map
  62. @pyqtSlot(str, result = str)
  63. def getQualityChangesIdByExtruderStackId(self, id: str) -> str:
  64. for position in self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()]:
  65. extruder = self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()][position]
  66. if extruder.getId() == id:
  67. return extruder.findContainer(type = "quality_changes").getId()
  68. ## The instance of the singleton pattern.
  69. #
  70. # It's None if the extruder manager hasn't been created yet.
  71. __instance = None
  72. ## Gets an instance of the extruder manager, or creates one if no instance
  73. # exists yet.
  74. #
  75. # This is an implementation of singleton. If an extruder manager already
  76. # exists, it is re-used.
  77. #
  78. # \return The extruder manager.
  79. @classmethod
  80. def getInstance(cls) -> "ExtruderManager":
  81. if not cls.__instance:
  82. cls.__instance = ExtruderManager()
  83. return cls.__instance
  84. ## Changes the active extruder by index.
  85. #
  86. # \param index The index of the new active extruder.
  87. @pyqtSlot(int)
  88. def setActiveExtruderIndex(self, index: int) -> None:
  89. self._active_extruder_index = index
  90. self.activeExtruderChanged.emit()
  91. @pyqtProperty(int, notify = activeExtruderChanged)
  92. def activeExtruderIndex(self) -> int:
  93. return self._active_extruder_index
  94. ## Gets the extruder name of an extruder of the currently active machine.
  95. #
  96. # \param index The index of the extruder whose name to get.
  97. @pyqtSlot(int, result = str)
  98. def getExtruderName(self, index):
  99. try:
  100. return list(self.getActiveExtruderStacks())[index].getName()
  101. except IndexError:
  102. return ""
  103. def getActiveExtruderStack(self) -> ContainerStack:
  104. global_container_stack = Application.getInstance().getGlobalContainerStack()
  105. if global_container_stack:
  106. if global_container_stack.getId() in self._extruder_trains:
  107. if str(self._active_extruder_index) in self._extruder_trains[global_container_stack.getId()]:
  108. return self._extruder_trains[global_container_stack.getId()][str(self._active_extruder_index)]
  109. return None
  110. ## Get an extruder stack by index
  111. def getExtruderStack(self, index):
  112. global_container_stack = Application.getInstance().getGlobalContainerStack()
  113. if global_container_stack:
  114. if global_container_stack.getId() in self._extruder_trains:
  115. if str(index) in self._extruder_trains[global_container_stack.getId()]:
  116. return self._extruder_trains[global_container_stack.getId()][str(index)]
  117. return None
  118. ## Adds all extruders of a specific machine definition to the extruder
  119. # manager.
  120. #
  121. # \param machine_definition The machine definition to add the extruders for.
  122. # \param machine_id The machine_id to add the extruders for.
  123. def addMachineExtruders(self, machine_definition: DefinitionContainer, machine_id: str) -> None:
  124. changed = False
  125. machine_definition_id = machine_definition.getId()
  126. if machine_id not in self._extruder_trains:
  127. self._extruder_trains[machine_id] = { }
  128. changed = True
  129. container_registry = ContainerRegistry.getInstance()
  130. if container_registry:
  131. # Add the extruder trains that don't exist yet.
  132. for extruder_definition in container_registry.findDefinitionContainers(machine = machine_definition_id):
  133. position = extruder_definition.getMetaDataEntry("position", None)
  134. if not position:
  135. Logger.log("w", "Extruder definition %s specifies no position metadata entry.", extruder_definition.getId())
  136. if not container_registry.findContainerStacks(machine = machine_id, position = position): # Doesn't exist yet.
  137. self.createExtruderTrain(extruder_definition, machine_definition, position, machine_id)
  138. changed = True
  139. # Gets the extruder trains that we just created as well as any that still existed.
  140. extruder_trains = container_registry.findContainerStacks(type = "extruder_train", machine = machine_id)
  141. for extruder_train in extruder_trains:
  142. self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train
  143. # regardless of what the next stack is, we have to set it again, because of signal routing.
  144. extruder_train.setNextStack(Application.getInstance().getGlobalContainerStack())
  145. changed = True
  146. if changed:
  147. self.extrudersChanged.emit(machine_id)
  148. def registerExtruder(self, extruder_train, machine_id):
  149. changed = False
  150. if machine_id not in self._extruder_trains:
  151. self._extruder_trains[machine_id] = {}
  152. changed = True
  153. if extruder_train:
  154. self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train
  155. changed = True
  156. if changed:
  157. self.extrudersChanged.emit(machine_id)
  158. ## Creates a container stack for an extruder train.
  159. #
  160. # The container stack has an extruder definition at the bottom, which is
  161. # linked to a machine definition. Then it has a variant profile, a material
  162. # profile, a quality profile and a user profile, in that order.
  163. #
  164. # The resulting container stack is added to the registry.
  165. #
  166. # \param extruder_definition The extruder to create the extruder train for.
  167. # \param machine_definition The machine that the extruder train belongs to.
  168. # \param position The position of this extruder train in the extruder slots of the machine.
  169. # \param machine_id The id of the "global" stack this extruder is linked to.
  170. def createExtruderTrain(self, extruder_definition: DefinitionContainer, machine_definition: DefinitionContainer,
  171. position, machine_id: str) -> None:
  172. # Cache some things.
  173. container_registry = ContainerRegistry.getInstance()
  174. machine_definition_id = Application.getInstance().getMachineManager().getQualityDefinitionId(machine_definition)
  175. # Create a container stack for this extruder.
  176. extruder_stack_id = container_registry.uniqueName(extruder_definition.getId())
  177. container_stack = ContainerStack(extruder_stack_id)
  178. container_stack.setName(extruder_definition.getName()) # Take over the display name to display the stack with.
  179. container_stack.addMetaDataEntry("type", "extruder_train")
  180. container_stack.addMetaDataEntry("machine", machine_id)
  181. container_stack.addMetaDataEntry("position", position)
  182. container_stack.addContainer(extruder_definition)
  183. # Find the variant to use for this extruder.
  184. variant = container_registry.findInstanceContainers(id = "empty_variant")[0]
  185. if machine_definition.getMetaDataEntry("has_variants"):
  186. # First add any variant. Later, overwrite with preference if the preference is valid.
  187. variants = container_registry.findInstanceContainers(definition = machine_definition_id, type = "variant")
  188. if len(variants) >= 1:
  189. variant = variants[0]
  190. preferred_variant_id = machine_definition.getMetaDataEntry("preferred_variant")
  191. if preferred_variant_id:
  192. preferred_variants = container_registry.findInstanceContainers(id = preferred_variant_id, definition = machine_definition_id, type = "variant")
  193. if len(preferred_variants) >= 1:
  194. variant = preferred_variants[0]
  195. else:
  196. Logger.log("w", "The preferred variant \"%s\" of machine %s doesn't exist or is not a variant profile.", preferred_variant_id, machine_id)
  197. # And leave it at the default variant.
  198. container_stack.addContainer(variant)
  199. # Find a material to use for this variant.
  200. material = container_registry.findInstanceContainers(id = "empty_material")[0]
  201. if machine_definition.getMetaDataEntry("has_materials"):
  202. # First add any material. Later, overwrite with preference if the preference is valid.
  203. machine_has_variant_materials = machine_definition.getMetaDataEntry("has_variant_materials", default = False)
  204. if machine_has_variant_materials or machine_has_variant_materials == "True":
  205. materials = container_registry.findInstanceContainers(type = "material", definition = machine_definition_id, variant = variant.getId())
  206. else:
  207. materials = container_registry.findInstanceContainers(type = "material", definition = machine_definition_id)
  208. if len(materials) >= 1:
  209. material = materials[0]
  210. preferred_material_id = machine_definition.getMetaDataEntry("preferred_material")
  211. if preferred_material_id:
  212. search_criteria = { "type": "material", "id": preferred_material_id}
  213. if machine_definition.getMetaDataEntry("has_machine_materials"):
  214. search_criteria["definition"] = machine_definition_id
  215. if machine_definition.getMetaDataEntry("has_variants") and variant:
  216. search_criteria["variant"] = variant.id
  217. else:
  218. search_criteria["definition"] = "fdmprinter"
  219. preferred_materials = container_registry.findInstanceContainers(**search_criteria)
  220. if len(preferred_materials) >= 1:
  221. material = preferred_materials[0]
  222. else:
  223. Logger.log("w", "The preferred material \"%s\" of machine %s doesn't exist or is not a material profile.", preferred_material_id, machine_id)
  224. # And leave it at the default material.
  225. container_stack.addContainer(material)
  226. # Find a quality to use for this extruder.
  227. quality = container_registry.getEmptyInstanceContainer()
  228. search_criteria = { "type": "quality" }
  229. if machine_definition.getMetaDataEntry("has_machine_quality"):
  230. search_criteria["definition"] = machine_definition_id
  231. if machine_definition.getMetaDataEntry("has_materials") and material:
  232. search_criteria["material"] = material.id
  233. else:
  234. search_criteria["definition"] = "fdmprinter"
  235. preferred_quality = machine_definition.getMetaDataEntry("preferred_quality")
  236. if preferred_quality:
  237. search_criteria["id"] = preferred_quality
  238. containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria)
  239. if not containers and preferred_quality:
  240. Logger.log("w", "The preferred quality \"%s\" of machine %s doesn't exist or is not a quality profile.", preferred_quality, machine_id)
  241. search_criteria.pop("id", None)
  242. containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria)
  243. if containers:
  244. quality = containers[0]
  245. container_stack.addContainer(quality)
  246. empty_quality_changes = container_registry.findInstanceContainers(id = "empty_quality_changes")[0]
  247. container_stack.addContainer(empty_quality_changes)
  248. user_profile = container_registry.findInstanceContainers(type = "user", extruder = extruder_stack_id)
  249. if user_profile: # There was already a user profile, loaded from settings.
  250. user_profile = user_profile[0]
  251. else:
  252. user_profile = InstanceContainer(extruder_stack_id + "_current_settings") # Add an empty user profile.
  253. user_profile.addMetaDataEntry("type", "user")
  254. user_profile.addMetaDataEntry("extruder", extruder_stack_id)
  255. user_profile.setDefinition(machine_definition)
  256. container_registry.addContainer(user_profile)
  257. container_stack.addContainer(user_profile)
  258. # regardless of what the next stack is, we have to set it again, because of signal routing.
  259. container_stack.setNextStack(Application.getInstance().getGlobalContainerStack())
  260. container_registry.addContainer(container_stack)
  261. def getAllExtruderValues(self, setting_key):
  262. return self.getAllExtruderSettings(setting_key, "value")
  263. ## Gets a property of a setting for all extruders.
  264. #
  265. # \param setting_key \type{str} The setting to get the property of.
  266. # \param property \type{str} The property to get.
  267. # \return \type{List} the list of results
  268. def getAllExtruderSettings(self, setting_key, property):
  269. global_container_stack = Application.getInstance().getGlobalContainerStack()
  270. if global_container_stack.getProperty("machine_extruder_count", "value") <= 1:
  271. return [global_container_stack.getProperty(setting_key, property)]
  272. result = []
  273. for index in self.extruderIds:
  274. extruder_stack_id = self.extruderIds[str(index)]
  275. stack = ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0]
  276. result.append(stack.getProperty(setting_key, property))
  277. return result
  278. ## Gets the extruder stacks that are actually being used at the moment.
  279. #
  280. # An extruder stack is being used if it is the extruder to print any mesh
  281. # with, or if it is the support infill extruder, the support interface
  282. # extruder, or the bed adhesion extruder.
  283. #
  284. # If there are no extruders, this returns the global stack as a singleton
  285. # list.
  286. #
  287. # \return A list of extruder stacks.
  288. def getUsedExtruderStacks(self):
  289. global_stack = Application.getInstance().getGlobalContainerStack()
  290. container_registry = ContainerRegistry.getInstance()
  291. if global_stack.getProperty("machine_extruder_count", "value") <= 1: #For single extrusion.
  292. return [global_stack]
  293. used_extruder_stack_ids = set()
  294. #Get the extruders of all meshes in the scene.
  295. support_enabled = False
  296. support_interface_enabled = False
  297. scene_root = Application.getInstance().getController().getScene().getRoot()
  298. meshes = [node for node in DepthFirstIterator(scene_root) if type(node) is SceneNode and node.isSelectable()] #Only use the nodes that will be printed.
  299. for mesh in meshes:
  300. extruder_stack_id = mesh.callDecoration("getActiveExtruder")
  301. if not extruder_stack_id: #No per-object settings for this node.
  302. extruder_stack_id = self.extruderIds["0"]
  303. used_extruder_stack_ids.add(extruder_stack_id)
  304. #Get whether any of them use support.
  305. per_mesh_stack = mesh.callDecoration("getStack")
  306. if per_mesh_stack:
  307. support_enabled |= per_mesh_stack.getProperty("support_enable", "value")
  308. support_interface_enabled |= per_mesh_stack.getProperty("support_interface_enable", "value")
  309. else: #Take the setting from the build extruder stack.
  310. extruder_stack = container_registry.findContainerStacks(id = extruder_stack_id)[0]
  311. support_enabled |= extruder_stack.getProperty("support_enable", "value")
  312. support_interface_enabled |= extruder_stack.getProperty("support_enable", "value")
  313. #The support extruders.
  314. if support_enabled:
  315. used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_infill_extruder_nr", "value"))])
  316. used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_extruder_nr_layer_0", "value"))])
  317. if support_interface_enabled:
  318. used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_interface_extruder_nr", "value"))])
  319. #The platform adhesion extruder. Not used if using none.
  320. if global_stack.getProperty("adhesion_type", "value") != "none":
  321. used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("adhesion_extruder_nr", "value"))])
  322. try:
  323. return [container_registry.findContainerStacks(id = stack_id)[0] for stack_id in used_extruder_stack_ids]
  324. except IndexError: # One or more of the extruders was not found.
  325. Logger.log("e", "Unable to find one or more of the extruders in %s", used_extruder_stack_ids)
  326. return []
  327. ## Removes the container stack and user profile for the extruders for a specific machine.
  328. #
  329. # \param machine_id The machine to remove the extruders for.
  330. def removeMachineExtruders(self, machine_id):
  331. for extruder in self.getMachineExtruders(machine_id):
  332. containers = ContainerRegistry.getInstance().findInstanceContainers(type = "user", extruder = extruder.getId())
  333. for container in containers:
  334. ContainerRegistry.getInstance().removeContainer(container.getId())
  335. ContainerRegistry.getInstance().removeContainer(extruder.getId())
  336. ## Returns extruders for a specific machine.
  337. #
  338. # \param machine_id The machine to get the extruders of.
  339. def getMachineExtruders(self, machine_id):
  340. if machine_id not in self._extruder_trains:
  341. Logger.log("w", "Tried to get the extruder trains for machine %s, which doesn't exist.", machine_id)
  342. return []
  343. return [self._extruder_trains[machine_id][name] for name in self._extruder_trains[machine_id]]
  344. ## Returns a list containing the global stack and active extruder stacks.
  345. #
  346. # The first element is the global container stack, followed by any extruder stacks.
  347. # \return \type{List[ContainerStack]}
  348. def getActiveGlobalAndExtruderStacks(self):
  349. global_stack = Application.getInstance().getGlobalContainerStack()
  350. if not global_stack:
  351. return None
  352. result = [global_stack]
  353. result.extend(self.getActiveExtruderStacks())
  354. return result
  355. ## Returns the list of active extruder stacks.
  356. #
  357. # \return \type{List[ContainerStack]} a list of
  358. def getActiveExtruderStacks(self):
  359. global_stack = Application.getInstance().getGlobalContainerStack()
  360. result = []
  361. if global_stack:
  362. for extruder in sorted(self._extruder_trains[global_stack.getId()]):
  363. result.append(self._extruder_trains[global_stack.getId()][extruder])
  364. return result
  365. def __globalContainerStackChanged(self) -> None:
  366. self._addCurrentMachineExtruders()
  367. global_container_stack = Application.getInstance().getGlobalContainerStack()
  368. if global_container_stack and global_container_stack.getBottom() and global_container_stack.getBottom().getId() != self._global_container_stack_definition_id:
  369. self._global_container_stack_definition_id = global_container_stack.getBottom().getId()
  370. self.globalContainerStackDefinitionChanged.emit()
  371. self.activeExtruderChanged.emit()
  372. ## Adds the extruders of the currently active machine.
  373. def _addCurrentMachineExtruders(self) -> None:
  374. global_stack = Application.getInstance().getGlobalContainerStack()
  375. if global_stack and global_stack.getBottom():
  376. self.addMachineExtruders(global_stack.getBottom(), global_stack.getId())
  377. ## Get all extruder values for a certain setting.
  378. #
  379. # This is exposed to SettingFunction so it can be used in value functions.
  380. #
  381. # \param key The key of the setting to retieve values for.
  382. #
  383. # \return A list of values for all extruders. If an extruder does not have a value, it will not be in the list.
  384. # If no extruder has the value, the list will contain the global value.
  385. @staticmethod
  386. def getExtruderValues(key):
  387. global_stack = Application.getInstance().getGlobalContainerStack()
  388. result = []
  389. for extruder in ExtruderManager.getInstance().getMachineExtruders(global_stack.getId()):
  390. value = extruder.getRawProperty(key, "value")
  391. if value is None:
  392. continue
  393. if isinstance(value, SettingFunction):
  394. value = value(extruder)
  395. result.append(value)
  396. if not result:
  397. result.append(global_stack.getProperty(key, "value"))
  398. return result
  399. ## Get all extruder values for a certain setting.
  400. #
  401. # This is exposed to qml for display purposes
  402. #
  403. # \param key The key of the setting to retieve values for.
  404. #
  405. # \return String representing the extruder values
  406. @pyqtSlot(str, result="QVariant")
  407. def getInstanceExtruderValues(self, key):
  408. return ExtruderManager.getExtruderValues(key)
  409. ## Get the value for a setting from a specific extruder.
  410. #
  411. # This is exposed to SettingFunction to use in value functions.
  412. #
  413. # \param extruder_index The index of the extruder to get the value from.
  414. # \param key The key of the setting to get the value of.
  415. #
  416. # \return The value of the setting for the specified extruder or for the
  417. # global stack if not found.
  418. @staticmethod
  419. def getExtruderValue(extruder_index, key):
  420. extruder = ExtruderManager.getInstance().getExtruderStack(extruder_index)
  421. if extruder:
  422. value = extruder.getRawProperty(key, "value")
  423. if isinstance(value, SettingFunction):
  424. value = value(extruder)
  425. else: #Just a value from global.
  426. value = Application.getInstance().getGlobalContainerStack().getProperty(key, "value")
  427. return value
  428. ## Get the resolve value or value for a given key
  429. #
  430. # This is the effective value for a given key, it is used for values in the global stack.
  431. # This is exposed to SettingFunction to use in value functions.
  432. # \param key The key of the setting to get the value of.
  433. #
  434. # \return The effective value
  435. @staticmethod
  436. def getResolveOrValue(key):
  437. global_stack = Application.getInstance().getGlobalContainerStack()
  438. resolved_value = global_stack.getProperty(key, "resolve")
  439. if resolved_value is not None:
  440. user_container = global_stack.findContainer({"type": "user"})
  441. quality_changes_container = global_stack.findContainer({"type": "quality_changes"})
  442. if user_container.hasProperty(key, "value") or quality_changes_container.hasProperty(key, "value"):
  443. # Normal case
  444. value = global_stack.getProperty(key, "value")
  445. else:
  446. # We have a resolved value and we're using it because of no user and quality_changes value
  447. value = resolved_value
  448. else:
  449. value = global_stack.getRawProperty(key, "value")
  450. return value