diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-10-02 14:15:37 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-10-02 14:15:37 +0300 |
commit | 386ba094988fc793f8e060d15438566e5e2d2cae (patch) | |
tree | 4cbde50b5d1d7a45c89ee99c29dd1b86d1d97b59 /source/blender/editors/transform/transform.c | |
parent | 6129e20cec4639aebf335ff13b2ba0c59670662d (diff) | |
parent | f97a64aa9b7b384f8221a1ef4f2eef9cde1238db (diff) |
Merge branch 'master' into temp-gpencil-drw-engine
Conflicts:
source/blender/draw/engines/gpencil/gpencil_engine.c
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r-- | source/blender/editors/transform/transform.c | 503 |
1 files changed, 37 insertions, 466 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 6478928a6b6..67ea0f255fc 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -65,7 +65,6 @@ #include "DEG_depsgraph.h" #include "GPU_immediate.h" -#include "GPU_immediate_util.h" #include "GPU_matrix.h" #include "GPU_state.h" @@ -79,6 +78,7 @@ #include "ED_clip.h" #include "ED_node.h" #include "ED_gpencil.h" +#include "ED_sculpt.h" #include "WM_types.h" #include "WM_api.h" @@ -95,6 +95,7 @@ #include "BLT_translation.h" #include "transform.h" +#include "transform_convert.h" /* Disabling, since when you type you know what you are doing, * and being able to set it to zero is handy. */ @@ -1793,7 +1794,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) if (t->helpline != HLP_NONE) { float cent[2]; - float mval[3] = { + const float mval[3] = { x, y, 0.0f, @@ -2298,16 +2299,14 @@ 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); } - - if (t->mode == TFM_SHEAR) { - prop = RNA_struct_find_property(op->ptr, "shear_axis"); - t->custom.mode.data = POINTER_FROM_INT(RNA_property_enum_get(op->ptr, prop)); - RNA_property_enum_set(op->ptr, prop, POINTER_AS_INT(t->custom.mode.data)); - } } /** @@ -2347,6 +2346,11 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } } + 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; @@ -2409,6 +2413,10 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve createTransData(C, t); // make TransData structs from selection + if (t->options & CTX_SCULPT) { + ED_sculpt_init_transform(C); + } + if (t->data_len_all == 0) { postTrans(C, t); return 0; @@ -2517,8 +2525,6 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve initToSphere(t); break; case TFM_SHEAR: - prop = RNA_struct_find_property(op->ptr, "shear_axis"); - t->custom.mode.data = POINTER_FROM_INT(RNA_property_enum_get(op->ptr, prop)); initShear(t); break; case TFM_BEND: @@ -3515,13 +3521,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2])) static void initShear_mouseInputMode(TransInfo *t) { float dir[3]; - - if (t->custom.mode.data == NULL) { - copy_v3_v3(dir, t->orient_matrix[t->orient_axis_ortho]); - } - else { - cross_v3_v3v3(dir, t->orient_matrix[t->orient_axis_ortho], t->orient_matrix[t->orient_axis]); - } + copy_v3_v3(dir, t->orient_matrix[t->orient_axis_ortho]); /* Without this, half the gizmo handles move in the opposite direction. */ if ((t->orient_axis_ortho + 1) % 3 != t->orient_axis) { @@ -3569,24 +3569,22 @@ static eRedrawFlag handleEventShear(TransInfo *t, const wmEvent *event) if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) { /* Use custom.mode.data pointer to signal Shear direction */ - if (t->custom.mode.data == NULL) { - t->custom.mode.data = (void *)1; - } - else { - t->custom.mode.data = NULL; - } + do { + t->orient_axis_ortho = (t->orient_axis_ortho + 1) % 3; + } while (t->orient_axis_ortho == t->orient_axis); + initShear_mouseInputMode(t); status = TREDRAW_HARD; } else if (event->type == XKEY && event->val == KM_PRESS) { - t->custom.mode.data = NULL; + t->orient_axis_ortho = (t->orient_axis + 1) % 3; initShear_mouseInputMode(t); status = TREDRAW_HARD; } else if (event->type == YKEY && event->val == KM_PRESS) { - t->custom.mode.data = (void *)1; + t->orient_axis_ortho = (t->orient_axis + 2) % 3; initShear_mouseInputMode(t); status = TREDRAW_HARD; @@ -3630,14 +3628,7 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2])) } unit_m3(smat); - - // Custom data signals shear direction - if (t->custom.mode.data == NULL) { - smat[1][0] = value; - } - else { - smat[0][1] = value; - } + smat[1][0] = value; copy_v3_v3(axismat_inv[0], t->orient_matrix[t->orient_axis_ortho]); copy_v3_v3(axismat_inv[2], t->orient_matrix[t->orient_axis]); @@ -3878,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); @@ -4331,8 +4322,11 @@ static void headerRotation(TransInfo *t, char str[UI_MAX_DRAW_STR], float final) * * Protected axis and other transform settings are taken into account. */ -static void ElementRotation_ex( - TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3], const float *center) +static void ElementRotation_ex(TransInfo *t, + TransDataContainer *tc, + TransData *td, + const float mat[3][3], + const float *center) { float vec[3], totmat[3][3], smat[3][3]; float eul[3], fmat[3][3], quat[4]; @@ -4736,7 +4730,7 @@ static void initTrackball(TransInfo *t) static void applyTrackballValue(TransInfo *t, const float axis1[3], const float axis2[3], - float angles[2]) + const float angles[2]) { float mat[3][3]; float axis[3]; @@ -6398,367 +6392,6 @@ static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) /** \} */ /* -------------------------------------------------------------------- */ -/* Original Data Store */ - -/** \name Orig-Data Store Utility Functions - * \{ */ - -static void slide_origdata_init_flag(TransInfo *t, TransDataContainer *tc, SlideOrigData *sod) -{ - BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); - BMesh *bm = em->bm; - const bool has_layer_math = CustomData_has_math(&bm->ldata); - const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS); - - if ((t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) && - /* don't do this at all for non-basis shape keys, too easy to - * accidentally break uv maps or vertex colors then */ - (bm->shapenr <= 1) && (has_layer_math || (cd_loop_mdisp_offset != -1))) { - sod->use_origfaces = true; - sod->cd_loop_mdisp_offset = cd_loop_mdisp_offset; - } - else { - sod->use_origfaces = false; - sod->cd_loop_mdisp_offset = -1; - } -} - -static void slide_origdata_init_data(TransDataContainer *tc, SlideOrigData *sod) -{ - if (sod->use_origfaces) { - BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); - BMesh *bm = em->bm; - - sod->origfaces = BLI_ghash_ptr_new(__func__); - sod->bm_origfaces = BM_mesh_create(&bm_mesh_allocsize_default, - &((struct BMeshCreateParams){ - .use_toolflags = false, - })); - /* we need to have matching customdata */ - BM_mesh_copy_init_customdata(sod->bm_origfaces, bm, NULL); - } -} - -static void slide_origdata_create_data_vert(BMesh *bm, - SlideOrigData *sod, - TransDataGenericSlideVert *sv) -{ - BMIter liter; - int j, l_num; - float *loop_weights; - - /* copy face data */ - // BM_ITER_ELEM (l, &liter, sv->v, BM_LOOPS_OF_VERT) { - BM_iter_init(&liter, bm, BM_LOOPS_OF_VERT, sv->v); - l_num = liter.count; - loop_weights = BLI_array_alloca(loop_weights, l_num); - for (j = 0; j < l_num; j++) { - BMLoop *l = BM_iter_step(&liter); - BMLoop *l_prev, *l_next; - void **val_p; - if (!BLI_ghash_ensure_p(sod->origfaces, l->f, &val_p)) { - BMFace *f_copy = BM_face_copy(sod->bm_origfaces, bm, l->f, true, true); - *val_p = f_copy; - } - - if ((l_prev = BM_loop_find_prev_nodouble(l, l->next, FLT_EPSILON)) && - (l_next = BM_loop_find_next_nodouble(l, l_prev, FLT_EPSILON))) { - loop_weights[j] = angle_v3v3v3(l_prev->v->co, l->v->co, l_next->v->co); - } - else { - loop_weights[j] = 0.0f; - } - } - - /* store cd_loop_groups */ - if (sod->layer_math_map_num && (l_num != 0)) { - sv->cd_loop_groups = BLI_memarena_alloc(sod->arena, sod->layer_math_map_num * sizeof(void *)); - for (j = 0; j < sod->layer_math_map_num; j++) { - const int layer_nr = sod->layer_math_map[j]; - sv->cd_loop_groups[j] = BM_vert_loop_groups_data_layer_create( - bm, sv->v, layer_nr, loop_weights, sod->arena); - } - } - else { - sv->cd_loop_groups = NULL; - } - - BLI_ghash_insert(sod->origverts, sv->v, sv); -} - -static void slide_origdata_create_data(TransDataContainer *tc, - SlideOrigData *sod, - TransDataGenericSlideVert *sv_array, - unsigned int v_stride, - unsigned int v_num) -{ - if (sod->use_origfaces) { - BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); - BMesh *bm = em->bm; - unsigned int i; - TransDataGenericSlideVert *sv; - - int layer_index_dst; - int j; - - layer_index_dst = 0; - - /* TODO: We don't need `sod->layer_math_map` when there are no loops linked - * to one of the sliding vertices. */ - if (CustomData_has_math(&bm->ldata)) { - /* over alloc, only 'math' layers are indexed */ - sod->layer_math_map = MEM_mallocN(bm->ldata.totlayer * sizeof(int), __func__); - for (j = 0; j < bm->ldata.totlayer; j++) { - if (CustomData_layer_has_math(&bm->ldata, j)) { - sod->layer_math_map[layer_index_dst++] = j; - } - } - BLI_assert(layer_index_dst != 0); - } - - sod->layer_math_map_num = layer_index_dst; - - sod->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); - - sod->origverts = BLI_ghash_ptr_new_ex(__func__, v_num); - - for (i = 0, sv = sv_array; i < v_num; i++, sv = POINTER_OFFSET(sv, v_stride)) { - slide_origdata_create_data_vert(bm, sod, sv); - } - - if (tc->mirror.axis_flag) { - TransData *td = tc->data; - TransDataGenericSlideVert *sv_mirror; - - sod->sv_mirror = MEM_callocN(sizeof(*sv_mirror) * tc->data_len, __func__); - sod->totsv_mirror = tc->data_len; - - sv_mirror = sod->sv_mirror; - - for (i = 0; i < tc->data_len; i++, td++) { - BMVert *eve = td->extra; - /* Check the vertex has been used since both sides - * of the mirror may be selected & sliding. */ - if (eve && !BLI_ghash_haskey(sod->origverts, eve)) { - sv_mirror->v = eve; - copy_v3_v3(sv_mirror->co_orig_3d, eve->co); - - slide_origdata_create_data_vert(bm, sod, sv_mirror); - sv_mirror++; - } - else { - sod->totsv_mirror--; - } - } - - if (sod->totsv_mirror == 0) { - MEM_freeN(sod->sv_mirror); - sod->sv_mirror = NULL; - } - } - } -} - -/** - * If we're sliding the vert, return its original location, if not, the current location is good. - */ -static const float *slide_origdata_orig_vert_co(SlideOrigData *sod, BMVert *v) -{ - TransDataGenericSlideVert *sv = BLI_ghash_lookup(sod->origverts, v); - return sv ? sv->co_orig_3d : v->co; -} - -static void slide_origdata_interp_data_vert(SlideOrigData *sod, - BMesh *bm, - bool is_final, - TransDataGenericSlideVert *sv) -{ - BMIter liter; - int j, l_num; - float *loop_weights; - const bool is_moved = (len_squared_v3v3(sv->v->co, sv->co_orig_3d) > FLT_EPSILON); - const bool do_loop_weight = sod->layer_math_map_num && is_moved; - const bool do_loop_mdisps = is_final && is_moved && (sod->cd_loop_mdisp_offset != -1); - const float *v_proj_axis = sv->v->no; - /* original (l->prev, l, l->next) projections for each loop ('l' remains unchanged) */ - float v_proj[3][3]; - - if (do_loop_weight || do_loop_mdisps) { - project_plane_normalized_v3_v3v3(v_proj[1], sv->co_orig_3d, v_proj_axis); - } - - // BM_ITER_ELEM (l, &liter, sv->v, BM_LOOPS_OF_VERT) - BM_iter_init(&liter, bm, BM_LOOPS_OF_VERT, sv->v); - l_num = liter.count; - loop_weights = do_loop_weight ? BLI_array_alloca(loop_weights, l_num) : NULL; - for (j = 0; j < l_num; j++) { - BMFace *f_copy; /* the copy of 'f' */ - BMLoop *l = BM_iter_step(&liter); - - f_copy = BLI_ghash_lookup(sod->origfaces, l->f); - - /* only loop data, no vertex data since that contains shape keys, - * and we do not want to mess up other shape keys */ - BM_loop_interp_from_face(bm, l, f_copy, false, false); - - /* make sure face-attributes are correct (e.g. #MLoopUV, #MLoopCol) */ - BM_elem_attrs_copy_ex(sod->bm_origfaces, bm, f_copy, l->f, 0x0, CD_MASK_NORMAL); - - /* weight the loop */ - if (do_loop_weight) { - const float eps = 1.0e-8f; - const BMLoop *l_prev = l->prev; - const BMLoop *l_next = l->next; - const float *co_prev = slide_origdata_orig_vert_co(sod, l_prev->v); - const float *co_next = slide_origdata_orig_vert_co(sod, l_next->v); - bool co_prev_ok; - bool co_next_ok; - - /* In the unlikely case that we're next to a zero length edge - - * walk around the to the next. - * - * Since we only need to check if the vertex is in this corner, - * its not important _which_ loop - as long as its not overlapping - * 'sv->co_orig_3d', see: T45096. */ - project_plane_normalized_v3_v3v3(v_proj[0], co_prev, v_proj_axis); - while (UNLIKELY(((co_prev_ok = (len_squared_v3v3(v_proj[1], v_proj[0]) > eps)) == false) && - ((l_prev = l_prev->prev) != l->next))) { - co_prev = slide_origdata_orig_vert_co(sod, l_prev->v); - project_plane_normalized_v3_v3v3(v_proj[0], co_prev, v_proj_axis); - } - project_plane_normalized_v3_v3v3(v_proj[2], co_next, v_proj_axis); - while (UNLIKELY(((co_next_ok = (len_squared_v3v3(v_proj[1], v_proj[2]) > eps)) == false) && - ((l_next = l_next->next) != l->prev))) { - co_next = slide_origdata_orig_vert_co(sod, l_next->v); - project_plane_normalized_v3_v3v3(v_proj[2], co_next, v_proj_axis); - } - - if (co_prev_ok && co_next_ok) { - const float dist = dist_signed_squared_to_corner_v3v3v3( - sv->v->co, UNPACK3(v_proj), v_proj_axis); - - loop_weights[j] = (dist >= 0.0f) ? 1.0f : ((dist <= -eps) ? 0.0f : (1.0f + (dist / eps))); - if (UNLIKELY(!isfinite(loop_weights[j]))) { - loop_weights[j] = 0.0f; - } - } - else { - loop_weights[j] = 0.0f; - } - } - } - - if (sod->layer_math_map_num && sv->cd_loop_groups) { - if (do_loop_weight) { - for (j = 0; j < sod->layer_math_map_num; j++) { - BM_vert_loop_groups_data_layer_merge_weights( - bm, sv->cd_loop_groups[j], sod->layer_math_map[j], loop_weights); - } - } - else { - for (j = 0; j < sod->layer_math_map_num; j++) { - BM_vert_loop_groups_data_layer_merge(bm, sv->cd_loop_groups[j], sod->layer_math_map[j]); - } - } - } - - /* Special handling for multires - * - * Interpolate from every other loop (not ideal) - * However values will only be taken from loops which overlap other mdisps. - * */ - if (do_loop_mdisps) { - float(*faces_center)[3] = BLI_array_alloca(faces_center, l_num); - BMLoop *l; - - BM_ITER_ELEM_INDEX (l, &liter, sv->v, BM_LOOPS_OF_VERT, j) { - BM_face_calc_center_median(l->f, faces_center[j]); - } - - BM_ITER_ELEM_INDEX (l, &liter, sv->v, BM_LOOPS_OF_VERT, j) { - BMFace *f_copy = BLI_ghash_lookup(sod->origfaces, l->f); - float f_copy_center[3]; - BMIter liter_other; - BMLoop *l_other; - int j_other; - - BM_face_calc_center_median(f_copy, f_copy_center); - - BM_ITER_ELEM_INDEX (l_other, &liter_other, sv->v, BM_LOOPS_OF_VERT, j_other) { - BM_face_interp_multires_ex(bm, - l_other->f, - f_copy, - faces_center[j_other], - f_copy_center, - sod->cd_loop_mdisp_offset); - } - } - } -} - -static void slide_origdata_interp_data(Object *obedit, - SlideOrigData *sod, - TransDataGenericSlideVert *sv, - unsigned int v_stride, - unsigned int v_num, - bool is_final) -{ - if (sod->use_origfaces) { - BMEditMesh *em = BKE_editmesh_from_object(obedit); - BMesh *bm = em->bm; - unsigned int i; - const bool has_mdisps = (sod->cd_loop_mdisp_offset != -1); - - for (i = 0; i < v_num; i++, sv = POINTER_OFFSET(sv, v_stride)) { - - if (sv->cd_loop_groups || has_mdisps) { - slide_origdata_interp_data_vert(sod, bm, is_final, sv); - } - } - - if (sod->sv_mirror) { - sv = sod->sv_mirror; - for (i = 0; i < v_num; i++, sv++) { - if (sv->cd_loop_groups || has_mdisps) { - slide_origdata_interp_data_vert(sod, bm, is_final, sv); - } - } - } - } -} - -static void slide_origdata_free_date(SlideOrigData *sod) -{ - if (sod->use_origfaces) { - if (sod->bm_origfaces) { - BM_mesh_free(sod->bm_origfaces); - sod->bm_origfaces = NULL; - } - - if (sod->origfaces) { - BLI_ghash_free(sod->origfaces, NULL, NULL); - sod->origfaces = NULL; - } - - if (sod->origverts) { - BLI_ghash_free(sod->origverts, NULL, NULL); - sod->origverts = NULL; - } - - if (sod->arena) { - BLI_memarena_free(sod->arena); - sod->arena = NULL; - } - - MEM_SAFE_FREE(sod->layer_math_map); - - MEM_SAFE_FREE(sod->sv_mirror); - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ /* Transform (Edge Slide) */ /** \name Transform Edge Slide @@ -7209,8 +6842,6 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t View3D *v3d = NULL; RegionView3D *rv3d = NULL; - slide_origdata_init_flag(t, tc, &sld->orig_data); - sld->curr_sv_index = 0; /*ensure valid selection*/ @@ -7541,18 +7172,10 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t calcEdgeSlide_mval_range(t, tc, sld, sv_table, loop_nr, mval, use_occlude_geometry, true); - /* create copies of faces for customdata projection */ - bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); - slide_origdata_init_data(tc, &sld->orig_data); - slide_origdata_create_data( - tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv); - if (rv3d) { calcEdgeSlide_even(t, tc, sld, mval); } - sld->em = em; - tc->custom.mode.data = sld; MEM_freeN(sv_table); @@ -7586,8 +7209,6 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *t rv3d = t->ar ? t->ar->regiondata : NULL; } - slide_origdata_init_flag(t, tc, &sld->orig_data); - sld->curr_sv_index = 0; /* ensure valid selection */ { @@ -7736,18 +7357,10 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *t calcEdgeSlide_mval_range(t, tc, sld, sv_table, loop_nr, mval, use_occlude_geometry, false); - /* create copies of faces for customdata projection */ - bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); - slide_origdata_init_data(tc, &sld->orig_data); - slide_origdata_create_data( - tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv); - if (rv3d) { calcEdgeSlide_even(t, tc, sld, mval); } - sld->em = em; - tc->custom.mode.data = sld; MEM_freeN(sv_table); @@ -7764,25 +7377,10 @@ void projectEdgeSlideData(TransInfo *t, bool is_final) continue; } - SlideOrigData *sod = &sld->orig_data; - if (sod->use_origfaces == false) { - continue; - } - - slide_origdata_interp_data(tc->obedit, - sod, - (TransDataGenericSlideVert *)sld->sv, - sizeof(*sld->sv), - sld->totsv, - is_final); + trans_mesh_customdata_correction_apply(tc, is_final); } } -void freeEdgeSlideTempFaces(EdgeSlideData *sld) -{ - slide_origdata_free_date(&sld->orig_data); -} - void freeEdgeSlideVerts(TransInfo *UNUSED(t), TransDataContainer *UNUSED(tc), TransCustomData *custom_data) @@ -7793,10 +7391,6 @@ void freeEdgeSlideVerts(TransInfo *UNUSED(t), return; } - freeEdgeSlideTempFaces(sld); - - bmesh_edit_end(sld->em->bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); - MEM_freeN(sld->sv); MEM_freeN(sld); @@ -7855,6 +7449,8 @@ static void initEdgeSlide_ex( tc->custom.mode.free_cb = freeEdgeSlideVerts; } + trans_mesh_customdata_correction_init(t); + /* set custom point first if you want value to be initialized by init */ calcEdgeSlideCustomPoints(t); initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO_FLIP); @@ -8330,8 +7926,6 @@ static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc) VertSlideData *sld = MEM_callocN(sizeof(*sld), "sld"); int j; - slide_origdata_init_flag(t, tc, &sld->orig_data); - sld->curr_sv_index = 0; j = 0; @@ -8395,13 +7989,6 @@ static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc) sld->sv = sv_array; sld->totsv = j; - bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); - slide_origdata_init_data(tc, &sld->orig_data); - slide_origdata_create_data( - tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv); - - sld->em = em; - tc->custom.mode.data = sld; /* most likely will be set below */ @@ -8430,24 +8017,10 @@ static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc) void projectVertSlideData(TransInfo *t, bool is_final) { FOREACH_TRANS_DATA_CONTAINER (t, tc) { - VertSlideData *sld = tc->custom.mode.data; - SlideOrigData *sod = &sld->orig_data; - if (sod->use_origfaces == true) { - slide_origdata_interp_data(tc->obedit, - sod, - (TransDataGenericSlideVert *)sld->sv, - sizeof(*sld->sv), - sld->totsv, - is_final); - } + trans_mesh_customdata_correction_apply(tc, is_final); } } -void freeVertSlideTempFaces(VertSlideData *sld) -{ - slide_origdata_free_date(&sld->orig_data); -} - void freeVertSlideVerts(TransInfo *UNUSED(t), TransDataContainer *UNUSED(tc), TransCustomData *custom_data) @@ -8458,10 +8031,6 @@ void freeVertSlideVerts(TransInfo *UNUSED(t), return; } - freeVertSlideTempFaces(sld); - - bmesh_edit_end(sld->em->bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); - if (sld->totsv > 0) { TransDataVertSlideVert *sv = sld->sv; int i = 0; @@ -8511,6 +8080,8 @@ static void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use return; } + trans_mesh_customdata_correction_init(t); + /* set custom point first if you want value to be initialized by init */ calcVertSlideCustomPoints(t); initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO); |