Add 2D navigation mesh baking

Adds 2D navigation mesh baking.
This commit is contained in:
smix8 2023-08-17 18:32:30 +02:00
parent 82f6e9be5e
commit 0ee7e3102b
44 changed files with 10706 additions and 537 deletions

View file

@ -32,16 +32,38 @@
#define NAVIGATION_POLYGON_EDITOR_PLUGIN_H
#include "editor/plugins/abstract_polygon_2d_editor.h"
#include "scene/2d/navigation_region_2d.h"
#include "editor/editor_plugin.h"
class AcceptDialog;
class HBoxContainer;
class NavigationPolygon;
class NavigationRegion2D;
class NavigationPolygonEditor : public AbstractPolygon2DEditor {
friend class NavigationPolygonEditorPlugin;
GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor);
NavigationRegion2D *node = nullptr;
Ref<NavigationPolygon> _ensure_navpoly() const;
AcceptDialog *err_dialog = nullptr;
HBoxContainer *bake_hbox = nullptr;
Button *button_bake = nullptr;
Button *button_reset = nullptr;
Label *bake_info = nullptr;
void _bake_pressed();
void _clear_pressed();
void _update_polygon_editing_state();
protected:
void _notification(int p_what);
virtual Node2D *_get_node() const override;
virtual void _set_node(Node *p_polygon) override;
@ -63,6 +85,8 @@ public:
class NavigationPolygonEditorPlugin : public AbstractPolygon2DEditorPlugin {
GDCLASS(NavigationPolygonEditorPlugin, AbstractPolygon2DEditorPlugin);
NavigationPolygonEditor *navigation_polygon_editor = nullptr;
public:
NavigationPolygonEditorPlugin();
};