mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Perform Platform physics changes on scene changed again and use a custom operation for better op merging
This commit is contained in:
parent
bfa3c00200
commit
e24c120e82
2 changed files with 35 additions and 16 deletions
27
PlatformPhysicsOperation.py
Normal file
27
PlatformPhysicsOperation.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from UM.Operations.Operation import Operation
|
||||
from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation
|
||||
from UM.Operations.TranslateOperation import TranslateOperation
|
||||
|
||||
## A specialised operation designed specifically to modify the previous operation.
|
||||
class PlatformPhysicsOperation(Operation):
|
||||
def __init__(self, node, translation):
|
||||
super().__init__()
|
||||
self._node = node
|
||||
self._translation = translation
|
||||
|
||||
def undo(self):
|
||||
pass
|
||||
|
||||
def redo(self):
|
||||
pass
|
||||
|
||||
def mergeWith(self, other):
|
||||
if type(other) is AddSceneNodeOperation:
|
||||
other._node.translate(self._translation)
|
||||
return other
|
||||
elif type(other) is TranslateOperation:
|
||||
other._translation += self._translation
|
||||
return other
|
||||
else:
|
||||
return False
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue