소스 검색

Fix undo references for conversion to CPUParticles

The 'undo' reference should be the node to free when the undo history
is lost, i.e. the original (GPU) Particles node. Similarly, the 'do'
reference should point to the CPUParticles (result of the 'do' call).

Fixes #29742.
Rémi Verschelde 6 년 전
부모
커밋
ed504753f4
2개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 2
      editor/plugins/particles_2d_editor_plugin.cpp
  2. 2 2
      editor/plugins/particles_editor_plugin.cpp

+ 2 - 2
editor/plugins/particles_2d_editor_plugin.cpp

@@ -96,9 +96,9 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
 			UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
 			UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
 			ur->create_action(TTR("Convert to CPUParticles"));
 			ur->create_action(TTR("Convert to CPUParticles"));
 			ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", particles, cpu_particles, true, false);
 			ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", particles, cpu_particles, true, false);
-			ur->add_do_reference(particles);
+			ur->add_do_reference(cpu_particles);
 			ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, particles, false, false);
 			ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, particles, false, false);
-			ur->add_undo_reference(this);
+			ur->add_undo_reference(particles);
 			ur->commit_action();
 			ur->commit_action();
 
 
 		} break;
 		} break;

+ 2 - 2
editor/plugins/particles_editor_plugin.cpp

@@ -315,9 +315,9 @@ void ParticlesEditor::_menu_option(int p_option) {
 			UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
 			UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
 			ur->create_action(TTR("Convert to CPUParticles"));
 			ur->create_action(TTR("Convert to CPUParticles"));
 			ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", node, cpu_particles, true, false);
 			ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", node, cpu_particles, true, false);
-			ur->add_do_reference(node);
+			ur->add_do_reference(cpu_particles);
 			ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, node, false, false);
 			ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, node, false, false);
-			ur->add_undo_reference(this);
+			ur->add_undo_reference(node);
 			ur->commit_action();
 			ur->commit_action();
 
 
 		} break;
 		} break;