mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 15:15:56 +08:00
parent
34e37af8c9
commit
a9527920ae
@ -252,16 +252,16 @@ class CuraApplication(QtApplication):
|
|||||||
## Remove an object from the scene
|
## Remove an object from the scene
|
||||||
@pyqtSlot("quint64")
|
@pyqtSlot("quint64")
|
||||||
def deleteObject(self, object_id):
|
def deleteObject(self, object_id):
|
||||||
object = self.getController().getScene().findObject(object_id)
|
node = self.getController().getScene().findObject(object_id)
|
||||||
|
|
||||||
if not object and object_id != 0: #Workaround for tool handles overlapping the selected object
|
if not node and object_id != 0: #Workaround for tool handles overlapping the selected object
|
||||||
object = Selection.getSelectedObject(0)
|
node = Selection.getSelectedObject(0)
|
||||||
|
|
||||||
if object:
|
if node:
|
||||||
if object.getParent():
|
if node.getParent():
|
||||||
group_node = object.getParent()
|
group_node = node.getParent()
|
||||||
if not group_node.callDecoration("isGroup"):
|
if not group_node.callDecoration("isGroup"):
|
||||||
op = RemoveSceneNodeOperation(object)
|
op = RemoveSceneNodeOperation(node)
|
||||||
else:
|
else:
|
||||||
while group_node.getParent().callDecoration("isGroup"):
|
while group_node.getParent().callDecoration("isGroup"):
|
||||||
group_node = group_node.getParent()
|
group_node = group_node.getParent()
|
||||||
@ -295,10 +295,15 @@ class CuraApplication(QtApplication):
|
|||||||
@pyqtSlot("quint64")
|
@pyqtSlot("quint64")
|
||||||
def centerObject(self, object_id):
|
def centerObject(self, object_id):
|
||||||
node = self.getController().getScene().findObject(object_id)
|
node = self.getController().getScene().findObject(object_id)
|
||||||
if node.getParent() and node.getParent().callDecoration("isGroup"):
|
|
||||||
node = node.getParent()
|
|
||||||
if not node and object_id != 0: #Workaround for tool handles overlapping the selected object
|
if not node and object_id != 0: #Workaround for tool handles overlapping the selected object
|
||||||
node = Selection.getSelectedObject(0)
|
node = Selection.getSelectedObject(0)
|
||||||
|
|
||||||
|
if not node:
|
||||||
|
return
|
||||||
|
|
||||||
|
if node.getParent() and node.getParent().callDecoration("isGroup"):
|
||||||
|
node = node.getParent()
|
||||||
|
|
||||||
if node:
|
if node:
|
||||||
op = SetTransformOperation(node, Vector())
|
op = SetTransformOperation(node, Vector())
|
||||||
op.push()
|
op.push()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user