Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 6,497 Lines • ▼ Show 20 Lines | if (sod->use_origfaces) { | ||||
| sod->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); | sod->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); | ||||
| sod->origverts = BLI_ghash_ptr_new_ex(__func__, v_num); | 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)) { | for (i = 0, sv = sv_array; i < v_num; i++, sv = POINTER_OFFSET(sv, v_stride)) { | ||||
| slide_origdata_create_data_vert(bm, sod, sv); | 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. | * 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) | static const float *slide_origdata_orig_vert_co(SlideOrigData *sod, BMVert *v) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | if (sod->use_origfaces) { | ||||
| const bool has_mdisps = (sod->cd_loop_mdisp_offset != -1); | const bool has_mdisps = (sod->cd_loop_mdisp_offset != -1); | ||||
| for (i = 0; i < v_num; i++, sv = POINTER_OFFSET(sv, v_stride)) { | for (i = 0; i < v_num; i++, sv = POINTER_OFFSET(sv, v_stride)) { | ||||
| if (sv->cd_loop_groups || has_mdisps) { | if (sv->cd_loop_groups || has_mdisps) { | ||||
| slide_origdata_interp_data_vert(sod, bm, is_final, sv); | 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) | static void slide_origdata_free_date(SlideOrigData *sod) | ||||
| { | { | ||||
| if (sod->use_origfaces) { | if (sod->use_origfaces) { | ||||
| if (sod->bm_origfaces) { | if (sod->bm_origfaces) { | ||||
| BM_mesh_free(sod->bm_origfaces); | BM_mesh_free(sod->bm_origfaces); | ||||
| Show All 11 Lines | if (sod->use_origfaces) { | ||||
| } | } | ||||
| if (sod->arena) { | if (sod->arena) { | ||||
| BLI_memarena_free(sod->arena); | BLI_memarena_free(sod->arena); | ||||
| sod->arena = NULL; | sod->arena = NULL; | ||||
| } | } | ||||
| MEM_SAFE_FREE(sod->layer_math_map); | MEM_SAFE_FREE(sod->layer_math_map); | ||||
| MEM_SAFE_FREE(sod->sv_mirror); | |||||
| } | } | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /* Transform (Edge Slide) */ | /* Transform (Edge Slide) */ | ||||
| ▲ Show 20 Lines • Show All 3,118 Lines • Show Last 20 Lines | |||||