[Bf-blender-cvs] [1857aa32bd3] master: UI: Only hide locked transform manipulator axes for matching spaces
Julian Eisel
noreply at git.blender.org
Thu Oct 10 15:17:27 CEST 2019
Commit: 1857aa32bd3bf6f48b3e1a24ad7576af5e06540a
Author: Julian Eisel
Date: Thu Oct 10 15:10:36 2019 +0200
Branches: master
https://developer.blender.org/rB1857aa32bd3bf6f48b3e1a24ad7576af5e06540a
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
===================================================================
M source/blender/editors/transform/transform_gizmo_3d.c
===================================================================
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++;
}
More information about the Bf-blender-cvs
mailing list