예제 #1
0
    def ungroupSelected(self):
        ungrouped_nodes = []
        selected_objects = Selection.getAllSelectedObjects(
        )[:]  #clone the list
        for node in selected_objects:
            if node.callDecoration("isGroup"):
                children_to_move = []
                for child in node.getChildren():
                    if type(child) is SceneNode:
                        children_to_move.append(child)

                for child in children_to_move:
                    child.setParent(node.getParent())
                    print(node.getPosition())
                    child.translate(node.getPosition())
                    child.setPosition(child.getPosition().scale(
                        node.getScale()))
                    child.scale(node.getScale())
                    child.rotate(node.getOrientation())

                    Selection.add(child)
                    child.callDecoration("setConvexHull", None)
                node.setParent(None)
                ungrouped_nodes.append(node)
        for node in ungrouped_nodes:
            Selection.remove(node)
예제 #2
0
    def _pixelSelection(self, event):
        pixel_id = self._renderer.getIdAtCoordinate(event.x, event.y)

        if not pixel_id:
            Selection.clear()
            return
        for node in BreadthFirstIterator(self._scene.getRoot()):
            if id(node) == pixel_id:
                
                if self._ctrl_is_active:
                    if Selection.isSelected(node):
                        if node.getParent():
                            if node.getParent().callDecoration("isGroup"):
                                Selection.remove(node.getParent())
                            else:
                                Selection.remove(node)
                    else: 
                        Selection.add(node)
                        if node.getParent():
                            if node.getParent().callDecoration("isGroup"):
                                Selection.add(node.getParent())
                            else:
                                Selection.add(node)
                else:
                    if not Selection.isSelected(node) or Selection.getCount() > 1:
                        Selection.clear()
                        if node.getParent():
                            if node.getParent().callDecoration("isGroup"):
                                Selection.add(node.getParent())
                            else: 
                                Selection.add(node)
예제 #3
0
    def changeSelection(self, index):
        modifiers = QApplication.keyboardModifiers()
        ctrl_is_active = modifiers & Qt.ControlModifier
        shift_is_active = modifiers & Qt.ShiftModifier

        if ctrl_is_active:
            item = self._objects_model.getItem(index)
            node = item["node"]
            if Selection.isSelected(node):
                Selection.remove(node)
            else:
                Selection.add(node)
        elif shift_is_active:
            polarity = 1 if index + 1 > self._last_selected_index else -1
            for i in range(self._last_selected_index, index + polarity,
                           polarity):
                item = self._objects_model.getItem(i)
                node = item["node"]
                Selection.add(node)
        else:
            # Single select
            item = self._objects_model.getItem(index)
            node = item["node"]
            build_plate_number = node.callDecoration("getBuildPlateNumber")
            if build_plate_number is not None and build_plate_number != -1:
                self.setActiveBuildPlate(build_plate_number)
            Selection.clear()
            Selection.add(node)

        self._last_selected_index = index
예제 #4
0
    def changeSelection(self, index):
        modifiers = QApplication.keyboardModifiers()
        ctrl_is_active = modifiers & Qt.ControlModifier
        shift_is_active = modifiers & Qt.ShiftModifier

        if ctrl_is_active:
            item = self._objects_model.getItem(index)
            node = item["node"]
            if Selection.isSelected(node):
                Selection.remove(node)
            else:
                Selection.add(node)
        elif shift_is_active:
            polarity = 1 if index + 1 > self._last_selected_index else -1
            for i in range(self._last_selected_index, index + polarity, polarity):
                item = self._objects_model.getItem(i)
                node = item["node"]
                Selection.add(node)
        else:
            # Single select
            item = self._objects_model.getItem(index)
            node = item["node"]
            build_plate_number = node.callDecoration("getBuildPlateNumber")
            if build_plate_number is not None and build_plate_number != -1:
                self.setActiveBuildPlate(build_plate_number)
            Selection.clear()
            Selection.add(node)

        self._last_selected_index = index
