11/* *************************************************************************/
2- /* navigation_mesh_editor_plugin .cpp */
2+ /* navigation_region_3d_editor_plugin .cpp */
33/* *************************************************************************/
44/* This file is part of: */
55/* GODOT ENGINE */
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"
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}
0 commit comments