2.5: warning fixes
[blender.git] / source / blender / editors / mesh / editmesh_mods.c
index ca0f73ece68701fbae55648e723be308b399a6fb..44f63427e5f250f37f6a9eab02d9f0ad2ab91df2 100644 (file)
@@ -92,7 +92,7 @@ editmesh_mods.c, UI level access, no geometry changes
 #include "BLO_sys_types.h" // for intptr_t support
 
 /* XXX */
-static void waitcursor() {}
+static void waitcursor(int val) {}
 static int pupmenu() {return 0;}
 
 /* ****************************** MIRROR **************** */
@@ -1227,12 +1227,42 @@ static int select_similar_exec(bContext *C, wmOperator *op)
                return similar_face_select_exec(C, op);
 }
 
-static EnumPropertyItem *select_similar_type_itemf(PointerRNA *ptr)
+static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *ptr, int *free)
 {
-       /* XXX need context! */
-       return prop_simface_types;
-       return prop_simvertex_types;
-       return prop_simedge_types;
+       Object *obedit;
+       EnumPropertyItem *item= NULL;
+       int totitem= 0;
+       
+       if(C==NULL) {
+               /* needed for doc generation */
+               RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
+               RNA_enum_items_add(&item, &totitem, prop_simedge_types);
+               RNA_enum_items_add(&item, &totitem, prop_simface_types);
+               RNA_enum_item_end(&item, &totitem);
+               *free= 1;
+               
+               return item;
+       }
+       
+       obedit= CTX_data_edit_object(C);
+       
+       if(obedit && obedit->type == OB_MESH) {
+               EditMesh *em= BKE_mesh_get_editmesh(obedit->data); 
+
+               if(em->selectmode & SCE_SELECT_VERTEX)
+                       RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
+               else if(em->selectmode & SCE_SELECT_EDGE)
+                       RNA_enum_items_add(&item, &totitem, prop_simedge_types);
+               else if(em->selectmode & SCE_SELECT_FACE)
+                       RNA_enum_items_add(&item, &totitem, prop_simface_types);
+               RNA_enum_item_end(&item, &totitem);
+
+               *free= 1;
+
+               return item;
+       }
+       
+       return NULL;
 }
 
 void MESH_OT_select_similar(wmOperatorType *ot)
@@ -4269,6 +4299,20 @@ static int smooth_vertex(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
+static int smooth_vertex_exec(bContext *C, wmOperator *op)
+{
+       int repeat = RNA_int_get(op->ptr, "repeat");
+       int i;
+
+       if (!repeat) repeat = 1;
+
+       for (i=0; i<repeat; i++) {
+               smooth_vertex(C, op);
+       }
+
+       return OPERATOR_FINISHED;
+}
+
 void MESH_OT_vertices_smooth(wmOperatorType *ot)
 {
        /* identifiers */
@@ -4276,11 +4320,13 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
        ot->idname= "MESH_OT_vertices_smooth";
        
        /* api callbacks */
-       ot->exec= smooth_vertex;
+       ot->exec= smooth_vertex_exec;
        ot->poll= ED_operator_editmesh;
        
        /* flags */
-       ot->flag= OPTYPE_UNDO;
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+       RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Number of times to smooth the mesh", "", 1, INT_MAX);
 }
 
 void vertexnoise(Object *obedit, EditMesh *em)