예제 #5
0
    def test_addRemoveSelection(self):
        node_1 = SceneNode()
        Selection.add(node_1)

        assert Selection.getAllSelectedObjects() == [node_1]

        Selection.remove(node_1)
        assert Selection.getAllSelectedObjects() == []
예제 #6
0
    def redo(self):
        self._node.setParent(None)

        # Hack to ensure that the _onchanged is triggered correctly.
        # We can't do it the right way as most remove changes don't need to trigger
        # a reslice (eg; removing hull nodes don't need to trigger reslice).
        Application.getInstance().getBackend().forceSlice()
        if Selection.isSelected(self._node):
            Selection.remove(self._node)
예제 #7
0
    def _pixelSelection(self, event):
        # Find a node id by looking at a pixel value at the requested location
        if self._selection_pass:
            item_id = self._selection_pass.getIdAtPosition(event.x, event.y)
        else:
            Logger.log("w", "Selection pass is None. getRenderPass('selection') returned None")
            return False

        if not item_id and not self._shift_is_active:
            if Selection.hasSelection():
                Selection.clear()
                return True
            return False  # Nothing was selected before and the user didn't click on an object.

        # Find the scene-node which matches the node-id
        for node in BreadthFirstIterator(self._scene.getRoot()):
            if id(node) != item_id:
                continue

            if self._isNodeInGroup(node):
                is_selected = Selection.isSelected(self._findTopGroupNode(node))
            else:
                is_selected = Selection.isSelected(node)

            if self._shift_is_active:
                if is_selected:
                    # Deselect the SceneNode and its siblings in a group
                    if node.getParent():
                        if self._ctrl_is_active or not self._isNodeInGroup(node):
                            Selection.remove(node)
                        else:
                            Selection.remove(self._findTopGroupNode(node))
                        return True
                else:
                    # Select the SceneNode and its siblings in a group
                    if node.getParent():
                        if self._ctrl_is_active or not self._isNodeInGroup(node):
                            Selection.add(node)
                        else:
                            Selection.add(self._findTopGroupNode(node))
                        return True
            else:
                if not is_selected or Selection.getCount() > 1:
                    # Select only the SceneNode and its siblings in a group
                    Selection.clear()
                    if node.getParent():
                        if self._ctrl_is_active or not self._isNodeInGroup(node):
                            Selection.add(node)
                        else:
                            Selection.add(self._findTopGroupNode(node))
                        return True
                elif self._isNodeInGroup(node) and self._ctrl_is_active:
                    Selection.clear()
                    Selection.add(node)
                    return True

        return False
예제 #8
0
    def undo(self):
        self._node.setParent(None)
        self._node_dup.setParent(None)
        self._selected = Selection.isSelected(self._node)
        if self._selected:
            Selection.remove(
                self._node)  # Also remove the node from the selection.

        self._print_mode_manager.deleteDuplicatedNode(self._node_dup)
예제 #9
0
    def test_addRemoveSelection(self):
        node_1 = SceneNode()
        Selection.add(node_1)
        Selection.setFace(node_1, 99)

        assert Selection.getAllSelectedObjects() == [node_1]

        Selection.remove(node_1)
        assert Selection.getAllSelectedObjects() == []
        assert Selection.getSelectedFace() is None
예제 #10
0
    def test_hasSelection(self):
        # Nothing is selected by default
        assert not self.proxy.hasSelection

        node_1 = SceneNode()
        Selection.add(node_1)

        assert self.proxy.hasSelection

        Selection.remove(node_1)
        assert not self.proxy.hasSelection
예제 #11
0
    def undo(self) -> None:
        """Reverses the operation of adding a scene node.

        This removes the scene node again.
        """

        self._node.setParent(None)
        self._selected = Selection.isSelected(self._node)
        if self._selected:
            Selection.remove(
                self._node)  # Also remove the node from the selection.
