diff --git a/editor/icons/GizmoListener.svg b/editor/icons/GizmoListener3D.svg similarity index 100% rename from editor/icons/GizmoListener.svg rename to editor/icons/GizmoListener3D.svg diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index e61571edffd..7962d186dcd 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -1481,8 +1481,6 @@ void Light3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { } } -////// - //// player gizmo AudioStreamPlayer3DGizmoPlugin::AudioStreamPlayer3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/stream_player_3d", Color(0.4, 0.8, 1)); @@ -1621,6 +1619,29 @@ void AudioStreamPlayer3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ////// +Listener3DGizmoPlugin::Listener3DGizmoPlugin() { + create_icon_material("listener_3d_icon", Node3DEditor::get_singleton()->get_theme_icon("GizmoListener3D", "EditorIcons")); +} + +bool Listener3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to(p_spatial) != nullptr; +} + +String Listener3DGizmoPlugin::get_gizmo_name() const { + return "Listener3D"; +} + +int Listener3DGizmoPlugin::get_priority() const { + return -1; +} + +void Listener3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { + const Ref icon = get_material("listener_3d_icon", p_gizmo); + p_gizmo->add_unscaled_billboard(icon, 0.05); +} + +////// + Camera3DGizmoPlugin::Camera3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/camera", Color(0.8, 0.4, 0.8)); diff --git a/editor/plugins/node_3d_editor_gizmos.h b/editor/plugins/node_3d_editor_gizmos.h index 415ed5da5c8..5dace06cd7b 100644 --- a/editor/plugins/node_3d_editor_gizmos.h +++ b/editor/plugins/node_3d_editor_gizmos.h @@ -249,6 +249,19 @@ public: AudioStreamPlayer3DGizmoPlugin(); }; +class Listener3DGizmoPlugin : public EditorNode3DGizmoPlugin { + GDCLASS(Listener3DGizmoPlugin, EditorNode3DGizmoPlugin); + +public: + bool has_gizmo(Node3D *p_spatial) override; + String get_gizmo_name() const override; + int get_priority() const override; + + void redraw(EditorNode3DGizmo *p_gizmo) override; + + Listener3DGizmoPlugin(); +}; + class Camera3DGizmoPlugin : public EditorNode3DGizmoPlugin { GDCLASS(Camera3DGizmoPlugin, EditorNode3DGizmoPlugin); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index be5d7564449..875474253df 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -6863,6 +6863,7 @@ void Node3DEditor::_register_all_gizmos() { add_gizmo_plugin(Ref(memnew(Camera3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(Light3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(AudioStreamPlayer3DGizmoPlugin))); + add_gizmo_plugin(Ref(memnew(Listener3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(MeshInstance3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(OccluderInstance3DGizmoPlugin))); add_gizmo_plugin(Ref(memnew(SoftBody3DGizmoPlugin))); diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 3ada9072c27..9aad338d158 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -254,10 +254,6 @@ bool Camera3D::is_current() const { } } -bool Camera3D::_can_gizmo_scale() const { - return false; -} - Vector3 Camera3D::project_ray_normal(const Point2 &p_pos) const { Vector3 ray = project_local_ray_normal(p_pos); return get_camera_transform().basis.xform(ray).normalized(); diff --git a/scene/3d/camera_3d.h b/scene/3d/camera_3d.h index 3b704944b06..c1af7fa4f72 100644 --- a/scene/3d/camera_3d.h +++ b/scene/3d/camera_3d.h @@ -79,8 +79,6 @@ private: Ref environment; Ref effects; - virtual bool _can_gizmo_scale() const; - // void _camera_make_current(Node *p_camera); friend class Viewport; void _update_audio_listener_state(); diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp index ab417fafddd..c787ba50872 100644 --- a/scene/3d/light_3d.cpp +++ b/scene/3d/light_3d.cpp @@ -30,10 +30,6 @@ #include "light_3d.h" -bool Light3D::_can_gizmo_scale() const { - return false; -} - void Light3D::set_param(Param p_param, real_t p_value) { ERR_FAIL_INDEX(p_param, PARAM_MAX); param[p_param] = p_value; diff --git a/scene/3d/light_3d.h b/scene/3d/light_3d.h index ecea60339f9..f788c323f77 100644 --- a/scene/3d/light_3d.h +++ b/scene/3d/light_3d.h @@ -86,8 +86,6 @@ private: protected: RID light; - virtual bool _can_gizmo_scale() const; - static void _bind_methods(); void _notification(int p_what); virtual void _validate_property(PropertyInfo &property) const override; diff --git a/scene/3d/listener_3d.cpp b/scene/3d/listener_3d.cpp index 1c52933ee5a..8ae1f1940f5 100644 --- a/scene/3d/listener_3d.cpp +++ b/scene/3d/listener_3d.cpp @@ -141,16 +141,6 @@ bool Listener3D::is_current() const { return false; } -bool Listener3D::_can_gizmo_scale() const { - return false; -} - -RES Listener3D::_get_gizmo_geometry() const { - Ref mesh = memnew(ArrayMesh); - - return mesh; -} - void Listener3D::_bind_methods() { ClassDB::bind_method(D_METHOD("make_current"), &Listener3D::make_current); ClassDB::bind_method(D_METHOD("clear_current"), &Listener3D::clear_current); @@ -160,7 +150,6 @@ void Listener3D::_bind_methods() { Listener3D::Listener3D() { set_notify_transform(true); - //active=false; } Listener3D::~Listener3D() { diff --git a/scene/3d/listener_3d.h b/scene/3d/listener_3d.h index 25eacf5135b..08c08aa0cb7 100644 --- a/scene/3d/listener_3d.h +++ b/scene/3d/listener_3d.h @@ -42,9 +42,6 @@ private: RID scenario_id; - virtual bool _can_gizmo_scale() const; - virtual RES _get_gizmo_geometry() const; - friend class Viewport; void _update_audio_listener_state(); diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index 5d89d295c27..b283749ffa5 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -91,9 +91,6 @@ SceneStringNames::SceneStringNames() { update = StaticCString::create("update"); updated = StaticCString::create("updated"); - _get_gizmo_geometry = StaticCString::create("_get_gizmo_geometry"); - _can_gizmo_scale = StaticCString::create("_can_gizmo_scale"); - _physics_process = StaticCString::create("_physics_process"); _process = StaticCString::create("_process"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index 01f427ecd10..2923351eabd 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -111,9 +111,6 @@ public: StringName _body_inout; StringName _area_inout; - StringName _get_gizmo_geometry; - StringName _can_gizmo_scale; - StringName _physics_process; StringName _process; StringName _enter_world;