Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(140)

Unified Diff: source/blender/editors/mesh/editmesh_tools.c

Issue 7416049: Freestyle r54826 branch review Base URL: https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: source/blender/editors/mesh/editmesh_tools.c
===================================================================
--- source/blender/editors/mesh/editmesh_tools.c (revision 54826)
+++ source/blender/editors/mesh/editmesh_tools.c (working copy)
@@ -5598,3 +5598,109 @@
BMO_SYMMETRIZE_NEGATIVE_X,
"Direction", "Which sides to copy from and to");
}
+
+#ifdef WITH_FREESTYLE
+static int edbm_mark_freestyle_edge(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ Mesh *me = ((Mesh *)obedit->data);
+ BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh;
+ BMEdge *eed;
+ BMIter iter;
+ int clear = RNA_boolean_get(op->ptr, "clear");
+
+ if (em == NULL)
+ return OPERATOR_FINISHED;
+
+ /* auto-enable seams drawing */
+ if (clear == 0) {
+ me->drawflag |= ME_DRAW_FREESTYLE_EDGE;
+ }
+
+ if (clear) {
+ BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN))
+ BM_elem_flag_disable(eed, BM_ELEM_FREESTYLE);
+ }
+ }
+ else {
+ BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN))
+ BM_elem_flag_enable(eed, BM_ELEM_FREESTYLE);
+ }
+ }
+
+ DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_mark_freestyle_edge(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Mark Freestyle Edge";
+ ot->description = "(un)mark selected edges as Freestyle feature edges";
+ ot->idname = "MESH_OT_mark_freestyle_edge";
+
+ /* api callbacks */
+ ot->exec = edbm_mark_freestyle_edge;
+ ot->poll = ED_operator_editmesh;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
+}
+
+static int edbm_mark_freestyle_face_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ Mesh *me = ((Mesh *)obedit->data);
+ BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh;
+ BMFace *efa;
+ BMIter iter;
+ int clear = RNA_boolean_get(op->ptr, "clear");
+
+ if (em == NULL) return OPERATOR_FINISHED;
+
+ /* auto-enable Freestyle face mark drawing */
+ if(!clear) {
+ me->drawflag |= ME_DRAW_FREESTYLE_FACE;
+ }
+
+ if(clear) {
+ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
+ BM_elem_flag_disable(efa, BM_ELEM_FREESTYLE);
+ }
+ } else {
+ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
+ BM_elem_flag_enable(efa, BM_ELEM_FREESTYLE);
+ }
+ }
+
+ DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_mark_freestyle_face(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Mark Freestyle Face";
+ ot->description = "(un)mark selected faces for exclusion from Freestyle feature edge detection";
+ ot->idname = "MESH_OT_mark_freestyle_face";
+
+ /* api callbacks */
+ ot->exec = edbm_mark_freestyle_face_exec;
+ ot->poll = ED_operator_editmesh;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
+}
+#endif

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b