Fix T87185: value assigned to modal Scale does not work properly
`t->values` does not necessarily represent a final value of the transformation, as each mode treats this value differently. So, unfortunately, we cannot have a generic offset solution for modal transform operations. Offset needs to be handled by each mode. Note: Currently only, `Move`, `Rotate` and `Resize` support this.
This commit is contained in:
@@ -353,8 +353,6 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
t->around = V3D_AROUND_CENTER_BOUNDS;
|
||||
}
|
||||
|
||||
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")) &&
|
||||
@@ -368,7 +366,6 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
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);
|
||||
|
||||
@@ -450,17 +450,6 @@ void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float outp
|
||||
mi->apply(t, mi, mval_db, output);
|
||||
}
|
||||
|
||||
if (!is_zero_v3(t->values_modal_offset)) {
|
||||
float values_ofs[3];
|
||||
if (t->con.mode & CON_APPLY) {
|
||||
mul_v3_m3v3(values_ofs, t->spacemtx, t->values_modal_offset);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(values_ofs, t->values_modal_offset);
|
||||
}
|
||||
add_v3_v3(t->values, values_ofs);
|
||||
}
|
||||
|
||||
if (mi->post) {
|
||||
mi->post(t, output);
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
|
||||
float ratio = t->values[0];
|
||||
|
||||
copy_v3_fl(t->values_final, ratio);
|
||||
add_v3_v3(t->values_final, t->values_modal_offset);
|
||||
|
||||
transform_snap_increment(t, t->values_final);
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
|
||||
{
|
||||
char str[UI_MAX_DRAW_STR];
|
||||
float axis_final[3];
|
||||
float final = t->values[0];
|
||||
float final = t->values[0] + t->values_modal_offset[0];
|
||||
|
||||
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
|
||||
t->con.applyRot(t, NULL, NULL, axis_final, &final);
|
||||
|
||||
@@ -362,6 +362,11 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(global_dir, t->values);
|
||||
if (!is_zero_v3(t->values_modal_offset)) {
|
||||
float values_ofs[3];
|
||||
mul_v3_m3v3(values_ofs, t->spacemtx, t->values_modal_offset);
|
||||
add_v3_v3(global_dir, values_ofs);
|
||||
}
|
||||
|
||||
t->tsnap.snapElem = 0;
|
||||
applySnapping(t, global_dir);
|
||||
|
||||
Reference in New Issue
Block a user