diff options
author | Jaime van Kessel <nallath@gmail.com> | 2020-07-08 11:39:33 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2020-07-08 11:39:33 +0300 |
commit | 91690524c0e11f7accde6fd802c9aab1348ad0f0 (patch) | |
tree | faf9771f7cbf6c16ba9ffc3fcc097d7f61b2af13 /plugins/3MFReader | |
parent | 141ad8ff1dcadeb98a530a858374ca7a63cb4c13 (diff) |
Ensure that the 3mf reader doesn't make groups of one
Diffstat (limited to 'plugins/3MFReader')
-rwxr-xr-x | plugins/3MFReader/ThreeMFReader.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/3MFReader/ThreeMFReader.py b/plugins/3MFReader/ThreeMFReader.py index 546c6fc27b..2e035c7a59 100755 --- a/plugins/3MFReader/ThreeMFReader.py +++ b/plugins/3MFReader/ThreeMFReader.py @@ -169,8 +169,16 @@ class ThreeMFReader(MeshReader): setting_container.setProperty(key, "value", setting_value) if len(um_node.getChildren()) > 0 and um_node.getMeshData() is None: - group_decorator = GroupDecorator() - um_node.addDecorator(group_decorator) + if len(um_node.getAllChildren()) == 1: + # We don't want groups of one, so move the node up one "level" + child_node = um_node.getChildren()[0] + parent_transformation = um_node.getLocalTransformation() + child_transformation = child_node.getLocalTransformation() + child_node.setTransformation(parent_transformation.multiply(child_transformation)) + um_node = um_node.getChildren()[0] + else: + group_decorator = GroupDecorator() + um_node.addDecorator(group_decorator) um_node.setSelectable(True) if um_node.getMeshData(): # Assuming that all nodes with mesh data are printable objects @@ -192,8 +200,8 @@ class ThreeMFReader(MeshReader): um_node = self._convertSavitarNodeToUMNode(node, file_name) if um_node is None: continue - # compensate for original center position, if object(s) is/are not around its zero position + # compensate for original center position, if object(s) is/are not around its zero position transform_matrix = Matrix() mesh_data = um_node.getMeshData() if mesh_data is not None: |