Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow editing NavigationObstacle2D shape vertices #91872

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions editor/plugins/navigation_obstacle_2d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ void NavigationObstacle2DEditor::_set_node(Node *p_polygon) {
node = Object::cast_to<NavigationObstacle2D>(p_polygon);
}

Variant NavigationObstacle2DEditor::_get_polygon(int p_idx) const {
return node->get_vertices();
}

void NavigationObstacle2DEditor::_set_polygon(int p_idx, const Variant &p_polygon) const {
node->set_vertices(p_polygon);
}

void NavigationObstacle2DEditor::_action_add_polygon(const Variant &p_polygon) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->add_do_method(node, "set_vertices", p_polygon);
Expand Down
3 changes: 3 additions & 0 deletions editor/plugins/navigation_obstacle_2d_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class NavigationObstacle2DEditor : public AbstractPolygon2DEditor {
virtual Node2D *_get_node() const override;
virtual void _set_node(Node *p_polygon) override;

virtual Variant _get_polygon(int p_idx) const override;
virtual void _set_polygon(int p_idx, const Variant &p_polygon) const override;

virtual void _action_add_polygon(const Variant &p_polygon) override;
virtual void _action_remove_polygon(int p_idx) override;
virtual void _action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon) override;
Expand Down
Loading