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.
This commit is contained in:
parent
2f63e47931
commit
b5eeef834f
Notes:
blender-bot
2023-02-14 08:06:38 +01:00
Referenced by issue #81480, Input 0 to scale in redo panel resets to 1
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue