diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-08-26 18:30:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-08-26 18:46:03 +0300 |
commit | 7fee153bf5e3268ce6627154e62ca5d867cecdb6 (patch) | |
tree | 34fbaa3f498c9042c521dfd7a04b446c1a4b21b4 /source/blender/draw/modes | |
parent | 487cd7237c9d208cd2b9fa11f49a83ba46a97399 (diff) |
3D View: show selected object axis when affect origins is enabled
This replaces temporarily enabling draw-axis.
Diffstat (limited to 'source/blender/draw/modes')
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 54e915dbe64..716372560db 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -234,6 +234,7 @@ typedef struct OBJECT_ShadingGroupList { /* Helpers */ DRWCallBuffer *relationship_lines; DRWCallBuffer *constraint_lines; + DRWCallBuffer *origin_xform; /* Camera */ DRWCallBuffer *camera; @@ -1735,6 +1736,16 @@ static void OBJECT_cache_init(void *vedata) sgl->constraint_lines = buffer_dynlines_dashed_uniform_color( sgl->non_meshes, gb->colorGridAxisZ, draw_ctx->sh_cfg); + { + DRWShadingGroup *grp_axes; + sgl->origin_xform = buffer_instance_color_axes( + sgl->non_meshes, DRW_cache_bone_arrows_get(), &grp_axes, draw_ctx->sh_cfg); + + DRW_shgroup_state_disable(grp_axes, DRW_STATE_DEPTH_LESS_EQUAL); + DRW_shgroup_state_enable(grp_axes, DRW_STATE_DEPTH_ALWAYS); + DRW_shgroup_state_enable(grp_axes, DRW_STATE_WIRE_SMOOTH); + } + /* Force Field Curve Guide End (here because of stipple) */ /* TODO port to shader stipple */ geom = DRW_cache_screenspace_circle_get(); @@ -3675,6 +3686,15 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) DRW_shgroup_bounds(sgl, ob, theme_id); } + /* Helpers for when we're transforming origins. */ + if (scene->toolsettings->transform_flag & SCE_XFORM_DATA_ORIGIN) { + if (ob->base_flag & BASE_SELECTED) { + const float color[4] = {0.75, 0.75, 0.75, 0.5}; + float axes_size = 1.0f; + DRW_buffer_add_entry(sgl->origin_xform, color, &axes_size, ob->obmat); + } + } + /* don't show object extras in set's */ if ((ob->base_flag & (BASE_FROM_SET | BASE_FROM_DUPLI)) == 0) { if ((draw_ctx->object_mode & (OB_MODE_ALL_PAINT | OB_MODE_ALL_PAINT_GPENCIL)) == 0) { |