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:
Diffstat (limited to 'source/blender/editors/transform/transform_generics.c')
-rw-r--r--source/blender/editors/transform/transform_generics.c82
1 files changed, 40 insertions, 42 deletions
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index e43a3ff3635..71c91221fbb 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -409,11 +409,10 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
short orient_types[3];
float custom_matrix[3][3];
- short orient_type_scene = V3D_ORIENT_GLOBAL;
- short orient_type_set = V3D_ORIENT_GLOBAL;
- short orient_type_matrix_set = -1;
-
- bool use_orient_axis = false;
+ int orient_type_scene = V3D_ORIENT_GLOBAL;
+ int orient_type_default = -1;
+ int orient_type_set = -1;
+ int orient_type_matrix_set = -1;
if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT];
@@ -424,40 +423,20 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
}
- short orient_type_default = orient_type_scene;
-
- if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis"))) {
- t->orient_axis = RNA_property_enum_get(op->ptr, prop);
- use_orient_axis = true;
- }
-
- if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) {
- t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop);
- }
-
if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_type")) &&
RNA_property_is_set(op->ptr, prop))) {
orient_type_set = RNA_property_enum_get(op->ptr, prop);
if (orient_type_set >= V3D_ORIENT_CUSTOM + BIF_countTransformOrientation(C)) {
orient_type_set = V3D_ORIENT_GLOBAL;
}
-
- /* Change the default orientation to be used when redoing. */
- orient_type_default = orient_type_set;
}
- else if (t->con.mode & CON_APPLY) {
- orient_type_set = orient_type_scene;
+
+ if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis"))) {
+ t->orient_axis = RNA_property_enum_get(op->ptr, prop);
}
- else {
- if (orient_type_set == orient_type_scene) {
- BLI_assert(orient_type_set == V3D_ORIENT_GLOBAL);
- orient_type_set = V3D_ORIENT_LOCAL;
- }
- if ((t->flag & T_MODAL) && (use_orient_axis || transform_mode_is_changeable(t->mode)) &&
- (t->mode != TFM_ALIGN)) {
- orient_type_default = V3D_ORIENT_VIEW;
- }
+ if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) {
+ t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop);
}
if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_matrix")) &&
@@ -468,19 +447,41 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
RNA_property_is_set(op->ptr, prop)) {
orient_type_matrix_set = RNA_property_enum_get(op->ptr, prop);
}
- else {
- orient_type_matrix_set = orient_type_set;
+ else if (orient_type_set == -1) {
+ orient_type_set = V3D_ORIENT_CUSTOM_MATRIX;
}
+ }
- if (orient_type_matrix_set == orient_type_set) {
- /* Constraints are forced to use the custom matrix when redoing. */
- orient_type_set = V3D_ORIENT_CUSTOM_MATRIX;
+ if (orient_type_set != -1) {
+ orient_type_default = orient_type_set;
+ t->is_orient_set = true;
+ }
+ else if (orient_type_matrix_set != -1) {
+ orient_type_default = orient_type_set = orient_type_matrix_set;
+ t->is_orient_set = true;
+ }
+ else if (t->con.mode & CON_APPLY) {
+ orient_type_default = orient_type_set = orient_type_scene;
+ }
+ else {
+ orient_type_default = orient_type_scene;
+ if (orient_type_scene == V3D_ORIENT_GLOBAL) {
+ orient_type_set = V3D_ORIENT_LOCAL;
}
+ else {
+ orient_type_set = V3D_ORIENT_GLOBAL;
+ }
+ }
+
+ BLI_assert(!ELEM(-1, orient_type_default, orient_type_set));
+ if (orient_type_matrix_set == orient_type_set) {
+ /* Constraints are forced to use the custom matrix when redoing. */
+ orient_type_set = V3D_ORIENT_CUSTOM_MATRIX;
}
- orient_types[0] = orient_type_default;
- orient_types[1] = orient_type_scene;
- orient_types[2] = orient_type_set;
+ orient_types[O_DEFAULT] = (short)orient_type_default;
+ orient_types[O_SCENE] = (short)orient_type_scene;
+ orient_types[O_SET] = (short)orient_type_set;
for (int i = 0; i < 3; i++) {
/* For efficiency, avoid calculating the same orientation twice. */
@@ -497,9 +498,6 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
}
- /* Set orient_curr to -1 in order to force the update in
- * `transform_orientations_current_set`. */
- t->orient_curr = -1;
transform_orientations_current_set(t, (t->con.mode & CON_APPLY) ? 2 : 0);
}
@@ -529,7 +527,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
else {
/* Avoid mirroring for unsupported contexts. */
- t->options |= CTX_NO_MIRROR;
+ t->flag |= T_NO_MIRROR;
}
/* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */