Fix Redundant Navigation Polygons

When adjusting the vertices of a navigation polygon, the tile editor would create a duplicate navigation polygon.  So each time you made an adjustment, another copy of the polygon would be created.

(cherry picked from commit 6c83550dfc)
This commit is contained in:
Emmanuel Barroga 2019-08-04 16:09:57 -07:00 committed by Rémi Verschelde
parent a07d53b262
commit 53b44aacad
1 changed files with 2 additions and 0 deletions

View File

@ -1450,6 +1450,8 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
undo_redo->create_action(TTR("Edit Navigation Polygon"));
undo_redo->add_do_method(edited_navigation_shape.ptr(), "set_vertices", polygon);
undo_redo->add_undo_method(edited_navigation_shape.ptr(), "set_vertices", edited_navigation_shape->get_vertices());
undo_redo->add_do_method(edited_navigation_shape.ptr(), "clear_polygons");
undo_redo->add_undo_method(edited_navigation_shape.ptr(), "clear_polygons");
undo_redo->add_do_method(edited_navigation_shape.ptr(), "add_polygon", indices);
undo_redo->add_undo_method(edited_navigation_shape.ptr(), "add_polygon", edited_navigation_shape->get_polygon(0));
undo_redo->add_do_method(this, "_select_edited_shape_coord");