예제 #12
0
    def test_hasSelection(self):
        # Nothing is selected by default
        assert not self.proxy.hasSelection

        node_1 = SceneNode()
        Selection.add(node_1)

        assert self.proxy.hasSelection

        Selection.remove(node_1)
        assert not self.proxy.hasSelection
예제 #13
0
 def _onChildrenChanged(self, node):
     if not self.getNode().hasChildren():
         # A group that no longer has children may remove itself from the scene
         self._old_parent = self.getNode().getParent()
         self.getNode().setParent(None)
         Selection.remove(self.getNode())
     else:
         # A group that has removed itself from the scene because it had no children may add itself back to the scene when a child is added to it
         if not self.getNode().getParent() and self._old_parent:
             self.getNode().setParent(self._old_parent)
             self._old_parent = None
예제 #14
0
 def _onChildrenChanged(self, node):
     if not self.getNode().hasChildren():
         # A group that no longer has children may remove itself from the scene
         self._old_parent = self.getNode().getParent()
         self.getNode().setParent(None)
         Selection.remove(self.getNode())
     else:
         # A group that has removed itself from the scene because it had no children may add itself back to the scene when a child is added to it
         if not self.getNode().getParent() and self._old_parent:
             self.getNode().setParent(self._old_parent)
             self._old_parent = None
예제 #15
0
    def groupSelected(self):
        group_node = SceneNode()
        group_decorator = GroupDecorator()
        group_node.addDecorator(group_decorator)
        group_node.setParent(self.getController().getScene().getRoot())

        for node in Selection.getAllSelectedObjects():
            node.setParent(group_node)

        for node in group_node.getChildren():
            Selection.remove(node)

        Selection.add(group_node)
예제 #16
0
 def groupSelected(self):
     group_node = SceneNode()
     group_decorator = GroupDecorator()
     group_node.addDecorator(group_decorator)
     group_node.setParent(self.getController().getScene().getRoot())
     
     for node in Selection.getAllSelectedObjects():
         node.setParent(group_node)
     
     for node in group_node.getChildren():
         Selection.remove(node)
     
     Selection.add(group_node)
예제 #17
0
    def undo(self):
        self._node.setParent(None)
        self._node_dup.setParent(None)
        self._selected = Selection.isSelected(self._node)
        if self._selected:
            Selection.remove(
                self._node)  # Also remove the node from the selection.

        self._print_mode_manager.deleteDuplicatedNode(self._node_dup)

        for child in self._node_dup.getAllChildren():
            if type(child) == DuplicatedNode:
                self._print_mode_manager.deleteDuplicatedNode(child)
예제 #18
0
 def _onChildrenChanged(self, node: "SceneNode") -> None:
     if self._node is None:
         return
     if not self._node.hasChildren():
         # A group that no longer has children may remove itself from the scene
         self._old_parent = self._node.getParent()
         self._node.setParent(None)
         Selection.remove(self.getNode())
     else:
         # A group that has removed itself from the scene because it had no children may add itself back to the scene
         # when a child is added to it.
         if not self._node.getParent() and self._old_parent:
             self._node.setParent(self._old_parent)
             self._old_parent = None
예제 #19
0
    def groupSelected(self):
        group_node = SceneNode()
        group_decorator = GroupDecorator()
        group_node.addDecorator(group_decorator)
        group_node.setParent(self.getController().getScene().getRoot())

        for node in Selection.getAllSelectedObjects():
            node.setParent(group_node)
        group_node.setCenterPosition(group_node.getBoundingBox().center)
        #group_node.translate(Vector(0,group_node.getBoundingBox().center.y,0))
        group_node.translate(group_node.getBoundingBox().center)
        for node in group_node.getChildren():
            Selection.remove(node)

        Selection.add(group_node)
예제 #20
0
 def groupSelected(self):
     group_node = SceneNode()
     group_decorator = GroupDecorator()
     group_node.addDecorator(group_decorator)
     group_node.setParent(self.getController().getScene().getRoot())
     
     for node in Selection.getAllSelectedObjects():
         node.setParent(group_node)
     group_node.setCenterPosition(group_node.getBoundingBox().center)
     #group_node.translate(Vector(0,group_node.getBoundingBox().center.y,0))
     group_node.translate(group_node.getBoundingBox().center)
     for node in group_node.getChildren():
         Selection.remove(node)
     
     Selection.add(group_node)
