Disable slicing and platform physics when an operation is being performed

This prevents the model from jumping around during rotation/scale

Fixes #56
This commit is contained in:
Arjen Hiemstra 2015-06-22 17:23:32 +02:00
parent bc055a8031
commit 72b1302f9e
2 changed files with 26 additions and 0 deletions

View file

@ -24,8 +24,12 @@ class PlatformPhysics:
super().__init__()
self._controller = controller
self._controller.getScene().sceneChanged.connect(self._onSceneChanged)
self._controller.toolOperationStarted.connect(self._onToolOperationStarted)
self._controller.toolOperationStopped.connect(self._onToolOperationStopped)
self._build_volume = volume
self._enabled = True
self._change_timer = QTimer()
self._change_timer.setInterval(100)
self._change_timer.setSingleShot(True)
@ -35,6 +39,9 @@ class PlatformPhysics:
self._change_timer.start()
def _onChangeTimerFinished(self):
if not self._enabled:
return
root = self._controller.getScene().getRoot()
for node in BreadthFirstIterator(root):
if node is root or type(node) is not SceneNode:
@ -93,3 +100,10 @@ class PlatformPhysics:
if node.getBoundingBox().intersectsBox(self._build_volume.getBoundingBox()) == AxisAlignedBox.IntersectionResult.FullIntersection:
op = ScaleToBoundsOperation(node, self._build_volume.getBoundingBox())
op.push()
def _onToolOperationStarted(self, tool):
self._enabled = False
def _onToolOperationStopped(self, tool):
self._enabled = True
self._onChangeTimerFinished()