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:
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/CMakeLists.txt4
-rw-r--r--source/blender/bmesh/SConscript3
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c32
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.h10
-rw-r--r--source/blender/bmesh/operators/bmo_similar.c30
5 files changed, 77 insertions, 2 deletions
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
index ad2e4c407b4..c21da46d678 100644
--- a/source/blender/bmesh/CMakeLists.txt
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -136,4 +136,8 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+if(WITH_FREESTYLE)
+ add_definitions(-DWITH_FREESTYLE)
+endif()
+
blender_add_lib(bf_bmesh "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/bmesh/SConscript b/source/blender/bmesh/SConscript
index eb9e7f1d66f..de839f7f6a6 100644
--- a/source/blender/bmesh/SConscript
+++ b/source/blender/bmesh/SConscript
@@ -53,4 +53,7 @@ if env['WITH_BF_BULLET']:
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
+if env['WITH_BF_FREESTYLE']:
+ defs.append('WITH_FREESTYLE')
+
env.BlenderLib ( libname = 'bf_bmesh', sources = sources, includes = Split(incs), libtype = ['core','player'], defines=defs, priority=[100, 100], compileflags=cflags )
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index 093234457df..c68bb2cd20c 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -112,6 +112,7 @@ void BM_mesh_cd_flag_apply(BMesh *bm, const char cd_flag)
/* CustomData_bmesh_init_pool() must run first */
BLI_assert(bm->vdata.totlayer == 0 || bm->vdata.pool != NULL);
BLI_assert(bm->edata.totlayer == 0 || bm->edata.pool != NULL);
+ BLI_assert(bm->pdata.totlayer == 0 || bm->pdata.pool != NULL);
if (cd_flag & ME_CDFLAG_VERT_BWEIGHT) {
if (!CustomData_has_layer(&bm->vdata, CD_BWEIGHT)) {
@@ -145,6 +146,29 @@ void BM_mesh_cd_flag_apply(BMesh *bm, const char cd_flag)
BM_data_layer_free(bm, &bm->edata, CD_CREASE);
}
}
+#ifdef WITH_FREESTYLE
+ if (cd_flag & ME_CDFLAG_FREESTYLE_EDGE) {
+ if (!CustomData_has_layer(&bm->edata, CD_FREESTYLE_EDGE)) {
+ BM_data_layer_add(bm, &bm->edata, CD_FREESTYLE_EDGE);
+ }
+ }
+ else {
+ if (CustomData_has_layer(&bm->edata, CD_FREESTYLE_EDGE)) {
+ BM_data_layer_free(bm, &bm->edata, CD_FREESTYLE_EDGE);
+ }
+ }
+
+ if (cd_flag & ME_CDFLAG_FREESTYLE_FACE) {
+ if (!CustomData_has_layer(&bm->pdata, CD_FREESTYLE_FACE)) {
+ BM_data_layer_add(bm, &bm->pdata, CD_FREESTYLE_FACE);
+ }
+ }
+ else {
+ if (CustomData_has_layer(&bm->pdata, CD_FREESTYLE_FACE)) {
+ BM_data_layer_free(bm, &bm->pdata, CD_FREESTYLE_FACE);
+ }
+ }
+#endif
}
char BM_mesh_cd_flag_from_bmesh(BMesh *bm)
@@ -159,6 +183,14 @@ char BM_mesh_cd_flag_from_bmesh(BMesh *bm)
if (CustomData_has_layer(&bm->edata, CD_CREASE)) {
cd_flag |= ME_CDFLAG_EDGE_CREASE;
}
+#ifdef WITH_FREESTYLE
+ if (CustomData_has_layer(&bm->edata, CD_FREESTYLE_EDGE)) {
+ cd_flag |= ME_CDFLAG_FREESTYLE_EDGE;
+ }
+ if (CustomData_has_layer(&bm->pdata, CD_FREESTYLE_FACE)) {
+ cd_flag |= ME_CDFLAG_FREESTYLE_FACE;
+ }
+#endif
return cd_flag;
}
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index d02b0dce728..16b38c340ff 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -60,7 +60,10 @@ enum {
SIMFACE_SIDES,
SIMFACE_PERIMETER,
SIMFACE_NORMAL,
- SIMFACE_COPLANAR
+ SIMFACE_COPLANAR,
+#ifdef WITH_FREESTYLE
+ SIMFACE_FREESTYLE
+#endif
};
/* similar edge selection slot values */
@@ -72,7 +75,10 @@ enum {
SIMEDGE_CREASE,
SIMEDGE_BEVEL,
SIMEDGE_SEAM,
- SIMEDGE_SHARP
+ SIMEDGE_SHARP,
+#ifdef WITH_FREESTYLE
+ SIMEDGE_FREESTYLE
+#endif
};
/* similar vertex selection slot values */
diff --git a/source/blender/bmesh/operators/bmo_similar.c b/source/blender/bmesh/operators/bmo_similar.c
index baabcffd162..5bea47969da 100644
--- a/source/blender/bmesh/operators/bmo_similar.c
+++ b/source/blender/bmesh/operators/bmo_similar.c
@@ -245,6 +245,21 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
cont = false;
}
break;
+#ifdef WITH_FREESTYLE
+ case SIMFACE_FREESTYLE:
+ if (CustomData_has_layer(&bm->pdata, CD_FREESTYLE_FACE)) {
+ FreestyleEdge *ffa1, *ffa2;
+
+ ffa1 = CustomData_bmesh_get(&bm->pdata, fs->head.data, CD_FREESTYLE_FACE);
+ ffa2 = CustomData_bmesh_get(&bm->pdata, fm->head.data, CD_FREESTYLE_FACE);
+
+ if (ffa1 && ffa2 && (ffa1->flag & FREESTYLE_FACE_MARK) == (ffa2->flag & FREESTYLE_FACE_MARK)) {
+ BMO_elem_flag_enable(bm, fm, FACE_MARK);
+ cont = false;
+ }
+ }
+ break;
+#endif
default:
BLI_assert(0);
}
@@ -463,6 +478,21 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
cont = false;
}
break;
+#ifdef WITH_FREESTYLE
+ case SIMEDGE_FREESTYLE:
+ if (CustomData_has_layer(&bm->edata, CD_FREESTYLE_EDGE)) {
+ FreestyleEdge *fed1, *fed2;
+
+ fed1 = CustomData_bmesh_get(&bm->edata, e->head.data, CD_FREESTYLE_EDGE);
+ fed2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_FREESTYLE_EDGE);
+
+ if (fed1 && fed2 && (fed1->flag & FREESTYLE_EDGE_MARK) == (fed2->flag & FREESTYLE_EDGE_MARK)) {
+ BMO_elem_flag_enable(bm, e, EDGE_MARK);
+ cont = false;
+ }
+ }
+ break;
+#endif
default:
BLI_assert(0);
}