예제 #21
0
    def redo(self):
        old_parent = self._parent
        self._node.setParent(None)

        if old_parent and old_parent.callDecoration("isGroup"):
            old_parent.callDecoration("recomputeConvexHull")

        # Hack to ensure that the _onchanged is triggered correctly.
        # We can't do it the right way as most remove changes don't need to trigger
        # a reslice (eg; removing hull nodes don't need to trigger reslice).
        try:
            Application.getInstance().getBackend().needsSlicing()
        except:
            pass
        if Selection.isSelected(self._node):  # Also remove the selection.
            Selection.remove(self._node)
예제 #22
0
    def _pixelSelection(self, event):
        # Find a node id by looking at a pixel value at the requested location
        item_id = self._selection_pass.getIdAtPosition(event.x, event.y)

        if not item_id:
            Selection.clear()
            return

        # Find the scene-node which matches the node-id
        for node in BreadthFirstIterator(self._scene.getRoot()):
            if id(node) == item_id:
                if self._isNodeInGroup(node):
                    is_selected = Selection.isSelected(
                        self._findTopGroupNode(node))
                else:
                    is_selected = Selection.isSelected(node)

                if self._ctrl_is_active:
                    if is_selected:
                        # Deselect the scenenode and its sibblings in a group
                        if node.getParent():
                            if self._alt_is_active or not self._isNodeInGroup(
                                    node):
                                Selection.remove(node)
                            else:
                                Selection.remove(self._findTopGroupNode(node))
                    else:
                        # Select the scenenode and its sibblings in a group
                        if node.getParent():
                            if self._alt_is_active or not self._isNodeInGroup(
                                    node):
                                Selection.add(node)
                            else:
                                Selection.add(self._findTopGroupNode(node))
                else:
                    if not is_selected or Selection.getCount() > 1:
                        # Select only the scenenode and its sibblings in a group
                        Selection.clear()
                        if node.getParent():
                            if self._alt_is_active or not self._isNodeInGroup(
                                    node):
                                Selection.add(node)
                            else:
                                Selection.add(self._findTopGroupNode(node))
                    elif self._isNodeInGroup(node) and self._alt_is_active:
                        Selection.clear()
                        Selection.add(node)
예제 #23
0
    def redo(self) -> None:
        old_parent = self._parent
        self._node.setParent(None)

        if old_parent and old_parent.callDecoration("isGroup"):
            old_parent.callDecoration("recomputeConvexHull")

        # Hack to ensure that the _onchanged is triggered correctly.
        # We can't do it the right way as most remove changes don't need to trigger
        # a reslice (eg; removing hull nodes don't need to trigger a reslice).
        try:
            Application.getInstance().getBackend().needsSlicing(
            )  # type: ignore
        except AttributeError:  # Todo: This should be removed, Uranium doesn't care or know about slicing!
            pass
        if Selection.isSelected(self._node):  # Also remove the selection.
            Selection.remove(self._node)
예제 #24
0
    def groupSelected(self):
        # Create a group-node
        group_node = SceneNode()
        group_decorator = GroupDecorator()
        group_node.addDecorator(group_decorator)
        group_node.setParent(self.getController().getScene().getRoot())
        group_node.setSelectable(True)
        center = Selection.getSelectionCenter()
        group_node.setPosition(center)
        group_node.setCenterPosition(center)

        # Move selected nodes into the group-node
        Selection.applyOperation(SetParentOperation, group_node)

        # Deselect individual nodes and select the group-node instead
        for node in group_node.getChildren():
            Selection.remove(node)
        Selection.add(group_node)
