diff options
-rw-r--r-- | editor/icons/GizmoListener3D.svg (renamed from editor/icons/GizmoListener.svg) | 0 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_gizmos.cpp | 25 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_gizmos.h | 13 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | scene/3d/camera_3d.cpp | 4 | ||||
-rw-r--r-- | scene/3d/camera_3d.h | 2 | ||||
-rw-r--r-- | scene/3d/light_3d.cpp | 4 | ||||
-rw-r--r-- | scene/3d/light_3d.h | 2 | ||||
-rw-r--r-- | scene/3d/listener_3d.cpp | 11 | ||||
-rw-r--r-- | scene/3d/listener_3d.h | 3 | ||||
-rw-r--r-- | scene/scene_string_names.cpp | 3 | ||||
-rw-r--r-- | scene/scene_string_names.h | 3 |
12 files changed, 37 insertions, 34 deletions
diff --git a/editor/icons/GizmoListener.svg b/editor/icons/GizmoListener3D.svg index 9d3ddf8b85..9d3ddf8b85 100644 --- a/editor/icons/GizmoListener.svg +++ b/editor/icons/GizmoListener3D.svg diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index e61571edff..7962d186dc 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<Listener3D>(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<Material> 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 415ed5da5c..5dace06cd7 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 be5d756444..875474253d 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<Camera3DGizmoPlugin>(memnew(Camera3DGizmoPlugin))); add_gizmo_plugin(Ref<Light3DGizmoPlugin>(memnew(Light3DGizmoPlugin))); add_gizmo_plugin(Ref<AudioStreamPlayer3DGizmoPlugin>(memnew(AudioStreamPlayer3DGizmoPlugin))); + add_gizmo_plugin(Ref<Listener3DGizmoPlugin>(memnew(Listener3DGizmoPlugin))); add_gizmo_plugin(Ref<MeshInstance3DGizmoPlugin>(memnew(MeshInstance3DGizmoPlugin))); add_gizmo_plugin(Ref<OccluderInstance3DGizmoPlugin>(memnew(OccluderInstance3DGizmoPlugin))); add_gizmo_plugin(Ref<SoftBody3DGizmoPlugin>(memnew(SoftBody3DGizmoPlugin))); diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 3ada9072c2..9aad338d15 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 3b704944b0..c1af7fa4f7 100644 --- a/scene/3d/camera_3d.h +++ b/scene/3d/camera_3d.h @@ -79,8 +79,6 @@ private: Ref<Environment> environment; Ref<CameraEffects> 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 ab417fafdd..c787ba5087 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 ecea60339f..f788c323f7 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 1c52933ee5..8ae1f1940f 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<ArrayMesh> 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 25eacf5135..08c08aa0cb 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 5d89d295c2..b283749ffa 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 01f427ecd1..2923351eab 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; |