You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Add per-scene UndoRedo
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_undo_redo_manager.h"
|
||||
#include "node_3d_editor_plugin.h"
|
||||
#include "scene/resources/curve.h"
|
||||
|
||||
@@ -172,7 +173,7 @@ void Path3DGizmo::commit_handle(int p_id, bool p_secondary, const Variant &p_res
|
||||
return;
|
||||
}
|
||||
|
||||
UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo();
|
||||
|
||||
if (!p_secondary) {
|
||||
if (p_cancel) {
|
||||
@@ -385,7 +386,7 @@ EditorPlugin::AfterGUIInput Path3DEditorPlugin::forward_spatial_gui_input(Camera
|
||||
}
|
||||
}
|
||||
|
||||
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo();
|
||||
if (closest_seg != -1) {
|
||||
//subdivide
|
||||
|
||||
@@ -427,21 +428,21 @@ EditorPlugin::AfterGUIInput Path3DEditorPlugin::forward_spatial_gui_input(Camera
|
||||
// Find the offset and point index of the place to break up.
|
||||
// Also check for the control points.
|
||||
if (dist_to_p < click_dist) {
|
||||
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo();
|
||||
ur->create_action(TTR("Remove Path Point"));
|
||||
ur->add_do_method(c.ptr(), "remove_point", i);
|
||||
ur->add_undo_method(c.ptr(), "add_point", c->get_point_position(i), c->get_point_in(i), c->get_point_out(i), i);
|
||||
ur->commit_action();
|
||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
||||
} else if (dist_to_p_out < click_dist) {
|
||||
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo();
|
||||
ur->create_action(TTR("Remove Out-Control Point"));
|
||||
ur->add_do_method(c.ptr(), "set_point_out", i, Vector3());
|
||||
ur->add_undo_method(c.ptr(), "set_point_out", i, c->get_point_out(i));
|
||||
ur->commit_action();
|
||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
||||
} else if (dist_to_p_in < click_dist) {
|
||||
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo();
|
||||
ur->create_action(TTR("Remove In-Control Point"));
|
||||
ur->add_do_method(c.ptr(), "set_point_in", i, Vector3());
|
||||
ur->add_undo_method(c.ptr(), "set_point_in", i, c->get_point_in(i));
|
||||
@@ -520,7 +521,7 @@ void Path3DEditorPlugin::_close_curve() {
|
||||
if (c->get_point_position(0) == c->get_point_position(c->get_point_count() - 1)) {
|
||||
return;
|
||||
}
|
||||
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
||||
Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo();
|
||||
ur->create_action(TTR("Close Curve"));
|
||||
ur->add_do_method(c.ptr(), "add_point", c->get_point_position(0), c->get_point_in(0), c->get_point_out(0), -1);
|
||||
ur->add_undo_method(c.ptr(), "remove_point", c->get_point_count());
|
||||
|
||||
Reference in New Issue
Block a user