예제 #25
0
    def groupSelected(self):
        group_node = SceneNode()
        group_decorator = GroupDecorator()
        group_node.addDecorator(group_decorator)
        group_node.setParent(self.getController().getScene().getRoot())
        center = Selection.getSelectionCenter()
        group_node.setPosition(center)
        group_node.setCenterPosition(center)

        for node in Selection.getAllSelectedObjects():
            world = node.getWorldPosition()
            node.setParent(group_node)
            node.setPosition(world - center)

        for node in group_node.getChildren():
            Selection.remove(node)

        Selection.add(group_node)
예제 #26
0
    def groupSelected(self):
        group_node = SceneNode()
        group_decorator = GroupDecorator()
        group_node.addDecorator(group_decorator)
        group_node.setParent(self.getController().getScene().getRoot())
        center = Selection.getSelectionCenter()
        group_node.setPosition(center)
        group_node.setCenterPosition(center)

        for node in Selection.getAllSelectedObjects():
            world = node.getWorldPosition()
            node.setParent(group_node)
            node.setPosition(world - center)

        for node in group_node.getChildren():
            Selection.remove(node)

        Selection.add(group_node)
예제 #27
0
 def ungroupSelected(self):
     ungrouped_nodes = []
     selected_objects = Selection.getAllSelectedObjects()[:] #clone the list
     for node in selected_objects:
         if node.callDecoration("isGroup" ):
             children_to_move = []
             for child in node.getChildren():
                 if type(child) is SceneNode:
                     children_to_move.append(child)
                    
             for child in children_to_move:
                 child.setParent(node.getParent())
                 Selection.add(child)
                 child.callDecoration("setConvexHull",None)
             node.setParent(None)
             ungrouped_nodes.append(node)
     for node in ungrouped_nodes:
         Selection.remove(node)
예제 #28
0
    def groupSelected(self):
        # Create a group-node
        group_node = SceneNode()
        group_decorator = GroupDecorator()
        group_node.addDecorator(group_decorator)
        group_node.setParent(self.getController().getScene().getRoot())
        group_node.setSelectable(True)
        center = Selection.getSelectionCenter()
        group_node.setPosition(center)
        group_node.setCenterPosition(center)

        # Move selected nodes into the group-node
        Selection.applyOperation(SetParentOperation, group_node)

        # Deselect individual nodes and select the group-node instead
        for node in group_node.getChildren():
            Selection.remove(node)
        Selection.add(group_node)
예제 #29
0
    def _pixelSelection(self, event):
        pixel_id = self._renderer.getIdAtCoordinate(event.x, event.y)

        if not pixel_id:
            Selection.clear()
            return
        for node in BreadthFirstIterator(self._scene.getRoot()):
            if id(node) == pixel_id:
                if self._ctrl_is_active:
                    if Selection.isSelected(node):
                        if node.getParent():
                            group_node = node.getParent()
                            if not group_node.callDecoration("isGroup"):
                                Selection.remove(node)
                            else:
                                while group_node.getParent().callDecoration(
                                        "isGroup"):
                                    group_node = group_node.getParent()
                                Selection.remove(group_node)
                    else:
                        if node.getParent():
                            group_node = node.getParent()
                            if not group_node.callDecoration("isGroup"):
                                Selection.add(node)
                            else:
                                while group_node.getParent().callDecoration(
                                        "isGroup"):
                                    group_node = group_node.getParent()
                                Selection.add(group_node)
                else:
                    if not Selection.isSelected(
                            node) or Selection.getCount() > 1:
                        Selection.clear()
                        if node.getParent():
                            group_node = node.getParent()
                            if not group_node.callDecoration("isGroup"):
                                Selection.add(node)
                            else:
                                while group_node.getParent().callDecoration(
                                        "isGroup"):
                                    group_node = group_node.getParent()
                                Selection.add(group_node)
