mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-30 07:44:22 +08:00
added settings for modifier meshes and grouped meshed
CURA-11403
This commit is contained in:
parent
831a1d4876
commit
dbf722e034
@ -66,43 +66,42 @@ class SettingsExportModel(QObject):
|
|||||||
"cutting_mesh",
|
"cutting_mesh",
|
||||||
"support_mesh"}
|
"support_mesh"}
|
||||||
|
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self._settings_groups = []
|
self._settings_groups = []
|
||||||
|
|
||||||
application = CuraApplication.getInstance()
|
application = CuraApplication.getInstance()
|
||||||
|
|
||||||
# Display global settings
|
self._appendGlobalSettings(application)
|
||||||
global_stack = application.getGlobalContainerStack()
|
self._appendExtruderSettings(application)
|
||||||
self._settings_groups.append(SettingsExportGroup(global_stack,
|
self._appendModelSettings(application)
|
||||||
"Global settings",
|
|
||||||
SettingsExportGroup.Category.Global,
|
|
||||||
self._exportSettings(global_stack)))
|
|
||||||
|
|
||||||
# Display per-extruder settings
|
def _appendGlobalSettings(self, application):
|
||||||
|
global_stack = application.getGlobalContainerStack()
|
||||||
|
self._settings_groups.append(SettingsExportGroup(
|
||||||
|
global_stack, "Global settings", SettingsExportGroup.Category.Global, self._exportSettings(global_stack)))
|
||||||
|
|
||||||
|
def _appendExtruderSettings(self, application):
|
||||||
extruders_stacks = ExtruderManager.getInstance().getUsedExtruderStacks()
|
extruders_stacks = ExtruderManager.getInstance().getUsedExtruderStacks()
|
||||||
for extruder_stack in extruders_stacks:
|
for extruder_stack in extruders_stacks:
|
||||||
color = ""
|
color = extruder_stack.material.getMetaDataEntry("color_code") if extruder_stack.material else ""
|
||||||
if extruder_stack.material:
|
self._settings_groups.append(SettingsExportGroup(
|
||||||
color = extruder_stack.material.getMetaDataEntry("color_code")
|
extruder_stack, "Extruder settings", SettingsExportGroup.Category.Extruder,
|
||||||
|
self._exportSettings(extruder_stack), extruder_index=extruder_stack.position, extruder_color=color))
|
||||||
|
|
||||||
self._settings_groups.append(SettingsExportGroup(extruder_stack,
|
def _appendModelSettings(self, application):
|
||||||
"Extruder settings",
|
scene = application.getController().getScene()
|
||||||
SettingsExportGroup.Category.Extruder,
|
for scene_node in scene.getRoot().getChildren():
|
||||||
self._exportSettings(extruder_stack),
|
self._appendNodeSettings(scene_node, "Model settings", SettingsExportGroup.Category.Model)
|
||||||
extruder_index=extruder_stack.position,
|
|
||||||
extruder_color=color))
|
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)
|
||||||
|
|
||||||
# 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()))
|
|
||||||
|
|
||||||
@pyqtProperty(list, constant=True)
|
@pyqtProperty(list, constant=True)
|
||||||
def settingsGroups(self) -> List[SettingsExportGroup]:
|
def settingsGroups(self) -> List[SettingsExportGroup]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user