| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "editor/plugins/editor_plugin.h" |
| 34 |
|
| 35 |
#include "navigation_region_3d_gizmo_plugin.h" |
| 36 |
|
| 37 |
class AcceptDialog; |
| 38 |
class Button; |
| 39 |
class ConfirmationDialog; |
| 40 |
class HBoxContainer; |
| 41 |
class Label; |
| 42 |
class NavigationRegion3D; |
| 43 |
|
| 44 |
class NavigationRegion3DEditor : public Control { |
| 45 |
friend class NavigationRegion3DEditorPlugin; |
| 46 |
|
| 47 |
GDCLASS(NavigationRegion3DEditor, Control); |
| 48 |
|
| 49 |
AcceptDialog *err_dialog = nullptr; |
| 50 |
ConfirmationDialog *multibake_dialog = nullptr; |
| 51 |
|
| 52 |
HBoxContainer *bake_hbox = nullptr; |
| 53 |
Button *button_bake = nullptr; |
| 54 |
Button *button_reset = nullptr; |
| 55 |
Label *bake_info = nullptr; |
| 56 |
|
| 57 |
LocalVector<NavigationRegion3D *> selected_regions; |
| 58 |
|
| 59 |
LocalVector<NavigationRegion3D *> regions_to_bake; |
| 60 |
LocalVector<NavigationRegion3D *> regions_with_navmesh_to_bake; |
| 61 |
|
| 62 |
int processed_regions_to_bake_count = 0; |
| 63 |
int processed_regions_to_bake_count_max = 0; |
| 64 |
bool region_baking_canceled = false; |
| 65 |
NavigationRegion3D *currently_baking_region = nullptr; |
| 66 |
|
| 67 |
bool bake_in_process = false; |
| 68 |
|
| 69 |
void _bake_pressed(); |
| 70 |
void _clear_pressed(); |
| 71 |
|
| 72 |
void _on_navmesh_multibake_confirmed(); |
| 73 |
void _on_navmesh_multibake_canceled(); |
| 74 |
void _process_regions_to_bake(); |
| 75 |
|
| 76 |
protected: |
| 77 |
void _node_removed(Node *p_node); |
| 78 |
void _notification(int p_what); |
| 79 |
|
| 80 |
public: |
| 81 |
void edit(LocalVector<NavigationRegion3D *> p_regions); |
| 82 |
NavigationRegion3DEditor(); |
| 83 |
}; |
| 84 |
|
| 85 |
class NavigationRegion3DEditorPlugin : public EditorPlugin { |
| 86 |
GDCLASS(NavigationRegion3DEditorPlugin, EditorPlugin); |
| 87 |
|
| 88 |
NavigationRegion3DEditor *navigation_region_editor = nullptr; |
| 89 |
|
| 90 |
Ref<NavigationRegion3DGizmoPlugin> gizmo_plugin; |
| 91 |
|
| 92 |
public: |
| 93 |
virtual String get_plugin_name() const override { return "NavigationRegion3D"; } |
| 94 |
bool has_main_screen() const override { return false; } |
| 95 |
virtual void edit(Object *p_object) override; |
| 96 |
virtual bool handles(Object *p_object) const override; |
| 97 |
virtual void make_visible(bool p_visible) override; |
| 98 |
|
| 99 |
NavigationRegion3DEditorPlugin(); |
| 100 |
}; |