BuildPlateDecorator.py 1.0 KB

1234567891011121314151617181920212223242526
  1. from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
  2. from cura.Scene.CuraSceneNode import CuraSceneNode
  3. ## Make a SceneNode build plate aware CuraSceneNode objects all have this decorator.
  4. class BuildPlateDecorator(SceneNodeDecorator):
  5. def __init__(self, build_plate_number = -1):
  6. super().__init__()
  7. self._build_plate_number = None
  8. self.setBuildPlateNumber(build_plate_number)
  9. def setBuildPlateNumber(self, nr):
  10. # Make sure that groups are set correctly
  11. # setBuildPlateForSelection in CuraActions makes sure that no single childs are set.
  12. self._build_plate_number = nr
  13. if isinstance(self._node, CuraSceneNode):
  14. self._node.transformChanged() # trigger refresh node without introducing a new signal
  15. if self._node:
  16. for child in self._node.getChildren():
  17. child.callDecoration("setBuildPlateNumber", nr)
  18. def getBuildPlateNumber(self):
  19. return self._build_plate_number
  20. def __deepcopy__(self, memo):
  21. return BuildPlateDecorator()