diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-06-26 20:54:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-26 20:54:00 +0200 |
commit | b740f645f7dab54db68a0c027be52b384fa8b687 (patch) | |
tree | 7d87450c930ca780ca2f895629a40519192c01f1 /editor/plugins/canvas_item_editor_plugin.cpp | |
parent | a4e200a47a151ed5ce1627a17ce694048987eadf (diff) | |
parent | a403131a25e165471f96ee2eb3f3db91994f8ce1 (diff) |
Merge pull request #39754 from akien-mga/canvasitemeditor-fix-dropped-scenes-position
CanvasItemEditor: Fix losing position for drag'n'dropped scenes
Diffstat (limited to 'editor/plugins/canvas_item_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index e35cbfcfb0..3af0b0d4e1 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -6149,6 +6149,11 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons Vector2 target_pos = canvas_item_editor->get_canvas_transform().affine_inverse().xform(p_point); target_pos = canvas_item_editor->snap_point(target_pos); target_pos = parent_ci->get_global_transform_with_canvas().affine_inverse().xform(target_pos); + // Preserve instance position of the original scene. + CanvasItem *instance_ci = Object::cast_to<CanvasItem>(instanced_scene); + if (instance_ci) { + target_pos += instance_ci->_edit_get_position(); + } editor_data->get_undo_redo().add_do_method(instanced_scene, "set_position", target_pos); } |