diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-20 05:52:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-20 05:52:35 +0400 |
commit | 1953f042e6f51ce9a795f1bce3cca7e8560cef86 (patch) | |
tree | 2ede8daf2f69626c3bd9e4e44a304a9ef2a6c630 /source | |
parent | 818e19713a089ffb500201bf3e1c3d8327c75fb9 (diff) |
added boolean type for bmesh operators, will make python wrapping clearer and also makes existing calls more obvious.
also corrected some error reports.
Diffstat (limited to 'source')
23 files changed, 221 insertions, 178 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 87172226ffa..6ebfa9a1172 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -528,7 +528,7 @@ BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob) bm = BM_mesh_create(ob, bm_mesh_allocsize_default); - BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%i", me, ob, 1); + BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", me, ob, TRUE); return bm; } diff --git a/source/blender/bmesh/bmesh_operator_api.h b/source/blender/bmesh/bmesh_operator_api.h index 7bbb579685d..ac07df362ab 100644 --- a/source/blender/bmesh/bmesh_operator_api.h +++ b/source/blender/bmesh/bmesh_operator_api.h @@ -78,11 +78,12 @@ struct GHashIterator; /* slot type arrays are terminated by the last member * having a slot type of 0.*/ #define BMO_OP_SLOT_SENTINEL 0 -#define BMO_OP_SLOT_INT 1 -#define BMO_OP_SLOT_FLT 2 -#define BMO_OP_SLOT_PNT 3 -#define BMO_OP_SLOT_MAT 4 -#define BMO_OP_SLOT_VEC 7 +#define BMO_OP_SLOT_BOOL 1 +#define BMO_OP_SLOT_INT 2 +#define BMO_OP_SLOT_FLT 3 +#define BMO_OP_SLOT_PNT 4 +#define BMO_OP_SLOT_MAT 5 +#define BMO_OP_SLOT_VEC 8 /* after BMO_OP_SLOT_VEC, everything is @@ -91,9 +92,9 @@ struct GHashIterator; * for future growth. */ //it's very important this remain a power of two -#define BMO_OP_SLOT_ELEMENT_BUF 8 -#define BMO_OP_SLOT_MAPPING 9 -/* #define BMO_OP_SLOT_TOTAL_TYPES 10 */ /* not used yet */ +#define BMO_OP_SLOT_ELEMENT_BUF 9 +#define BMO_OP_SLOT_MAPPING 10 +#define BMO_OP_SLOT_TOTAL_TYPES 11 /* please ignore all these structures, don't touch them in tool code, except * for when your defining an operator with BMOpDefine.*/ @@ -199,7 +200,7 @@ int BMO_mesh_flag_count(struct BMesh *bm, const short oflag, const char htype); * this system is used to execute or initialize an operator, * using a formatted-string system. * - * for example, BMO_op_callf(bm, "del geom=%hf context=%d", BM_ELEM_SELECT, DEL_FACES); + * for example, BMO_op_callf(bm, "del geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES); * . . .will execute the delete operator, feeding in selected faces, deleting them. * * the basic format for the format string is: @@ -282,6 +283,8 @@ void BMO_slot_float_set(struct BMOperator *op, const char *slotname, const floa float BMO_slot_float_get(BMOperator *op, const char *slotname); void BMO_slot_int_set(struct BMOperator *op, const char *slotname, const int i); int BMO_slot_int_get(BMOperator *op, const char *slotname); +void BMO_slot_bool_set(struct BMOperator *op, const char *slotname, const int i); +int BMO_slot_bool_get(BMOperator *op, const char *slotname); /* don't pass in arrays that are supposed to map to elements this way. * @@ -448,7 +451,7 @@ typedef struct BMOElemMapping { int len; } BMOElemMapping; -extern const int BMO_OPSLOT_TYPEINFO[]; +extern const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES]; BM_INLINE void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, void *element, void *data, int len) diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index a432049e238..a378ddaeabb 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -349,7 +349,7 @@ static void bmesh_rationalize_normals(BMesh *bm, int undo) return; } - BMO_op_initf(bm, &bmop, "righthandfaces faces=%af doflip=%d", FALSE); + BMO_op_initf(bm, &bmop, "righthandfaces faces=%af do_flip=%b", FALSE); BMO_push(bm, &bmop); bmesh_righthandfaces_exec(bm, &bmop); diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 19e9971619a..61f698fe7d9 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -98,9 +98,9 @@ static BMOpDefine def_vertexsmooth = { "vertexsmooth", {{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input vertices - {BMO_OP_SLOT_INT, "mirror_clip_x"}, //set vertices close to the x axis before the operation to 0 - {BMO_OP_SLOT_INT, "mirror_clip_y"}, //set vertices close to the y axis before the operation to 0 - {BMO_OP_SLOT_INT, "mirror_clip_z"}, //set vertices close to the z axis before the operation to 0 + {BMO_OP_SLOT_BOOL, "mirror_clip_x"}, //set vertices close to the x axis before the operation to 0 + {BMO_OP_SLOT_BOOL, "mirror_clip_y"}, //set vertices close to the y axis before the operation to 0 + {BMO_OP_SLOT_BOOL, "mirror_clip_z"}, //set vertices close to the z axis before the operation to 0 {BMO_OP_SLOT_FLT, "clipdist"}, //clipping threshod for the above three slots {0} /* null-terminating sentine */, }, @@ -117,7 +117,7 @@ static BMOpDefine def_vertexsmooth = { static BMOpDefine def_righthandfaces = { "righthandfaces", {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, - {BMO_OP_SLOT_INT, "doflip"}, //internal flag, used by bmesh_rationalize_normals + {BMO_OP_SLOT_BOOL, "do_flip"}, //internal flag, used by bmesh_rationalize_normals {0} /* null-terminating sentine */, }, bmesh_righthandfaces_exec, @@ -138,8 +138,8 @@ static BMOpDefine def_regionextend = { "regionextend", {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, //input geometry {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, //output slot, computed boundary geometry. - {BMO_OP_SLOT_INT, "constrict"}, //find boundary inside the regions, not outside. - {BMO_OP_SLOT_INT, "usefaces"}, //extend from faces instead of edges + {BMO_OP_SLOT_BOOL, "constrict"}, //find boundary inside the regions, not outside. + {BMO_OP_SLOT_BOOL, "use_faces"}, //extend from faces instead of edges {0} /* null-terminating sentine */, }, bmesh_regionextend_exec, @@ -156,7 +156,7 @@ static BMOpDefine def_edgerotate = { "edgerotate", {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, //input edges {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, //newly spun edges - {BMO_OP_SLOT_INT, "ccw"}, //rotate edge counter-clockwise if true, othewise clockwise + {BMO_OP_SLOT_BOOL, "ccw"}, //rotate edge counter-clockwise if true, othewise clockwise {0} /* null-terminating sentine */, }, bmesh_edgerotate_exec, @@ -210,8 +210,8 @@ static BMOpDefine def_mirror = { {BMO_OP_SLOT_FLT, "mergedist"}, //maximum distance for merging. does no merging if 0. {BMO_OP_SLOT_ELEMENT_BUF, "newout"}, //output geometry, mirrored {BMO_OP_SLOT_INT, "axis"}, //the axis to use, 0, 1, or 2 for x, y, z - {BMO_OP_SLOT_INT, "mirror_u"}, //mirror UVs across the u axis - {BMO_OP_SLOT_INT, "mirror_v"}, //mirror UVs across the v axis + {BMO_OP_SLOT_BOOL, "mirror_u"}, //mirror UVs across the u axis + {BMO_OP_SLOT_BOOL, "mirror_v"}, //mirror UVs across the v axis {0, /* null-terminating sentine */}}, bmesh_mirror_exec, 0, @@ -375,10 +375,10 @@ static BMOpDefine def_join_triangles = { "join_triangles", {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, //input geometry. {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, //joined faces - {BMO_OP_SLOT_INT, "compare_sharp"}, - {BMO_OP_SLOT_INT, "compare_uvs"}, - {BMO_OP_SLOT_INT, "compare_vcols"}, - {BMO_OP_SLOT_INT, "compare_materials"}, + {BMO_OP_SLOT_BOOL, "cmp_sharp"}, + {BMO_OP_SLOT_BOOL, "cmp_uvs"}, + {BMO_OP_SLOT_BOOL, "cmp_vcols"}, + {BMO_OP_SLOT_BOOL, "cmp_materials"}, {BMO_OP_SLOT_FLT, "limit"}, {0, /* null-terminating sentine */}}, bmesh_jointriangles_exec, @@ -421,7 +421,7 @@ static BMOpDefine def_edgenet_fill = { "edgenet_fill", {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */ {BMO_OP_SLOT_MAPPING, "restrict"}, /* restricts edges to groups. maps edges to integer */ - {BMO_OP_SLOT_INT, "use_restrict"}, + {BMO_OP_SLOT_BOOL, "use_restrict"}, {BMO_OP_SLOT_ELEMENT_BUF, "excludefaces"}, /* list of faces to ignore for manifold check */ {BMO_OP_SLOT_MAPPING, "faceout_groupmap"}, /* maps new faces to the group numbers they came fro */ {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */ @@ -535,7 +535,7 @@ static BMOpDefine def_bmesh_to_mesh = { "bmesh_to_mesh", {{BMO_OP_SLOT_PNT, "mesh"}, //pointer to a mesh structure to fill in {BMO_OP_SLOT_PNT, "object"}, //pointer to an object structure - {BMO_OP_SLOT_INT, "notesselation"}, //don't calculate mfaces + {BMO_OP_SLOT_BOOL, "notesselation"}, //don't calculate mfaces {0, /* null-terminating sentine */}}, bmesh_to_mesh_exec, 0, @@ -551,7 +551,7 @@ static BMOpDefine def_mesh_to_bmesh = { "mesh_to_bmesh", {{BMO_OP_SLOT_PNT, "mesh"}, //pointer to a Mesh structure {BMO_OP_SLOT_PNT, "object"}, //pointer to an Object structure - {BMO_OP_SLOT_INT, "set_shapekey"}, //load active shapekey coordinates into verts + {BMO_OP_SLOT_BOOL, "set_shapekey"}, //load active shapekey coordinates into verts {0, /* null-terminating sentine */}}, mesh_to_bmesh_exec, 0 @@ -615,7 +615,7 @@ static BMOpDefine def_extrudefaceregion = { "extrudefaceregion", {{BMO_OP_SLOT_ELEMENT_BUF, "edgefacein"}, {BMO_OP_SLOT_MAPPING, "exclude"}, - {BMO_OP_SLOT_INT, "alwayskeeporig"}, + {BMO_OP_SLOT_BOOL, "alwayskeeporig"}, {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, {0} /* null-terminating sentine */}, extrude_edge_context_exec, @@ -634,7 +634,7 @@ static BMOpDefine def_dissolveedgessop = { "dissolveedges", {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, {BMO_OP_SLOT_ELEMENT_BUF, "regionout"}, - {BMO_OP_SLOT_INT, "use_verts"}, // dissolve verts left between only 2 edges. + {BMO_OP_SLOT_BOOL, "use_verts"}, // dissolve verts left between only 2 edges. {0} /* null-terminating sentine */}, dissolveedges_exec, BMO_OP_FLAG_UNTAN_MULTIRES @@ -653,7 +653,7 @@ static BMOpDefine def_dissolvefacesop = { "dissolvefaces", {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, {BMO_OP_SLOT_ELEMENT_BUF, "regionout"}, - {BMO_OP_SLOT_INT, "use_verts"}, // dissolve verts left between only 2 edges. + {BMO_OP_SLOT_BOOL, "use_verts"}, // dissolve verts left between only 2 edges. {0} /* null-terminating sentine */}, dissolvefaces_exec, BMO_OP_FLAG_UNTAN_MULTIRES @@ -696,9 +696,9 @@ static BMOpDefine def_subdop = { {BMO_OP_SLOT_ELEMENT_BUF, "outsplit"}, {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* contains all output geometr */ - {BMO_OP_SLOT_INT, "quadcornertype"}, //quad corner type, see bmesh_operators.h - {BMO_OP_SLOT_INT, "gridfill"}, //fill in fully-selected faces with a grid - {BMO_OP_SLOT_INT, "singleedge"}, //tesselate the case of one edge selected in a quad or triangle + {BMO_OP_SLOT_INT, "quadcornertype"}, //quad corner type, see bmesh_operators.h + {BMO_OP_SLOT_BOOL, "gridfill"}, //fill in fully-selected faces with a grid + {BMO_OP_SLOT_BOOL, "singleedge"}, //tesselate the case of one edge selected in a quad or triangle {0} /* null-terminating sentine */, }, @@ -708,7 +708,8 @@ static BMOpDefine def_subdop = { static BMOpDefine def_delop = { "del", - {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, {BMO_OP_SLOT_INT, "context"}, + {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, + {BMO_OP_SLOT_INT, "context"}, {0} /* null-terminating sentine */}, delop_exec, 0 @@ -757,7 +758,7 @@ static BMOpDefine def_spinop = { {BMO_OP_SLOT_VEC, "dvec"}, /* translation delta per step */ {BMO_OP_SLOT_FLT, "ang"}, /* total rotation angle (degrees) */ {BMO_OP_SLOT_INT, "steps"}, /* number of steps */ - {BMO_OP_SLOT_INT, "dupli"}, /* duplicate or extrude? */ + {BMO_OP_SLOT_BOOL, "do_dupli"}, /* duplicate or extrude? */ {0} /* null-terminating sentine */}, spinop_exec, 0 @@ -965,8 +966,8 @@ static BMOpDefine def_create_monkey = { static BMOpDefine def_create_cone = { "create_cone", {{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output verts - {BMO_OP_SLOT_INT, "cap_ends"}, //wheter or not to fill in the ends with faces - {BMO_OP_SLOT_INT, "cap_tris"}, //fill ends with triangles instead of ngons + {BMO_OP_SLOT_BOOL, "cap_ends"}, //wheter or not to fill in the ends with faces + {BMO_OP_SLOT_BOOL, "cap_tris"}, //fill ends with triangles instead of ngons {BMO_OP_SLOT_INT, "segments"}, {BMO_OP_SLOT_FLT, "diameter1"}, //diameter of one end {BMO_OP_SLOT_FLT, "diameter2"}, //diameter of the opposite @@ -983,8 +984,8 @@ static BMOpDefine def_create_cone = { static BMOpDefine def_create_circle = { "create_circle", {{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output verts - {BMO_OP_SLOT_INT, "cap_ends"}, //wheter or not to fill in the ends with faces - {BMO_OP_SLOT_INT, "cap_tris"}, //fill ends with triangles instead of ngons + {BMO_OP_SLOT_BOOL, "cap_ends"}, //wheter or not to fill in the ends with faces + {BMO_OP_SLOT_BOOL, "cap_tris"}, //fill ends with triangles instead of ngons {BMO_OP_SLOT_INT, "segments"}, {BMO_OP_SLOT_FLT, "diameter"}, //diameter of one end {BMO_OP_SLOT_MAT, "mat"}, //matrix to multiply the new geometry with-- @@ -1018,9 +1019,9 @@ static BMOpDefine def_bevel = { {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input edges and vertices */ {BMO_OP_SLOT_ELEMENT_BUF, "face_spans"}, /* new geometry */ {BMO_OP_SLOT_ELEMENT_BUF, "face_holes"}, /* new geometry */ - {BMO_OP_SLOT_INT, "use_lengths"}, /* grab edge lengths from a PROP_FLT customdata laye */ - {BMO_OP_SLOT_INT, "use_even"}, /* corner vert placement: use shell/angle calculations */ - {BMO_OP_SLOT_INT, "use_dist"}, /* corner vert placement: evaluate percent as a distance, + {BMO_OP_SLOT_BOOL, "use_lengths"}, /* grab edge lengths from a PROP_FLT customdata laye */ + {BMO_OP_SLOT_BOOL, "use_even"}, /* corner vert placement: use shell/angle calculations */ + {BMO_OP_SLOT_BOOL, "use_dist"}, /* corner vert placement: evaluate percent as a distance, * modifier uses this. We could do this as another float setting */ {BMO_OP_SLOT_INT, "lengthlayer"}, /* which PROP_FLT layer to us */ {BMO_OP_SLOT_FLT, "percent"}, /* percentage to expand bevelled edge */ diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 66222c39c68..d9a5b27ad4a 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -63,8 +63,9 @@ static const char *bmo_error_messages[] = { /* operator slot type information - size of one element of the type given. */ -const int BMO_OPSLOT_TYPEINFO[] = { +const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = { 0, + sizeof(int), sizeof(int), sizeof(float), sizeof(void *), @@ -324,6 +325,15 @@ void BMO_slot_int_set(BMOperator *op, const char *slotname, const int i) slot->data.i = i; } +void BMO_slot_bool_set(BMOperator *op, const char *slotname, const int i) +{ + BMOpSlot *slot = BMO_slot_get(op, slotname); + if (!(slot->slottype == BMO_OP_SLOT_BOOL)) + return; + + slot->data.i = i; +} + /* only supports square mats */ void BMO_slot_mat_set(struct BMOperator *op, const char *slotname, const float *mat, int size) { @@ -402,6 +412,15 @@ int BMO_slot_int_get(BMOperator *op, const char *slotname) return slot->data.i; } +int BMO_slot_bool_get(BMOperator *op, const char *slotname) +{ + BMOpSlot *slot = BMO_slot_get(op, slotname); + if (!(slot->slottype == BMO_OP_SLOT_BOOL)) + return 0; + + return slot->data.i; +} + void *BMO_slot_ptr_get(BMOperator *op, const char *slotname) { @@ -1102,19 +1121,6 @@ int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op) return errorcode; } -/* example: - * BMO_CallOp(bm, "del %d %hv", DEL_ONLYFACES, BM_ELEM_SELECT); - * - * d - int - * i - int - * f - float - * hv - header flagged verts - * he - header flagged edges - * hf - header flagged faces - * fv - flagged verts - * fe - flagged edges - * ff - flagged faces - */ #define NEXT_CHAR(fmt) ((fmt)[0] != 0 ? (fmt)[1] : 0) @@ -1155,6 +1161,20 @@ static int bmesh_opname_to_opcode(const char *opname) return -1; } +/* Example: + * BMO_op_callf(bm, "del %i %hv", DEL_ONLYFACES, BM_ELEM_SELECT); + * + * i - int + * b - boolean (same as int but 1/0 only) + * f - float + * hv - header flagged verts (hflag) + * he - header flagged edges (hflag) + * hf - header flagged faces (hflag) + * fv - flagged verts (oflag) + * fe - flagged edges (oflag) + * ff - flagged faces (oflag) + */ + int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist) { BMOpDefine *def; @@ -1265,10 +1285,13 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist) break; } case 'i': - case 'd': BMO_slot_int_set(op, slotname, va_arg(vlist, int)); state = 1; break; + case 'b': + BMO_slot_bool_set(op, slotname, va_arg(vlist, int)); + state = 1; + break; case 'p': BMO_slot_ptr_set(op, slotname, va_arg(vlist, void *)); state = 1; diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c index 98e9a510126..aab8d7d40dd 100644 --- a/source/blender/bmesh/operators/bmo_bevel.c +++ b/source/blender/bmesh/operators/bmo_bevel.c @@ -190,11 +190,11 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op) BLI_array_declare(edges); SmallHash hash; float fac = BMO_slot_float_get(op, "percent"); - const short do_even = BMO_slot_int_get(op, "use_even"); - const short do_dist = BMO_slot_int_get(op, "use_dist"); + const short do_even = BMO_slot_bool_get(op, "use_even"); + const short do_dist = BMO_slot_bool_get(op, "use_dist"); int i, li, has_elens, HasMDisps = CustomData_has_layer(&bm->ldata, CD_MDISPS); - has_elens = CustomData_has_layer(&bm->edata, CD_PROP_FLT) && BMO_slot_int_get(op, "use_lengths"); + has_elens = CustomData_has_layer(&bm->edata, CD_PROP_FLT) && BMO_slot_bool_get(op, "use_lengths"); if (has_elens) { li = BMO_slot_int_get(op, "lengthlayer"); } diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index d90e5c36c80..39f1ff10a9a 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -872,7 +872,7 @@ void bmesh_edgenet_fill_exec(BMesh *bm, BMOperator *op) BMEdge **edges = NULL; PathBase *pathbase = edge_pathbase_new(); BLI_array_declare(edges); - int use_restrict = BMO_slot_int_get(op, "use_restrict"); + int use_restrict = BMO_slot_bool_get(op, "use_restrict"); int i, j, group = 0; unsigned int winding[2]; /* accumulte winding directions for each edge which has a face */ diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 05aead466d1..46124590d5e 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -79,7 +79,7 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op) BMWalker regwalker; int i; - int use_verts = BMO_slot_int_get(op, "use_verts"); + int use_verts = BMO_slot_bool_get(op, "use_verts"); if (use_verts) { /* tag verts that start out with only 2 edges, @@ -160,7 +160,7 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op) } - BMO_op_callf(bm, "del geom=%ff context=%d", FACE_ORIG, DEL_FACES); + BMO_op_callf(bm, "del geom=%ff context=%i", FACE_ORIG, DEL_FACES); if (use_verts) { @@ -247,7 +247,7 @@ void dissolveedges_exec(BMesh *bm, BMOperator *op) BMIter viter; BMVert *v; - int use_verts = BMO_slot_int_get(op, "use_verts"); + int use_verts = BMO_slot_bool_get(op, "use_verts"); if (use_verts) { BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) { diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 2e1c91d920c..676e2eeb5f6 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -468,7 +468,7 @@ void spinop_exec(BMesh *bm, BMOperator *op) float q[4]; float rmat[3][3]; float phi, si; - int steps, dupli, a, usedvec; + int steps, do_dupli, a, usedvec; BMO_slot_vec_get(op, "cent", cent); BMO_slot_vec_get(op, "axis", axis); @@ -477,7 +477,7 @@ void spinop_exec(BMesh *bm, BMOperator *op) usedvec = !is_zero_v3(dvec); steps = BMO_slot_int_get(op, "steps"); phi = BMO_slot_float_get(op, "ang") * (float)M_PI / (360.0f * steps); - dupli = BMO_slot_int_get(op, "dupli"); + do_dupli = BMO_slot_bool_get(op, "do_dupli"); si = (float)sin(phi); q[0] = (float)cos(phi); @@ -488,7 +488,7 @@ void spinop_exec(BMesh *bm, BMOperator *op) BMO_slot_copy(op, op, "geom", "lastout"); for (a = 0; a < steps; a++) { - if (dupli) { + if (do_dupli) { BMO_op_initf(bm, &dupop, "dupe geom=%s", op, "lastout"); BMO_op_exec(bm, &dupop); BMO_op_callf(bm, "rotate cent=%v mat=%m3 verts=%s", diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index b6a87e604ec..2c6a0e0de6a 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -107,7 +107,7 @@ void bmesh_extrude_face_indiv_exec(BMesh *bm, BMOperator *op) BLI_array_free(edges); - BMO_op_callf(bm, "del geom=%ff context=%d", EXT_DEL, DEL_ONLYFACES); + BMO_op_callf(bm, "del geom=%ff context=%i", EXT_DEL, DEL_ONLYFACES); BMO_slot_from_flag(bm, op, "faceout", EXT_KEEP, BM_FACE); } @@ -201,7 +201,7 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op) /* if one flagged face is bordered by an unflagged face, then we delete * original geometry unless caller explicitly asked to keep it. */ - if (!BMO_slot_int_get(op, "alwayskeeporig")) { + if (!BMO_slot_bool_get(op, "alwayskeeporig")) { BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (!BMO_elem_flag_test(bm, e, EXT_INPUT)) continue; @@ -248,7 +248,7 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op) } if (delorig) { - BMO_op_initf(bm, &delop, "del geom=%fvef context=%d", + BMO_op_initf(bm, &delop, "del geom=%fvef context=%i", EXT_DEL, DEL_ONLYTAGGED); } @@ -576,7 +576,7 @@ void bmesh_solidify_face_region_exec(BMesh *bm, BMOperator *op) BMO_op_finish(bm, &reverseop); /* Extrude the region */ - BMO_op_initf(bm, &extrudeop, "extrudefaceregion alwayskeeporig=%i", TRUE); + BMO_op_initf(bm, &extrudeop, "extrudefaceregion alwayskeeporig=%b", TRUE); BMO_slot_copy(op, &extrudeop, "geom", "edgefacein"); BMO_op_exec(bm, &extrudeop); diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 921c579447b..3f102661d30 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -231,8 +231,10 @@ void bmesh_jointriangles_exec(BMesh *bm, BMOperator *op) BMEdge *e; BLI_array_declare(jedges); JoinEdge *jedges = NULL; - int dosharp = BMO_slot_int_get(op, "compare_sharp"), douvs = BMO_slot_int_get(op, "compare_uvs"); - int dovcols = BMO_slot_int_get(op, "compare_vcols"), domat = BMO_slot_int_get(op, "compare_materials"); + int dosharp = BMO_slot_bool_get(op, "cmp_sharp"); + int douvs = BMO_slot_bool_get(op, "cmp_uvs"); + int dovcols = BMO_slot_bool_get(op, "cmp_vcols"); + int domat = BMO_slot_bool_get(op, "cmp_materials"); float limit = BMO_slot_float_get(op, "limit"); int i, totedge; diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c index 4f6db9056e5..7b929042ea9 100644 --- a/source/blender/bmesh/operators/bmo_mesh_conv.c +++ b/source/blender/bmesh/operators/bmo_mesh_conv.c @@ -69,7 +69,7 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) BLI_array_declare(fedges); float (*keyco)[3] = NULL; int *keyi; - int set_key = BMO_slot_int_get(op, "set_shapekey"); + int set_key = BMO_slot_bool_get(op, "set_shapekey"); int totuv, i, j; if (!me || !me->totvert) { @@ -370,7 +370,7 @@ void object_load_bmesh_exec(BMesh *bm, BMOperator *op) /* Scene *scene = BMO_slot_ptr_get(op, "scene"); */ Mesh *me = ob->data; - BMO_op_callf(bm, "bmesh_to_mesh mesh=%p object=%p notesselation=%i", me, ob, TRUE); + BMO_op_callf(bm, "bmesh_to_mesh mesh=%p object=%p notesselation=%b", me, ob, TRUE); } @@ -447,7 +447,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) BMFace *f; BMIter iter, liter; int i, j, *keyi, ototvert, totloop; - int dotess = !BMO_slot_int_get(op, "notesselation"); + int dotess = !BMO_slot_bool_get(op, "notesselation"); ototvert = me->totvert; diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c index 82e77fc9a96..128b64b08de 100644 --- a/source/blender/bmesh/operators/bmo_mirror.c +++ b/source/blender/bmesh/operators/bmo_mirror.c @@ -48,8 +48,8 @@ void bmesh_mirror_exec(BMesh *bm, BMOperator *op) float scale[3] = {1.0f, 1.0f, 1.0f}; float dist = BMO_slot_float_get(op, "mergedist"); int i, ototvert, ototedge, axis = BMO_slot_int_get(op, "axis"); - int mirroru = BMO_slot_int_get(op, "mirror_u"); - int mirrorv = BMO_slot_int_get(op, "mirror_v"); + int mirroru = BMO_slot_bool_get(op, "mirror_u"); + int mirrorv = BMO_slot_bool_get(op, "mirror_v"); ototvert = bm->totvert; ototedge = bm->totedge; diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index f7a1a8f4d06..dc9b26cd665 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -495,8 +495,9 @@ void bmesh_create_circle_exec(BMesh *bm, BMOperator *op) BMVert *v1, *lastv1 = NULL, *cent1, *firstv1 = NULL; float vec[3], mat[4][4], phi, phid; float dia = BMO_slot_float_get(op, "diameter"); - int cap_ends = BMO_slot_int_get(op, "cap_ends"), segs = BMO_slot_int_get(op, "segments"); - int cap_tris = BMO_slot_int_get(op, "cap_tris"); + int segs = BMO_slot_int_get(op, "segments"); + int cap_ends = BMO_slot_bool_get(op, "cap_ends"); + int cap_tris = BMO_slot_bool_get(op, "cap_tris"); int a; if (!segs) @@ -567,8 +568,9 @@ void bmesh_create_cone_exec(BMesh *bm, BMOperator *op) float dia1 = BMO_slot_float_get(op, "diameter1"); float dia2 = BMO_slot_float_get(op, "diameter2"); float depth = BMO_slot_float_get(op, "depth"); - int cap_ends = BMO_slot_int_get(op, "cap_ends"), segs = BMO_slot_int_get(op, "segments"); - int cap_tris = BMO_slot_int_get(op, "cap_tris"); + int segs = BMO_slot_int_get(op, "segments"); + int cap_ends = BMO_slot_bool_get(op, "cap_ends"); + int cap_tris = BMO_slot_bool_get(op, "cap_tris"); int a; if (!segs) diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 310762e0e37..ce00441dcac 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -693,8 +693,8 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) fractal = BMO_slot_float_get(op, "fractal"); beauty = BMO_slot_int_get(op, "beauty"); cornertype = BMO_slot_int_get(op, "quadcornertype"); - singleedge = BMO_slot_int_get(op, "singleedge"); - gridfill = BMO_slot_int_get(op, "gridfill"); + singleedge = BMO_slot_bool_get(op, "singleedge"); + gridfill = BMO_slot_bool_get(op, "gridfill"); BLI_srandom(seed); @@ -1022,8 +1022,8 @@ void BM_mesh_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float s BMOperator op; BMO_op_initf(bm, &op, "esubd edges=%he smooth=%f fractal=%f " - "beauty=%d numcuts=%d quadcornertype=%d singleedge=%d " - "gridfill=%d seed=%d", + "beauty=%i numcuts=%i quadcornertype=%i singleedge=%b " + "gridfill=%b seed=%i", flag, smooth, fractal, beauty, numcuts, cornertype, singleedge, gridfill, seed); diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index e0187476a6a..8d7bdf598dc 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -123,7 +123,7 @@ void bmesh_edgerotate_exec(BMesh *bm, BMOperator *op) { BMOIter siter; BMEdge *e, *e2; - int ccw = BMO_slot_int_get(op, "ccw"); + int ccw = BMO_slot_bool_get(op, "ccw"); BMO_ITER(e, &siter, bm, op, "edges", BM_EDGE) { if (!(e2 = BM_edge_rotate(bm, e, ccw))) { @@ -221,15 +221,15 @@ static void bmesh_regionextend_constrict(BMesh *bm, BMOperator *op, int usefaces void bmesh_regionextend_exec(BMesh *bm, BMOperator *op) { - int usefaces = BMO_slot_int_get(op, "usefaces"); - int constrict = BMO_slot_int_get(op, "constrict"); + int use_faces = BMO_slot_bool_get(op, "use_faces"); + int constrict = BMO_slot_bool_get(op, "constrict"); BMO_slot_buffer_flag_enable(bm, op, "geom", SEL_ORIG, BM_ALL); if (constrict) - bmesh_regionextend_constrict(bm, op, usefaces); + bmesh_regionextend_constrict(bm, op, use_faces); else - bmesh_regionextend_extend(bm, op, usefaces); + bmesh_regionextend_extend(bm, op, use_faces); BMO_slot_from_flag(bm, op, "geomout", SEL_FLAG, BM_ALL); } @@ -270,7 +270,7 @@ void bmesh_righthandfaces_exec(BMesh *bm, BMOperator *op) BLI_array_declare(fstack); BMLoop *l, *l2; float maxx, cent[3]; - int i, maxi, flagflip = BMO_slot_int_get(op, "doflip"); + int i, maxi, flagflip = BMO_slot_bool_get(op, "do_flip"); startf = NULL; maxx = -1.0e10; @@ -381,9 +381,9 @@ void bmesh_vertexsmooth_exec(BMesh *bm, BMOperator *op) float *co, *co2, clipdist = BMO_slot_float_get(op, "clipdist"); int i, j, clipx, clipy, clipz; - clipx = BMO_slot_int_get(op, "mirror_clip_x"); - clipy = BMO_slot_int_get(op, "mirror_clip_y"); - clipz = BMO_slot_int_get(op, "mirror_clip_z"); + clipx = BMO_slot_bool_get(op, "mirror_clip_x"); + clipy = BMO_slot_bool_get(op, "mirror_clip_y"); + clipz = BMO_slot_bool_get(op, "mirror_clip_z"); i = 0; BMO_ITER(v, &siter, bm, op, "verts", BM_VERT) { diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index 38daf3c0d22..1377970083c 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -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); diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index 4f7fab75f7e..5ba943cdede 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -99,7 +99,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) ts->editbutflag|flag, cuts, 0, RNA_enum_get(op->ptr, "quadcorner"), RNA_boolean_get(op->ptr, "quadtri"), - 1, RNA_int_get(op->ptr, "seed")); + TRUE, RNA_int_get(op->ptr, "seed")); DAG_id_tag_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -1215,8 +1215,9 @@ static int editbmesh_edge_split(bContext *C, wmOperator *op) BMOperator bmop; int len = 0; - if (!EDBM_InitOpf(em, &bmop, op, "edgesplit edges=%he numcuts=%d", - BM_ELEM_SELECT, RNA_int_get(op->ptr,"number_cuts"))) { + if (!EDBM_InitOpf(em, &bmop, op, "edgesplit edges=%he numcuts=%i", + BM_ELEM_SELECT, RNA_int_get(op->ptr,"number_cuts"))) + { return OPERATOR_CANCELLED; } BMO_op_exec(bm, &bmop); @@ -1380,7 +1381,7 @@ static int edge_rotate_selected(bContext *C, wmOperator *op) if (!eed) return OPERATOR_CANCELLED; - EDBM_InitOpf(em, &bmop, op, "edgerotate edges=%e ccw=%d", eed, do_ccw); + EDBM_InitOpf(em, &bmop, op, "edgerotate edges=%e ccw=%b", eed, do_ccw); /* avoid adding to the selection if we start off with only a selected edge, * we could also just deselect the single edge easily but use the BMO api @@ -1564,7 +1565,7 @@ static int normals_make_consistent_exec(bContext *C, wmOperator *op) /* doflip has to do with bmesh_rationalize_normals, it's an internal * thing */ - if (!EDBM_CallOpf(em, op, "righthandfaces faces=%hf doflip=%d", BM_ELEM_SELECT, 1)) + if (!EDBM_CallOpf(em, op, "righthandfaces faces=%hf do_flip=%d", BM_ELEM_SELECT, TRUE)) return OPERATOR_CANCELLED; if (RNA_boolean_get(op->ptr, "inside")) @@ -1600,7 +1601,7 @@ static int do_smooth_vertex(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; ModifierData *md; - int mirrx = 0, mirry = 0, mirrz = 0; + int mirrx = FALSE, mirry = FALSE, mirrz = FALSE; int i, repeat; float clipdist = 0.0f; @@ -1618,11 +1619,11 @@ static int do_smooth_vertex(bContext *C, wmOperator *op) if (mmd->flag & MOD_MIR_CLIPPING) { if (mmd->flag & MOD_MIR_AXIS_X) - mirrx = 1; + mirrx = TRUE; if (mmd->flag & MOD_MIR_AXIS_Y) - mirry = 1; + mirry = TRUE; if (mmd->flag & MOD_MIR_AXIS_Z) - mirrz = 1; + mirrz = TRUE; clipdist = mmd->tolerance; } @@ -1635,7 +1636,7 @@ static int do_smooth_vertex(bContext *C, wmOperator *op) for (i = 0; i < repeat; i++) { if (!EDBM_CallOpf(em, op, - "vertexsmooth verts=%hv mirror_clip_x=%d mirror_clip_y=%d mirror_clip_z=%d clipdist=%f", + "vertexsmooth verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f", BM_ELEM_SELECT, mirrx, mirry, mirrz, clipdist)) { return OPERATOR_CANCELLED; @@ -1840,7 +1841,7 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op) int dir = RNA_enum_get(op->ptr, "direction"); /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "meshrotateuvs faces=%hf dir=%d", BM_ELEM_SELECT, dir); + EDBM_InitOpf(em, &bmop, op, "meshrotateuvs faces=%hf dir=%i", BM_ELEM_SELECT, dir); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -1893,7 +1894,7 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op) int dir = RNA_enum_get(op->ptr, "direction"); /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "meshrotatecolors faces=%hf dir=%d", BM_ELEM_SELECT, dir); + EDBM_InitOpf(em, &bmop, op, "meshrotatecolors faces=%hf dir=%i", BM_ELEM_SELECT, dir); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -2197,8 +2198,7 @@ static int removedoublesflag_exec(bContext *C, wmOperator *op) BMOperator bmop; int count; - EDBM_InitOpf(em, &bmop, op, "finddoubles verts=%hv dist=%f", - BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist")); + EDBM_InitOpf(em, &bmop, op, "finddoubles verts=%hv dist=%f", BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist")); BMO_op_exec(em->bm, &bmop); count = BMO_slot_map_count(em->bm, &bmop, "targetmapout"); @@ -2276,7 +2276,7 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "vertexshortestpath startv=%e endv=%e type=%d", sv->data, ev->data, type); + EDBM_InitOpf(em, &bmop, op, "vertexshortestpath startv=%e endv=%e type=%i", sv->data, ev->data, type); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -3162,8 +3162,8 @@ static int knife_cut_exec(bContext *C, wmOperator *op) BMO_slot_int_set(&bmop, "flag", B_KNIFE); BMO_slot_int_set(&bmop, "quadcornertype", SUBD_STRAIGHT_CUT); - BMO_slot_int_set(&bmop, "singleedge", 0); - BMO_slot_int_set(&bmop, "gridfill", 0); + BMO_slot_bool_set(&bmop, "singleedge", FALSE); + BMO_slot_bool_set(&bmop, "gridfill", FALSE); BMO_slot_float_set(&bmop, "radius", 0); @@ -3262,7 +3262,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO EDBM_CallOpf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS); BM_mesh_normals_update(bmnew); - BMO_op_callf(bmnew, "bmesh_to_mesh mesh=%p object=%p notesselation=%i", + BMO_op_callf(bmnew, "bmesh_to_mesh mesh=%p object=%p notesselation=%b", basenew->object->data, basenew->object, TRUE); BM_mesh_free(bmnew); @@ -3408,8 +3408,9 @@ static int fill_mesh_exec(bContext *C, wmOperator *op) BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; BMOperator bmop; - if (!EDBM_InitOpf(em, &bmop, op, "triangle_fill edges=%he", BM_ELEM_SELECT)) + if (!EDBM_InitOpf(em, &bmop, op, "triangle_fill edges=%he", BM_ELEM_SELECT)) { return OPERATOR_CANCELLED; + } BMO_op_exec(em->bm, &bmop); @@ -3511,9 +3512,9 @@ static int tris_convert_to_quads_exec(bContext *C, wmOperator *op) dovcols = RNA_boolean_get(op->ptr, "vcols"); domaterials = RNA_boolean_get(op->ptr, "materials"); - if (!EDBM_CallOpf(em, op, - "join_triangles faces=%hf limit=%f compare_sharp=%i compare_uvs=%i compare_vcols=%i compare_materials=%i", - BM_ELEM_SELECT, limit, dosharp, douvs, dovcols, domaterials)) + if (!EDBM_CallOpf(em, op, + "join_triangles faces=%hf limit=%f cmp_sharp=%b cmp_uvs=%b cmp_vcols=%b cmp_materials=%b", + BM_ELEM_SELECT, limit, dosharp, douvs, dovcols, domaterials)) { return OPERATOR_CANCELLED; } @@ -3684,8 +3685,9 @@ static int spin_mesh_exec(bContext *C, wmOperator *op) mul_m3_v3(imat, axis); if (!EDBM_InitOpf(em, &spinop, op, - "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%d ang=%f dupli=%d", - BM_ELEM_SELECT, cent, axis, d, steps, degr, dupli)) { + "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i ang=%f do_dupli=%b", + BM_ELEM_SELECT, cent, axis, d, steps, degr, dupli)) + { return OPERATOR_CANCELLED; } BMO_op_exec(bm, &spinop); @@ -3809,8 +3811,8 @@ static int screw_mesh_exec(bContext *C, wmOperator *op) negate_v3(dvec); if (!EDBM_InitOpf(em, &spinop, op, - "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%d ang=%f dupli=0", - BM_ELEM_SELECT, cent, axis, dvec, turns * steps, 360.0f * turns)) + "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i ang=%f do_dupli=%b", + BM_ELEM_SELECT, cent, axis, dvec, turns * steps, 360.0f * turns, FALSE)) { return OPERATOR_CANCELLED; } @@ -4506,8 +4508,8 @@ static int mesh_bevel_exec(bContext *C, wmOperator *op) fac = w[recursion - i - 1] * factor; if (!EDBM_InitOpf(em, &bmop, op, - "bevel geom=%hev percent=%f lengthlayer=%i use_lengths=%i use_even=%i use_dist=%i", - BM_ELEM_SELECT, fac, li, 1, use_even, use_dist)) + "bevel geom=%hev percent=%f lengthlayer=%i use_lengths=%b use_even=%b use_dist=%b", + BM_ELEM_SELECT, fac, li, TRUE, use_even, use_dist)) { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/mesh/bmesh_utils.c b/source/blender/editors/mesh/bmesh_utils.c index 92011b46815..7419eb5ba58 100644 --- a/source/blender/editors/mesh/bmesh_utils.c +++ b/source/blender/editors/mesh/bmesh_utils.c @@ -111,8 +111,7 @@ int EDBM_InitOpf(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *f va_start(list, fmt); if (!BMO_op_vinitf(bm, bmop, fmt, list)) { - BKE_report(op->reports, RPT_ERROR, - "Parse error in EDBM_CallOpf"); + BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__); va_end(list); return 0; } @@ -173,8 +172,7 @@ int EDBM_CallOpf(BMEditMesh *em, wmOperator *op, const char *fmt, ...) va_start(list, fmt); if (!BMO_op_vinitf(bm, &bmop, fmt, list)) { - BKE_report(op->reports, RPT_ERROR, - "Parse error in EDBM_CallOpf"); + BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__); va_end(list); return 0; } @@ -198,8 +196,7 @@ int EDBM_CallAndSelectOpf(BMEditMesh *em, wmOperator *op, const char *selectslot va_start(list, fmt); if (!BMO_op_vinitf(bm, &bmop, fmt, list)) { - BKE_report(op->reports, RPT_ERROR, - "Parse error in EDBM_CallOpf"); + BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__); va_end(list); return 0; } @@ -415,11 +412,11 @@ void EDBM_select_flush(BMEditMesh *em) void EDBM_select_more(BMEditMesh *em) { BMOperator bmop; - int usefaces = em->selectmode > SCE_SELECT_EDGE; + int use_faces = em->selectmode > SCE_SELECT_EDGE; BMO_op_initf(em->bm, &bmop, - "regionextend geom=%hvef constrict=%d usefaces=%d", - BM_ELEM_SELECT, 0, usefaces); + "regionextend geom=%hvef constrict=%i use_faces=%b", + BM_ELEM_SELECT, FALSE, use_faces); BMO_op_exec(em->bm, &bmop); BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ELEM_SELECT, BM_ALL); BMO_op_finish(em->bm, &bmop); @@ -430,11 +427,11 @@ void EDBM_select_more(BMEditMesh *em) void EDBM_select_less(BMEditMesh *em) { BMOperator bmop; - int usefaces = em->selectmode > SCE_SELECT_EDGE; + int use_faces = em->selectmode > SCE_SELECT_EDGE; BMO_op_initf(em->bm, &bmop, - "regionextend geom=%hvef constrict=%d usefaces=%d", - BM_ELEM_SELECT, 0, usefaces); + "regionextend geom=%hvef constrict=%i use_faces=%b", + BM_ELEM_SELECT, FALSE, use_faces); BMO_op_exec(em->bm, &bmop); BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ELEM_SELECT, BM_ALL); BMO_op_finish(em->bm, &bmop); @@ -525,7 +522,7 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata) #endif - BMO_op_callf(em->bm, "bmesh_to_mesh mesh=%p notesselation=%i", &um->me, TRUE); + BMO_op_callf(em->bm, "bmesh_to_mesh mesh=%p notesselation=%b", &um->me, TRUE); um->selectmode = em->selectmode; return um; @@ -537,14 +534,15 @@ static void undoMesh_to_editbtMesh(void *umv, void *emv, void *UNUSED(obdata)) Object *ob; undomesh *um = umv; BMesh *bm; - + + /* BMESH_TODO - its possible the name wont be found right?, should fallback */ ob = (Object *)find_id("OB", um->obname); ob->shapenr = em->bm->shapenr; BMEdit_Free(em); bm = BM_mesh_create(ob, bm_mesh_allocsize_default); - BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%i", &um->me, ob, 0); + BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", &um->me, ob, FALSE); em2 = BMEdit_Create(bm, TRUE); *em = *em2; diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index ea9dc73ee94..c12d28e4166 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -145,8 +145,10 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op) em = me->edit_btmesh; if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", 1, 1, dia, mat)) + "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", 1, 1, dia, mat)) + { return OPERATOR_CANCELLED; + } make_prim_finish(C, &state, enter_editmode); @@ -188,8 +190,9 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", "create_cube mat=%m4 size=%f", mat, 2.0f)) + if (!EDBM_CallAndSelectOpf(em, op, "vertout", "create_cube mat=%m4 size=%f", mat, 2.0f)) { return OPERATOR_CANCELLED; + } /* BMESH_TODO make plane side this: M_SQRT2 - plane (diameter of 1.41 makes it unit size) */ make_prim_finish(C, &state, enter_editmode); @@ -241,11 +244,13 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_circle segments=%i diameter=%f cap_ends=%i cap_tris=%i mat=%m4", - RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), - cap_end, cap_tri, mat)) + if (!EDBM_CallAndSelectOpf(em, op, "vertout", + "create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b mat=%m4", + RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), + cap_end, cap_tri, mat)) + { return OPERATOR_CANCELLED; + } make_prim_finish(C, &state, enter_editmode); @@ -298,11 +303,17 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%i cap_tris=%i depth=%f mat=%m4", - RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), - RNA_float_get(op->ptr, "radius"), cap_end, cap_tri, RNA_float_get(op->ptr, "depth"), mat)) + if (!EDBM_CallAndSelectOpf( + em, op, "vertout", + "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f mat=%m4", + RNA_int_get(op->ptr, "vertices"), + RNA_float_get(op->ptr, "radius"), + RNA_float_get(op->ptr, "radius"), + cap_end, cap_tri, + RNA_float_get(op->ptr, "depth"), mat)) + { return OPERATOR_CANCELLED; + } make_prim_finish(C, &state, enter_editmode); @@ -357,11 +368,14 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%i cap_tris=%i depth=%f mat=%m4", - RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius1"), - RNA_float_get(op->ptr, "radius2"), cap_end, cap_tri, RNA_float_get(op->ptr, "depth"), mat)) + if (!EDBM_CallAndSelectOpf( + em, op, "vertout", + "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f mat=%m4", + RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius1"), + RNA_float_get(op->ptr, "radius2"), cap_end, cap_tri, RNA_float_get(op->ptr, "depth"), mat)) + { return OPERATOR_CANCELLED; + } make_prim_finish(C, &state, enter_editmode); @@ -415,11 +429,11 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", - RNA_int_get(op->ptr, "x_subdivisions"), - RNA_int_get(op->ptr, "y_subdivisions"), - RNA_float_get(op->ptr, "size") * dia, mat)) + if (!EDBM_CallAndSelectOpf(em, op, "vertout", + "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", + RNA_int_get(op->ptr, "x_subdivisions"), + RNA_int_get(op->ptr, "y_subdivisions"), + RNA_float_get(op->ptr, "size") * dia, mat)) { return OPERATOR_CANCELLED; } @@ -517,11 +531,13 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_uvsphere segments=%i revolutions=%i diameter=%f mat=%m4", - RNA_int_get(op->ptr, "ring_count"), RNA_int_get(op->ptr, "segments"), - RNA_float_get(op->ptr,"size"), mat)) + if (!EDBM_CallAndSelectOpf(em, op, "vertout", + "create_uvsphere segments=%i revolutions=%i diameter=%f mat=%m4", + RNA_int_get(op->ptr, "ring_count"), RNA_int_get(op->ptr, "segments"), + RNA_float_get(op->ptr,"size"), mat)) + { return OPERATOR_CANCELLED; + } make_prim_finish(C, &state, enter_editmode); @@ -571,10 +587,12 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_icosphere subdivisions=%i diameter=%f mat=%m4", - RNA_int_get(op->ptr, "subdivisions"), - RNA_float_get(op->ptr, "size"), mat)) { + if (!EDBM_CallAndSelectOpf( + em, op, "vertout", + "create_icosphere subdivisions=%i diameter=%f mat=%m4", + RNA_int_get(op->ptr, "subdivisions"), + RNA_float_get(op->ptr, "size"), mat)) + { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 794356510aa..dbcc0447a89 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -310,7 +310,7 @@ static void ringsel_finish(bContext *C, wmOperator *op) if (lcd->do_cut) { BM_mesh_esubdivideflag(lcd->ob, em->bm, BM_ELEM_SELECT, 0.0f, 0.0f, 0, cuts, SUBDIV_SELECT_LOOPCUT, - SUBD_PATH, 0, 0, 0); + SUBD_PATH, 0, FALSE, 0); /* force edge slide to edge select mode in in face select mode */ if (em->selectmode & SCE_SELECT_FACE) { diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 6b0ed5c14d6..e495908b56e 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -59,12 +59,6 @@ ok: the EDBM module is for editmode bmesh stuff. in contrast, the /*calls a bmesh op, reporting errors to the user, etc*/ int EDBM_CallOpf(struct BMEditMesh *em, struct wmOperator *op, const char *fmt, ...); -/*calls a bmesh op, reporting errors to the user, etc. - - selects an output slot specified by selslot*/ -//int EDBM_CallAndSelectOpf(struct BMEditMesh *em, struct wmOperator *op, char *selslot, char *fmt, ...); -//moved to ED_mesh.h - /*same as above, but doesn't report errors.*/ int EDBM_CallOpfSilent(struct BMEditMesh *em, const char *fmt, ...); diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 91ff1ad0063..8aefd928858 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -144,8 +144,8 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, } } - BMO_op_callf(bm, "bevel geom=%fe percent=%f use_even=%i use_dist=%i", - EDGE_MARK, bmd->value, (bmd->flags & BME_BEVEL_EVEN)!=0, (bmd->flags & BME_BEVEL_DIST) != 0); + BMO_op_callf(bm, "bevel geom=%fe percent=%f use_even=%b use_dist=%b", + EDGE_MARK, bmd->value, (bmd->flags & BME_BEVEL_EVEN) != 0, (bmd->flags & BME_BEVEL_DIST) != 0); BMO_pop(bm); BLI_assert(em->looptris == NULL); |