summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorStéphane Fortin <stewatto@hotmail.com>2021-09-14 21:24:55 -0400
committerStéphane Fortin <stewatto@hotmail.com>2021-09-14 21:24:55 -0400
commit367cab90f07237765ae911c4572cdab4c0738344 (patch)
tree2120037a093f454c8ef50c509079f413afbfde93 /editor
parentcd5a8f8dd4a86b06f6aa898db03a18d5dbd0f94c (diff)
add missing undo on CloseCurve path3d
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/path_3d_editor_plugin.cpp9
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) {