Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CURA-9224] Approver settings json #13209

Merged
merged 11 commits into from
Sep 13, 2022
32 changes: 21 additions & 11 deletions plugins/UFPWriter/UFPWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Scene.SceneNode import SceneNode
from cura.CuraApplication import CuraApplication
from cura.Settings.CuraStackBuilder import CuraStackBuilder
from cura.Settings.GlobalStack import GlobalStack
from cura.Utils.Threading import call_on_qt_thread

Expand Down Expand Up @@ -212,19 +213,28 @@ def _getObjectMetadata(node: SceneNode) -> List[Dict[str, str]]:
if item.getMeshData() is not None and not item.callDecoration("isNonPrintingMesh")]

def _getSettings(self) -> Dict[str, Dict[str, Dict[str, str]]]:
container_registry = Application.getInstance().getContainerRegistry()

global_stack = cast(GlobalStack, Application.getInstance().getGlobalContainerStack())
quality_changes = global_stack.qualityChanges

settings = {
"extruder_1": {
"changes": {},
"default": {}
},
"extruder_2": {
"global": {
"changes": {},
"default": {}
},
}
}

global_stack = cast(GlobalStack, Application.getInstance().getGlobalContainerStack())

for i, extruder in enumerate(global_stack.extruderList):
extruder_flattened_changes = CuraStackBuilder.createFlattenedContainerInstance(extruder.userChanges, extruder.qualityChanges)
settings[f"extruder_{i}"] = {}
settings[f"extruder_{i}"]["changes"] = {}
settings[f"extruder_{i}"]["default"] = {}
casperlamboo marked this conversation as resolved.
Show resolved Hide resolved
for setting in extruder_flattened_changes.getAllKeys():
settings[f"extruder_{i}"]["changes"][setting] = extruder_flattened_changes.getProperty(setting, "value")

settings["global"] = {}
settings["global"]["changes"] = {}
settings["global"]["default"] = {}
casperlamboo marked this conversation as resolved.
Show resolved Hide resolved
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