Fix T69804: Transform tools in sculpt mode fails with transformed objects
Reviewed By: mano-wii Maniphest Tasks: T69804 Differential Revision: https://developer.blender.org/D5777
This commit is contained in:
parent
0ec6564668
commit
f71d89bb04
Notes:
blender-bot
2023-02-14 06:23:08 +01:00
Referenced by issue #69831, Transform tools sculpt mode : Orientation Referenced by issue #69804, New transform tools in sculpt mode works weird if origin is not in world center 0,0,0.
|
@ -9110,14 +9110,6 @@ void ED_sculpt_init_transform(struct bContext *C)
|
|||
copy_v3_v3(ss->init_pivot_pos, ss->pivot_pos);
|
||||
copy_v4_v4(ss->init_pivot_rot, ss->pivot_rot);
|
||||
|
||||
ss->init_pivot_scale[0] = 1.0f;
|
||||
ss->init_pivot_scale[1] = 1.0f;
|
||||
ss->init_pivot_scale[2] = 1.0f;
|
||||
|
||||
ss->pivot_scale[0] = 1.0f;
|
||||
ss->pivot_scale[1] = 1.0f;
|
||||
ss->pivot_scale[2] = 1.0f;
|
||||
|
||||
sculpt_undo_push_begin("Transform");
|
||||
BKE_sculpt_update_object_for_edit(depsgraph, ob, false, false);
|
||||
|
||||
|
|
|
@ -3869,7 +3869,7 @@ static void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, f
|
|||
if (td->ext && td->ext->size) {
|
||||
float fsize[3];
|
||||
|
||||
if (t->flag & (T_OBJECT | T_TEXTURE | T_POSE)) {
|
||||
if ((t->options & CTX_SCULPT) || t->flag & (T_OBJECT | T_TEXTURE | T_POSE)) {
|
||||
float obsizemat[3][3];
|
||||
/* Reorient the size mat to fit the oriented object. */
|
||||
mul_m3_m3m3(obsizemat, tmat, td->axismtx);
|
||||
|
|
|
@ -58,17 +58,14 @@ void createTransSculpt(TransInfo *t)
|
|||
TransDataContainer *tc = t->data_container;
|
||||
tc->data_len = 1;
|
||||
tc->is_active = 1;
|
||||
td = tc->data = MEM_callocN(sizeof(TransData), "TransTexspace");
|
||||
td->ext = tc->data_ext = MEM_callocN(sizeof(TransDataExtension), "TransTexspace");
|
||||
td = tc->data = MEM_callocN(sizeof(TransData), "TransSculpt");
|
||||
td->ext = tc->data_ext = MEM_callocN(sizeof(TransDataExtension), "TransSculpt");
|
||||
}
|
||||
|
||||
td->flag = TD_SELECTED;
|
||||
copy_v3_v3(td->center, ss->pivot_pos);
|
||||
td->ob = NULL;
|
||||
|
||||
float tquat[4];
|
||||
normalize_qt_qt(tquat, ss->pivot_rot);
|
||||
quat_to_mat3(td->axismtx, tquat);
|
||||
mul_m4_v3(ob->obmat, td->center);
|
||||
td->ob = ob;
|
||||
|
||||
td->loc = ss->pivot_pos;
|
||||
copy_v3_v3(td->iloc, ss->pivot_pos);
|
||||
|
@ -77,10 +74,18 @@ void createTransSculpt(TransInfo *t)
|
|||
ss->pivot_rot[3] = 1.0f;
|
||||
}
|
||||
|
||||
float obmat_inv[3][3];
|
||||
copy_m3_m4(obmat_inv, ob->obmat);
|
||||
invert_m3(obmat_inv);
|
||||
|
||||
td->ext->rot = NULL;
|
||||
td->ext->rotAxis = NULL;
|
||||
td->ext->rotAngle = NULL;
|
||||
td->ext->quat = ss->pivot_rot;
|
||||
copy_m4_m4(td->ext->obmat, ob->obmat);
|
||||
copy_m3_m3(td->ext->l_smtx, obmat_inv);
|
||||
copy_m3_m4(td->ext->r_mtx, ob->obmat);
|
||||
copy_m3_m3(td->ext->r_smtx, obmat_inv);
|
||||
|
||||
copy_qt_qt(td->ext->iquat, ss->pivot_rot);
|
||||
td->ext->rotOrder = ROT_MODE_QUAT;
|
||||
|
@ -89,13 +94,12 @@ void createTransSculpt(TransInfo *t)
|
|||
ss->pivot_scale[1] = 1.0f;
|
||||
ss->pivot_scale[2] = 1.0f;
|
||||
td->ext->size = ss->pivot_scale;
|
||||
copy_v3_v3(td->ext->isize, ss->pivot_scale);
|
||||
copy_v3_v3(ss->init_pivot_scale, ss->pivot_scale);
|
||||
copy_v3_v3(td->ext->isize, ss->init_pivot_scale);
|
||||
|
||||
float obmat_inv[3][3];
|
||||
copy_m3_m4(obmat_inv, ob->obmat);
|
||||
invert_m3(obmat_inv);
|
||||
copy_m3_m3(td->smtx, obmat_inv);
|
||||
copy_m3_m4(td->mtx, ob->obmat);
|
||||
copy_m3_m4(td->axismtx, ob->obmat);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
Loading…
Reference in New Issue