mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 01:15:51 +08:00
Merge branch '2.7'
This commit is contained in:
commit
b917511528
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2015 Ultimaker B.V.
|
# Copyright (c) 2017 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
# Cura is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
@ -306,12 +306,14 @@ class StartSliceJob(Job):
|
|||||||
# \param message object_lists message to put the per object settings in
|
# \param message object_lists message to put the per object settings in
|
||||||
def _handlePerObjectSettings(self, node, message):
|
def _handlePerObjectSettings(self, node, message):
|
||||||
stack = node.callDecoration("getStack")
|
stack = node.callDecoration("getStack")
|
||||||
# Check if the node has a stack attached to it and the stack has any settings in the top container.
|
if not stack: # Check if the node has a stack attached to it and the stack has any settings in the top container.
|
||||||
if stack:
|
return
|
||||||
# Check all settings for relations, so we can also calculate the correct values for dependant settings.
|
|
||||||
changed_setting_keys = set(stack.getTop().getAllKeys())
|
# Check all settings for relations, so we can also calculate the correct values for dependent settings.
|
||||||
for key in stack.getTop().getAllKeys():
|
top_of_stack = stack.getTop() #Cache for efficiency.
|
||||||
instance = stack.getTop().getInstance(key)
|
changed_setting_keys = set(top_of_stack.getAllKeys())
|
||||||
|
for key in top_of_stack.getAllKeys():
|
||||||
|
instance = top_of_stack.getInstance(key)
|
||||||
self._addRelations(changed_setting_keys, instance.definition.relations)
|
self._addRelations(changed_setting_keys, instance.definition.relations)
|
||||||
Job.yieldThread()
|
Job.yieldThread()
|
||||||
|
|
||||||
@ -323,14 +325,19 @@ class StartSliceJob(Job):
|
|||||||
for key in changed_setting_keys:
|
for key in changed_setting_keys:
|
||||||
setting = message.addRepeatedMessage("settings")
|
setting = message.addRepeatedMessage("settings")
|
||||||
setting.name = key
|
setting.name = key
|
||||||
setting.value = str(stack.getProperty(key, "value")).encode("utf-8")
|
extruder = int(round(float(stack.getProperty(key, "limit_to_extruder"))))
|
||||||
|
if extruder >= 0 and key not in top_of_stack.getAllKeys(): #Limited to a specific extruder, but not overridden by per-object settings.
|
||||||
|
limited_stack = ExtruderManager.getInstance().getActiveExtruderStacks()[extruder]
|
||||||
|
else:
|
||||||
|
limited_stack = stack #Just take from the per-object settings itself.
|
||||||
|
setting.value = str(limited_stack.getProperty(key, "value")).encode("utf-8")
|
||||||
Job.yieldThread()
|
Job.yieldThread()
|
||||||
|
|
||||||
## Recursive function to put all settings that require eachother for value changes in a list
|
## Recursive function to put all settings that require eachother for value changes in a list
|
||||||
# \param relations_set \type{set} Set of keys (strings) of settings that are influenced
|
# \param relations_set \type{set} Set of keys (strings) of settings that are influenced
|
||||||
# \param relations list of relation objects that need to be checked.
|
# \param relations list of relation objects that need to be checked.
|
||||||
def _addRelations(self, relations_set, relations):
|
def _addRelations(self, relations_set, relations):
|
||||||
for relation in filter(lambda r: r.role == "value", relations):
|
for relation in filter(lambda r: r.role == "value" or r.role == "limit_to_extruder", relations):
|
||||||
if relation.type == RelationType.RequiresTarget:
|
if relation.type == RelationType.RequiresTarget:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user