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.
This commit is contained in:
Alessandro Famà 2024-01-07 18:03:32 +01:00
parent c8c483cf57
commit 4ea5c1ff2a
1 changed files with 1 additions and 1 deletions

View File

@ -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];