From e21388d9f484aeb2df802762a0ef2b95f60f271a Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 26 Sep 2021 23:54:40 +0200 Subject: [PATCH] Readd a Camera3D icon gizmo to the 3D editor, renew Camera2D/3D icons The lack of icon gizmo made it no longer possible to select Camera3D nodes in the 3D viewport by clicking on them. A new Camera3D icon gizmo was designed to be direction-neutral. This avoids the issue that the previous icon gizmo had, since it was always facing right. This also adds icons for CameraAttributesPractical and CameraAttributesPhysical. --- editor/icons/Camera2D.svg | 2 +- editor/icons/Camera3D.svg | 2 +- editor/icons/CameraAttributes.svg | 2 +- editor/icons/CameraAttributesPhysical.svg | 1 + editor/icons/CameraAttributesPractical.svg | 1 + editor/icons/CameraTexture.svg | 2 +- editor/icons/GizmoCamera3D.svg | 1 + editor/icons/XRCamera3D.svg | 2 +- editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp | 3 +++ 9 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 editor/icons/CameraAttributesPhysical.svg create mode 100644 editor/icons/CameraAttributesPractical.svg create mode 100644 editor/icons/GizmoCamera3D.svg diff --git a/editor/icons/Camera2D.svg b/editor/icons/Camera2D.svg index 81e5cc2c8e41..24198a8f0687 100644 --- a/editor/icons/Camera2D.svg +++ b/editor/icons/Camera2D.svg @@ -1 +1 @@ - + diff --git a/editor/icons/Camera3D.svg b/editor/icons/Camera3D.svg index bf61aa48fcc1..69d435ff175b 100644 --- a/editor/icons/Camera3D.svg +++ b/editor/icons/Camera3D.svg @@ -1 +1 @@ - + diff --git a/editor/icons/CameraAttributes.svg b/editor/icons/CameraAttributes.svg index 459c64e11c6d..72d88ace7a95 100644 --- a/editor/icons/CameraAttributes.svg +++ b/editor/icons/CameraAttributes.svg @@ -1 +1 @@ - + diff --git a/editor/icons/CameraAttributesPhysical.svg b/editor/icons/CameraAttributesPhysical.svg new file mode 100644 index 000000000000..f75cd0dc4426 --- /dev/null +++ b/editor/icons/CameraAttributesPhysical.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/CameraAttributesPractical.svg b/editor/icons/CameraAttributesPractical.svg new file mode 100644 index 000000000000..0aed99056dfd --- /dev/null +++ b/editor/icons/CameraAttributesPractical.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/CameraTexture.svg b/editor/icons/CameraTexture.svg index 145a817b7ecf..5a050b900e9f 100644 --- a/editor/icons/CameraTexture.svg +++ b/editor/icons/CameraTexture.svg @@ -1 +1 @@ - + diff --git a/editor/icons/GizmoCamera3D.svg b/editor/icons/GizmoCamera3D.svg new file mode 100644 index 000000000000..c22fa18ee43f --- /dev/null +++ b/editor/icons/GizmoCamera3D.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/XRCamera3D.svg b/editor/icons/XRCamera3D.svg index 501a86a9f787..88e11cfe34b2 100644 --- a/editor/icons/XRCamera3D.svg +++ b/editor/icons/XRCamera3D.svg @@ -1 +1 @@ - + diff --git a/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp index e4503b9c6fc1..2ef2e3a666c9 100644 --- a/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp @@ -41,6 +41,7 @@ Camera3DGizmoPlugin::Camera3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/camera", Color(0.8, 0.4, 0.8)); create_material("camera_material", gizmo_color); + create_icon_material("camera_icon", Node3DEditor::get_singleton()->get_theme_icon("GizmoCamera3D", "EditorIcons")); create_handle_material("handles"); } @@ -159,6 +160,7 @@ void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Vector handles; Ref material = get_material("camera_material", p_gizmo); + Ref icon = get_material("camera_icon", p_gizmo); const Size2i viewport_size = _get_viewport_size(camera); const real_t viewport_aspect = viewport_size.x > 0 && viewport_size.y > 0 ? viewport_size.aspect() : 1.0; @@ -256,6 +258,7 @@ void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { #undef ADD_QUAD p_gizmo->add_lines(lines, material); + p_gizmo->add_unscaled_billboard(icon, 0.05); p_gizmo->add_collision_segments(lines); if (!handles.is_empty()) {