예제 #30
0
    def _pixelSelection(self, event):
        # Find a node id by looking at a pixel value at the requested location
        item_id = self._selection_pass.getIdAtPosition(event.x, event.y)

        if not item_id and not self._shift_is_active:
            Selection.clear()
            return

        # Find the scene-node which matches the node-id
        for node in BreadthFirstIterator(self._scene.getRoot()):
            if id(node) == item_id:
                if self._isNodeInGroup(node):
                    is_selected = Selection.isSelected(self._findTopGroupNode(node))
                else:
                    is_selected = Selection.isSelected(node)
                if self._shift_is_active:
                    if is_selected:
                        # Deselect the scenenode and its sibblings in a group
                        if node.getParent():
                            if self._ctrl_is_active or not self._isNodeInGroup(node):
                                Selection.remove(node)
                            else:
                                Selection.remove(self._findTopGroupNode(node))
                    else:
                        # Select the scenenode and its sibblings in a group
                        if node.getParent():
                            if self._ctrl_is_active or not self._isNodeInGroup(node):
                                Selection.add(node)
                            else:
                                Selection.add(self._findTopGroupNode(node))
                else:
                    if not is_selected or Selection.getCount() > 1:
                        # Select only the scenenode and its sibblings in a group
                        Selection.clear()
                        if node.getParent():
                            if self._ctrl_is_active or not self._isNodeInGroup(node):
                                Selection.add(node)
                            else:
                                Selection.add(self._findTopGroupNode(node))
                    elif self._isNodeInGroup(node) and self._ctrl_is_active:
                        Selection.clear()
                        Selection.add(node)
예제 #31
0
 def setSelected(self, key):
     for index in range(0,len(self.items)):
         if self.items[index]["key"] == key:
             for node in Application.getInstance().getController().getScene().getRoot().getAllChildren():
                 if id(node) == key:
                     if node not in Selection.getAllSelectedObjects(): #node already selected
                         Selection.add(node)
                         if self.items[index]["depth"] == 1: #Its a group node
                             for child_node in node.getChildren(): 
                                 if child_node not in Selection.getAllSelectedObjects(): #Set all children to parent state (if they arent already)
                                     Selection.add(child_node) 
                     else:
                         Selection.remove(node)
                         if self.items[index]["depth"] == 1: #Its a group
                             for child_node in node.getChildren():
                                 if child_node in Selection.getAllSelectedObjects():
                                     Selection.remove(child_node)    
                        
     all_children_selected = True
     #Check all group nodes to see if all their children are selected (if so, they also need to be selected!)
     for index in range(0,len(self.items)):
         if self.items[index]["depth"] == 1:
             for node in Application.getInstance().getController().getScene().getRoot().getAllChildren():
                 if node.hasChildren():
                     if id(node) == self.items[index]["key"] and id(node) != key: 
                         for index, child_node in enumerate(node.getChildren()):
                             if not Selection.isSelected(child_node):
                                 all_children_selected = False #At least one of its children is not selected, dont change state
                                 break 
                         if all_children_selected:
                             Selection.add(node)
                         else:
                             Selection.remove(node)
     #Force update                  
     self.updateList(Application.getInstance().getController().getScene().getRoot())
예제 #32
0
    def _pixelSelection(self, event):
        item_id = self._selection_pass.getIdAtPosition(event.x, event.y)

        if not item_id:
            Selection.clear()
            return

        for node in BreadthFirstIterator(self._scene.getRoot()):
            if id(node) == item_id:
                if self._ctrl_is_active:
                    if Selection.isSelected(node):
                        if node.getParent():
                            group_node = node.getParent()
                            if not group_node.callDecoration("isGroup"):
                                Selection.remove(node)
                            else:
                                while group_node.getParent().callDecoration("isGroup"):
                                    group_node = group_node.getParent()
                                Selection.remove(group_node)
                    else:
                        if node.getParent():
                            group_node = node.getParent()
                            if not group_node.callDecoration("isGroup"):
                                Selection.add(node)
                            else:
                                while group_node.getParent().callDecoration("isGroup"):
                                    group_node = group_node.getParent()
                                Selection.add(group_node)
                else:
                    if not Selection.isSelected(node) or Selection.getCount() > 1:
                        Selection.clear()
                        if node.getParent():
                            group_node = node.getParent()
                            if not group_node.callDecoration("isGroup"):
                                Selection.add(node)
                            else:
                                while group_node.getParent().callDecoration("isGroup"):
                                    group_node = group_node.getParent()
                                Selection.add(group_node)
