mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Show mesh type and number of per model settings in ObjectSelector
This commit is contained in:
parent
d1c79a3af2
commit
bba07d01fb
3 changed files with 92 additions and 2 deletions
|
@ -38,6 +38,8 @@ class ObjectsModel(ListModel):
|
|||
OutsideAreaRole = Qt.UserRole + 3
|
||||
BuilplateNumberRole = Qt.UserRole + 4
|
||||
NodeRole = Qt.UserRole + 5
|
||||
PerObjectSettingsCountRole = Qt.UserRole + 6
|
||||
MeshTypeRole = Qt.UserRole + 7
|
||||
|
||||
def __init__(self, parent = None) -> None:
|
||||
super().__init__(parent)
|
||||
|
@ -46,6 +48,8 @@ class ObjectsModel(ListModel):
|
|||
self.addRoleName(self.SelectedRole, "selected")
|
||||
self.addRoleName(self.OutsideAreaRole, "outside_build_area")
|
||||
self.addRoleName(self.BuilplateNumberRole, "buildplate_number")
|
||||
self.addRoleName(self.PerObjectSettingsCountRole, "per_object_settings_count")
|
||||
self.addRoleName(self.MeshTypeRole, "mesh_type")
|
||||
self.addRoleName(self.NodeRole, "node")
|
||||
|
||||
Application.getInstance().getController().getScene().sceneChanged.connect(self._updateSceneDelayed)
|
||||
|
@ -172,11 +176,26 @@ class ObjectsModel(ListModel):
|
|||
|
||||
node_build_plate_number = node.callDecoration("getBuildPlateNumber")
|
||||
|
||||
node_mesh_type = ""
|
||||
per_object_settings_count = 0
|
||||
|
||||
per_object_stack = node.callDecoration("getStack")
|
||||
if per_object_stack:
|
||||
per_object_settings_count = per_object_stack.getTop().getNumInstances()
|
||||
|
||||
for mesh_type in ["anti_overhang_mesh", "infill_mesh", "cutting_mesh", "support_mesh"]:
|
||||
if per_object_stack.getProperty(mesh_type, "value"):
|
||||
node_mesh_type = mesh_type
|
||||
per_object_settings_count -= 1 # do not count this mesh type setting
|
||||
break
|
||||
|
||||
nodes.append({
|
||||
"name": node.getName(),
|
||||
"selected": Selection.isSelected(node),
|
||||
"outside_build_area": is_outside_build_area,
|
||||
"buildplate_number": node_build_plate_number,
|
||||
"per_object_settings_count": per_object_settings_count,
|
||||
"mesh_type": node_mesh_type,
|
||||
"node": node
|
||||
})
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ Button
|
|||
width: parent.width
|
||||
height: UM.Theme.getSize("action_button").height
|
||||
leftPadding: UM.Theme.getSize("thin_margin").width
|
||||
rightPadding: UM.Theme.getSize("thin_margin").width
|
||||
rightPadding: UM.Theme.getSize("default_lining").width
|
||||
checkable: true
|
||||
hoverEnabled: true
|
||||
|
||||
|
@ -29,7 +29,7 @@ Button
|
|||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
right: perObjectSettingsInfo.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: objectItemButton.text
|
||||
|
@ -41,6 +41,75 @@ Button
|
|||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: perObjectSettingsInfo
|
||||
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
rightMargin: 0
|
||||
}
|
||||
width: childrenRect.width
|
||||
height: parent.height
|
||||
padding: 0
|
||||
leftPadding: UM.Theme.getSize("thin_margin").width
|
||||
|
||||
onClicked:
|
||||
{
|
||||
Cura.SceneController.changeSelection(index)
|
||||
UM.Controller.setActiveTool("PerObjectSettingsTool")
|
||||
}
|
||||
|
||||
contentItem: Item
|
||||
{
|
||||
height: parent.height
|
||||
width: childrenRect.width
|
||||
|
||||
Cura.NotificationIcon
|
||||
{
|
||||
id: perObjectSettingsCountLabel
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
rightMargin: 0
|
||||
}
|
||||
visible: perObjectSettingsCount > 0
|
||||
color: UM.Theme.getColor("text_scene")
|
||||
labelText: perObjectSettingsCount.toString()
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
anchors
|
||||
{
|
||||
right: perObjectSettingsCountLabel.left
|
||||
rightMargin: UM.Theme.getSize("narrow_margin").width
|
||||
}
|
||||
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
color: UM.Theme.getColor("text_scene")
|
||||
visible: meshType != ""
|
||||
source:
|
||||
{
|
||||
switch (meshType) {
|
||||
case "support_mesh":
|
||||
return UM.Theme.getIcon("pos_print_as_support")
|
||||
case "cutting_mesh":
|
||||
case "infill_mesh":
|
||||
return UM.Theme.getIcon("pos_modify_overlaps")
|
||||
case "anti_overhang_mesh":
|
||||
return UM.Theme.getIcon("pos_modify_dont_support_overlap")
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Item {}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle
|
||||
|
|
|
@ -121,6 +121,8 @@ Item
|
|||
text: model.name
|
||||
width: listView.width
|
||||
property bool outsideBuildArea: model.outside_build_area
|
||||
property int perObjectSettingsCount: model.per_object_settings_count
|
||||
property string meshType: model.mesh_type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue