diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-09-29 10:18:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-29 10:18:24 +0200 |
commit | 1979266a17df5b19ac5cb1b63d80e0428bfd7756 (patch) | |
tree | 3f8099d6f0e9cc95fbb2e715dd832ed81820dbef /editor | |
parent | b1237b5caca9c9193b63698d9a05f13e11e53860 (diff) | |
parent | 367cab90f07237765ae911c4572cdab4c0738344 (diff) |
Merge pull request #53062 from stebulba/4.0_undo_CloseCurve
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/path_3d_editor_plugin.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index 13f7908170..bb0c270baa 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -510,7 +510,14 @@ void Path3DEditorPlugin::_close_curve() { if (c->get_point_count() < 2) { return; } - c->add_point(c->get_point_position(0), c->get_point_in(0), c->get_point_out(0)); + if (c->get_point_position(0) == c->get_point_position(c->get_point_count() - 1)) { + return; + } + UndoRedo *ur = editor->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()); + ur->commit_action(); } void Path3DEditorPlugin::_handle_option_pressed(int p_option) { |