Skip to content

Commit

Permalink
Merge pull request godotengine#88269 from MajorMcDoom/live-debug-loca…
Browse files Browse the repository at this point in the history
…l-transform

Fix an edge case bug in drag-and-drop Node3D spawning.
  • Loading branch information
akien-mga committed Feb 13, 2024
2 parents fb688b3 + 123dbdb commit fbe8a1d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4364,7 +4364,16 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po

Node3D *node3d = Object::cast_to<Node3D>(instantiated_scene);
if (node3d) {
undo_redo->add_do_method(instantiated_scene, "set_transform", node3d->get_transform());
Transform3D parent_tf;
Node3D *parent_node3d = Object::cast_to<Node3D>(parent);
if (parent_node3d) {
parent_tf = parent_node3d->get_global_gizmo_transform();
}

Transform3D new_tf = node3d->get_transform();
new_tf.origin = parent_tf.xform_inv(preview_node_pos);

undo_redo->add_do_method(instantiated_scene, "set_transform", new_tf);
}

return true;
Expand Down

0 comments on commit fbe8a1d

Please sign in to comment.