added boolean type for bmesh operators, will make python wrapping clearer and also...
[blender.git] / source / blender / editors / mesh / bmesh_select.c
index 6f4b4fff369416467d9d37fe97df176ddac1fbd4..1377970083c379e7a61dac78d62003bd2f36fbf5 100644 (file)
@@ -701,7 +701,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
        float thresh = CTX_data_tool_settings(C)->select_thresh;
 
        /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
-       EDBM_InitOpf(em, &bmop, op, "similarfaces faces=%hf type=%d thresh=%f", BM_ELEM_SELECT, type, thresh);
+       EDBM_InitOpf(em, &bmop, op, "similarfaces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
 
        /* execute the operator */
        BMO_op_exec(em->bm, &bmop);
@@ -742,7 +742,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
        float thresh = CTX_data_tool_settings(C)->select_thresh;
 
        /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
-       EDBM_InitOpf(em, &bmop, op, "similaredges edges=%he type=%d thresh=%f", BM_ELEM_SELECT, type, thresh);
+       EDBM_InitOpf(em, &bmop, op, "similaredges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
 
        /* execute the operator */
        BMO_op_exec(em->bm, &bmop);
@@ -787,7 +787,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
        float thresh = CTX_data_tool_settings(C)->select_thresh;
 
        /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
-       EDBM_InitOpf(em, &bmop, op, "similarverts verts=%hv type=%d thresh=%f", BM_ELEM_SELECT, type, thresh);
+       EDBM_InitOpf(em, &bmop, op, "similarverts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
 
        /* execute the operator */
        BMO_op_exec(em->bm, &bmop);
@@ -1196,7 +1196,7 @@ static int edgetag_context_check(Scene *scene, BMEditMesh *em, BMEdge *e)
        case EDGE_MODE_TAG_SEAM:
                return BM_elem_flag_test(e, BM_ELEM_SEAM);
        case EDGE_MODE_TAG_SHARP:
-               return BM_elem_flag_test(e, BM_ELEM_SHARP);
+               return !BM_elem_flag_test(e, BM_ELEM_SMOOTH);
        case EDGE_MODE_TAG_CREASE:      
                return BM_elem_float_data_get(&em->bm->edata, e, CD_CREASE) ? 1 : 0;
        case EDGE_MODE_TAG_BEVEL:
@@ -1694,6 +1694,38 @@ void EDBM_select_swap(BMEditMesh *em) /* exported for UV */
 //     if (EM_texFaceCheck())
 }
 
+int EDBM_select_interior_faces(struct BMEditMesh *em)
+{
+       BMesh *bm = em->bm;
+       BMIter iter;
+       BMIter eiter;
+       BMFace *efa;
+       BMEdge *eed;
+       int ok;
+       int change = FALSE;
+
+       BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
+               if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
+                       continue;
+
+
+               ok = TRUE;
+               BM_ITER(eed, &eiter, bm, BM_EDGES_OF_FACE, efa) {
+                       if (BM_edge_face_count(eed) < 3) {
+                               ok = FALSE;
+                               break;
+                       }
+               }
+
+               if (ok) {
+                       BM_elem_select_set(bm, efa, TRUE);
+                       change = TRUE;
+               }
+       }
+
+       return change;
+}
+
 static void linked_limit_default(bContext *C, wmOperator *op)
 {
        if (!RNA_struct_property_is_set(op->ptr, "limit")) {
@@ -2328,7 +2360,7 @@ static int select_non_manifold_exec(bContext *C, wmOperator *op)
        }
        
        BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-               if (!BM_elem_flag_test(em->bm, BM_ELEM_HIDDEN) && BM_vert_is_nonmanifold(em->bm, v)) {
+               if (!BM_elem_flag_test(em->bm, BM_ELEM_HIDDEN) && !BM_vert_is_manifold(em->bm, v)) {
                        BM_elem_select_set(em->bm, v, TRUE);
                }
        }