From 4ea5c1ff2a06e4426915c175f39262fc96fc2421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alessandro=20Fam=C3=A0?= Date: Sun, 7 Jan 2024 18:03:32 +0100 Subject: [PATCH] Fix issue with dropping texture in 2D viewport causing incorrect global history registration This fix addresses an issue where dropping a texture onto the 2D viewport in a scene without a root node incorrectly registers the action in the global history. Subsequently undoing and redoing this action in another scene results in the newly created node replacing the root of the current scene. Fixes #86826. --- editor/plugins/canvas_item_editor_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 7d4502b69de..02241546684 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5842,7 +5842,7 @@ void CanvasItemEditorViewport::_perform_drop_data() { Vector error_files; EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); - undo_redo->create_action(TTR("Create Node")); + undo_redo->create_action_for_history(TTR("Create Node"), EditorNode::get_editor_data().get_current_edited_scene_history_id()); for (int i = 0; i < selected_files.size(); i++) { String path = selected_files[i];