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/bmesh_class.h3
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c52
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.h10
-rw-r--r--source/blender/bmesh/operators/bmo_similar.c16
6 files changed, 69 insertions, 19 deletions
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
index 42a1a5e0f3e..d49686f204a 100644
--- a/source/blender/bmesh/CMakeLists.txt
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -134,4 +134,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 a8ca514297e..fa6bdbcf26f 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/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 4fa3a69356f..4461a7afdd7 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -246,6 +246,9 @@ enum {
/* spare tag, assumed dirty, use define in each function to name based on use */
// _BM_ELEM_TAG_ALT = (1 << 6), // UNUSED
+#ifdef WITH_FREESTYLE
+ BM_ELEM_FREESTYLE = (1 << 6), /* used for Freestyle faces and edges */
+#endif
BM_ELEM_INTERNAL_TAG = (1 << 7) /* for low level internal API tagging,
* since tools may want to tag verts and
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index fddb7b4bf2c..fa58ccd98bc 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -1002,18 +1002,28 @@ char BM_vert_flag_from_mflag(const char meflag)
}
char BM_edge_flag_from_mflag(const short meflag)
{
- return ( ((meflag & SELECT) ? BM_ELEM_SELECT : 0) |
- ((meflag & ME_SEAM) ? BM_ELEM_SEAM : 0) |
- ((meflag & ME_EDGEDRAW) ? BM_ELEM_DRAW : 0) |
- ((meflag & ME_SHARP) == 0 ? BM_ELEM_SMOOTH : 0) | /* invert */
- ((meflag & ME_HIDE) ? BM_ELEM_HIDDEN : 0)
+ return ( ((meflag & SELECT) ? BM_ELEM_SELECT : 0) |
+ ((meflag & ME_SEAM) ? BM_ELEM_SEAM : 0) |
+ ((meflag & ME_EDGEDRAW) ? BM_ELEM_DRAW : 0) |
+ ((meflag & ME_SHARP) == 0 ? BM_ELEM_SMOOTH : 0) | /* invert */
+ ((meflag & ME_HIDE) ? BM_ELEM_HIDDEN : 0) |
+#ifdef WITH_FREESTYLE
+ ((meflag & ME_FREESTYLE_EDGE) ? BM_ELEM_FREESTYLE : 0)
+#else
+ 0
+#endif
);
}
char BM_face_flag_from_mflag(const char meflag)
{
- return ( ((meflag & ME_FACE_SEL) ? BM_ELEM_SELECT : 0) |
- ((meflag & ME_SMOOTH) ? BM_ELEM_SMOOTH : 0) |
- ((meflag & ME_HIDE) ? BM_ELEM_HIDDEN : 0)
+ return ( ((meflag & ME_FACE_SEL) ? BM_ELEM_SELECT : 0) |
+ ((meflag & ME_SMOOTH) ? BM_ELEM_SMOOTH : 0) |
+ ((meflag & ME_HIDE) ? BM_ELEM_HIDDEN : 0) |
+#ifdef WITH_FREESTYLE
+ ((meflag & ME_FREESTYLE_FACE) ? BM_ELEM_FREESTYLE : 0)
+#else
+ 0
+#endif
);
}
@@ -1031,12 +1041,15 @@ short BM_edge_flag_to_mflag(BMEdge *eed)
{
const char hflag = eed->head.hflag;
- return ( ((hflag & BM_ELEM_SELECT) ? SELECT : 0) |
- ((hflag & BM_ELEM_SEAM) ? ME_SEAM : 0) |
- ((hflag & BM_ELEM_DRAW) ? ME_EDGEDRAW : 0) |
- ((hflag & BM_ELEM_SMOOTH) == 0 ? ME_SHARP : 0) |
- ((hflag & BM_ELEM_HIDDEN) ? ME_HIDE : 0) |
- ((BM_edge_is_wire(eed)) ? ME_LOOSEEDGE : 0) | /* not typical */
+ return ( ((hflag & BM_ELEM_SELECT) ? SELECT : 0) |
+ ((hflag & BM_ELEM_SEAM) ? ME_SEAM : 0) |
+ ((hflag & BM_ELEM_DRAW) ? ME_EDGEDRAW : 0) |
+ ((hflag & BM_ELEM_SMOOTH) == 0 ? ME_SHARP : 0) |
+ ((hflag & BM_ELEM_HIDDEN) ? ME_HIDE : 0) |
+#ifdef WITH_FREESTYLE
+ ((hflag & BM_ELEM_FREESTYLE) ? ME_FREESTYLE_EDGE : 0) |
+#endif
+ ((BM_edge_is_wire(eed)) ? ME_LOOSEEDGE : 0) | /* not typical */
ME_EDGERENDER
);
}
@@ -1044,8 +1057,13 @@ char BM_face_flag_to_mflag(BMFace *efa)
{
const char hflag = efa->head.hflag;
- return ( ((hflag & BM_ELEM_SELECT) ? ME_FACE_SEL : 0) |
- ((hflag & BM_ELEM_SMOOTH) ? ME_SMOOTH : 0) |
- ((hflag & BM_ELEM_HIDDEN) ? ME_HIDE : 0)
+ return ( ((hflag & BM_ELEM_SELECT) ? ME_FACE_SEL : 0) |
+ ((hflag & BM_ELEM_SMOOTH) ? ME_SMOOTH : 0) |
+ ((hflag & BM_ELEM_HIDDEN) ? ME_HIDE : 0) |
+#ifdef WITH_FREESTYLE
+ ((hflag & BM_ELEM_FREESTYLE) ? ME_FREESTYLE_FACE : 0)
+#else
+ 0
+#endif
);
}
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..454f9ab2ad3 100644
--- a/source/blender/bmesh/operators/bmo_similar.c
+++ b/source/blender/bmesh/operators/bmo_similar.c
@@ -245,6 +245,14 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
cont = false;
}
break;
+#ifdef WITH_FREESTYLE
+ case SIMFACE_FREESTYLE:
+ if (BM_elem_flag_test(fm, BM_ELEM_FREESTYLE) == BM_elem_flag_test(fs, BM_ELEM_FREESTYLE)) {
+ BMO_elem_flag_enable(bm, fm, FACE_MARK);
+ cont = FALSE;
+ }
+ break;
+#endif
default:
BLI_assert(0);
}
@@ -463,6 +471,14 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
cont = false;
}
break;
+#ifdef WITH_FREESTYLE
+ case SIMEDGE_FREESTYLE:
+ if (BM_elem_flag_test(e, BM_ELEM_FREESTYLE) == BM_elem_flag_test(es, BM_ELEM_FREESTYLE)) {
+ BMO_elem_flag_enable(bm, e, EDGE_MARK);
+ cont = FALSE;
+ }
+ break;
+#endif
default:
BLI_assert(0);
}