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:
authorPablo Dobarro <pablodp606@gmail.com>2019-09-13 17:27:53 +0300
committerPablo Dobarro <pablodp606@gmail.com>2019-09-13 17:30:06 +0300
commitf71d89bb047e33e8990e2d87d19484b09452d3ca (patch)
treeef1ba55373e0106b6c719eaa09a43d7a4d89d568
parent0ec65646681795662577b7e64a2a6397ccbd2cd5 (diff)
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
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c8
-rw-r--r--source/blender/editors/transform/transform.c2
-rw-r--r--source/blender/editors/transform/transform_convert_sculpt.c26
3 files changed, 16 insertions, 20 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index afbe7e14794..768a6976567 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -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);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 1effbcbd635..8839abe70a2 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -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);
diff --git a/source/blender/editors/transform/transform_convert_sculpt.c b/source/blender/editors/transform/transform_convert_sculpt.c
index b02ad71da07..6b584f806b8 100644
--- a/source/blender/editors/transform/transform_convert_sculpt.c
+++ b/source/blender/editors/transform/transform_convert_sculpt.c
@@ -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);
}
/** \} */