浏览代码

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 年之前
父节点
当前提交
4ea5c1ff2a
共有 1 个文件被更改,包括 1 次插入1 次删除
  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;
 	Vector<String> error_files;
 
 
 	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
 	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++) {
 	for (int i = 0; i < selected_files.size(); i++) {
 		String path = selected_files[i];
 		String path = selected_files[i];