diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2018-01-15 12:49:38 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2018-01-15 12:49:38 +0300 |
commit | 20e7fe911fdebb9fb74df4ae5490e1e423252504 (patch) | |
tree | 140700686439ec5db8107aed9c50867dd20b9e6d /plugins/3MFWriter | |
parent | 87dc3535bbbd2ad3d66b9579fcda6b375920eaec (diff) |
Only save models on the active build plate in 3MFWriter
CURA-4792
Diffstat (limited to 'plugins/3MFWriter')
-rw-r--r-- | plugins/3MFWriter/ThreeMFWriter.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/3MFWriter/ThreeMFWriter.py b/plugins/3MFWriter/ThreeMFWriter.py index 79b821fe31..c4b7035cf1 100644 --- a/plugins/3MFWriter/ThreeMFWriter.py +++ b/plugins/3MFWriter/ThreeMFWriter.py @@ -6,8 +6,9 @@ from UM.Math.Vector import Vector from UM.Logger import Logger from UM.Math.Matrix import Matrix from UM.Application import Application -import UM.Scene.SceneNode -from cura.Scene.CuraSceneNode import CuraSceneNode +from UM.Scene.SceneNode import SceneNode + +from cura.CuraApplication import CuraApplication import Savitar @@ -62,11 +63,15 @@ class ThreeMFWriter(MeshWriter): self._store_archive = store_archive ## Convenience function that converts an Uranium SceneNode object to a SavitarSceneNode - # \returns Uranium Scenen node. + # \returns Uranium Scene node. def _convertUMNodeToSavitarNode(self, um_node, transformation = Matrix()): - if type(um_node) not in [UM.Scene.SceneNode.SceneNode, CuraSceneNode]: + if not isinstance(um_node, SceneNode): return None + active_build_plate_nr = CuraApplication.getInstance().getBuildPlateModel().activeBuildPlate + if um_node.callDecoration("getBuildPlateNumber") != active_build_plate_nr: + return + savitar_node = Savitar.SceneNode() node_matrix = um_node.getLocalTransformation() @@ -97,6 +102,9 @@ class ThreeMFWriter(MeshWriter): savitar_node.setSetting(key, str(stack.getProperty(key, "value"))) for child_node in um_node.getChildren(): + # only save the nodes on the active build plate + if child_node.callDecoration("getBuildPlateNumber") != active_build_plate_nr: + continue savitar_child_node = self._convertUMNodeToSavitarNode(child_node) if savitar_child_node is not None: savitar_node.addChild(savitar_child_node) |