Skip to content

Commit

Permalink
Merge pull request #81554 from Calinou/editor-gizmos-add-decal
Browse files Browse the repository at this point in the history
Add 3D editor gizmo icons for Decal, LightmapProbe and FogVolume
  • Loading branch information
akien-mga committed Sep 16, 2023
2 parents 51f67ea + 5345cf3 commit 7ca579c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion editor/icons/GizmoCPUParticles3D.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions editor/icons/GizmoDecal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions editor/icons/GizmoFogVolume.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions editor/icons/GizmoLightmapProbe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions editor/plugins/gizmos/decal_gizmo_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@

#include "decal_gizmo_plugin.h"

#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/plugins/gizmos/gizmo_3d_helper.h"
#include "editor/plugins/node_3d_editor_plugin.h"
Expand All @@ -40,6 +42,8 @@ DecalGizmoPlugin::DecalGizmoPlugin() {
helper.instantiate();
Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/decal", Color(0.6, 0.5, 1.0));

create_icon_material("decal_icon", EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("GizmoDecal"), EditorStringName(EditorIcons)));

create_material("decal_material", gizmo_color);

create_handle_material("handles");
Expand Down Expand Up @@ -124,7 +128,9 @@ void DecalGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {

Vector<Vector3> handles = helper->box_get_handles(decal->get_size());
Ref<Material> material = get_material("decal_material", p_gizmo);
const Ref<Material> icon = get_material("decal_icon", p_gizmo);

p_gizmo->add_lines(lines, material);
p_gizmo->add_unscaled_billboard(icon, 0.05);
p_gizmo->add_handles(handles, get_material("handles"));
}
6 changes: 6 additions & 0 deletions editor/plugins/gizmos/fog_volume_gizmo_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@

#include "fog_volume_gizmo_plugin.h"

#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/fog_volume.h"
Expand All @@ -41,6 +43,8 @@ FogVolumeGizmoPlugin::FogVolumeGizmoPlugin() {
gizmo_color.a = 0.15;
create_material("shape_material_internal", gizmo_color);

create_icon_material("fog_volume_icon", EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("GizmoFogVolume"), EditorStringName(EditorIcons)));

create_handle_material("handles");
}

Expand Down Expand Up @@ -143,6 +147,8 @@ void FogVolumeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {

p_gizmo->add_lines(lines, material);
p_gizmo->add_collision_segments(lines);
const Ref<Material> icon = get_material("fog_volume_icon", p_gizmo);
p_gizmo->add_unscaled_billboard(icon, 0.05);
p_gizmo->add_handles(handles, handles_material);
}
}
7 changes: 7 additions & 0 deletions editor/plugins/gizmos/lightmap_probe_gizmo_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@

#include "lightmap_probe_gizmo_plugin.h"

#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/lightmap_probe.h"

LightmapProbeGizmoPlugin::LightmapProbeGizmoPlugin() {
create_icon_material("lightmap_probe_icon", EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("GizmoLightmapProbe"), EditorStringName(EditorIcons)));

Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/lightprobe_lines", Color(0.5, 0.6, 1));

gizmo_color.a = 0.3;
Expand Down Expand Up @@ -111,5 +115,8 @@ void LightmapProbeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
}
}

const Ref<Material> icon = get_material("lightmap_probe_icon", p_gizmo);

p_gizmo->add_lines(lines, material_lines);
p_gizmo->add_unscaled_billboard(icon, 0.05);
}

0 comments on commit 7ca579c

Please sign in to comment.