From c839bc175998707ec1ddddb4464298ff2884d812 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 5 Jan 2018 16:53:18 +0100 Subject: [PATCH] Groups of objects are taken into account and are shown in the object list instead of each model separatelly. Contributes to CURA-4525 --- cura/ObjectsModel.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cura/ObjectsModel.py b/cura/ObjectsModel.py index 2e83ee9033..7efbb8e5b9 100644 --- a/cura/ObjectsModel.py +++ b/cura/ObjectsModel.py @@ -24,16 +24,28 @@ class ObjectsModel(ListModel): nodes = [] filter_current_build_plate = Preferences.getInstance().getValue("view/filter_current_build_plate") active_build_plate_number = self._build_plate_number + group_nr = 1 for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()): - if not issubclass(type(node), SceneNode) or (not node.getMeshData() and not node.callDecoration("getLayerData")): + if not issubclass(type(node), SceneNode): continue - if not node.callDecoration("isSliceable"): + if (not node.getMeshData() and not node.callDecoration("getLayerData")) and not node.callDecoration("isGroup"): + continue + if node.getParent() and node.getParent().callDecoration("isGroup"): + continue # Grouped nodes don't need resetting as their parent (the group) is resetted) + if not node.callDecoration("isSliceable") and not node.callDecoration("isGroup"): continue node_build_plate_number = node.callDecoration("getBuildPlateNumber") if filter_current_build_plate and node_build_plate_number != active_build_plate_number: continue + + if not node.callDecoration("isGroup"): + name = node.getName() + else: + name = "Group #" + str(group_nr) + group_nr += 1 + nodes.append({ - "name": node.getName(), + "name": name, "isSelected": Selection.isSelected(node), "isOutsideBuildArea": node.isOutsideBuildArea(), "buildPlateNumber": node_build_plate_number,