[Bf-blender-cvs] [47f4f3c932b] blender-v2.93-release: Cleanup: Use enum to indicate the current orientation
Germano Cavalcante
noreply at git.blender.org
Thu May 20 16:23:34 CEST 2021
Commit: 47f4f3c932b251268f2fcd56a924d5f005bcb8cd
Author: Germano Cavalcante
Date: Tue May 11 22:40:56 2021 -0300
Branches: blender-v2.93-release
https://developer.blender.org/rB47f4f3c932b251268f2fcd56a924d5f005bcb8cd
Cleanup: Use enum to indicate the current orientation
Improves readability.
===================================================================
M source/blender/editors/transform/transform.c
M source/blender/editors/transform/transform.h
M source/blender/editors/transform/transform_constraints.c
===================================================================
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 2fbcbe22349..8546ec88715 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -782,7 +782,7 @@ static bool transform_event_modal_constraint(TransInfo *t, short modal_type)
}
else {
short orient_index = 1;
- if (t->orient_curr == 0 || ELEM(constraint_curr, -1, constraint_new)) {
+ if (t->orient_curr == O_DEFAULT || ELEM(constraint_curr, -1, constraint_new)) {
/* Successive presses on existing axis, cycle orientation modes. */
orient_index = (short)((t->orient_curr + 1) % (int)ARRAY_SIZE(t->orient));
}
@@ -1426,7 +1426,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
mat3_to_size(t->values_final, tmat);
}
- BLI_assert(t->orient_curr == 0);
+ BLI_assert(t->orient_curr == O_DEFAULT);
unit_m3(t->spacemtx);
t->orient[0].type = V3D_ORIENT_GLOBAL;
}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index f2d5800abb7..a29e02718cf 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -602,7 +602,12 @@ typedef struct TransInfo {
short type;
float matrix[3][3];
} orient[3];
- short orient_curr;
+
+ enum {
+ O_DEFAULT = 0,
+ O_SCENE,
+ O_SET,
+ } orient_curr;
/** backup from view3d, to restore on end. */
short gizmo_flag;
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 2037981e655..615467932a7 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -953,9 +953,8 @@ void startConstraint(TransInfo *t)
void stopConstraint(TransInfo *t)
{
- if (t->orient_curr != 0) {
- t->orient_curr = 0;
- transform_orientations_current_set(t, t->orient_curr);
+ if (t->orient_curr != O_DEFAULT) {
+ transform_orientations_current_set(t, O_DEFAULT);
}
t->con.mode &= ~(CON_APPLY | CON_SELECT);
@@ -971,8 +970,8 @@ void stopConstraint(TransInfo *t)
void initSelectConstraint(TransInfo *t)
{
- if (t->orient_curr == 0) {
- transform_orientations_current_set(t, 1);
+ if (t->orient_curr == O_DEFAULT) {
+ transform_orientations_current_set(t, O_SCENE);
}
setUserConstraint(t, CON_APPLY | CON_SELECT, "%s");
More information about the Bf-blender-cvs
mailing list