diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-07 15:41:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-07 15:41:37 +0400 |
commit | b1ac23c5bd63cdf5bb6cf27fb62dc332d8d9cc39 (patch) | |
tree | 29e3348b47b7180c3295e843f7bd3c84c48aa2fc /source/blender/bmesh/intern/bmesh_interp.c | |
parent | eb495b2a8a331e74bdcedd9c0d5415b4c20a136d (diff) |
Mesh Tool,
inset interpolation now works for 'inset_region', enabled by default.
Example:
http://www.graphicall.org/ftp/ideasman42/inset_interpolation_new.png
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_interp.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_interp.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 120618a90e2..b6585811fd5 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -167,6 +167,29 @@ void BM_data_interp_face_vert_edge(BMesh *bm, BMVert *v1, BMVert *UNUSED(v2), BM * * \note Only handles loop customdata. multires is handled. */ +void BM_face_interp_from_face_ex(BMesh *bm, BMFace *target, BMFace *source, + void **blocks, float (*cos_2d)[2], float axis_mat[3][3]) +{ + BMLoop *l_iter; + BMLoop *l_first; + + float *w = BLI_array_alloca(w, source->len); + float co[2]; + int i; + + if (source != target) + BM_elem_attrs_copy(bm, bm, source, target); + + /* interpolate */ + i = 0; + l_iter = l_first = BM_FACE_FIRST_LOOP(target); + do { + mul_v2_m3v3(co, axis_mat, l_iter->v->co); + interp_weights_poly_v2(w, cos_2d, source->len, co); + CustomData_bmesh_interp(&bm->ldata, blocks, w, NULL, source->len, l_iter->head.data); + } while (i++, (l_iter = l_iter->next) != l_first); +} + void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source) { BMLoop *l_iter; @@ -176,14 +199,11 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source) float (*cos_2d)[2] = BLI_array_alloca(cos_2d, source->len); float *w = BLI_array_alloca(w, source->len); float axis_mat[3][3]; /* use normal to transform into 2d xy coords */ - float co[2]; int i; /* convert the 3d coords into 2d for projection */ axis_dominant_v3_to_m3(axis_mat, source->no); - BM_elem_attrs_copy(bm, bm, source, target); - i = 0; l_iter = l_first = BM_FACE_FIRST_LOOP(source); do { @@ -191,14 +211,8 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source) blocks[i] = l_iter->head.data; } while (i++, (l_iter = l_iter->next) != l_first); - /* interpolate */ - i = 0; - l_iter = l_first = BM_FACE_FIRST_LOOP(target); - do { - mul_v2_m3v3(co, axis_mat, l_iter->v->co); - interp_weights_poly_v2(w, cos_2d, source->len, co); - CustomData_bmesh_interp(&bm->ldata, blocks, w, NULL, source->len, l_iter->head.data); - } while (i++, (l_iter = l_iter->next) != l_first); + BM_face_interp_from_face_ex(bm, target, source, + blocks, cos_2d, axis_mat); } /** |