Browse Source

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.
Alessandro Famà 1 year ago
parent
commit
4ea5c1ff2a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      editor/plugins/canvas_item_editor_plugin.cpp

+ 1 - 1
editor/plugins/canvas_item_editor_plugin.cpp

@@ -5842,7 +5842,7 @@ void CanvasItemEditorViewport::_perform_drop_data() {
 	Vector<String> 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];