diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-06-10 22:36:07 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-06-10 22:36:16 +0300 |
commit | 04390941050b1b790cbe812e9a8867cb56c93565 (patch) | |
tree | 26f31b8438303f5581bc902274a853eddc419742 /source/blender | |
parent | bfa5eceb89cfc1d9f120c35e2206464c31630111 (diff) |
Cleanup: make the sculpt convert type follow transform convention
Diffstat (limited to 'source/blender')
6 files changed, 26 insertions, 23 deletions
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index a62deb9d69f..29ed0485490 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -97,7 +97,6 @@ enum TfmMode { #define CTX_OBMODE_XFORM_OBDATA (1 << 11) /** Transform object parents without moving their children. */ #define CTX_OBMODE_XFORM_SKIP_CHILDREN (1 << 12) -#define CTX_SCULPT (1 << 13) /* Standalone call to get the transformation center corresponding to the current situation * returns 1 if successful, 0 otherwise (usually means there's no selection) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 79090bd633e..d8503a28774 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -45,7 +45,6 @@ #include "ED_keyframing.h" #include "ED_node.h" #include "ED_screen.h" -#include "ED_sculpt.h" #include "ED_space_api.h" #include "WM_api.h" @@ -1767,10 +1766,6 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } } - if ((t->options & CTX_SCULPT) && !(t->options & CTX_PAINT_CURVE)) { - ED_sculpt_end_transform(C); - } - if ((prop = RNA_struct_find_property(op->ptr, "correct_uv"))) { RNA_property_boolean_set( op->ptr, prop, (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) != 0); @@ -1851,13 +1846,6 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } } - if (CTX_wm_view3d(C) != NULL) { - Object *ob = CTX_data_active_object(C); - if (ob && ob->mode == OB_MODE_SCULPT && ob->sculpt) { - options |= CTX_SCULPT; - } - } - t->options = options; t->mode = mode; @@ -1924,10 +1912,6 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve createTransData(C, t); // make TransData structs from selection - if ((t->options & CTX_SCULPT) && !(t->options & CTX_PAINT_CURVE)) { - ED_sculpt_init_transform(C); - } - if (t->data_len_all == 0) { postTrans(C, t); return 0; diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index fcca9b06451..8496642185d 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -916,6 +916,9 @@ void special_aftertrans_update(bContext *C, TransInfo *t) case TC_OBJECT_TEXSPACE: special_aftertrans_update__object(C, t); break; + case TC_SCULPT: + special_aftertrans_update__sculpt(C, t); + break; case TC_SEQ_DATA: special_aftertrans_update__sequencer(C, t); break; @@ -932,7 +935,6 @@ void special_aftertrans_update(bContext *C, TransInfo *t) case TC_MESH_UV: case TC_PAINT_CURVE_VERTS: case TC_PARTICLE_VERTS: - case TC_SCULPT: case TC_NONE: default: break; @@ -1013,7 +1015,8 @@ void createTransData(bContext *C, TransInfo *t) convert_type = TC_CURSOR_VIEW3D; } } - else if ((t->options & CTX_SCULPT) && !(t->options & CTX_PAINT_CURVE)) { + else if (!(t->options & CTX_PAINT_CURVE) && (t->spacetype == SPACE_VIEW3D) && ob && + (ob->mode == OB_MODE_SCULPT) && ob->sculpt) { convert_type = TC_SCULPT; } else if (t->options & CTX_TEXTURE) { @@ -1255,7 +1258,7 @@ void createTransData(bContext *C, TransInfo *t) createTransParticleVerts(C, t); break; case TC_SCULPT: - createTransSculpt(t); + createTransSculpt(C, t); init_prop_edit = false; break; case TC_SEQ_DATA: diff --git a/source/blender/editors/transform/transform_convert.h b/source/blender/editors/transform/transform_convert.h index 872f05418c4..fdb6767a267 100644 --- a/source/blender/editors/transform/transform_convert.h +++ b/source/blender/editors/transform/transform_convert.h @@ -176,8 +176,9 @@ void createTransParticleVerts(bContext *C, TransInfo *t); void recalcData_particles(TransInfo *t); /* transform_convert_sculpt.c */ -void createTransSculpt(TransInfo *t); +void createTransSculpt(bContext *C, TransInfo *t); void recalcData_sculpt(TransInfo *t); +void special_aftertrans_update__sculpt(bContext *C, TransInfo *t); /* transform_convert_sequencer.c */ void createTransSeqData(TransInfo *t); diff --git a/source/blender/editors/transform/transform_convert_sculpt.c b/source/blender/editors/transform/transform_convert_sculpt.c index b439c9a1731..0ac6bd9264f 100644 --- a/source/blender/editors/transform/transform_convert_sculpt.c +++ b/source/blender/editors/transform/transform_convert_sculpt.c @@ -39,7 +39,7 @@ * * \{ */ -void createTransSculpt(TransInfo *t) +void createTransSculpt(bContext *C, TransInfo *t) { TransData *td; @@ -99,6 +99,9 @@ void createTransSculpt(TransInfo *t) copy_m3_m3(td->smtx, obmat_inv); copy_m3_m4(td->mtx, ob->obmat); copy_m3_m4(td->axismtx, ob->obmat); + + BLI_assert(!(t->options & CTX_PAINT_CURVE)); + ED_sculpt_init_transform(C); } /** \} */ @@ -113,4 +116,16 @@ void recalcData_sculpt(TransInfo *t) ED_sculpt_update_modal_transform(t->context); } +void special_aftertrans_update__sculpt(bContext *C, TransInfo *t) +{ + Scene *scene = t->scene; + if (ID_IS_LINKED(scene)) { + /* `ED_sculpt_init_transform` was not called in this case. */ + return; + } + + BLI_assert(!(t->options & CTX_PAINT_CURVE)); + ED_sculpt_end_transform(C); +} + /** \} */ diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c index c2c880b03ff..e1fd22f06be 100644 --- a/source/blender/editors/transform/transform_mode.c +++ b/source/blender/editors/transform/transform_mode.c @@ -46,6 +46,7 @@ #include "BLT_translation.h" #include "transform.h" +#include "transform_convert.h" #include "transform_snap.h" /* Own include. */ @@ -937,7 +938,7 @@ void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, float ma if (td->ext && td->ext->size) { float fsize[3]; - if ((t->options & CTX_SCULPT) || t->flag & (T_OBJECT | T_TEXTURE | T_POSE)) { + if (ELEM(t->data_type, TC_SCULPT, TC_OBJECT, TC_OBJECT_TEXSPACE, TC_POSE)) { float obsizemat[3][3]; /* Reorient the size mat to fit the oriented object. */ mul_m3_m3m3(obsizemat, tmat, td->axismtx); |