diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-06-03 18:21:43 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-09-16 10:56:45 +0200 |
commit | 05697ee848d0f17605fe3416da57c0fcc2eb6323 (patch) | |
tree | 3bbe18e8b8a2b08943302abf22237c116751a431 /editor | |
parent | 73ec378c6431fc2e86c1116505b61f5064d3cd4d (diff) |
Display a editor gizmo icon for Listener3D
The icon was present in `editor/icons/`, but it was never implemented
in the editor gizmos code.
This also removes some unused gizmo drawing code (overridden methods
that are no longer called anywhere).
Diffstat (limited to 'editor')
-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 |
4 files changed, 37 insertions, 2 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))); |