예제 #33
0
    def redo(self):
        old_parent = self._parent
        self._node_dup.node.setParent(None)
        self._node_dup.setParent(None)

        self._print_mode_manager.deleteDuplicatedNode(self._node_dup)
        for child in self._node_dup.getChildren():
            if type(child) == DuplicatedNode:
                self._print_mode_manager.deleteDuplicatedNode(child)

        if old_parent and old_parent.callDecoration("isGroup"):
            old_parent.callDecoration("recomputeConvexHull")

        # Hack to ensure that the _onchanged is triggered correctly.
        # We can't do it the right way as most remove changes don't need to trigger
        # a reslice (eg; removing hull nodes don't need to trigger reslice).
        try:
            Application.getInstance().getBackend().needsSlicing()
        except:
            pass
        if Selection.isSelected(self._node):  # Also remove the selection.
            Selection.remove(self._node)
예제 #34
0
    def setSelected(self, key):
        for index in range(0, len(self.items)):
            if self.items[index]["key"] == key:
                for node in Application.getInstance().getController().getScene(
                ).getRoot().getAllChildren():
                    if id(node) == key:
                        if node not in Selection.getAllSelectedObjects(
                        ):  #node already selected
                            Selection.add(node)
                            if node.callDecoration(
                                    "isGroup"):  #Its a group node
                                for child_node in node.getChildren():
                                    if child_node not in Selection.getAllSelectedObjects(
                                    ):  #Set all children to parent state (if they arent already)
                                        Selection.add(child_node)
                        else:
                            Selection.remove(node)
                            if node.callDecoration("isGroup"):  #Its a group
                                for child_node in node.getChildren():
                                    if child_node in Selection.getAllSelectedObjects(
                                    ):
                                        Selection.remove(child_node)

        all_children_selected = True
        #Check all group nodes to see if all their children are selected (if so, they also need to be selected!)
        for index in range(0, len(self.items)):
            if self.items[index]["is_group"]:
                for node in Application.getInstance().getController().getScene(
                ).getRoot().getAllChildren():
                    if node.hasChildren():
                        if id(node) == self.items[index]["key"] and id(
                                node) != key:
                            for index, child_node in enumerate(
                                    node.getChildren()):
                                if not Selection.isSelected(child_node):
                                    all_children_selected = False  #At least one of its children is not selected, dont change state
                                    break
                            if all_children_selected:
                                Selection.add(node)
                            else:
                                Selection.remove(node)
        #Force update
        self.updateList(
            Application.getInstance().getController().getScene().getRoot())
예제 #35
0
 def setSelectedMeshName(self, new_name:str) -> None:
     node = self._node_queue[0]
     node.setName(new_name)
     Selection.remove(node)
     Selection.add(node)
예제 #36
0
 def undo(self):
     self._node.setParent(None)
     self._selected = Selection.isSelected(self._node)
     if self._selected:
         Selection.remove(
             self._node)  #Also remove the node from the selection.
예제 #37
0
 def redo(self):
     self._node.setParent(None)
     if Selection.isSelected(self._node):
         Selection.remove(self._node)
예제 #38
0
 def undo(self):
     self._node.setParent(None)
     self._selected = Selection.isSelected(self._node)
     if self._selected:
         Selection.remove(self._node)
예제 #39
0
 def undo(self):
     self._node.setParent(None)
     self._selected = Selection.isSelected(self._node)
     if self._selected:
         Selection.remove(self._node)
예제 #40
0
 def undo(self):
     self._node.setParent(None)
     self._selected = Selection.isSelected(self._node)
     if self._selected:
         Selection.remove(self._node)  # Also remove the node from the selection.