diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index daad0cd6b85..1132ecbe632 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -64,7 +64,6 @@ #include "editor/plugins/gizmos/lightmap_probe_gizmo_plugin.h" #include "editor/plugins/gizmos/marker_3d_gizmo_plugin.h" #include "editor/plugins/gizmos/mesh_instance_3d_gizmo_plugin.h" -#include "editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.h" #include "editor/plugins/gizmos/occluder_instance_3d_gizmo_plugin.h" #include "editor/plugins/gizmos/particles_3d_emission_shape_gizmo_plugin.h" #include "editor/plugins/gizmos/physics_bone_3d_gizmo_plugin.h" @@ -8731,7 +8730,6 @@ void Node3DEditor::_register_all_gizmos() { add_gizmo_plugin(Ref(memnew(CollisionObject3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(CollisionShape3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(CollisionPolygon3DGizmoPlugin))); - add_gizmo_plugin(Ref(memnew(NavigationLink3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(Joint3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(PhysicalBone3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(FogVolumeGizmoPlugin))); diff --git a/modules/navigation_3d/editor/navigation_link_3d_editor_plugin.cpp b/modules/navigation_3d/editor/navigation_link_3d_editor_plugin.cpp new file mode 100644 index 00000000000..6c0bcc1856a --- /dev/null +++ b/modules/navigation_3d/editor/navigation_link_3d_editor_plugin.cpp @@ -0,0 +1,46 @@ +/**************************************************************************/ +/* navigation_link_3d_editor_plugin.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#include "navigation_link_3d_editor_plugin.h" + +#include "editor/plugins/node_3d_editor_plugin.h" +#include "scene/3d/navigation/navigation_link_3d.h" + +void NavigationLink3DEditorPlugin::edit(Object *p_object) { +} + +bool NavigationLink3DEditorPlugin::handles(Object *p_object) const { + return Object::cast_to(p_object) != nullptr; +} + +NavigationLink3DEditorPlugin::NavigationLink3DEditorPlugin() { + gizmo_plugin.instantiate(); + Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin); +} diff --git a/modules/navigation_3d/editor/navigation_link_3d_editor_plugin.h b/modules/navigation_3d/editor/navigation_link_3d_editor_plugin.h new file mode 100644 index 00000000000..2c644cc8f69 --- /dev/null +++ b/modules/navigation_3d/editor/navigation_link_3d_editor_plugin.h @@ -0,0 +1,49 @@ +/**************************************************************************/ +/* navigation_link_3d_editor_plugin.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#pragma once + +#include "editor/plugins/editor_plugin.h" + +#include "navigation_link_3d_gizmo_plugin.h" + +class NavigationLink3DEditorPlugin : public EditorPlugin { + GDCLASS(NavigationLink3DEditorPlugin, EditorPlugin); + + Ref gizmo_plugin; + +public: + virtual String get_plugin_name() const override { return "NavigationLink3D"; } + bool has_main_screen() const override { return false; } + virtual void edit(Object *p_object) override; + virtual bool handles(Object *p_object) const override; + + NavigationLink3DEditorPlugin(); +}; diff --git a/editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp b/modules/navigation_3d/editor/navigation_link_3d_gizmo_plugin.cpp similarity index 99% rename from editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp rename to modules/navigation_3d/editor/navigation_link_3d_gizmo_plugin.cpp index ea01a2e9320..139a2afe8af 100644 --- a/editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp +++ b/modules/navigation_3d/editor/navigation_link_3d_gizmo_plugin.cpp @@ -204,7 +204,7 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { } String NavigationLink3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const { - return p_id == 0 ? TTR("Start Location") : TTR("End Location"); + return p_id == 0 ? TTR("Start Position") : TTR("End Position"); } Variant NavigationLink3DGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary) const { diff --git a/editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.h b/modules/navigation_3d/editor/navigation_link_3d_gizmo_plugin.h similarity index 100% rename from editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.h rename to modules/navigation_3d/editor/navigation_link_3d_gizmo_plugin.h diff --git a/modules/navigation_3d/register_types.cpp b/modules/navigation_3d/register_types.cpp index 0d21073b22f..6238aee150c 100644 --- a/modules/navigation_3d/register_types.cpp +++ b/modules/navigation_3d/register_types.cpp @@ -37,6 +37,7 @@ #endif // DISABLE_DEPRECATED #ifdef TOOLS_ENABLED +#include "editor/navigation_link_3d_editor_plugin.h" #include "editor/navigation_obstacle_3d_editor_plugin.h" #include "editor/navigation_region_3d_editor_plugin.h" #endif @@ -65,6 +66,7 @@ void initialize_navigation_3d_module(ModuleInitializationLevel p_level) { #ifdef TOOLS_ENABLED if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) { + EditorPlugins::add_by_type(); EditorPlugins::add_by_type(); EditorPlugins::add_by_type(); }