diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-10-10 16:10:36 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-10-10 16:17:08 +0300 |
commit | 1857aa32bd3bf6f48b3e1a24ad7576af5e06540a (patch) | |
tree | 728716562aa3fa6b7ebce93568af9baafad2bdc5 /source | |
parent | cf192bdd43b8cd4e89161ca7fc5986f6f1a239f1 (diff) |
UI: Only hide locked transform manipulator axes for matching spaces
The manipulator would hide axes that were locked, even if the lock was
applied to a different space. That would lead to confusing behavior of
the manipulator. E.g.:
* Add armature
* Enter Pose Mode and select the bone
* Lock X and Y location in the Sidebar
* Enable the Move tool
* Only the Y axis is visible, but doesn't do anything on dragging
The manipulator would only show the Y axes, even though the lock is
applied to the bone's local Y axis, which matches the manipulators Z
axis.
Differential Revision: D6021
Reviewed by: Brecht van Lommel, William Reynish
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/transform/transform_gizmo_3d.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 8f475890e8f..157cf96a85e 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -516,9 +516,15 @@ static void protectflag_to_drawflags(short protectflag, short *drawflags) } /* for pose mode */ -static void protectflag_to_drawflags_pchan(RegionView3D *rv3d, const bPoseChannel *pchan) +static void protectflag_to_drawflags_pchan(RegionView3D *rv3d, + const bPoseChannel *pchan, + short orientation_type) { - protectflag_to_drawflags(pchan->protectflag, &rv3d->twdrawflag); + /* Protect-flags apply to local space in pose mode, so only let them influence axis + * visibility if we show the global orientation, otherwise it's confusing. */ + if (orientation_type == V3D_ORIENT_LOCAL) { + protectflag_to_drawflags(pchan->protectflag, &rv3d->twdrawflag); + } } /* for editmode*/ @@ -742,7 +748,14 @@ int ED_transform_calc_gizmo_stats(const bContext *C, bGPdata *gpd = CTX_data_gpencil_data(C); const bool is_gp_edit = GPENCIL_ANY_MODE(gpd); int a, totsel = 0; + const int pivot_point = scene->toolsettings->transform_pivot_point; + const short orientation_type = params->orientation_type ? + (params->orientation_type - 1) : + scene->orientation_slots[SCE_ORIENT_DEFAULT].type; + const short orientation_index_custom = + params->orientation_type ? params->orientation_index_custom : + scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom; /* transform widget matrix */ unit_m4(rv3d->twmat); @@ -756,12 +769,6 @@ int ED_transform_calc_gizmo_stats(const bContext *C, /* global, local or normal orientation? * if we could check 'totsel' now, this should be skipped with no selection. */ if (ob) { - const short orientation_type = params->orientation_type ? - (params->orientation_type - 1) : - scene->orientation_slots[SCE_ORIENT_DEFAULT].type; - const short orientation_index_custom = - params->orientation_type ? params->orientation_index_custom : - scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom; float mat[3][3]; ED_transform_calc_orientation_from_type_ex( C, mat, scene, rv3d, ob, obedit, orientation_type, orientation_index_custom, pivot_point); @@ -1038,7 +1045,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C, Bone *bone = pchan->bone; if (bone && (bone->flag & BONE_TRANSFORM)) { calc_tw_center_with_matrix(tbounds, pchan->pose_head, use_mat_local, mat_local); - protectflag_to_drawflags_pchan(rv3d, pchan); + protectflag_to_drawflags_pchan(rv3d, pchan, orientation_type); } } totsel += totsel_iter; @@ -1122,7 +1129,12 @@ int ED_transform_calc_gizmo_stats(const bContext *C, calc_tw_center(tbounds, co); } } - protectflag_to_drawflags(base->object->protectflag, &rv3d->twdrawflag); + + /* Protect-flags apply to world space in object mode, so only let them influence axis + * visibility if we show the global orientation, otherwise it's confusing. */ + if (orientation_type == V3D_ORIENT_GLOBAL) { + protectflag_to_drawflags(base->object->protectflag, &rv3d->twdrawflag); + } totsel++; } |