mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Move src to cura so we can use the same package for installed and source
Contributes to #41 Contributes to #42
This commit is contained in:
parent
70f5dede95
commit
ae71c309ac
10 changed files with 2 additions and 2 deletions
33
cura/PlatformPhysicsOperation.py
Normal file
33
cura/PlatformPhysicsOperation.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Copyright (c) 2015 Ultimaker B.V.
|
||||
# Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
from UM.Operations.Operation import Operation
|
||||
from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation
|
||||
from UM.Operations.TranslateOperation import TranslateOperation
|
||||
from UM.Operations.GroupedOperation import GroupedOperation
|
||||
|
||||
## A specialised operation designed specifically to modify the previous operation.
|
||||
class PlatformPhysicsOperation(Operation):
|
||||
def __init__(self, node, translation):
|
||||
super().__init__()
|
||||
self._node = node
|
||||
self._old_position = node.getPosition()
|
||||
self._new_position = node.getPosition() + translation
|
||||
self._always_merge = True
|
||||
|
||||
def undo(self):
|
||||
self._node.setPosition(self._old_position)
|
||||
|
||||
def redo(self):
|
||||
self._node.setPosition(self._new_position)
|
||||
|
||||
def mergeWith(self, other):
|
||||
group = GroupedOperation()
|
||||
|
||||
group.addOperation(self)
|
||||
group.addOperation(other)
|
||||
|
||||
return group
|
||||
|
||||
def __repr__(self):
|
||||
return "PlatformPhysicsOperation(t = {0})".format(self._position)
|
||||
Loading…
Add table
Add a link
Reference in a new issue