diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/transform/transform_convert_mesh_skin.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/source/blender/editors/transform/transform_convert_mesh_skin.c b/source/blender/editors/transform/transform_convert_mesh_skin.c index 4c42ed6ca1e..1807e9adcd1 100644 --- a/source/blender/editors/transform/transform_convert_mesh_skin.c +++ b/source/blender/editors/transform/transform_convert_mesh_skin.c @@ -48,7 +48,23 @@ * * \{ */ -static void mesh_skin_transdata_create(TransDataBasic *td, BMEditMesh *em, BMVert *eve) +static float *mesh_skin_transdata_center(const struct TransIslandData *island_data, + const int island_index, + BMVert *eve) +{ + if (island_data->center && island_index != -1) { + return island_data->center[island_index]; + } + else { + return eve->co; + } +} + +static void mesh_skin_transdata_create(TransDataBasic *td, + BMEditMesh *em, + BMVert *eve, + const struct TransIslandData *island_data, + const int island_index) { BLI_assert(BM_elem_flag_test(eve, BM_ELEM_HIDDEN) == 0); MVertSkin *vs = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MVERT_SKIN); @@ -65,6 +81,7 @@ static void mesh_skin_transdata_create(TransDataBasic *td, BMEditMesh *em, BMVer td->flag |= TD_SELECTED; } + copy_v3_v3(td->center, mesh_skin_transdata_center(island_data, island_index, eve)); td->extra = eve; } @@ -188,8 +205,15 @@ void createTransMeshSkin(TransInfo *t) continue; } + int island_index = -1; + if (island_data.island_vert_map) { + const int connected_index = (dists_index && dists_index[a] != -1) ? dists_index[a] : a; + island_index = island_data.island_vert_map[connected_index]; + } + if (mirror_data.vert_map && mirror_data.vert_map[a].index != -1) { - mesh_skin_transdata_create((TransDataBasic *)td_mirror, em, eve); + mesh_skin_transdata_create( + (TransDataBasic *)td_mirror, em, eve, &island_data, island_index); int elem_index = mirror_data.vert_map[a].index; BMVert *v_src = BM_vert_at_index(bm, elem_index); @@ -200,7 +224,7 @@ void createTransMeshSkin(TransInfo *t) td_mirror++; } else if (prop_mode || BM_elem_flag_test(eve, BM_ELEM_SELECT)) { - mesh_skin_transdata_create((TransDataBasic *)td, em, eve); + mesh_skin_transdata_create((TransDataBasic *)td, em, eve, &island_data, island_index); if (t->around == V3D_AROUND_LOCAL_ORIGINS) { createSpaceNormal(td->axismtx, eve->no); |