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-07 22:51:30 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2020-05-07 22:51:51 +0300
commitb5eeef834f5d59c081ff15a5b8a01d414c6d8e1d (patch)
treedc08cc6733c932fa65cb9a325b3d31501246ec2f
parent2f63e479313332756d0879b841527a31fa1d30b3 (diff)
Fix direction of the Gizmo Extrude adjustment axis
The extrude adjustment gizmo reads the last constrained axis set. So it is important to keep the final value actually used.
-rw-r--r--source/blender/editors/transform/transform.c61
-rw-r--r--source/blender/editors/transform/transform_generics.c38
2 files changed, 46 insertions, 53 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index c15c8aefddf..6ff3826da09 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1740,38 +1740,26 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
!RNA_property_is_set(op->ptr, prop))) {
/* Set the first time to register on redo. */
RNA_property_enum_set(op->ptr, prop, orient_set);
-
- if (((prop = RNA_struct_find_property(op->ptr, "orient_matrix")) &&
- !RNA_property_is_set(op->ptr, prop))) {
- RNA_float_set_array(op->ptr, "orient_matrix", &t->spacemtx[0][0]);
- }
+ RNA_float_set_array(op->ptr, "orient_matrix", &t->spacemtx[0][0]);
}
}
if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
bool constraint_axis[3] = {false, false, false};
- if (t->idx_max == 0) {
- if (t->con.mode & CON_APPLY) {
- if (t->con.mode & CON_AXIS0) {
- constraint_axis[0] = true;
- }
- if (t->con.mode & CON_AXIS1) {
- constraint_axis[1] = true;
- }
- if (t->con.mode & CON_AXIS2) {
- constraint_axis[2] = true;
- }
- RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
+ if (t->con.mode & CON_APPLY) {
+ if (t->con.mode & CON_AXIS0) {
+ constraint_axis[0] = true;
}
- else {
- RNA_property_unset(op->ptr, prop);
+ if (t->con.mode & CON_AXIS1) {
+ constraint_axis[1] = true;
+ }
+ if (t->con.mode & CON_AXIS2) {
+ constraint_axis[2] = true;
}
+ RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
}
else {
- constraint_axis[0] = true;
- constraint_axis[1] = true;
- constraint_axis[2] = true;
- RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
+ RNA_property_unset(op->ptr, prop);
}
}
@@ -2028,33 +2016,6 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
calculatePropRatio(t);
calculateCenter(t);
- /* Overwrite initial values if operator supplied a non-null vector.
- *
- * Run before init functions so 'values_modal_offset' can be applied on mouse input.
- */
- BLI_assert(is_zero_v4(t->values_modal_offset));
- if ((prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) {
- float values[4] = {0}; /* in case value isn't length 4, avoid uninitialized memory */
-
- if (RNA_property_array_check(prop)) {
- RNA_float_get_array(op->ptr, "value", values);
- }
- else {
- values[0] = RNA_float_get(op->ptr, "value");
- }
-
- copy_v4_v4(t->values, values);
-
- if (t->flag & T_MODAL) {
- copy_v4_v4(t->values_modal_offset, values);
- t->redraw = TREDRAW_HARD;
- }
- else {
- copy_v4_v4(t->values, values);
- t->flag |= T_INPUT_IS_VALUES_FINAL;
- }
- }
-
if (event) {
/* Initialize accurate transform to settings requested by keymap. */
bool use_accurate = false;
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 9d94d229b25..704a48f3707 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1595,11 +1595,43 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->around = V3D_AROUND_CENTER_BOUNDS;
}
- if (op && (prop = RNA_struct_find_property(op->ptr, "constraint_axis")) &&
+ BLI_assert(is_zero_v4(t->values_modal_offset));
+ bool t_values_set_is_array = false;
+ if (op && (prop = RNA_struct_find_property(op->ptr, "value")) &&
RNA_property_is_set(op->ptr, prop)) {
- bool constraint_axis[3];
+ float values[4] = {0}; /* in case value isn't length 4, avoid uninitialized memory */
+ if (RNA_property_array_check(prop)) {
+ RNA_float_get_array(op->ptr, "value", values);
+ t_values_set_is_array = true;
+ }
+ else {
+ values[0] = RNA_float_get(op->ptr, "value");
+ }
+
+ copy_v4_v4(t->values, values);
+ if (t->flag & T_MODAL) {
+ /* Run before init functions so 'values_modal_offset' can be applied on mouse input. */
+ copy_v4_v4(t->values_modal_offset, values);
+ }
+ else {
+ copy_v4_v4(t->values, values);
+ t->flag |= T_INPUT_IS_VALUES_FINAL;
+ }
+ }
- RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
+ if (op && (prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
+ bool constraint_axis[3] = {false, false, false};
+ if (RNA_property_is_set(op->ptr, prop)) {
+ RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
+ }
+
+ if (t_values_set_is_array && t->flag & T_INPUT_IS_VALUES_FINAL) {
+ /* For operators whose `t->values` is array, set contrain so that the
+ * orientation is more intuitive in the Redo Panel. */
+ for (int i = 3; i--;) {
+ constraint_axis[i] |= t->values[i] != 0.0f;
+ }
+ }
if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) {
t->con.mode |= CON_APPLY;