mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Parent added meshes to the parent node instead of creating a group
This requires a small change in PlatformPhysics, or otherwise the added mesh would still drop down.
This commit is contained in:
parent
8e26d27e80
commit
83168886d6
2 changed files with 5 additions and 38 deletions
|
@ -71,7 +71,7 @@ class PlatformPhysics:
|
||||||
# Move it downwards if bottom is above platform
|
# Move it downwards if bottom is above platform
|
||||||
move_vector = Vector()
|
move_vector = Vector()
|
||||||
|
|
||||||
if Preferences.getInstance().getValue("physics/automatic_drop_down") and not (node.getParent() and node.getParent().callDecoration("isGroup")) and node.isEnabled(): #If an object is grouped, don't move it down
|
if Preferences.getInstance().getValue("physics/automatic_drop_down") and not (node.getParent() and node.getParent().callDecoration("isGroup") or node.getParent() != root) and node.isEnabled(): #If an object is grouped, don't move it down
|
||||||
z_offset = node.callDecoration("getZOffset") if node.getDecorator(ZOffsetDecorator.ZOffsetDecorator) else 0
|
z_offset = node.callDecoration("getZOffset") if node.getDecorator(ZOffsetDecorator.ZOffsetDecorator) else 0
|
||||||
move_vector = move_vector.set(y = -bbox.bottom + z_offset)
|
move_vector = move_vector.set(y = -bbox.bottom + z_offset)
|
||||||
|
|
||||||
|
|
|
@ -120,49 +120,16 @@ class SupportEraser(Tool):
|
||||||
op = GroupedOperation()
|
op = GroupedOperation()
|
||||||
# First add the node to the scene, so it gets the expected transform
|
# First add the node to the scene, so it gets the expected transform
|
||||||
op.addOperation(AddSceneNodeOperation(node, root))
|
op.addOperation(AddSceneNodeOperation(node, root))
|
||||||
|
op.addOperation(SetParentOperation(node, parent))
|
||||||
# Determine the parent group the node should be put in
|
|
||||||
if parent.getParent().callDecoration("isGroup"):
|
|
||||||
group = parent.getParent()
|
|
||||||
else:
|
|
||||||
# Create a group-node
|
|
||||||
group = CuraSceneNode()
|
|
||||||
group.addDecorator(GroupDecorator())
|
|
||||||
group.addDecorator(BuildPlateDecorator(active_build_plate))
|
|
||||||
group.setParent(root)
|
|
||||||
center = parent.getPosition()
|
|
||||||
group.setPosition(center)
|
|
||||||
group.setCenterPosition(center)
|
|
||||||
op.addOperation(SetParentOperation(parent, group))
|
|
||||||
|
|
||||||
op.addOperation(SetParentOperation(node, group))
|
|
||||||
op.push()
|
op.push()
|
||||||
Application.getInstance().getController().getScene().sceneChanged.emit(node)
|
|
||||||
|
|
||||||
# Select the picked node so the group does not get drawn as a wireframe (yet)
|
Application.getInstance().getController().getScene().sceneChanged.emit(node)
|
||||||
if not Selection.isSelected(parent):
|
|
||||||
Selection.add(parent)
|
|
||||||
if Selection.isSelected(group):
|
|
||||||
Selection.remove(group)
|
|
||||||
|
|
||||||
def _removeEraserMesh(self, node: CuraSceneNode):
|
def _removeEraserMesh(self, node: CuraSceneNode):
|
||||||
group = node.getParent()
|
op = RemoveSceneNodeOperation(node)
|
||||||
if group.callDecoration("isGroup"):
|
|
||||||
parent = group.getChildren()[0]
|
|
||||||
|
|
||||||
op = GroupedOperation()
|
|
||||||
op.addOperation(RemoveSceneNodeOperation(node))
|
|
||||||
if len(group.getChildren()) == 2:
|
|
||||||
op.addOperation(SetParentOperation(parent, group.getParent()))
|
|
||||||
|
|
||||||
op.push()
|
op.push()
|
||||||
Application.getInstance().getController().getScene().sceneChanged.emit(node)
|
|
||||||
|
|
||||||
# Select the picked node so the group does not get drawn as a wireframe (yet)
|
Application.getInstance().getController().getScene().sceneChanged.emit(node)
|
||||||
if parent and not Selection.isSelected(parent):
|
|
||||||
Selection.add(parent)
|
|
||||||
if Selection.isSelected(group):
|
|
||||||
Selection.remove(group)
|
|
||||||
|
|
||||||
def _updateEnabled(self):
|
def _updateEnabled(self):
|
||||||
plugin_enabled = False
|
plugin_enabled = False
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue