diff options
author | Daniel J. Ramirez <djrmuv@gmail.com> | 2017-08-28 01:21:54 -0500 |
---|---|---|
committer | Daniel J. Ramirez <djrmuv@gmail.com> | 2017-08-28 01:28:24 -0500 |
commit | 3003e19ab1bb64b75ab71e64e063998f50c7b7e4 (patch) | |
tree | 0993512ac228473eff17e490964f651c42a0a937 /editor | |
parent | 8fce79aaeef3788bed170f07fc728e25f66e4a20 (diff) |
Highlight currently selected gizmo.
Work with, GIProbe, ReflectionProbe and Particles.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/spatial_editor_gizmos.cpp | 33 | ||||
-rw-r--r-- | editor/spatial_editor_gizmos.h | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index fb5143b486..6a49e24012 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -36,6 +36,7 @@ #include "scene/resources/capsule_shape.h" #include "scene/resources/convex_polygon_shape.h" #include "scene/resources/plane_shape.h" +#include "scene/resources/primitive_meshes.h" #include "scene/resources/ray_shape.h" #include "scene/resources/sphere_shape.h" #include "scene/resources/surface_tool.h" @@ -296,6 +297,15 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_bi } } +void EditorSpatialGizmo::add_solid_box(Ref<Material> &p_material, Vector3 size) { + CubeMesh cubem; + cubem.set_size(size); + Ref<ArrayMesh> m = memnew(ArrayMesh); + m->add_surface_from_arrays(cubem.surface_get_primitive_type(0), cubem.surface_get_arrays(0)); + m->surface_set_material(0, p_material); + add_mesh(m); +} + void EditorSpatialGizmo::set_spatial_node(Spatial *p_node) { ERR_FAIL_NULL(p_node); @@ -2334,6 +2344,14 @@ void ParticlesGizmo::redraw() { add_lines(lines, material); add_collision_segments(lines); + + if (is_selected()) { + + gizmo_color.a = 0.1; + Ref<Material> solid_material = create_material("particles_solid_material", gizmo_color); + add_solid_box(solid_material, aabb.get_size()); + } + //add_unscaled_billboard(SpatialEditorGizmos::singleton->visi,0.05); add_handles(handles); } @@ -2487,6 +2505,14 @@ void ReflectionProbeGizmo::redraw() { add_lines(lines, material); add_lines(internal_lines, material_internal); + + if (is_selected()) { + + gizmo_color.a = 0.1; + Ref<Material> solid_material = create_material("reflection_probe_solid_material", gizmo_color); + add_solid_box(solid_material, probe->get_extents() * 2.0); + } + //add_unscaled_billboard(SpatialEditorGizmos::singleton->visi,0.05); add_collision_segments(lines); add_handles(handles); @@ -2639,6 +2665,13 @@ void GIProbeGizmo::redraw() { handles.push_back(ax); } + if (is_selected()) { + + gizmo_color.a = 0.1; + Ref<Material> solid_material = create_material("gi_probe_solid_material", gizmo_color); + add_solid_box(solid_material, aabb.get_size()); + } + add_handles(handles); } GIProbeGizmo::GIProbeGizmo(GIProbe *p_probe) { diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h index a7c7497763..d63a804055 100644 --- a/editor/spatial_editor_gizmos.h +++ b/editor/spatial_editor_gizmos.h @@ -102,6 +102,7 @@ protected: void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh); void add_unscaled_billboard(const Ref<Material> &p_material, float p_scale = 1); void add_handles(const Vector<Vector3> &p_handles, bool p_billboard = false, bool p_secondary = false); + void add_solid_box(Ref<Material> &p_material, Vector3 size); void set_spatial_node(Spatial *p_node); |