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/blender/bmesh | |
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/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/bmesh_operator_api.h | 23 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_opdefines.c | 63 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.c | 53 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_bevel.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_create.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_dissolve.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_dupe.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_extrude.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_join_triangles.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_mesh_conv.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_mirror.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_primitive.c | 10 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_subdivide.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_utils.c | 18 |
15 files changed, 126 insertions, 95 deletions
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) { |