mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-01 16:24:41 +08:00
28 lines
837 B
Python
28 lines
837 B
Python
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
|
|
|