Skip to content

Commit 75253b0

Browse files
committed
Merge pull request #105592 from smix8/navregion_3d_plugin
Rename `NavigationMeshEditor` to `NavigationRegion3DEditor`
2 parents fd11686 + 01e85c4 commit 75253b0

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

modules/navigation_3d/editor/navigation_mesh_editor_plugin.cpp renamed to modules/navigation_3d/editor/navigation_region_3d_editor_plugin.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************/
2-
/* navigation_mesh_editor_plugin.cpp */
2+
/* navigation_region_3d_editor_plugin.cpp */
33
/**************************************************************************/
44
/* This file is part of: */
55
/* GODOT ENGINE */
@@ -28,7 +28,7 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31-
#include "navigation_mesh_editor_plugin.h"
31+
#include "navigation_region_3d_editor_plugin.h"
3232

3333
#include "editor/editor_node.h"
3434
#include "editor/editor_string_names.h"
@@ -38,15 +38,15 @@
3838
#include "scene/gui/dialogs.h"
3939
#include "scene/gui/label.h"
4040

41-
void NavigationMeshEditor::_node_removed(Node *p_node) {
41+
void NavigationRegion3DEditor::_node_removed(Node *p_node) {
4242
if (p_node == node) {
4343
node = nullptr;
4444

4545
hide();
4646
}
4747
}
4848

49-
void NavigationMeshEditor::_notification(int p_what) {
49+
void NavigationRegion3DEditor::_notification(int p_what) {
5050
switch (p_what) {
5151
case NOTIFICATION_ENTER_TREE: {
5252
button_bake->set_button_icon(get_theme_icon(SNAME("Bake"), EditorStringName(EditorIcons)));
@@ -55,7 +55,7 @@ void NavigationMeshEditor::_notification(int p_what) {
5555
}
5656
}
5757

58-
void NavigationMeshEditor::_bake_pressed() {
58+
void NavigationRegion3DEditor::_bake_pressed() {
5959
button_bake->set_pressed(false);
6060

6161
ERR_FAIL_NULL(node);
@@ -98,7 +98,7 @@ void NavigationMeshEditor::_bake_pressed() {
9898
node->update_gizmos();
9999
}
100100

101-
void NavigationMeshEditor::_clear_pressed() {
101+
void NavigationRegion3DEditor::_clear_pressed() {
102102
if (node) {
103103
if (node->get_navigation_mesh().is_valid()) {
104104
node->get_navigation_mesh()->clear();
@@ -113,15 +113,15 @@ void NavigationMeshEditor::_clear_pressed() {
113113
}
114114
}
115115

116-
void NavigationMeshEditor::edit(NavigationRegion3D *p_nav_region) {
116+
void NavigationRegion3DEditor::edit(NavigationRegion3D *p_nav_region) {
117117
if (p_nav_region == nullptr || node == p_nav_region) {
118118
return;
119119
}
120120

121121
node = p_nav_region;
122122
}
123123

124-
NavigationMeshEditor::NavigationMeshEditor() {
124+
NavigationRegion3DEditor::NavigationRegion3DEditor() {
125125
bake_hbox = memnew(HBoxContainer);
126126

127127
button_bake = memnew(Button);
@@ -130,14 +130,14 @@ NavigationMeshEditor::NavigationMeshEditor() {
130130
button_bake->set_toggle_mode(true);
131131
button_bake->set_text(TTR("Bake NavigationMesh"));
132132
button_bake->set_tooltip_text(TTR("Bakes the NavigationMesh by first parsing the scene for source geometry and then creating the navigation mesh vertices and polygons."));
133-
button_bake->connect(SceneStringName(pressed), callable_mp(this, &NavigationMeshEditor::_bake_pressed));
133+
button_bake->connect(SceneStringName(pressed), callable_mp(this, &NavigationRegion3DEditor::_bake_pressed));
134134

135135
button_reset = memnew(Button);
136136
button_reset->set_theme_type_variation(SceneStringName(FlatButton));
137137
bake_hbox->add_child(button_reset);
138138
button_reset->set_text(TTR("Clear NavigationMesh"));
139139
button_reset->set_tooltip_text(TTR("Clears the internal NavigationMesh vertices and polygons."));
140-
button_reset->connect(SceneStringName(pressed), callable_mp(this, &NavigationMeshEditor::_clear_pressed));
140+
button_reset->connect(SceneStringName(pressed), callable_mp(this, &NavigationRegion3DEditor::_clear_pressed));
141141

142142
bake_info = memnew(Label);
143143
bake_info->set_focus_mode(FOCUS_ACCESSIBILITY);
@@ -148,29 +148,29 @@ NavigationMeshEditor::NavigationMeshEditor() {
148148
node = nullptr;
149149
}
150150

151-
void NavigationMeshEditorPlugin::edit(Object *p_object) {
152-
navigation_mesh_editor->edit(Object::cast_to<NavigationRegion3D>(p_object));
151+
void NavigationRegion3DEditorPlugin::edit(Object *p_object) {
152+
navigation_region_editor->edit(Object::cast_to<NavigationRegion3D>(p_object));
153153
}
154154

155-
bool NavigationMeshEditorPlugin::handles(Object *p_object) const {
155+
bool NavigationRegion3DEditorPlugin::handles(Object *p_object) const {
156156
return p_object->is_class("NavigationRegion3D");
157157
}
158158

159-
void NavigationMeshEditorPlugin::make_visible(bool p_visible) {
159+
void NavigationRegion3DEditorPlugin::make_visible(bool p_visible) {
160160
if (p_visible) {
161-
navigation_mesh_editor->show();
162-
navigation_mesh_editor->bake_hbox->show();
161+
navigation_region_editor->show();
162+
navigation_region_editor->bake_hbox->show();
163163
} else {
164-
navigation_mesh_editor->hide();
165-
navigation_mesh_editor->bake_hbox->hide();
166-
navigation_mesh_editor->edit(nullptr);
164+
navigation_region_editor->hide();
165+
navigation_region_editor->bake_hbox->hide();
166+
navigation_region_editor->edit(nullptr);
167167
}
168168
}
169169

170-
NavigationMeshEditorPlugin::NavigationMeshEditorPlugin() {
171-
navigation_mesh_editor = memnew(NavigationMeshEditor);
172-
EditorNode::get_singleton()->get_gui_base()->add_child(navigation_mesh_editor);
173-
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, navigation_mesh_editor->bake_hbox);
174-
navigation_mesh_editor->hide();
175-
navigation_mesh_editor->bake_hbox->hide();
170+
NavigationRegion3DEditorPlugin::NavigationRegion3DEditorPlugin() {
171+
navigation_region_editor = memnew(NavigationRegion3DEditor);
172+
EditorNode::get_singleton()->get_gui_base()->add_child(navigation_region_editor);
173+
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, navigation_region_editor->bake_hbox);
174+
navigation_region_editor->hide();
175+
navigation_region_editor->bake_hbox->hide();
176176
}

modules/navigation_3d/editor/navigation_mesh_editor_plugin.h renamed to modules/navigation_3d/editor/navigation_region_3d_editor_plugin.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************/
2-
/* navigation_mesh_editor_plugin.h */
2+
/* navigation_region_3d_editor_plugin.h */
33
/**************************************************************************/
44
/* This file is part of: */
55
/* GODOT ENGINE */
@@ -38,10 +38,10 @@ class HBoxContainer;
3838
class Label;
3939
class NavigationRegion3D;
4040

41-
class NavigationMeshEditor : public Control {
42-
friend class NavigationMeshEditorPlugin;
41+
class NavigationRegion3DEditor : public Control {
42+
friend class NavigationRegion3DEditorPlugin;
4343

44-
GDCLASS(NavigationMeshEditor, Control);
44+
GDCLASS(NavigationRegion3DEditor, Control);
4545

4646
AcceptDialog *err_dialog = nullptr;
4747

@@ -61,20 +61,20 @@ class NavigationMeshEditor : public Control {
6161

6262
public:
6363
void edit(NavigationRegion3D *p_nav_region);
64-
NavigationMeshEditor();
64+
NavigationRegion3DEditor();
6565
};
6666

67-
class NavigationMeshEditorPlugin : public EditorPlugin {
68-
GDCLASS(NavigationMeshEditorPlugin, EditorPlugin);
67+
class NavigationRegion3DEditorPlugin : public EditorPlugin {
68+
GDCLASS(NavigationRegion3DEditorPlugin, EditorPlugin);
6969

70-
NavigationMeshEditor *navigation_mesh_editor = nullptr;
70+
NavigationRegion3DEditor *navigation_region_editor = nullptr;
7171

7272
public:
73-
virtual String get_plugin_name() const override { return "NavigationMesh"; }
73+
virtual String get_plugin_name() const override { return "NavigationRegion3D"; }
7474
bool has_main_screen() const override { return false; }
7575
virtual void edit(Object *p_object) override;
7676
virtual bool handles(Object *p_object) const override;
7777
virtual void make_visible(bool p_visible) override;
7878

79-
NavigationMeshEditorPlugin();
79+
NavigationRegion3DEditorPlugin();
8080
};

modules/navigation_3d/register_types.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#endif // DISABLE_DEPRECATED
3838

3939
#ifdef TOOLS_ENABLED
40-
#include "editor/navigation_mesh_editor_plugin.h"
40+
#include "editor/navigation_region_3d_editor_plugin.h"
4141
#endif
4242

4343
#include "core/config/engine.h"
@@ -64,7 +64,7 @@ void initialize_navigation_3d_module(ModuleInitializationLevel p_level) {
6464

6565
#ifdef TOOLS_ENABLED
6666
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
67-
EditorPlugins::add_by_type<NavigationMeshEditorPlugin>();
67+
EditorPlugins::add_by_type<NavigationRegion3DEditorPlugin>();
6868
}
6969
#endif
7070
}

0 commit comments

Comments
 (0)