[Bf-blender-cvs] [185e1d53950] master: Fix T76254: 'Normal' Transformation Orientation using Global
Germano Cavalcante
noreply at git.blender.org
Fri May 1 14:32:32 CEST 2020
Commit: 185e1d53950faa9b56c812793f2bbda21d7489f8
Author: Germano Cavalcante
Date: Fri May 1 09:31:20 2020 -0300
Branches: master
https://developer.blender.org/rB185e1d53950faa9b56c812793f2bbda21d7489f8
Fix T76254: 'Normal' Transformation Orientation using Global
Issue introduced in rBc57e4418bb85.
===================================================================
M source/blender/editors/transform/transform.c
M source/blender/editors/transform/transform.h
M source/blender/editors/transform/transform_constraints.c
M source/blender/editors/transform/transform_orientations.c
===================================================================
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 843c60ec87c..9ce98611b40 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -828,8 +828,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, bool is
if (ELEM(cmode, '\0', axis)) {
/* Successive presses on existing axis, cycle orientation modes. */
t->orientation.index = (t->orientation.index + 1) % ARRAY_SIZE(t->orientation.types);
- BLI_assert(t->orientation.types[0] != V3D_ORIENT_CUSTOM_MATRIX);
- initTransformOrientation(t->context, t, t->orientation.types[t->orientation.index]);
+ initTransformOrientation(t->context, t);
}
if (t->orientation.index == 0) {
@@ -1894,10 +1893,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
unit_m3(t->spacemtx);
initTransInfo(C, t, op, event);
-
- /* Although `t->orientation.index` can be different from 0, always init the
- * default orientation so that in redo the contraint uses the `orient_matrix` */
- initTransformOrientation(C, t, t->orientation.types[0]);
+ initTransformOrientation(C, t);
if (t->spacetype == SPACE_VIEW3D) {
t->draw_handle_apply = ED_region_draw_cb_activate(
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 503e7bd4691..107cbde1658 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -912,7 +912,7 @@ void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot);
/*********************** Transform Orientations ******************************/
-void initTransformOrientation(struct bContext *C, TransInfo *t, short orientation);
+void initTransformOrientation(struct bContext *C, TransInfo *t);
/* Those two fill in mat and return non-zero on success */
bool createSpaceNormal(float mat[3][3], const float normal[3]);
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 7d7b9f7e8ce..195057460fe 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -1064,8 +1064,7 @@ void initSelectConstraint(TransInfo *t, bool force_global)
else {
if (t->orientation.index == 0) {
t->orientation.index = 1;
- BLI_assert(t->orientation.types[0] != V3D_ORIENT_CUSTOM_MATRIX);
- initTransformOrientation(t->context, t, t->orientation.types[t->orientation.index]);
+ initTransformOrientation(t->context, t);
}
orientation = t->orientation.types[t->orientation.index];
}
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 3b1f3559daa..0edaf259f0e 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -438,11 +438,16 @@ static int armature_bone_transflags_update_recursive(bArmature *arm,
return total;
}
-void initTransformOrientation(bContext *C, TransInfo *t, short orientation)
+void initTransformOrientation(bContext *C, TransInfo *t)
{
Object *ob = CTX_data_active_object(C);
Object *obedit = CTX_data_active_object(C);
+ /* Use the custom orientation when it is set. */
+ short orientation = t->orientation.types[0] == V3D_ORIENT_CUSTOM_MATRIX ?
+ V3D_ORIENT_CUSTOM_MATRIX :
+ t->orientation.types[t->orientation.index];
+
switch (orientation) {
case V3D_ORIENT_GLOBAL:
unit_m3(t->spacemtx);
More information about the Bf-blender-cvs
mailing list