|
@@ -66,43 +66,42 @@ class SettingsExportModel(QObject):
|
|
|
"cutting_mesh",
|
|
|
"support_mesh"}
|
|
|
|
|
|
- def __init__(self, parent = None):
|
|
|
+ def __init__(self, parent=None):
|
|
|
super().__init__(parent)
|
|
|
self._settings_groups = []
|
|
|
|
|
|
application = CuraApplication.getInstance()
|
|
|
|
|
|
- # Display global settings
|
|
|
+ self._appendGlobalSettings(application)
|
|
|
+ self._appendExtruderSettings(application)
|
|
|
+ self._appendModelSettings(application)
|
|
|
+
|
|
|
+ def _appendGlobalSettings(self, application):
|
|
|
global_stack = application.getGlobalContainerStack()
|
|
|
- self._settings_groups.append(SettingsExportGroup(global_stack,
|
|
|
- "Global settings",
|
|
|
- SettingsExportGroup.Category.Global,
|
|
|
- self._exportSettings(global_stack)))
|
|
|
+ self._settings_groups.append(SettingsExportGroup(
|
|
|
+ global_stack, "Global settings", SettingsExportGroup.Category.Global, self._exportSettings(global_stack)))
|
|
|
|
|
|
- # Display per-extruder settings
|
|
|
+ def _appendExtruderSettings(self, application):
|
|
|
extruders_stacks = ExtruderManager.getInstance().getUsedExtruderStacks()
|
|
|
for extruder_stack in extruders_stacks:
|
|
|
- color = ""
|
|
|
- if extruder_stack.material:
|
|
|
- color = extruder_stack.material.getMetaDataEntry("color_code")
|
|
|
-
|
|
|
- self._settings_groups.append(SettingsExportGroup(extruder_stack,
|
|
|
- "Extruder settings",
|
|
|
- SettingsExportGroup.Category.Extruder,
|
|
|
- self._exportSettings(extruder_stack),
|
|
|
- extruder_index=extruder_stack.position,
|
|
|
- extruder_color=color))
|
|
|
-
|
|
|
- # Display per-model settings
|
|
|
- scene_root = application.getController().getScene().getRoot()
|
|
|
- for scene_node in scene_root.getChildren():
|
|
|
- per_model_stack = scene_node.callDecoration("getStack")
|
|
|
- if per_model_stack is not None:
|
|
|
- self._settings_groups.append(SettingsExportGroup(per_model_stack,
|
|
|
- "Model settings",
|
|
|
- SettingsExportGroup.Category.Model,
|
|
|
- self._exportSettings(per_model_stack),
|
|
|
- scene_node.getName()))
|
|
|
+ color = extruder_stack.material.getMetaDataEntry("color_code") if extruder_stack.material else ""
|
|
|
+ self._settings_groups.append(SettingsExportGroup(
|
|
|
+ extruder_stack, "Extruder settings", SettingsExportGroup.Category.Extruder,
|
|
|
+ self._exportSettings(extruder_stack), extruder_index=extruder_stack.position, extruder_color=color))
|
|
|
+
|
|
|
+ def _appendModelSettings(self, application):
|
|
|
+ scene = application.getController().getScene()
|
|
|
+ for scene_node in scene.getRoot().getChildren():
|
|
|
+ self._appendNodeSettings(scene_node, "Model settings", SettingsExportGroup.Category.Model)
|
|
|
+
|
|
|
+ def _appendNodeSettings(self, node, title_prefix, category):
|
|
|
+ stack = node.callDecoration("getStack")
|
|
|
+ if stack:
|
|
|
+ self._settings_groups.append(SettingsExportGroup(
|
|
|
+ stack, f"{title_prefix}", category, self._exportSettings(stack), node.getName()))
|
|
|
+ for child in node.getChildren():
|
|
|
+ self._appendNodeSettings(child, f"Children of {node.getName()}", SettingsExportGroup.Category.Model)
|
|
|
+
|
|
|
|
|
|
@pyqtProperty(list, constant=True)
|
|
|
def settingsGroups(self) -> List[SettingsExportGroup]:
|