mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Rename NavigationMeshEditor to NavigationRegion3DEditor
Renames NavigationMeshEditor to NavigationRegion3DEditor to better describe its actual purpose.
This commit is contained in:
parent
1a1cc0f7b0
commit
01e85c49e9
3 changed files with 37 additions and 37 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/* navigation_mesh_editor_plugin.cpp */
|
/* navigation_region_3d_editor_plugin.cpp */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/* This file is part of: */
|
/* This file is part of: */
|
||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
#include "navigation_mesh_editor_plugin.h"
|
#include "navigation_region_3d_editor_plugin.h"
|
||||||
|
|
||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
#include "editor/editor_string_names.h"
|
#include "editor/editor_string_names.h"
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
#include "scene/gui/dialogs.h"
|
#include "scene/gui/dialogs.h"
|
||||||
#include "scene/gui/label.h"
|
#include "scene/gui/label.h"
|
||||||
|
|
||||||
void NavigationMeshEditor::_node_removed(Node *p_node) {
|
void NavigationRegion3DEditor::_node_removed(Node *p_node) {
|
||||||
if (p_node == node) {
|
if (p_node == node) {
|
||||||
node = nullptr;
|
node = nullptr;
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ void NavigationMeshEditor::_node_removed(Node *p_node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationMeshEditor::_notification(int p_what) {
|
void NavigationRegion3DEditor::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
button_bake->set_button_icon(get_theme_icon(SNAME("Bake"), EditorStringName(EditorIcons)));
|
button_bake->set_button_icon(get_theme_icon(SNAME("Bake"), EditorStringName(EditorIcons)));
|
||||||
|
|
@ -55,7 +55,7 @@ void NavigationMeshEditor::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationMeshEditor::_bake_pressed() {
|
void NavigationRegion3DEditor::_bake_pressed() {
|
||||||
button_bake->set_pressed(false);
|
button_bake->set_pressed(false);
|
||||||
|
|
||||||
ERR_FAIL_NULL(node);
|
ERR_FAIL_NULL(node);
|
||||||
|
|
@ -98,7 +98,7 @@ void NavigationMeshEditor::_bake_pressed() {
|
||||||
node->update_gizmos();
|
node->update_gizmos();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationMeshEditor::_clear_pressed() {
|
void NavigationRegion3DEditor::_clear_pressed() {
|
||||||
if (node) {
|
if (node) {
|
||||||
if (node->get_navigation_mesh().is_valid()) {
|
if (node->get_navigation_mesh().is_valid()) {
|
||||||
node->get_navigation_mesh()->clear();
|
node->get_navigation_mesh()->clear();
|
||||||
|
|
@ -113,7 +113,7 @@ void NavigationMeshEditor::_clear_pressed() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationMeshEditor::edit(NavigationRegion3D *p_nav_region) {
|
void NavigationRegion3DEditor::edit(NavigationRegion3D *p_nav_region) {
|
||||||
if (p_nav_region == nullptr || node == p_nav_region) {
|
if (p_nav_region == nullptr || node == p_nav_region) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +121,7 @@ void NavigationMeshEditor::edit(NavigationRegion3D *p_nav_region) {
|
||||||
node = p_nav_region;
|
node = p_nav_region;
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationMeshEditor::NavigationMeshEditor() {
|
NavigationRegion3DEditor::NavigationRegion3DEditor() {
|
||||||
bake_hbox = memnew(HBoxContainer);
|
bake_hbox = memnew(HBoxContainer);
|
||||||
|
|
||||||
button_bake = memnew(Button);
|
button_bake = memnew(Button);
|
||||||
|
|
@ -130,14 +130,14 @@ NavigationMeshEditor::NavigationMeshEditor() {
|
||||||
button_bake->set_toggle_mode(true);
|
button_bake->set_toggle_mode(true);
|
||||||
button_bake->set_text(TTR("Bake NavigationMesh"));
|
button_bake->set_text(TTR("Bake NavigationMesh"));
|
||||||
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."));
|
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."));
|
||||||
button_bake->connect(SceneStringName(pressed), callable_mp(this, &NavigationMeshEditor::_bake_pressed));
|
button_bake->connect(SceneStringName(pressed), callable_mp(this, &NavigationRegion3DEditor::_bake_pressed));
|
||||||
|
|
||||||
button_reset = memnew(Button);
|
button_reset = memnew(Button);
|
||||||
button_reset->set_theme_type_variation(SceneStringName(FlatButton));
|
button_reset->set_theme_type_variation(SceneStringName(FlatButton));
|
||||||
bake_hbox->add_child(button_reset);
|
bake_hbox->add_child(button_reset);
|
||||||
button_reset->set_text(TTR("Clear NavigationMesh"));
|
button_reset->set_text(TTR("Clear NavigationMesh"));
|
||||||
button_reset->set_tooltip_text(TTR("Clears the internal NavigationMesh vertices and polygons."));
|
button_reset->set_tooltip_text(TTR("Clears the internal NavigationMesh vertices and polygons."));
|
||||||
button_reset->connect(SceneStringName(pressed), callable_mp(this, &NavigationMeshEditor::_clear_pressed));
|
button_reset->connect(SceneStringName(pressed), callable_mp(this, &NavigationRegion3DEditor::_clear_pressed));
|
||||||
|
|
||||||
bake_info = memnew(Label);
|
bake_info = memnew(Label);
|
||||||
bake_info->set_focus_mode(FOCUS_ACCESSIBILITY);
|
bake_info->set_focus_mode(FOCUS_ACCESSIBILITY);
|
||||||
|
|
@ -148,29 +148,29 @@ NavigationMeshEditor::NavigationMeshEditor() {
|
||||||
node = nullptr;
|
node = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationMeshEditorPlugin::edit(Object *p_object) {
|
void NavigationRegion3DEditorPlugin::edit(Object *p_object) {
|
||||||
navigation_mesh_editor->edit(Object::cast_to<NavigationRegion3D>(p_object));
|
navigation_region_editor->edit(Object::cast_to<NavigationRegion3D>(p_object));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NavigationMeshEditorPlugin::handles(Object *p_object) const {
|
bool NavigationRegion3DEditorPlugin::handles(Object *p_object) const {
|
||||||
return p_object->is_class("NavigationRegion3D");
|
return p_object->is_class("NavigationRegion3D");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationMeshEditorPlugin::make_visible(bool p_visible) {
|
void NavigationRegion3DEditorPlugin::make_visible(bool p_visible) {
|
||||||
if (p_visible) {
|
if (p_visible) {
|
||||||
navigation_mesh_editor->show();
|
navigation_region_editor->show();
|
||||||
navigation_mesh_editor->bake_hbox->show();
|
navigation_region_editor->bake_hbox->show();
|
||||||
} else {
|
} else {
|
||||||
navigation_mesh_editor->hide();
|
navigation_region_editor->hide();
|
||||||
navigation_mesh_editor->bake_hbox->hide();
|
navigation_region_editor->bake_hbox->hide();
|
||||||
navigation_mesh_editor->edit(nullptr);
|
navigation_region_editor->edit(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationMeshEditorPlugin::NavigationMeshEditorPlugin() {
|
NavigationRegion3DEditorPlugin::NavigationRegion3DEditorPlugin() {
|
||||||
navigation_mesh_editor = memnew(NavigationMeshEditor);
|
navigation_region_editor = memnew(NavigationRegion3DEditor);
|
||||||
EditorNode::get_singleton()->get_gui_base()->add_child(navigation_mesh_editor);
|
EditorNode::get_singleton()->get_gui_base()->add_child(navigation_region_editor);
|
||||||
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, navigation_mesh_editor->bake_hbox);
|
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, navigation_region_editor->bake_hbox);
|
||||||
navigation_mesh_editor->hide();
|
navigation_region_editor->hide();
|
||||||
navigation_mesh_editor->bake_hbox->hide();
|
navigation_region_editor->bake_hbox->hide();
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/* navigation_mesh_editor_plugin.h */
|
/* navigation_region_3d_editor_plugin.h */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/* This file is part of: */
|
/* This file is part of: */
|
||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
|
|
@ -38,10 +38,10 @@ class HBoxContainer;
|
||||||
class Label;
|
class Label;
|
||||||
class NavigationRegion3D;
|
class NavigationRegion3D;
|
||||||
|
|
||||||
class NavigationMeshEditor : public Control {
|
class NavigationRegion3DEditor : public Control {
|
||||||
friend class NavigationMeshEditorPlugin;
|
friend class NavigationRegion3DEditorPlugin;
|
||||||
|
|
||||||
GDCLASS(NavigationMeshEditor, Control);
|
GDCLASS(NavigationRegion3DEditor, Control);
|
||||||
|
|
||||||
AcceptDialog *err_dialog = nullptr;
|
AcceptDialog *err_dialog = nullptr;
|
||||||
|
|
||||||
|
|
@ -61,20 +61,20 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void edit(NavigationRegion3D *p_nav_region);
|
void edit(NavigationRegion3D *p_nav_region);
|
||||||
NavigationMeshEditor();
|
NavigationRegion3DEditor();
|
||||||
};
|
};
|
||||||
|
|
||||||
class NavigationMeshEditorPlugin : public EditorPlugin {
|
class NavigationRegion3DEditorPlugin : public EditorPlugin {
|
||||||
GDCLASS(NavigationMeshEditorPlugin, EditorPlugin);
|
GDCLASS(NavigationRegion3DEditorPlugin, EditorPlugin);
|
||||||
|
|
||||||
NavigationMeshEditor *navigation_mesh_editor = nullptr;
|
NavigationRegion3DEditor *navigation_region_editor = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual String get_plugin_name() const override { return "NavigationMesh"; }
|
virtual String get_plugin_name() const override { return "NavigationRegion3D"; }
|
||||||
bool has_main_screen() const override { return false; }
|
bool has_main_screen() const override { return false; }
|
||||||
virtual void edit(Object *p_object) override;
|
virtual void edit(Object *p_object) override;
|
||||||
virtual bool handles(Object *p_object) const override;
|
virtual bool handles(Object *p_object) const override;
|
||||||
virtual void make_visible(bool p_visible) override;
|
virtual void make_visible(bool p_visible) override;
|
||||||
|
|
||||||
NavigationMeshEditorPlugin();
|
NavigationRegion3DEditorPlugin();
|
||||||
};
|
};
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
#endif // DISABLE_DEPRECATED
|
#endif // DISABLE_DEPRECATED
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
#include "editor/navigation_mesh_editor_plugin.h"
|
#include "editor/navigation_region_3d_editor_plugin.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "core/config/engine.h"
|
#include "core/config/engine.h"
|
||||||
|
|
@ -64,7 +64,7 @@ void initialize_navigation_3d_module(ModuleInitializationLevel p_level) {
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||||
EditorPlugins::add_by_type<NavigationMeshEditorPlugin>();
|
EditorPlugins::add_by_type<NavigationRegion3DEditorPlugin>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue