Add settings changes

CURA-9224
This commit is contained in:
joeydelarago 2022-09-02 16:31:21 +02:00 committed by Joey de l'Arago
parent ee7c8d1f02
commit b1090728c0

View file

@ -19,6 +19,7 @@ from UM.PluginRegistry import PluginRegistry # To get the g-code writer.
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.Settings.CuraStackBuilder import CuraStackBuilder
from cura.Settings.GlobalStack import GlobalStack from cura.Settings.GlobalStack import GlobalStack
from cura.Utils.Threading import call_on_qt_thread from cura.Utils.Threading import call_on_qt_thread
@ -212,19 +213,28 @@ class UFPWriter(MeshWriter):
if item.getMeshData() is not None and not item.callDecoration("isNonPrintingMesh")] if item.getMeshData() is not None and not item.callDecoration("isNonPrintingMesh")]
def _getSettings(self) -> Dict[str, Dict[str, Dict[str, str]]]: def _getSettings(self) -> Dict[str, Dict[str, Dict[str, str]]]:
container_registry = Application.getInstance().getContainerRegistry() settings = {
"global": {
"changes": {},
"default": {}
}
}
global_stack = cast(GlobalStack, Application.getInstance().getGlobalContainerStack()) global_stack = cast(GlobalStack, Application.getInstance().getGlobalContainerStack())
quality_changes = global_stack.qualityChanges
settings = { for i, extruder in enumerate(global_stack.extruderList):
"extruder_1": { extruder_flattened_changes = CuraStackBuilder.createFlattenedContainerInstance(extruder.userChanges, extruder.qualityChanges)
"changes": {}, settings[f"extruder_{i}"] = {}
"default": {} settings[f"extruder_{i}"]["changes"] = {}
}, settings[f"extruder_{i}"]["default"] = {}
"extruder_2": { for setting in extruder_flattened_changes.getAllKeys():
"changes": {}, settings[f"extruder_{i}"]["changes"][setting] = extruder_flattened_changes.getProperty(setting, "value")
"default": {}
}, settings["global"] = {}
} settings["global"]["changes"] = {}
settings["global"]["default"] = {}
global_flattened_changes = CuraStackBuilder.createFlattenedContainerInstance(global_stack.userChanges, global_stack.qualityChanges)
for setting in global_flattened_changes.getAllKeys():
settings["global"]["changes"][setting] = global_flattened_changes.getProperty(setting, "value")
return settings return settings