Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_convert_mesh.c
| Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "transform.h" | #include "transform.h" | ||||
| #include "transform_convert.h" | #include "transform_convert.h" | ||||
| #include "bmesh.h" | #include "bmesh.h" | ||||
| /* Used for both mirror epsilon and TD_MIRROR_EDGE_ */ | |||||
| #define TRANSFORM_MAXDIST_MIRROR 0.00002f | |||||
| /* when transforming islands */ | /* when transforming islands */ | ||||
| struct TransIslandData { | struct TransIslandData { | ||||
| float co[3]; | float co[3]; | ||||
| float axismtx[3][3]; | float axismtx[3][3]; | ||||
| }; | }; | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Edit Mesh Verts Transform Creation | /** \name Edit Mesh Verts Transform Creation | ||||
| ▲ Show 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | static struct TransIslandData *editmesh_islands_info_calc(BMEditMesh *em, | ||||
| } | } | ||||
| *r_island_tot = group_tot; | *r_island_tot = group_tot; | ||||
| *r_island_vert_map = vert_map; | *r_island_vert_map = vert_map; | ||||
| return trans_islands; | return trans_islands; | ||||
| } | } | ||||
| static bool is_in_quadrant_v3(const float co[3], const int quadrant[3], const float epsilon) | |||||
| { | |||||
| if (quadrant[0] && ((co[0] * quadrant[0]) < -epsilon)) { | |||||
| return false; | |||||
| } | |||||
| if (quadrant[1] && ((co[1] * quadrant[1]) < -epsilon)) { | |||||
| return false; | |||||
| } | |||||
| if (quadrant[2] && ((co[2] * quadrant[2]) < -epsilon)) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| static TransDataMirror *editmesh_mirror_data_calc(BMEditMesh *em, | |||||
| bool use_select, | |||||
| const bool use_topology, | |||||
| const bool mirror_axis[3], | |||||
| int *r_mirror_data_len, | |||||
| BLI_bitmap **r_mirror_bitmap) | |||||
| { | |||||
| BMesh *bm = em->bm; | |||||
| int *index[3] = {NULL}; | |||||
| int i; | |||||
| bool test_selected_only = use_select && (mirror_axis[0] + mirror_axis[1] + mirror_axis[2]) == 1; | |||||
| for (i = 0; i < 3; i++) { | |||||
| if (mirror_axis[i]) { | |||||
| index[i] = MEM_mallocN(bm->totvert * sizeof(int), __func__); | |||||
| EDBM_verts_mirror_cache_begin_ex( | |||||
| em, i, false, test_selected_only, use_topology, TRANSFORM_MAXDIST_MIRROR, index[i]); | |||||
| } | |||||
| } | |||||
| BMVert *eve; | |||||
| BMIter iter; | |||||
| int quadrant[3]; | |||||
| { | |||||
| float mirror_sum[3] = {0}; | |||||
| BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { | |||||
| if (BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { | |||||
| continue; | |||||
| } | |||||
| if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { | |||||
| add_v3_v3(mirror_sum, eve->co); | |||||
| } | |||||
| } | |||||
| for (i = 0; i < 3; i++) { | |||||
| if (mirror_axis[i]) { | |||||
| quadrant[i] = mirror_sum[i] >= 0.0f ? 1 : -1; | |||||
| } | |||||
| else { | |||||
| quadrant[i] = 0; | |||||
| } | |||||
| } | |||||
| } | |||||
| /* Tag only elements that will be transformed within the quadrant. */ | |||||
| BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) { | |||||
| if (BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { | |||||
| continue; | |||||
| } | |||||
| if ((!use_select || BM_elem_flag_test(eve, BM_ELEM_SELECT)) && | |||||
| is_in_quadrant_v3(eve->co, quadrant, TRANSFORM_MAXDIST_MIRROR)) { | |||||
| BM_elem_flag_enable(eve, BM_ELEM_TAG); | |||||
| BM_elem_index_set(eve, i); | |||||
| } | |||||
| else { | |||||
| BM_elem_flag_disable(eve, BM_ELEM_TAG); | |||||
| BM_elem_index_set(eve, -1); | |||||
| } | |||||
| } | |||||
| for (int a = 0; a < 3; a++) { | |||||
| int *index_iter = index[a]; | |||||
| if (index_iter == NULL) { | |||||
| continue; | |||||
| } | |||||
| BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) { | |||||
| if (BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { | |||||
| continue; | |||||
| } | |||||
| if (test_selected_only && !BM_elem_flag_test(eve, BM_ELEM_SELECT)) { | |||||
| continue; | |||||
| } | |||||
| int elem_index = BM_elem_index_get(eve); | |||||
| if (elem_index != -1) { | |||||
| int i_mirr = index_iter[i]; | |||||
| if (i_mirr >= 0) { | |||||
| BMVert *vmir = BM_vert_at_index(bm, i_mirr); | |||||
| BM_elem_index_set(vmir, elem_index); | |||||
| /* The slot of this element in the index array no longer needs to be read. | |||||
| * Use to set the mirror sign. */ | |||||
| if (index[0] && a > 0) { | |||||
| index[0][i_mirr] = index[0][i]; | |||||
| } | |||||
| if (index[1] && a > 1) { | |||||
| index[1][i_mirr] = index[1][i]; | |||||
| } | |||||
| /* Use -2 to differ from -1, but both can work. */ | |||||
| index_iter[i_mirr] = -2; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /* Count the mirror elements. */ | |||||
| uint mirror_elem_len = 0; | |||||
| BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) { | |||||
| if (BM_elem_flag_test(eve, BM_ELEM_HIDDEN | BM_ELEM_TAG)) { | |||||
| /* These are not mirror elements. */ | |||||
| BM_elem_index_set(eve, -1); | |||||
| continue; | |||||
| } | |||||
| int elem_index = BM_elem_index_get(eve); | |||||
| if (elem_index != -1) { | |||||
| mirror_elem_len++; | |||||
| } | |||||
| } | |||||
| TransDataMirror *mirror_data_iter, *mirror_data = NULL; | |||||
| if (mirror_elem_len != 0) { | |||||
| mirror_data = MEM_mallocN(mirror_elem_len * sizeof(*mirror_data), __func__); | |||||
| mirror_data_iter = &mirror_data[0]; | |||||
| *r_mirror_bitmap = BLI_BITMAP_NEW(bm->totvert, __func__); | |||||
| BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) { | |||||
| int elem_index = BM_elem_index_get(eve); | |||||
| if (elem_index != -1) { | |||||
| BMVert *v_ref = BM_vert_at_index(bm, elem_index); | |||||
| mirror_data_iter->loc_ref = v_ref->co; | |||||
| mirror_data_iter->loc = eve->co; | |||||
| mirror_data_iter->sign[0] = index[0] && index[0][i] == -2 ? -1 : 1; | |||||
| mirror_data_iter->sign[1] = index[1] && index[1][i] == -2 ? -1 : 1; | |||||
| mirror_data_iter->sign[2] = index[2] && index[2][i] == -2 ? -1 : 1; | |||||
| mirror_data_iter->extra = eve; | |||||
| mirror_data_iter++; | |||||
| BLI_BITMAP_ENABLE(*r_mirror_bitmap, i); | |||||
| } | |||||
| } | |||||
| } | |||||
| MEM_SAFE_FREE(index[0]); | |||||
| MEM_SAFE_FREE(index[1]); | |||||
| MEM_SAFE_FREE(index[2]); | |||||
| bm->elem_index_dirty |= BM_VERT; | |||||
| *r_mirror_data_len = mirror_elem_len; | |||||
| return mirror_data; | |||||
| } | |||||
| /* way to overwrite what data is edited with transform */ | /* way to overwrite what data is edited with transform */ | ||||
| static void VertsToTransData(TransInfo *t, | static void VertsToTransData(TransInfo *t, | ||||
| TransData *td, | TransData *td, | ||||
| TransDataExtension *tx, | TransDataExtension *tx, | ||||
| BMEditMesh *em, | BMEditMesh *em, | ||||
| BMVert *eve, | BMVert *eve, | ||||
| float *bweight, | float *bweight, | ||||
| struct TransIslandData *v_island, | struct TransIslandData *v_island, | ||||
| ▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| BMesh *bm = em->bm; | BMesh *bm = em->bm; | ||||
| BMVert *eve; | BMVert *eve; | ||||
| BMIter iter; | BMIter iter; | ||||
| float(*mappedcos)[3] = NULL, (*quats)[4] = NULL; | float(*mappedcos)[3] = NULL, (*quats)[4] = NULL; | ||||
| float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL; | float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL; | ||||
| float *dists = NULL; | float *dists = NULL; | ||||
| int a; | int a; | ||||
| const int prop_mode = (t->flag & T_PROP_EDIT) ? (t->flag & T_PROP_EDIT_ALL) : 0; | const int prop_mode = (t->flag & T_PROP_EDIT) ? (t->flag & T_PROP_EDIT_ALL) : 0; | ||||
| int mirror = 0; | |||||
| int cd_vert_bweight_offset = -1; | int cd_vert_bweight_offset = -1; | ||||
| bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; | |||||
| struct TransIslandData *island_info = NULL; | struct TransIslandData *island_info = NULL; | ||||
| int island_info_tot; | int island_info_tot; | ||||
| int *island_vert_map = NULL; | int *island_vert_map = NULL; | ||||
| /* Snap rotation along normal needs a common axis for whole islands, | /* Snap rotation along normal needs a common axis for whole islands, | ||||
| * otherwise one get random crazy results, see T59104. | * otherwise one get random crazy results, see T59104. | ||||
| * However, we do not want to use the island center for the pivot/translation reference. */ | * However, we do not want to use the island center for the pivot/translation reference. */ | ||||
| const bool is_snap_rotate = ((t->mode == TFM_TRANSLATION) && | const bool is_snap_rotate = ((t->mode == TFM_TRANSLATION) && | ||||
| /* There is not guarantee that snapping | /* There is not guarantee that snapping | ||||
| * is initialized yet at this point... */ | * is initialized yet at this point... */ | ||||
| (usingSnappingNormal(t) || | (usingSnappingNormal(t) || | ||||
| (t->settings->snap_flag & SCE_SNAP_ROTATE) != 0) && | (t->settings->snap_flag & SCE_SNAP_ROTATE) != 0) && | ||||
| (t->around != V3D_AROUND_LOCAL_ORIGINS)); | (t->around != V3D_AROUND_LOCAL_ORIGINS)); | ||||
| /* Even for translation this is needed because of island-orientation, see: T51651. */ | /* Even for translation this is needed because of island-orientation, see: T51651. */ | ||||
| const bool is_island_center = (t->around == V3D_AROUND_LOCAL_ORIGINS) || is_snap_rotate; | const bool is_island_center = (t->around == V3D_AROUND_LOCAL_ORIGINS) || is_snap_rotate; | ||||
| /* Original index of our connected vertex when connected distances are calculated. | /* Original index of our connected vertex when connected distances are calculated. | ||||
| * Optional, allocate if needed. */ | * Optional, allocate if needed. */ | ||||
| int *dists_index = NULL; | int *dists_index = NULL; | ||||
| if (tc->mirror.axis_flag) { | |||||
| EDBM_verts_mirror_cache_begin(em, 0, false, (t->flag & T_PROP_EDIT) == 0, use_topology); | |||||
| mirror = 1; | |||||
| } | |||||
| /** | /** | ||||
| * Quick check if we can transform. | * Quick check if we can transform. | ||||
| * | * | ||||
| * \note ignore modes here, even in edge/face modes, | * \note ignore modes here, even in edge/face modes, | ||||
| * transform data is created by selected vertices. | * transform data is created by selected vertices. | ||||
| * \note in prop mode we need at least 1 selected. | * \note in prop mode we need at least 1 selected. | ||||
| */ | */ | ||||
| if (bm->totvertsel == 0) { | if (bm->totvertsel == 0) { | ||||
| goto cleanup; | goto cleanup; | ||||
| } | } | ||||
| if (t->mode == TFM_BWEIGHT) { | if (t->mode == TFM_BWEIGHT) { | ||||
| BM_mesh_cd_flag_ensure(bm, BKE_mesh_from_object(tc->obedit), ME_CDFLAG_VERT_BWEIGHT); | BM_mesh_cd_flag_ensure(bm, BKE_mesh_from_object(tc->obedit), ME_CDFLAG_VERT_BWEIGHT); | ||||
| cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT); | cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT); | ||||
| } | } | ||||
| BLI_bitmap *mirror_bitmap = NULL; | |||||
| if (tc->mirror.axis_flag) { | |||||
| bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; | |||||
| bool use_select = (t->flag & T_PROP_EDIT) == 0; | |||||
| bool mirror_axis[3] = {tc->mirror.axis_x, tc->mirror.axis_y, tc->mirror.axis_z}; | |||||
| tc->mirror.data = editmesh_mirror_data_calc( | |||||
| em, use_select, use_topology, mirror_axis, &tc->mirror.data_len, &mirror_bitmap); | |||||
| } | |||||
| int data_len = 0; | |||||
| if (prop_mode) { | if (prop_mode) { | ||||
| unsigned int count = 0; | |||||
| BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { | BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { | ||||
| if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { | if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { | ||||
| count++; | data_len++; | ||||
| } | } | ||||
| } | } | ||||
| tc->data_len = count; | |||||
| /* allocating scratch arrays */ | /* allocating scratch arrays */ | ||||
| if (prop_mode & T_PROP_CONNECTED) { | if (prop_mode & T_PROP_CONNECTED) { | ||||
| dists = MEM_mallocN(em->bm->totvert * sizeof(float), __func__); | dists = MEM_mallocN(em->bm->totvert * sizeof(float), __func__); | ||||
| if (is_island_center) { | if (is_island_center) { | ||||
| dists_index = MEM_mallocN(em->bm->totvert * sizeof(int), __func__); | dists_index = MEM_mallocN(em->bm->totvert * sizeof(int), __func__); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| tc->data_len = bm->totvertsel; | data_len = bm->totvertsel; | ||||
| } | |||||
| if (mirror_bitmap) { | |||||
| BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, a) { | |||||
| if (prop_mode || BM_elem_flag_test(eve, BM_ELEM_SELECT)) { | |||||
| if (BLI_BITMAP_TEST(mirror_bitmap, a)) { | |||||
| data_len--; | |||||
| } | |||||
| } | } | ||||
| } | |||||
| } | |||||
| BLI_assert(data_len != 0); | |||||
| tob = tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransObData(Mesh EditMode)"); | tc->data_len = data_len; | ||||
| tc->data = tob = MEM_callocN(data_len * sizeof(TransData), "TransObData(Mesh EditMode)"); | |||||
| if (ELEM(t->mode, TFM_SKIN_RESIZE, TFM_SHRINKFATTEN)) { | if (ELEM(t->mode, TFM_SKIN_RESIZE, TFM_SHRINKFATTEN)) { | ||||
| /* warning, this is overkill, we only need 2 extra floats, | /* warning, this is overkill, we only need 2 extra floats, | ||||
| * but this stores loads of extra stuff, for TFM_SHRINKFATTEN its even more overkill | * but this stores loads of extra stuff, for TFM_SHRINKFATTEN its even more overkill | ||||
| * since we may not use the 'alt' transform mode to maintain shell thickness, | * since we may not use the 'alt' transform mode to maintain shell thickness, | ||||
| * but with generic transform code its hard to lazy init vars */ | * but with generic transform code its hard to lazy init vars */ | ||||
| tx = tc->data_ext = MEM_callocN(tc->data_len * sizeof(TransDataExtension), | tx = tc->data_ext = MEM_callocN(tc->data_len * sizeof(TransDataExtension), | ||||
| "TransObData ext"); | "TransObData ext"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | #endif | ||||
| } | } | ||||
| } | } | ||||
| if (defcos) { | if (defcos) { | ||||
| MEM_freeN(defcos); | MEM_freeN(defcos); | ||||
| } | } | ||||
| } | } | ||||
| /* find out which half we do */ | BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, a) { | ||||
| if (mirror) { | if (BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { | ||||
| BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { | continue; | ||||
| if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve->co[0] != 0.0f) { | |||||
| if (eve->co[0] < 0.0f) { | |||||
| tc->mirror.sign = -1.0f; | |||||
| mirror = -1; | |||||
| } | |||||
| break; | |||||
| } | |||||
| } | } | ||||
| if (mirror_bitmap && BLI_BITMAP_TEST(mirror_bitmap, a)) { | |||||
| continue; | |||||
| } | } | ||||
| BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, a) { | |||||
| if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { | |||||
| if (prop_mode || BM_elem_flag_test(eve, BM_ELEM_SELECT)) { | if (prop_mode || BM_elem_flag_test(eve, BM_ELEM_SELECT)) { | ||||
| struct TransIslandData *v_island = NULL; | struct TransIslandData *v_island = NULL; | ||||
| float *bweight = (cd_vert_bweight_offset != -1) ? | float *bweight = (cd_vert_bweight_offset != -1) ? | ||||
| BM_ELEM_CD_GET_VOID_P(eve, cd_vert_bweight_offset) : | BM_ELEM_CD_GET_VOID_P(eve, cd_vert_bweight_offset) : | ||||
| NULL; | NULL; | ||||
| if (island_info) { | if (island_info) { | ||||
| const int connected_index = (dists_index && dists_index[a] != -1) ? dists_index[a] : a; | const int connected_index = (dists_index && dists_index[a] != -1) ? dists_index[a] : a; | ||||
| v_island = (island_vert_map[connected_index] != -1) ? | v_island = (island_vert_map[connected_index] != -1) ? | ||||
| &island_info[island_vert_map[connected_index]] : | &island_info[island_vert_map[connected_index]] : | ||||
| NULL; | NULL; | ||||
| } | } | ||||
| /* Do not use the island center in case we are using islands | /* Do not use the island center in case we are using islands | ||||
| * only to get axis for snap/rotate to normal... */ | * only to get axis for snap/rotate to normal... */ | ||||
| VertsToTransData(t, tob, tx, em, eve, bweight, v_island, is_snap_rotate); | VertsToTransData(t, tob, tx, em, eve, bweight, v_island, is_snap_rotate); | ||||
| if (tx) { | if (tx) { | ||||
| tx++; | tx++; | ||||
| } | } | ||||
| /* selected */ | /* selected */ | ||||
| if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { | if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { | ||||
| tob->flag |= TD_SELECTED; | tob->flag |= TD_SELECTED; | ||||
| } | } | ||||
| if (prop_mode) { | if (prop_mode) { | ||||
| if (prop_mode & T_PROP_CONNECTED) { | if (prop_mode & T_PROP_CONNECTED) { | ||||
| tob->dist = dists[a]; | tob->dist = dists[a]; | ||||
| } | } | ||||
| else { | else { | ||||
| tob->flag |= TD_NOTCONNECTED; | tob->flag |= TD_NOTCONNECTED; | ||||
| tob->dist = FLT_MAX; | tob->dist = FLT_MAX; | ||||
| } | } | ||||
| } | } | ||||
| /* CrazySpace */ | /* CrazySpace */ | ||||
| const bool use_quats = quats && BM_elem_flag_test(eve, BM_ELEM_TAG); | const bool use_quats = quats && BM_elem_flag_test(eve, BM_ELEM_TAG); | ||||
| if (use_quats || defmats) { | if (use_quats || defmats) { | ||||
| float mat[3][3], qmat[3][3], imat[3][3]; | float mat[3][3], qmat[3][3], imat[3][3]; | ||||
| /* Use both or either quat and defmat correction. */ | /* Use both or either quat and defmat correction. */ | ||||
| if (use_quats) { | if (use_quats) { | ||||
| quat_to_mat3(qmat, quats[BM_elem_index_get(eve)]); | quat_to_mat3(qmat, quats[BM_elem_index_get(eve)]); | ||||
| if (defmats) { | if (defmats) { | ||||
| mul_m3_series(mat, defmats[a], qmat, mtx); | mul_m3_series(mat, defmats[a], qmat, mtx); | ||||
| } | } | ||||
| else { | else { | ||||
| mul_m3_m3m3(mat, mtx, qmat); | mul_m3_m3m3(mat, mtx, qmat); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| mul_m3_m3m3(mat, mtx, defmats[a]); | mul_m3_m3m3(mat, mtx, defmats[a]); | ||||
| } | } | ||||
| invert_m3_m3(imat, mat); | invert_m3_m3(imat, mat); | ||||
| copy_m3_m3(tob->smtx, imat); | copy_m3_m3(tob->smtx, imat); | ||||
| copy_m3_m3(tob->mtx, mat); | copy_m3_m3(tob->mtx, mat); | ||||
| } | } | ||||
| else { | else { | ||||
| copy_m3_m3(tob->smtx, smtx); | copy_m3_m3(tob->smtx, smtx); | ||||
| copy_m3_m3(tob->mtx, mtx); | copy_m3_m3(tob->mtx, mtx); | ||||
| } | } | ||||
| /* Mirror? */ | if (tc->mirror.axis_flag) { | ||||
| if ((mirror > 0 && tob->iloc[0] > 0.0f) || (mirror < 0 && tob->iloc[0] < 0.0f)) { | if (tc->mirror.axis_x && fabsf(tob->loc[0]) < TRANSFORM_MAXDIST_MIRROR) { | ||||
| BMVert *vmir = EDBM_verts_mirror_get(em, eve); // t->obedit, em, eve, tob->iloc, a); | tob->flag |= TD_MIRROR_EDGE_X; | ||||
| if (vmir && vmir != eve) { | |||||
| tob->extra = vmir; | |||||
| } | } | ||||
| if (tc->mirror.axis_y && fabsf(tob->loc[1]) < TRANSFORM_MAXDIST_MIRROR) { | |||||
| tob->flag |= TD_MIRROR_EDGE_Y; | |||||
| } | |||||
| if (tc->mirror.axis_z && fabsf(tob->loc[2]) < TRANSFORM_MAXDIST_MIRROR) { | |||||
| tob->flag |= TD_MIRROR_EDGE_Z; | |||||
| } | } | ||||
| tob++; | |||||
| } | } | ||||
| tob++; | |||||
| } | } | ||||
| } | } | ||||
| if (island_info) { | if (island_info) { | ||||
| MEM_freeN(island_info); | MEM_freeN(island_info); | ||||
| MEM_freeN(island_vert_map); | MEM_freeN(island_vert_map); | ||||
| } | } | ||||
| if (mirror != 0) { | |||||
| tob = tc->data; | |||||
| for (a = 0; a < tc->data_len; a++, tob++) { | |||||
| if (ABS(tob->loc[0]) <= 0.00001f) { | |||||
| tob->flag |= TD_MIRROR_EDGE; | |||||
| } | |||||
| } | |||||
| } | |||||
| cleanup: | cleanup: | ||||
| /* crazy space free */ | /* crazy space free */ | ||||
| if (quats) { | if (quats) { | ||||
| MEM_freeN(quats); | MEM_freeN(quats); | ||||
| } | } | ||||
| if (defmats) { | if (defmats) { | ||||
| MEM_freeN(defmats); | MEM_freeN(defmats); | ||||
| } | } | ||||
| if (dists) { | if (dists) { | ||||
| MEM_freeN(dists); | MEM_freeN(dists); | ||||
| } | } | ||||
| if (dists_index) { | if (dists_index) { | ||||
| MEM_freeN(dists_index); | MEM_freeN(dists_index); | ||||
| } | } | ||||
| if (mirror_bitmap) { | |||||
| if (tc->mirror.axis_flag) { | MEM_freeN(mirror_bitmap); | ||||
campbellbarton: Use doxygen sections, as used at the start of the file. | |||||
| EDBM_verts_mirror_cache_end(em); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Edge (for crease) Transform Creation | /** \name Edge (for crease) Transform Creation | ||||
| ▲ Show 20 Lines • Show All 362 Lines • Show Last 20 Lines | |||||
Use doxygen sections, as used at the start of the file.