Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2020-05-01 23:40:54 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2020-05-01 23:41:06 +0300
commit06839379c5d4f541a80c4d0f4487d8eb2c6fbba0 (patch)
tree7c1c04fef3a8011ed58a866c1eebca6f60ecd687
parent87602d886f70a38a20e5738709dd971744a27516 (diff)
Transform: Allow orientation change with custom matrix in modal
-rw-r--r--source/blender/editors/transform/transform.c10
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_constraints.c2
-rw-r--r--source/blender/editors/transform/transform_orientations.c7
4 files changed, 11 insertions, 10 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 9ce98611b40..f3306caa931 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -828,7 +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);
- initTransformOrientation(t->context, t);
+ initTransformOrientation(t->context, t, t->orientation.types[t->orientation.index]);
}
if (t->orientation.index == 0) {
@@ -1893,7 +1893,13 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
unit_m3(t->spacemtx);
initTransInfo(C, t, op, event);
- initTransformOrientation(C, t);
+
+ /* 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];
+
+ initTransformOrientation(C, t, orientation);
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 107cbde1658..503e7bd4691 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);
+void initTransformOrientation(struct bContext *C, TransInfo *t, short orientation);
/* 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 3d4fdba9bce..94cfed32841 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -996,7 +996,7 @@ void initSelectConstraint(TransInfo *t, bool force_global)
else {
if (t->orientation.index == 0) {
t->orientation.index = 1;
- initTransformOrientation(t->context, t);
+ initTransformOrientation(t->context, t, t->orientation.types[t->orientation.index]);
}
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 0edaf259f0e..3b1f3559daa 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -438,16 +438,11 @@ static int armature_bone_transflags_update_recursive(bArmature *arm,
return total;
}
-void initTransformOrientation(bContext *C, TransInfo *t)
+void initTransformOrientation(bContext *C, TransInfo *t, short orientation)
{
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);