Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-11-05 09:40:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-11-05 09:40:33 +0300
commit23344bca6c5d1de330169a04ed8d21145fc60053 (patch)
tree8ea59d02f0e24f3cf74efc1fdb3463f725488c33 /source/blender/bmesh/intern/bmesh_polygon.c
parentce49c70956e4e93071d73311a50cce0c404c3ed2 (diff)
BMesh: triangulate & poke - multires data support
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_polygon.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 06ef84bc589..5bbade2f716 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -42,6 +42,8 @@
#include "bmesh.h"
#include "bmesh_tools.h"
+#include "BKE_customdata.h"
+
#include "intern/bmesh_private.h"
/**
@@ -785,11 +787,13 @@ void BM_face_triangulate(
/* use for MOD_TRIANGULATE_NGON_BEAUTY only! */
struct Heap *pf_heap, struct EdgeHash *pf_ehash)
{
+ const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS);
+ const bool use_beauty = (ngon_method == MOD_TRIANGULATE_NGON_BEAUTY);
BMLoop *l_iter, *l_first, *l_new;
BMFace *f_new;
int nf_i = 0;
int ne_i = 0;
- bool use_beauty = (ngon_method == MOD_TRIANGULATE_NGON_BEAUTY);
+
BLI_assert(BM_face_is_normal_valid(f));
@@ -804,6 +808,8 @@ void BM_face_triangulate(
const int totfilltri = f->len - 2;
const int last_tri = f->len - 3;
int i;
+ /* for mdisps */
+ float f_center[3];
if (f->len == 4) {
/* even though we're not using BLI_polyfill, fill in 'tris' and 'loops'
@@ -901,6 +907,10 @@ void BM_face_triangulate(
BLI_memarena_clear(pf_arena);
}
+ if (cd_loop_mdisp_offset != -1) {
+ BM_face_calc_center_mean(f, f_center);
+ }
+
/* loop over calculated triangles and create new geometry */
for (i = 0; i < totfilltri; i++) {
/* the order is reverse, otherwise the normal is flipped */
@@ -954,6 +964,12 @@ void BM_face_triangulate(
/* note, never disable tag's */
} while ((l_iter = l_iter->next) != l_first);
}
+
+ if (cd_loop_mdisp_offset != -1) {
+ float f_new_center[3];
+ BM_face_calc_center_mean(f_new, f_new_center);
+ BM_face_interp_multires_ex(bm, f_new, f, f_new_center, f_center, cd_loop_mdisp_offset);
+ }
}
{