use input and output slots for bmesh operators, needed for the python api to get return values.
This commit is contained in:
@@ -109,6 +109,7 @@ static BMOpDefine bmo_smooth_vert_def = {
|
||||
{BMO_OP_SLOT_BOOL, "use_axis_z"}, /* smooth vertices along Z axis */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_smooth_vert_exec,
|
||||
0
|
||||
};
|
||||
@@ -129,6 +130,7 @@ static BMOpDefine bmo_smooth_laplacian_vert_def = {
|
||||
{BMO_OP_SLOT_BOOL, "volume_preservation"}, //Apply volume preservation after smooth
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_smooth_laplacian_vert_exec,
|
||||
0
|
||||
};
|
||||
@@ -145,6 +147,7 @@ static BMOpDefine bmo_recalc_face_normals_def = {
|
||||
{BMO_OP_SLOT_BOOL, "do_flip"}, /* internal flag, used by bmesh_rationalize_normals */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_recalc_face_normals_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES,
|
||||
};
|
||||
@@ -162,11 +165,13 @@ static BMOpDefine bmo_recalc_face_normals_def = {
|
||||
static BMOpDefine bmo_region_extend_def = {
|
||||
"region_extend",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* output slot, computed boundary geometry. */
|
||||
{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 sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* output slot, computed boundary geometry. */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_region_extend_exec,
|
||||
0
|
||||
};
|
||||
@@ -180,10 +185,12 @@ static BMOpDefine bmo_region_extend_def = {
|
||||
static BMOpDefine bmo_rotate_edges_def = {
|
||||
"rotate_edges",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* newly spun edges */
|
||||
{BMO_OP_SLOT_BOOL, "ccw"}, /* rotate edge counter-clockwise if true, othewise clockwise */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* newly spun edges */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_rotate_edges_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -199,6 +206,7 @@ static BMOpDefine bmo_reverse_faces_def = {
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_reverse_faces_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES,
|
||||
};
|
||||
@@ -213,7 +221,9 @@ static BMOpDefine bmo_bisect_edges_def = {
|
||||
"bisect_edges",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
|
||||
{BMO_OP_SLOT_INT, "numcuts"}, /* number of cuts */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "outsplit"}, /* newly created vertices and edges */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "splitout"}, /* newly created vertices and edges */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_bisect_edges_exec,
|
||||
@@ -233,11 +243,14 @@ static BMOpDefine bmo_mirror_def = {
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry */
|
||||
{BMO_OP_SLOT_MAT, "mat"}, /* matrix defining the mirror transformation */
|
||||
{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_BOOL, "mirror_u"}, /* mirror UVs across the u axis */
|
||||
{BMO_OP_SLOT_BOOL, "mirror_v"}, /* mirror UVs across the v axis */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "newout"}, /* output geometry, mirrored */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_mirror_exec,
|
||||
0,
|
||||
};
|
||||
@@ -256,8 +269,11 @@ static BMOpDefine bmo_find_doubles_def = {
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "keep_verts"}, /* list of verts to keep */
|
||||
{BMO_OP_SLOT_FLT, "dist"}, /* minimum distance */
|
||||
{BMO_OP_SLOT_MAPPING, "targetmapout"},
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_MAPPING, "targetmapout"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_find_doubles_exec,
|
||||
0,
|
||||
};
|
||||
@@ -272,7 +288,9 @@ static BMOpDefine bmo_remove_doubles_def = {
|
||||
"remove_doubles",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input verts */
|
||||
{BMO_OP_SLOT_FLT, "dist"}, /* minimum distance */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_remove_doubles_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES,
|
||||
};
|
||||
@@ -288,7 +306,9 @@ static BMOpDefine bmo_automerge_def = {
|
||||
"automerge",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input verts */
|
||||
{BMO_OP_SLOT_FLT, "dist"}, /* minimum distance */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_automerge_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES,
|
||||
};
|
||||
@@ -301,7 +321,9 @@ static BMOpDefine bmo_automerge_def = {
|
||||
static BMOpDefine bmo_collapse_def = {
|
||||
"collapse",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_collapse_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES,
|
||||
};
|
||||
@@ -316,7 +338,9 @@ static BMOpDefine bmo_pointmerge_facedata_def = {
|
||||
"pointmerge_facedata",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertice */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "snapv"}, /* snap verte */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_pointmerge_facedata_exec,
|
||||
0,
|
||||
};
|
||||
@@ -331,7 +355,9 @@ static BMOpDefine bmo_pointmerge_facedata_def = {
|
||||
static BMOpDefine bmo_average_vert_facedata_def = {
|
||||
"average_vert_facedata",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertice */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_average_vert_facedata_exec,
|
||||
0,
|
||||
};
|
||||
@@ -345,7 +371,9 @@ static BMOpDefine bmo_pointmerge_def = {
|
||||
"pointmerge",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertice */
|
||||
{BMO_OP_SLOT_VEC, "merge_co"},
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_pointmerge_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES,
|
||||
};
|
||||
@@ -358,7 +386,9 @@ static BMOpDefine bmo_pointmerge_def = {
|
||||
static BMOpDefine bmo_collapse_uvs_def = {
|
||||
"collapse_uvs",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_collapse_uvs_exec,
|
||||
0,
|
||||
};
|
||||
@@ -373,7 +403,9 @@ static BMOpDefine bmo_collapse_uvs_def = {
|
||||
static BMOpDefine bmo_weld_verts_def = {
|
||||
"weld_verts",
|
||||
{{BMO_OP_SLOT_MAPPING, "targetmap"}, /* maps welded vertices to verts they should weld to */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_weld_verts_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES,
|
||||
};
|
||||
@@ -387,8 +419,11 @@ static BMOpDefine bmo_weld_verts_def = {
|
||||
static BMOpDefine bmo_create_vert_def = {
|
||||
"create_vert",
|
||||
{{BMO_OP_SLOT_VEC, "co"}, /* the coordinate of the new vert */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "newvertout"}, /* the new vert */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "newvertout"}, /* the new vert */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_create_vert_exec,
|
||||
0,
|
||||
};
|
||||
@@ -402,13 +437,16 @@ static BMOpDefine bmo_create_vert_def = {
|
||||
static BMOpDefine bmo_join_triangles_def = {
|
||||
"join_triangles",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input geometry. */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* joined faces */
|
||||
{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 sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* joined faces */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_join_triangles_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES,
|
||||
};
|
||||
@@ -427,12 +465,15 @@ static BMOpDefine bmo_join_triangles_def = {
|
||||
static BMOpDefine bmo_contextual_create_def = {
|
||||
"contextual_create",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry. */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* newly-made face(s) */
|
||||
{BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */
|
||||
{BMO_OP_SLOT_BOOL, "use_smooth"}, /* smooth to use */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* newly-made face(s) */
|
||||
/* note, this is for stand-alone edges only, not edges which are apart of newly created faces */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* newly-made edge(s) */
|
||||
{BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */
|
||||
{BMO_OP_SLOT_BOOL, "use_smooth"}, /* material to use */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_contextual_create_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES,
|
||||
};
|
||||
@@ -443,10 +484,13 @@ static BMOpDefine bmo_contextual_create_def = {
|
||||
static BMOpDefine bmo_bridge_loops_def = {
|
||||
"bridge_loops",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */
|
||||
{BMO_OP_SLOT_BOOL, "use_merge"},
|
||||
{BMO_OP_SLOT_FLT, "merge_factor"},
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new faces */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_bridge_loops_exec,
|
||||
0,
|
||||
};
|
||||
@@ -458,11 +502,14 @@ static BMOpDefine bmo_edgenet_fill_def = {
|
||||
{BMO_OP_SLOT_BOOL, "use_restrict"},
|
||||
{BMO_OP_SLOT_BOOL, "use_fill_check"},
|
||||
{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 */
|
||||
{BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */
|
||||
{BMO_OP_SLOT_BOOL, "use_smooth"}, /* material to use */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_MAPPING, "face_groupmap_out"}, /* maps new faces to the group numbers they came fro */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_edgenet_fill_exec,
|
||||
0,
|
||||
};
|
||||
@@ -480,8 +527,11 @@ static BMOpDefine bmo_edgenet_fill_def = {
|
||||
static BMOpDefine bmo_edgenet_prepare_def = {
|
||||
"edgenet_prepare",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* new edges */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* new edges */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_edgenet_prepare,
|
||||
0,
|
||||
};
|
||||
@@ -497,7 +547,9 @@ static BMOpDefine bmo_rotate_def = {
|
||||
{{BMO_OP_SLOT_VEC, "cent"}, /* center of rotation */
|
||||
{BMO_OP_SLOT_MAT, "mat"}, /* matrix defining rotation */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_rotate_exec,
|
||||
0,
|
||||
};
|
||||
@@ -512,7 +564,9 @@ static BMOpDefine bmo_translate_def = {
|
||||
"translate",
|
||||
{{BMO_OP_SLOT_VEC, "vec"}, /* translation offset */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_translate_exec,
|
||||
0,
|
||||
};
|
||||
@@ -526,7 +580,9 @@ static BMOpDefine bmo_scale_def = {
|
||||
"scale",
|
||||
{{BMO_OP_SLOT_VEC, "vec"}, /* scale factor */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_scale_exec,
|
||||
0,
|
||||
};
|
||||
@@ -542,7 +598,9 @@ static BMOpDefine bmo_transform_def = {
|
||||
"transform",
|
||||
{{BMO_OP_SLOT_MAT, "mat"}, /* transform matrix */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_transform_exec,
|
||||
0,
|
||||
};
|
||||
@@ -557,7 +615,9 @@ static BMOpDefine bmo_object_load_bmesh_def = {
|
||||
"object_load_bmesh",
|
||||
{{BMO_OP_SLOT_PTR, "scene"},
|
||||
{BMO_OP_SLOT_PTR, "object"},
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_object_load_bmesh_exec,
|
||||
0,
|
||||
};
|
||||
@@ -573,7 +633,9 @@ static BMOpDefine bmo_bmesh_to_mesh_def = {
|
||||
{{BMO_OP_SLOT_PTR, "mesh"}, /* pointer to a mesh structure to fill in */
|
||||
{BMO_OP_SLOT_PTR, "object"}, /* pointer to an object structure */
|
||||
{BMO_OP_SLOT_BOOL, "notessellation"}, /* don't calculate mfaces */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_bmesh_to_mesh_exec,
|
||||
0,
|
||||
};
|
||||
@@ -589,7 +651,9 @@ static BMOpDefine bmo_mesh_to_bmesh_def = {
|
||||
{{BMO_OP_SLOT_PTR, "mesh"}, /* pointer to a Mesh structure */
|
||||
{BMO_OP_SLOT_PTR, "object"}, /* pointer to an Object structure */
|
||||
{BMO_OP_SLOT_BOOL, "set_shapekey"}, /* load active shapekey coordinates into verts */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_mesh_to_bmesh_exec,
|
||||
0
|
||||
};
|
||||
@@ -602,9 +666,12 @@ static BMOpDefine bmo_mesh_to_bmesh_def = {
|
||||
static BMOpDefine bmo_extrude_discrete_faces_def = {
|
||||
"extrude_discrete_faces",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "skirtout"}, /* output skirt geometry, faces and edges */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_extrude_discrete_faces_exec,
|
||||
0
|
||||
};
|
||||
@@ -618,8 +685,11 @@ static BMOpDefine bmo_extrude_discrete_faces_def = {
|
||||
static BMOpDefine bmo_extrude_edge_only_def = {
|
||||
"extrude_edge_only",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input vertices */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* output geometry */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* output geometry */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_extrude_edge_only_exec,
|
||||
0
|
||||
};
|
||||
@@ -632,9 +702,12 @@ static BMOpDefine bmo_extrude_edge_only_def = {
|
||||
static BMOpDefine bmo_extrude_vert_indiv_def = {
|
||||
"extrude_vert_indiv",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* output wire edges */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* output wire edges */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output vertices */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_extrude_vert_indiv_exec,
|
||||
0
|
||||
};
|
||||
@@ -642,8 +715,11 @@ static BMOpDefine bmo_extrude_vert_indiv_def = {
|
||||
static BMOpDefine bmo_connect_verts_def = {
|
||||
"connect_verts",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_connect_verts_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -653,8 +729,11 @@ static BMOpDefine bmo_extrude_face_region_def = {
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edgefacein"},
|
||||
{BMO_OP_SLOT_MAPPING, "exclude"},
|
||||
{BMO_OP_SLOT_BOOL, "alwayskeeporig"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_extrude_face_region_exec,
|
||||
0
|
||||
};
|
||||
@@ -662,7 +741,9 @@ static BMOpDefine bmo_extrude_face_region_def = {
|
||||
static BMOpDefine bmo_dissolve_verts_def = {
|
||||
"dissolve_verts",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_dissolve_verts_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -670,9 +751,12 @@ static BMOpDefine bmo_dissolve_verts_def = {
|
||||
static BMOpDefine bmo_dissolve_edges_def = {
|
||||
"dissolve_edges",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
|
||||
{BMO_OP_SLOT_BOOL, "use_verts"}, /* dissolve verts left between only 2 edges. */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_dissolve_edges_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -680,8 +764,11 @@ static BMOpDefine bmo_dissolve_edges_def = {
|
||||
static BMOpDefine bmo_dissolve_edge_loop_def = {
|
||||
"dissolve_edge_loop",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_dissolve_edgeloop_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -689,9 +776,12 @@ static BMOpDefine bmo_dissolve_edge_loop_def = {
|
||||
static BMOpDefine bmo_dissolve_faces_def = {
|
||||
"dissolve_faces",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
|
||||
{BMO_OP_SLOT_BOOL, "use_verts"}, /* dissolve verts left between only 2 edges. */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_dissolve_faces_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -702,7 +792,9 @@ static BMOpDefine bmo_dissolve_limit_def = {
|
||||
{BMO_OP_SLOT_BOOL, "use_dissolve_boundaries"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "verts"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_dissolve_limit_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -710,11 +802,14 @@ static BMOpDefine bmo_dissolve_limit_def = {
|
||||
static BMOpDefine bmo_triangulate_def = {
|
||||
"triangulate",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"},
|
||||
{BMO_OP_SLOT_MAPPING, "facemap"},
|
||||
{BMO_OP_SLOT_BOOL, "use_beauty"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"},
|
||||
{BMO_OP_SLOT_MAPPING, "facemap_out"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_triangulate_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -723,7 +818,9 @@ static BMOpDefine bmo_unsubdivide_def = {
|
||||
"unsubdivide",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
|
||||
{BMO_OP_SLOT_INT, "iterations"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_unsubdivide_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -739,16 +836,16 @@ static BMOpDefine bmo_subdivide_edges_def = {
|
||||
{BMO_OP_SLOT_MAPPING, "custompatterns"},
|
||||
{BMO_OP_SLOT_MAPPING, "edgepercents"},
|
||||
|
||||
/* these next three can have multiple types of elements in them */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "outinner"},
|
||||
{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_BOOL, "use_gridfill"}, /* fill in fully-selected faces with a grid */
|
||||
{BMO_OP_SLOT_BOOL, "use_singleedge"}, /* tessellate the case of one edge selected in a quad or triangle */
|
||||
{BMO_OP_SLOT_BOOL, "use_sphere"}, /* for making new primitives only */
|
||||
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{/* these next three can have multiple types of elements in them */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "innerout"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "splitout"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* contains all output geometr */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_subdivide_edges_exec,
|
||||
@@ -759,7 +856,9 @@ static BMOpDefine bmo_delete_def = {
|
||||
"delete",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
|
||||
{BMO_OP_SLOT_INT, "context"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_delete_exec,
|
||||
0
|
||||
};
|
||||
@@ -767,15 +866,18 @@ static BMOpDefine bmo_delete_def = {
|
||||
static BMOpDefine bmo_duplicate_def = {
|
||||
"duplicate",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "origout"},
|
||||
{BMO_OP_SLOT_PTR, "dest"}, /* destination bmesh, if NULL will use current on */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "origout"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "newout"},
|
||||
/* facemap maps from source faces to dupe
|
||||
* faces, and from dupe faces to source faces */
|
||||
{BMO_OP_SLOT_MAPPING, "facemap"},
|
||||
{BMO_OP_SLOT_MAPPING, "boundarymap"},
|
||||
{BMO_OP_SLOT_MAPPING, "isovertmap"},
|
||||
{BMO_OP_SLOT_PTR, "dest"}, /* destination bmesh, if NULL will use current on */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{BMO_OP_SLOT_MAPPING, "facemap_out"},
|
||||
{BMO_OP_SLOT_MAPPING, "boundarymap_out"},
|
||||
{BMO_OP_SLOT_MAPPING, "isovertmap_out"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_duplicate_exec,
|
||||
0
|
||||
};
|
||||
@@ -783,12 +885,15 @@ static BMOpDefine bmo_duplicate_def = {
|
||||
static BMOpDefine bmo_split_def = {
|
||||
"split",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
|
||||
{BMO_OP_SLOT_MAPPING, "boundarymap"},
|
||||
{BMO_OP_SLOT_MAPPING, "isovertmap"},
|
||||
{BMO_OP_SLOT_PTR, "dest"}, /* destination bmesh, if NULL will use current on */
|
||||
{BMO_OP_SLOT_BOOL, "use_only_faces"}, /* when enabled. don't duplicate loose verts/edges */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
|
||||
{BMO_OP_SLOT_MAPPING, "boundarymap_out"},
|
||||
{BMO_OP_SLOT_MAPPING, "isovertmap_out"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_split_exec,
|
||||
0
|
||||
};
|
||||
@@ -802,14 +907,17 @@ static BMOpDefine bmo_split_def = {
|
||||
static BMOpDefine bmo_spin_def = {
|
||||
"spin",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "lastout"}, /* result of last step */
|
||||
{BMO_OP_SLOT_VEC, "cent"}, /* rotation center */
|
||||
{BMO_OP_SLOT_VEC, "axis"}, /* rotation axis */
|
||||
{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_BOOL, "do_dupli"}, /* duplicate or extrude? */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "lastout"}, /* result of last step */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_spin_exec,
|
||||
0
|
||||
};
|
||||
@@ -823,11 +931,14 @@ static BMOpDefine bmo_spin_def = {
|
||||
static BMOpDefine bmo_similar_faces_def = {
|
||||
"similar_faces",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
|
||||
{BMO_OP_SLOT_INT, "type"}, /* type of selection */
|
||||
{BMO_OP_SLOT_FLT, "thresh"}, /* threshold of selection */
|
||||
{BMO_OP_SLOT_INT, "compare"}, /* comparison method */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_similar_faces_exec,
|
||||
0
|
||||
};
|
||||
@@ -840,11 +951,14 @@ static BMOpDefine bmo_similar_faces_def = {
|
||||
static BMOpDefine bmo_similar_edges_def = {
|
||||
"similar_edges",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* output edges */
|
||||
{BMO_OP_SLOT_INT, "type"}, /* type of selection */
|
||||
{BMO_OP_SLOT_FLT, "thresh"}, /* threshold of selection */
|
||||
{BMO_OP_SLOT_INT, "compare"}, /* comparison method */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* output edges */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_similar_edges_exec,
|
||||
0
|
||||
};
|
||||
@@ -857,11 +971,14 @@ static BMOpDefine bmo_similar_edges_def = {
|
||||
static BMOpDefine bmo_similar_verts_def = {
|
||||
"similar_verts",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output vertices */
|
||||
{BMO_OP_SLOT_INT, "type"}, /* type of selection */
|
||||
{BMO_OP_SLOT_FLT, "thresh"}, /* threshold of selection */
|
||||
{BMO_OP_SLOT_INT, "compare"}, /* comparison method */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output vertices */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_similar_verts_exec,
|
||||
0
|
||||
};
|
||||
@@ -874,7 +991,9 @@ static BMOpDefine bmo_rotate_uvs_def = {
|
||||
"rotate_uvs",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
|
||||
{BMO_OP_SLOT_INT, "dir"}, /* direction */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_rotate_uvs_exec,
|
||||
0
|
||||
};
|
||||
@@ -886,7 +1005,9 @@ static BMOpDefine bmo_rotate_uvs_def = {
|
||||
static BMOpDefine bmo_reverse_uvs_def = {
|
||||
"reverse_uvs",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_reverse_uvs_exec,
|
||||
0
|
||||
};
|
||||
@@ -898,8 +1019,10 @@ static BMOpDefine bmo_reverse_uvs_def = {
|
||||
static BMOpDefine bmo_rotate_colors_def = {
|
||||
"rotate_colors",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
|
||||
{BMO_OP_SLOT_INT, "dir"}, /* direction */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{BMO_OP_SLOT_INT, "dir"}, /* direction */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_rotate_colors_exec,
|
||||
0
|
||||
};
|
||||
@@ -911,7 +1034,9 @@ static BMOpDefine bmo_rotate_colors_def = {
|
||||
static BMOpDefine bmo_reverse_colors_def = {
|
||||
"reverse_colors",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{0}}, /* no output */
|
||||
bmo_reverse_colors_exec,
|
||||
0
|
||||
};
|
||||
@@ -925,9 +1050,12 @@ static BMOpDefine bmo_shortest_path_def = {
|
||||
"shortest_path",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "startv"}, /* start vertex */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "endv"}, /* end vertex */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output vertices */
|
||||
{BMO_OP_SLOT_INT, "type"}, /* type of selection */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output vertices */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_shortest_path_exec,
|
||||
0
|
||||
};
|
||||
@@ -940,11 +1068,14 @@ static BMOpDefine bmo_shortest_path_def = {
|
||||
static BMOpDefine bmo_split_edges_def = {
|
||||
"split_edges",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* old output disconnected edges */
|
||||
/* needed for vertex rip so we can rip only half an edge at a boundary wich would otherwise split off */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* optional tag verts, use to have greater control of splits */
|
||||
{BMO_OP_SLOT_BOOL, "use_verts"}, /* use 'verts' for splitting, else just find verts to split from edges */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* old output disconnected edges */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_split_edges_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -956,12 +1087,15 @@ static BMOpDefine bmo_split_edges_def = {
|
||||
*/
|
||||
static BMOpDefine bmo_create_grid_def = {
|
||||
"create_grid",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{BMO_OP_SLOT_INT, "xsegments"}, /* number of x segments */
|
||||
{{BMO_OP_SLOT_INT, "xsegments"}, /* number of x segments */
|
||||
{BMO_OP_SLOT_INT, "ysegments"}, /* number of y segments */
|
||||
{BMO_OP_SLOT_FLT, "size"}, /* size of the grid */
|
||||
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_create_grid_exec,
|
||||
0,
|
||||
};
|
||||
@@ -973,12 +1107,15 @@ static BMOpDefine bmo_create_grid_def = {
|
||||
*/
|
||||
static BMOpDefine bmo_create_uvsphere_def = {
|
||||
"create_uvsphere",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{BMO_OP_SLOT_INT, "segments"}, /* number of u segments */
|
||||
{{BMO_OP_SLOT_INT, "segments"}, /* number of u segments */
|
||||
{BMO_OP_SLOT_INT, "revolutions"}, /* number of v segment */
|
||||
{BMO_OP_SLOT_FLT, "diameter"}, /* diameter */
|
||||
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_create_uvsphere_exec,
|
||||
0,
|
||||
};
|
||||
@@ -990,11 +1127,14 @@ static BMOpDefine bmo_create_uvsphere_def = {
|
||||
*/
|
||||
static BMOpDefine bmo_create_icosphere_def = {
|
||||
"create_icosphere",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{BMO_OP_SLOT_INT, "subdivisions"}, /* how many times to recursively subdivide the sphere */
|
||||
{{BMO_OP_SLOT_INT, "subdivisions"}, /* how many times to recursively subdivide the sphere */
|
||||
{BMO_OP_SLOT_FLT, "diameter"}, /* diameter */
|
||||
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_create_icosphere_exec,
|
||||
0,
|
||||
};
|
||||
@@ -1006,9 +1146,12 @@ static BMOpDefine bmo_create_icosphere_def = {
|
||||
*/
|
||||
static BMOpDefine bmo_create_monkey_def = {
|
||||
"create_monkey",
|
||||
{{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_create_monkey_exec,
|
||||
0,
|
||||
};
|
||||
@@ -1020,15 +1163,18 @@ static BMOpDefine bmo_create_monkey_def = {
|
||||
*/
|
||||
static BMOpDefine bmo_create_cone_def = {
|
||||
"create_cone",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{BMO_OP_SLOT_BOOL, "cap_ends"}, /* wheter or not to fill in the ends with faces */
|
||||
{{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 */
|
||||
{BMO_OP_SLOT_FLT, "depth"}, /* distance between ends */
|
||||
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_create_cone_exec,
|
||||
0,
|
||||
};
|
||||
@@ -1038,13 +1184,16 @@ static BMOpDefine bmo_create_cone_def = {
|
||||
*/
|
||||
static BMOpDefine bmo_create_circle_def = {
|
||||
"create_circle",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{BMO_OP_SLOT_BOOL, "cap_ends"}, /* wheter or not to fill in the ends with faces */
|
||||
{{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-- */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_create_circle_exec,
|
||||
0,
|
||||
};
|
||||
@@ -1056,15 +1205,17 @@ static BMOpDefine bmo_create_circle_def = {
|
||||
*/
|
||||
static BMOpDefine bmo_create_cube_def = {
|
||||
"create_cube",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{BMO_OP_SLOT_FLT, "size"}, /* size of the cube */
|
||||
{{BMO_OP_SLOT_FLT, "size"}, /* size of the cube */
|
||||
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_create_cube_exec,
|
||||
0,
|
||||
};
|
||||
|
||||
#define NEW_BEVEL 1
|
||||
/*
|
||||
* Bevel
|
||||
*
|
||||
@@ -1072,13 +1223,15 @@ static BMOpDefine bmo_create_cube_def = {
|
||||
*/
|
||||
static BMOpDefine bmo_bevel_def = {
|
||||
"bevel",
|
||||
#ifdef NEW_BEVEL
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input edges and vertices */
|
||||
{BMO_OP_SLOT_FLT, "offset"}, /* amount to offset beveled edge */
|
||||
{BMO_OP_SLOT_INT, "segments"}, /* number of segments in bevel */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
|
||||
{0} /* null-terminating sentinel */},
|
||||
#else
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
#if 0 /* old 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 */
|
||||
@@ -1088,7 +1241,8 @@ static BMOpDefine bmo_bevel_def = {
|
||||
* 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 beveled edge */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
#endif
|
||||
bmo_bevel_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
@@ -1103,8 +1257,11 @@ static BMOpDefine bmo_beautify_fill_def = {
|
||||
"beautify_fill",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "constrain_edges"}, /* edges that can't be flipped */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* new flipped faces and edges */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* new flipped faces and edges */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_beautify_fill_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -1117,8 +1274,11 @@ static BMOpDefine bmo_beautify_fill_def = {
|
||||
static BMOpDefine bmo_triangle_fill_def = {
|
||||
"triangle_fill",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* new faces and edges */
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* new faces and edges */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_triangle_fill_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -1132,8 +1292,11 @@ static BMOpDefine bmo_solidify_def = {
|
||||
"solidify",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
|
||||
{BMO_OP_SLOT_FLT, "thickness"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
|
||||
{0}},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_solidify_face_region_exec,
|
||||
0
|
||||
};
|
||||
@@ -1146,14 +1309,17 @@ static BMOpDefine bmo_solidify_def = {
|
||||
static BMOpDefine bmo_inset_def = {
|
||||
"inset",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
|
||||
{BMO_OP_SLOT_BOOL, "use_boundary"},
|
||||
{BMO_OP_SLOT_BOOL, "use_even_offset"},
|
||||
{BMO_OP_SLOT_BOOL, "use_relative_offset"},
|
||||
{BMO_OP_SLOT_FLT, "thickness"},
|
||||
{BMO_OP_SLOT_FLT, "depth"},
|
||||
{BMO_OP_SLOT_BOOL, "use_outset"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_inset_exec,
|
||||
0
|
||||
};
|
||||
@@ -1166,14 +1332,17 @@ static BMOpDefine bmo_inset_def = {
|
||||
static BMOpDefine bmo_wireframe_def = {
|
||||
"wireframe",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
|
||||
{BMO_OP_SLOT_BOOL, "use_boundary"},
|
||||
{BMO_OP_SLOT_BOOL, "use_even_offset"},
|
||||
{BMO_OP_SLOT_BOOL, "use_crease"},
|
||||
{BMO_OP_SLOT_FLT, "thickness"},
|
||||
{BMO_OP_SLOT_BOOL, "use_relative_offset"},
|
||||
{BMO_OP_SLOT_FLT, "depth"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_wireframe_exec,
|
||||
0
|
||||
};
|
||||
@@ -1187,9 +1356,12 @@ static BMOpDefine bmo_slide_vert_def = {
|
||||
"slide_vert",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vert"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "edge"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "vertout"},
|
||||
{BMO_OP_SLOT_FLT, "distance_t"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "vertout"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_slide_vert_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES
|
||||
};
|
||||
@@ -1214,13 +1386,14 @@ static BMOpDefine bmo_convex_hull_def = {
|
||||
"convex_hull",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "input"},
|
||||
{BMO_OP_SLOT_BOOL, "use_existing_faces"},
|
||||
|
||||
/* Outputs */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "interior_geom"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "unused_geom"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "holes_geom"},
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "interior_geom_out"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "unused_geom_out"},
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "holes_geom_out"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_convex_hull_exec,
|
||||
0
|
||||
};
|
||||
@@ -1240,11 +1413,11 @@ static BMOpDefine bmo_symmetrize_def = {
|
||||
"symmetrize",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "input"},
|
||||
{BMO_OP_SLOT_INT, "direction"},
|
||||
|
||||
/* Outputs */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
|
||||
|
||||
{0} /* null-terminating sentinel */},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
|
||||
{0} /* null-terminating sentinel */,
|
||||
},
|
||||
bmo_symmetrize_exec,
|
||||
0
|
||||
};
|
||||
|
||||
@@ -116,6 +116,7 @@ enum {
|
||||
* for when your defining an operator with BMOpDefine.*/
|
||||
|
||||
typedef struct BMOpSlot {
|
||||
const char *slot_name; /* pointer to BMOpDefine.slot_args */
|
||||
int slot_type;
|
||||
int len;
|
||||
int flag;
|
||||
@@ -130,14 +131,16 @@ typedef struct BMOpSlot {
|
||||
} data;
|
||||
} BMOpSlot;
|
||||
|
||||
#define BMO_OP_MAX_SLOTS 16 /* way more than probably needed */
|
||||
/* way more than probably needed, compiler complains if limit hit */
|
||||
#define BMO_OP_MAX_SLOTS 16
|
||||
|
||||
typedef struct BMOperator {
|
||||
int type;
|
||||
int slot_type;
|
||||
int type_flag;
|
||||
int flag; /* runtime options */
|
||||
struct BMOpSlot slot_args[BMO_OP_MAX_SLOTS];
|
||||
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS];
|
||||
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS];
|
||||
void (*exec)(BMesh *bm, struct BMOperator *op);
|
||||
struct MemArena *arena;
|
||||
} BMOperator;
|
||||
@@ -156,8 +159,9 @@ typedef struct BMOSlotType {
|
||||
} BMOSlotType;
|
||||
|
||||
typedef struct BMOpDefine {
|
||||
const char *name;
|
||||
BMOSlotType slot_types[BMO_OP_MAX_SLOTS];
|
||||
const char *opname;
|
||||
BMOSlotType slot_types_in[BMO_OP_MAX_SLOTS];
|
||||
BMOSlotType slot_types_out[BMO_OP_MAX_SLOTS];
|
||||
void (*exec)(BMesh *bm, BMOperator *op);
|
||||
int type_flag;
|
||||
} BMOpDefine;
|
||||
@@ -245,15 +249,22 @@ int BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, ...
|
||||
int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, va_list vlist);
|
||||
|
||||
/* test whether a named slot exists */
|
||||
int BMO_slot_exists(BMOperator *op, const char *slot_name);
|
||||
int BMO_slot_exists(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
|
||||
|
||||
/* get a pointer to a slot. this may be removed layer on from the public API. */
|
||||
BMOpSlot *BMO_slot_get(BMOperator *op, const char *slot_name);
|
||||
BMOpSlot *BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
|
||||
|
||||
/* copies the data of a slot from one operator to another. src and dst are the
|
||||
* source/destination slot codes, respectively. */
|
||||
void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op,
|
||||
const char *src, const char *dst);
|
||||
#define BMO_slot_copy(op_src, slots_src, slot_name_src, \
|
||||
op_dst, slots_dst, slot_name_dst) \
|
||||
_bmo_slot_copy((op_src)->slots_src, slot_name_src, \
|
||||
(op_dst)->slots_dst, slot_name_dst, \
|
||||
(op_dst)->arena)
|
||||
|
||||
void _bmo_slot_copy(BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
|
||||
BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
|
||||
struct MemArena *arena_dst);
|
||||
|
||||
/* del "context" slot values, used for operator too */
|
||||
enum {
|
||||
@@ -279,13 +290,13 @@ typedef enum {
|
||||
void BMO_op_flag_enable(BMesh *bm, BMOperator *op, const int op_flag);
|
||||
void BMO_op_flag_disable(BMesh *bm, BMOperator *op, const int op_flag);
|
||||
|
||||
void BMO_slot_float_set(BMOperator *op, const char *slot_name, const float f);
|
||||
float BMO_slot_float_get(BMOperator *op, const char *slot_name);
|
||||
void BMO_slot_int_set(BMOperator *op, const char *slot_name, const int i);
|
||||
int BMO_slot_int_get(BMOperator *op, const char *slot_name);
|
||||
void BMO_slot_bool_set(BMOperator *op, const char *slot_name, const int i);
|
||||
int BMO_slot_bool_get(BMOperator *op, const char *slot_name);
|
||||
void *BMO_slot_as_arrayN(BMOperator *op, const char *slot_name, int *len);
|
||||
void BMO_slot_float_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float f);
|
||||
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
|
||||
void BMO_slot_int_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i);
|
||||
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
|
||||
void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i);
|
||||
int BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
|
||||
void *BMO_slot_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, int *len);
|
||||
|
||||
|
||||
/* don't pass in arrays that are supposed to map to elements this way.
|
||||
@@ -293,68 +304,80 @@ void *BMO_slot_as_arrayN(BMOperator *op, const char *slot_name, int *len);
|
||||
* so, e.g. passing in list of floats per element in another slot is bad.
|
||||
* passing in, e.g. pointer to an editmesh for the conversion operator is fine
|
||||
* though. */
|
||||
void BMO_slot_ptr_set(BMOperator *op, const char *slot_name, void *p);
|
||||
void *BMO_slot_ptr_get(BMOperator *op, const char *slot_name);
|
||||
void BMO_slot_vec_set(BMOperator *op, const char *slot_name, const float vec[3]);
|
||||
void BMO_slot_vec_get(BMOperator *op, const char *slot_name, float r_vec[3]);
|
||||
void BMO_slot_ptr_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, void *p);
|
||||
void *BMO_slot_ptr_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
|
||||
void BMO_slot_vec_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float vec[3]);
|
||||
void BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_vec[3]);
|
||||
|
||||
/* only supports square mats */
|
||||
/* size must be 3 or 4; this api is meant only for transformation matrices.
|
||||
* note that internally the matrix is stored in 4x4 form, and it's safe to
|
||||
* call whichever BMO_Get_MatXXX function you want. */
|
||||
void BMO_slot_mat_set(BMOperator *op, const char *slot_name, const float *mat, int size);
|
||||
void BMO_slot_mat4_get(BMOperator *op, const char *slot_name, float r_mat[4][4]);
|
||||
void BMO_slot_mat3_set(BMOperator *op, const char *slot_name, float r_mat[3][3]);
|
||||
void BMO_slot_mat_set(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float *mat, int size);
|
||||
void BMO_slot_mat4_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[4][4]);
|
||||
void BMO_slot_mat3_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[3][3]);
|
||||
|
||||
void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *op, const char htype, const short oflag);
|
||||
|
||||
/* copies the values from another slot to the end of the output slot */
|
||||
void BMO_slot_buffer_append(BMOperator *output_op, const char *output_op_slot,
|
||||
BMOperator *other_op, const char *other_op_slot);
|
||||
#define BMO_slot_buffer_append(op_src, slots_src, slot_name_src, \
|
||||
op_dst, slots_dst, slot_name_dst) \
|
||||
_bmo_slot_buffer_append((op_src)->slots_src, slot_name_src, \
|
||||
(op_dst)->slots_dst, slot_name_dst, \
|
||||
(op_dst)->arena)
|
||||
void _bmo_slot_buffer_append(BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
|
||||
BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
|
||||
struct MemArena *arena_dst);
|
||||
|
||||
/* puts every element of type 'type' (which is a bitmask) with tool
|
||||
* flag 'flag', into a slot. */
|
||||
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const short oflag);
|
||||
|
||||
/* puts every element of type 'type' (which is a bitmask) without tool
|
||||
* flag 'flag', into a slot. */
|
||||
void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const short oflag);
|
||||
|
||||
/* tool-flags all elements inside an element slot array with flag flag. */
|
||||
void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_flag_enable(BMesh *bm,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const short oflag);
|
||||
/* clears tool-flag flag from all elements inside a slot array. */
|
||||
void BMO_slot_buffer_flag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_flag_disable(BMesh *bm,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const short oflag);
|
||||
|
||||
/* tool-flags all elements inside an element slot array with flag flag. */
|
||||
void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_hflag_enable(BMesh *bm,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const char hflag, const char do_flush);
|
||||
/* clears tool-flag flag from all elements inside a slot array. */
|
||||
void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_hflag_disable(BMesh *bm,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const char hflag, const char do_flush);
|
||||
|
||||
/* puts every element of type 'type' (which is a bitmask) with header
|
||||
* flag 'flag', into a slot. note: ignores hidden elements
|
||||
* (e.g. elements with header flag BM_ELEM_HIDDEN set).*/
|
||||
void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op,
|
||||
const char *slot_name,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const char hflag);
|
||||
|
||||
/* puts every element of type 'type' (which is a bitmask) without
|
||||
* header flag 'flag', into a slot. note: ignores hidden elements
|
||||
* (e.g. elements with header flag BM_ELEM_HIDDEN set).*/
|
||||
void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op,
|
||||
const char *slot_name,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const char hflag);
|
||||
|
||||
/* counts number of elements inside a slot array. */
|
||||
int BMO_slot_buffer_count(BMesh *bm, BMOperator *op, const char *slot_name);
|
||||
int BMO_slot_map_count(BMesh *bm, BMOperator *op, const char *slot_name);
|
||||
int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
|
||||
int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
|
||||
|
||||
void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_map_insert(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
void *element, void *data, int len);
|
||||
|
||||
/* Counts the number of edges with tool flag toolflag around
|
||||
@@ -363,13 +386,14 @@ int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag);
|
||||
|
||||
/* flags all elements in a mapping. note that the mapping must only have
|
||||
* bmesh elements in it.*/
|
||||
void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
const char hflag, const short oflag);
|
||||
void BMO_slot_map_to_flag(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
|
||||
const char *slot_name, const char hflag, const short oflag);
|
||||
|
||||
void *BMO_slot_buffer_alloc(BMOperator *op, const char *slot_name, const int len);
|
||||
void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
|
||||
const char *slot_name, const int len);
|
||||
|
||||
void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
const char htype);
|
||||
void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
|
||||
const char *slot_name, const char htype);
|
||||
|
||||
/* this part of the API is used to iterate over element buffer or
|
||||
* mapping slots.
|
||||
@@ -412,10 +436,11 @@ typedef struct BMOIter {
|
||||
char restrictmask; /* bitwise '&' with BMHeader.htype */
|
||||
} BMOIter;
|
||||
|
||||
void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slot_name);
|
||||
void *BMO_slot_buffer_elem_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
|
||||
|
||||
void *BMO_iter_new(BMOIter *iter, BMesh *bm, BMOperator *op,
|
||||
const char *slot_name, const char restrictmask);
|
||||
void *BMO_iter_new(BMOIter *iter,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char restrictmask);
|
||||
void *BMO_iter_step(BMOIter *iter);
|
||||
|
||||
/* returns a pointer to the key value when iterating over mappings.
|
||||
@@ -428,8 +453,8 @@ void *BMO_iter_map_value_p(BMOIter *iter);
|
||||
/* use this for float mappings */
|
||||
float BMO_iter_map_value_f(BMOIter *iter);
|
||||
|
||||
#define BMO_ITER(ele, iter, bm, op, slot_name, restrict) \
|
||||
for (ele = BMO_iter_new(iter, bm, op, slot_name, restrict); ele; ele = BMO_iter_step(iter))
|
||||
#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag) \
|
||||
for (ele = BMO_iter_new(iter, slot_args, slot_name, restrict_flag); ele; ele = BMO_iter_step(iter))
|
||||
|
||||
/******************* Inlined Functions********************/
|
||||
typedef void (*opexec)(BMesh *bm, BMOperator *op);
|
||||
|
||||
@@ -69,16 +69,18 @@ BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const shor
|
||||
oflags[bm->stackdepth - 1].f ^= oflag;
|
||||
}
|
||||
|
||||
BLI_INLINE void BMO_slot_map_int_insert(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
BLI_INLINE void BMO_slot_map_int_insert(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
|
||||
const char *slot_name,
|
||||
void *element, int val)
|
||||
{
|
||||
BMO_slot_map_insert(bm, op, slot_name, element, &val, sizeof(int));
|
||||
BMO_slot_map_insert(op, slot_args, slot_name, element, &val, sizeof(int));
|
||||
}
|
||||
|
||||
BLI_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
BLI_INLINE void BMO_slot_map_float_insert(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
|
||||
const char *slot_name,
|
||||
void *element, float val)
|
||||
{
|
||||
BMO_slot_map_insert(bm, op, slot_name, element, &val, sizeof(float));
|
||||
BMO_slot_map_insert(op, slot_args, slot_name, element, &val, sizeof(float));
|
||||
}
|
||||
|
||||
|
||||
@@ -87,15 +89,16 @@ BLI_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char
|
||||
* do NOT use these for non-operator-api-allocated memory! instead
|
||||
* use BMO_slot_map_data_get and BMO_slot_map_insert, which copies the data. */
|
||||
|
||||
BLI_INLINE void BMO_slot_map_ptr_insert(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
BLI_INLINE void BMO_slot_map_ptr_insert(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
|
||||
const char *slot_name,
|
||||
void *element, void *val)
|
||||
{
|
||||
BMO_slot_map_insert(bm, op, slot_name, element, &val, sizeof(void *));
|
||||
BMO_slot_map_insert(op, slot_args, slot_name, element, &val, sizeof(void *));
|
||||
}
|
||||
|
||||
BLI_INLINE int BMO_slot_map_contains(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name, void *element)
|
||||
BLI_INLINE int BMO_slot_map_contains(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, void *element)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
|
||||
|
||||
/* sanity check */
|
||||
@@ -104,11 +107,11 @@ BLI_INLINE int BMO_slot_map_contains(BMesh *UNUSED(bm), BMOperator *op, const ch
|
||||
return BLI_ghash_haskey(slot->data.ghash, element);
|
||||
}
|
||||
|
||||
BLI_INLINE void *BMO_slot_map_data_get(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name,
|
||||
BLI_INLINE void *BMO_slot_map_data_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
void *element)
|
||||
{
|
||||
BMOElemMapping *mapping;
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
|
||||
|
||||
/* sanity check */
|
||||
@@ -121,28 +124,28 @@ BLI_INLINE void *BMO_slot_map_data_get(BMesh *UNUSED(bm), BMOperator *op, const
|
||||
return mapping + 1;
|
||||
}
|
||||
|
||||
BLI_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
BLI_INLINE float BMO_slot_map_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
void *element)
|
||||
{
|
||||
float *val = (float *) BMO_slot_map_data_get(bm, op, slot_name, element);
|
||||
float *val = (float *) BMO_slot_map_data_get(slot_args, slot_name, element);
|
||||
if (val) return *val;
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
BLI_INLINE int BMO_slot_map_int_get(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
BLI_INLINE int BMO_slot_map_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
void *element)
|
||||
{
|
||||
int *val = (int *) BMO_slot_map_data_get(bm, op, slot_name, element);
|
||||
int *val = (int *) BMO_slot_map_data_get(slot_args, slot_name, element);
|
||||
if (val) return *val;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BLI_INLINE void *BMO_slot_map_ptr_get(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
BLI_INLINE void *BMO_slot_map_ptr_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
void *element)
|
||||
{
|
||||
void **val = (void **) BMO_slot_map_data_get(bm, op, slot_name, element);
|
||||
void **val = (void **) BMO_slot_map_data_get(slot_args, slot_name, element);
|
||||
if (val) return *val;
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
static void bmo_flag_layer_alloc(BMesh *bm);
|
||||
static void bmo_flag_layer_free(BMesh *bm);
|
||||
static void bmo_flag_layer_clear(BMesh *bm);
|
||||
static int bmo_name_to_slotcode(BMOpDefine *def, const char *name);
|
||||
static int bmo_name_to_slotcode_check(BMOpDefine *def, const char *name);
|
||||
static int bmo_name_to_slotcode(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
|
||||
static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
|
||||
static int bmo_opname_to_opcode(const char *opname);
|
||||
|
||||
static const char *bmo_error_messages[] = {
|
||||
@@ -125,6 +125,18 @@ void BMO_pop(BMesh *bm)
|
||||
bm->stackdepth--;
|
||||
}
|
||||
|
||||
|
||||
/* use for both slot_types_in and slot_types_out */
|
||||
static void bmo_op_slots_init(BMOSlotType *slot_types, BMOpSlot *slot_args)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; slot_types[i].type; i++) {
|
||||
slot_args[i].slot_name = slot_types[i].name;
|
||||
slot_args[i].slot_type = slot_types[i].type;
|
||||
slot_args[i].index = i;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief BMESH OPSTACK INIT OP
|
||||
*
|
||||
@@ -132,7 +144,7 @@ void BMO_pop(BMesh *bm)
|
||||
*/
|
||||
void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
|
||||
{
|
||||
int i, opcode = bmo_opname_to_opcode(opname);
|
||||
int opcode = bmo_opname_to_opcode(opname);
|
||||
|
||||
#ifdef DEBUG
|
||||
BM_ELEM_INDEX_VALIDATE(bm, "pre bmo", opname);
|
||||
@@ -150,10 +162,8 @@ void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
|
||||
op->flag = flag;
|
||||
|
||||
/* initialize the operator slot types */
|
||||
for (i = 0; opdefines[opcode]->slot_types[i].type; i++) {
|
||||
op->slot_args[i].slot_type = opdefines[opcode]->slot_types[i].type;
|
||||
op->slot_args[i].index = i;
|
||||
}
|
||||
bmo_op_slots_init(opdefines[opcode]->slot_types_in, op->slots_in);
|
||||
bmo_op_slots_init(opdefines[opcode]->slot_types_out, op->slots_out);
|
||||
|
||||
/* callback */
|
||||
op->exec = opdefines[opcode]->exec;
|
||||
@@ -189,6 +199,20 @@ void BMO_op_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_pop(bm);
|
||||
}
|
||||
|
||||
static void bmo_op_slots_free(BMOSlotType *slot_types, BMOpSlot *slot_args)
|
||||
{
|
||||
BMOpSlot *slot;
|
||||
unsigned int i;
|
||||
for (i = 0; slot_types[i].type; i++) {
|
||||
slot = &slot_args[i];
|
||||
if (slot->slot_type == BMO_OP_SLOT_MAPPING) {
|
||||
if (slot->data.ghash) {
|
||||
BLI_ghash_free(slot->data.ghash, NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief BMESH OPSTACK FINISH OP
|
||||
*
|
||||
@@ -196,21 +220,13 @@ void BMO_op_exec(BMesh *bm, BMOperator *op)
|
||||
*/
|
||||
void BMO_op_finish(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
BMOpSlot *slot;
|
||||
int i;
|
||||
|
||||
for (i = 0; opdefines[op->type]->slot_types[i].type; i++) {
|
||||
slot = &op->slot_args[i];
|
||||
if (slot->slot_type == BMO_OP_SLOT_MAPPING) {
|
||||
if (slot->data.ghash)
|
||||
BLI_ghash_free(slot->data.ghash, NULL, NULL);
|
||||
}
|
||||
}
|
||||
bmo_op_slots_free(opdefines[op->type]->slot_types_in, op->slots_in);
|
||||
bmo_op_slots_free(opdefines[op->type]->slot_types_out, op->slots_out);
|
||||
|
||||
BLI_memarena_free(op->arena);
|
||||
|
||||
#ifdef DEBUG
|
||||
BM_ELEM_INDEX_VALIDATE(bm, "post bmo", opdefines[op->type]->name);
|
||||
BM_ELEM_INDEX_VALIDATE(bm, "post bmo", opdefines[op->type]->opname);
|
||||
#else
|
||||
(void)bm;
|
||||
#endif
|
||||
@@ -221,9 +237,9 @@ void BMO_op_finish(BMesh *bm, BMOperator *op)
|
||||
*
|
||||
* \return Success if the slot if found.
|
||||
*/
|
||||
int BMO_slot_exists(BMOperator *op, const char *slot_name)
|
||||
int BMO_slot_exists(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
|
||||
{
|
||||
int slot_code = bmo_name_to_slotcode(opdefines[op->type], slot_name);
|
||||
int slot_code = bmo_name_to_slotcode(slot_args, identifier);
|
||||
return (slot_code >= 0);
|
||||
}
|
||||
|
||||
@@ -232,73 +248,76 @@ int BMO_slot_exists(BMOperator *op, const char *slot_name)
|
||||
*
|
||||
* Returns a pointer to the slot of type 'slot_code'
|
||||
*/
|
||||
BMOpSlot *BMO_slot_get(BMOperator *op, const char *slot_name)
|
||||
BMOpSlot *BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
|
||||
{
|
||||
int slot_code = bmo_name_to_slotcode_check(opdefines[op->type], slot_name);
|
||||
int slot_code = bmo_name_to_slotcode_check(slot_args, identifier);
|
||||
|
||||
if (slot_code < 0) {
|
||||
return &BMOpEmptySlot;
|
||||
}
|
||||
|
||||
return &(op->slot_args[slot_code]);
|
||||
return &slot_args[slot_code];
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief BMESH OPSTACK COPY SLOT
|
||||
*
|
||||
* define used.
|
||||
* Copies data from one slot to another.
|
||||
*/
|
||||
void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op, const char *src, const char *dst)
|
||||
void _bmo_slot_copy(BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
|
||||
BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
|
||||
struct MemArena *arena_dst)
|
||||
{
|
||||
BMOpSlot *source_slot = BMO_slot_get(source_op, src);
|
||||
BMOpSlot *dest_slot = BMO_slot_get(dest_op, dst);
|
||||
BMOpSlot *slot_src = BMO_slot_get(slot_args_src, slot_name_src);
|
||||
BMOpSlot *slot_dst = BMO_slot_get(slot_args_dst, slot_name_dst);
|
||||
|
||||
if (source_slot == dest_slot)
|
||||
if (slot_src == slot_dst)
|
||||
return;
|
||||
|
||||
if (source_slot->slot_type != dest_slot->slot_type) {
|
||||
/* possibly assert here? */
|
||||
BLI_assert(slot_src->slot_type == slot_dst->slot_type);
|
||||
if (slot_src->slot_type != slot_dst->slot_type) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dest_slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF) {
|
||||
if (slot_dst->slot_type == BMO_OP_SLOT_ELEMENT_BUF) {
|
||||
/* do buffer copy */
|
||||
dest_slot->data.buf = NULL;
|
||||
dest_slot->len = source_slot->len;
|
||||
if (dest_slot->len) {
|
||||
const int slot_alloc_size = BMO_OPSLOT_TYPEINFO[dest_slot->slot_type] * dest_slot->len;
|
||||
dest_slot->data.buf = BLI_memarena_alloc(dest_op->arena, slot_alloc_size);
|
||||
memcpy(dest_slot->data.buf, source_slot->data.buf, slot_alloc_size);
|
||||
slot_dst->data.buf = NULL;
|
||||
slot_dst->len = slot_src->len;
|
||||
if (slot_dst->len) {
|
||||
const int slot_alloc_size = BMO_OPSLOT_TYPEINFO[slot_dst->slot_type] * slot_dst->len;
|
||||
slot_dst->data.buf = BLI_memarena_alloc(arena_dst, slot_alloc_size);
|
||||
memcpy(slot_dst->data.buf, slot_src->data.buf, slot_alloc_size);
|
||||
}
|
||||
}
|
||||
else if (dest_slot->slot_type == BMO_OP_SLOT_MAPPING) {
|
||||
else if (slot_dst->slot_type == BMO_OP_SLOT_MAPPING) {
|
||||
GHashIterator it;
|
||||
BMOElemMapping *srcmap, *dstmap;
|
||||
|
||||
/* sanity check */
|
||||
if (!source_slot->data.ghash) {
|
||||
if (!slot_src->data.ghash) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dest_slot->data.ghash) {
|
||||
dest_slot->data.ghash = BLI_ghash_ptr_new("bmesh operator 2");
|
||||
if (!slot_dst->data.ghash) {
|
||||
slot_dst->data.ghash = BLI_ghash_ptr_new("bmesh operator 2");
|
||||
}
|
||||
|
||||
BLI_ghashIterator_init(&it, source_slot->data.ghash);
|
||||
for ( ; (srcmap = BLI_ghashIterator_getValue(&it));
|
||||
BLI_ghashIterator_step(&it))
|
||||
for (BLI_ghashIterator_init(&it, slot_src->data.ghash);
|
||||
(srcmap = BLI_ghashIterator_getValue(&it));
|
||||
BLI_ghashIterator_step(&it))
|
||||
{
|
||||
dstmap = BLI_memarena_alloc(dest_op->arena, sizeof(*dstmap) + srcmap->len);
|
||||
dstmap = BLI_memarena_alloc(arena_dst, sizeof(*dstmap) + srcmap->len);
|
||||
|
||||
dstmap->element = srcmap->element;
|
||||
dstmap->len = srcmap->len;
|
||||
memcpy(dstmap + 1, srcmap + 1, srcmap->len);
|
||||
|
||||
BLI_ghash_insert(dest_slot->data.ghash, dstmap->element, dstmap);
|
||||
BLI_ghash_insert(slot_dst->data.ghash, dstmap->element, dstmap);
|
||||
}
|
||||
}
|
||||
else {
|
||||
dest_slot->data = source_slot->data;
|
||||
slot_dst->data = slot_src->data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,9 +327,9 @@ void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op, const char *src,
|
||||
* Sets the value of a slot depending on it's type
|
||||
*/
|
||||
|
||||
void BMO_slot_float_set(BMOperator *op, const char *slot_name, const float f)
|
||||
void BMO_slot_float_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float f)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_FLT);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_FLT))
|
||||
return;
|
||||
@@ -318,9 +337,9 @@ void BMO_slot_float_set(BMOperator *op, const char *slot_name, const float f)
|
||||
slot->data.f = f;
|
||||
}
|
||||
|
||||
void BMO_slot_int_set(BMOperator *op, const char *slot_name, const int i)
|
||||
void BMO_slot_int_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_INT);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_INT))
|
||||
return;
|
||||
@@ -328,9 +347,9 @@ void BMO_slot_int_set(BMOperator *op, const char *slot_name, const int i)
|
||||
slot->data.i = i;
|
||||
}
|
||||
|
||||
void BMO_slot_bool_set(BMOperator *op, const char *slot_name, const int i)
|
||||
void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_BOOL);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_BOOL))
|
||||
return;
|
||||
@@ -339,9 +358,9 @@ void BMO_slot_bool_set(BMOperator *op, const char *slot_name, const int i)
|
||||
}
|
||||
|
||||
/* only supports square mats */
|
||||
void BMO_slot_mat_set(BMOperator *op, const char *slot_name, const float *mat, int size)
|
||||
void BMO_slot_mat_set(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float *mat, int size)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_MAT))
|
||||
return;
|
||||
@@ -362,9 +381,9 @@ void BMO_slot_mat_set(BMOperator *op, const char *slot_name, const float *mat, i
|
||||
}
|
||||
}
|
||||
|
||||
void BMO_slot_mat4_get(BMOperator *op, const char *slot_name, float r_mat[4][4])
|
||||
void BMO_slot_mat4_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[4][4])
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_MAT))
|
||||
return;
|
||||
@@ -377,9 +396,9 @@ void BMO_slot_mat4_get(BMOperator *op, const char *slot_name, float r_mat[4][4])
|
||||
}
|
||||
}
|
||||
|
||||
void BMO_slot_mat3_set(BMOperator *op, const char *slot_name, float r_mat[3][3])
|
||||
void BMO_slot_mat3_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[3][3])
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_MAT))
|
||||
return;
|
||||
@@ -392,9 +411,9 @@ void BMO_slot_mat3_set(BMOperator *op, const char *slot_name, float r_mat[3][3])
|
||||
}
|
||||
}
|
||||
|
||||
void BMO_slot_ptr_set(BMOperator *op, const char *slot_name, void *p)
|
||||
void BMO_slot_ptr_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, void *p)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_PTR);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_PTR))
|
||||
return;
|
||||
@@ -402,9 +421,9 @@ void BMO_slot_ptr_set(BMOperator *op, const char *slot_name, void *p)
|
||||
slot->data.p = p;
|
||||
}
|
||||
|
||||
void BMO_slot_vec_set(BMOperator *op, const char *slot_name, const float vec[3])
|
||||
void BMO_slot_vec_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float vec[3])
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_VEC);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_VEC))
|
||||
return;
|
||||
@@ -413,9 +432,9 @@ void BMO_slot_vec_set(BMOperator *op, const char *slot_name, const float vec[3])
|
||||
}
|
||||
|
||||
|
||||
float BMO_slot_float_get(BMOperator *op, const char *slot_name)
|
||||
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_FLT);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_FLT))
|
||||
return 0.0f;
|
||||
@@ -423,9 +442,9 @@ float BMO_slot_float_get(BMOperator *op, const char *slot_name)
|
||||
return slot->data.f;
|
||||
}
|
||||
|
||||
int BMO_slot_int_get(BMOperator *op, const char *slot_name)
|
||||
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_INT);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_INT))
|
||||
return 0;
|
||||
@@ -433,9 +452,9 @@ int BMO_slot_int_get(BMOperator *op, const char *slot_name)
|
||||
return slot->data.i;
|
||||
}
|
||||
|
||||
int BMO_slot_bool_get(BMOperator *op, const char *slot_name)
|
||||
int BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_BOOL);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_BOOL))
|
||||
return 0;
|
||||
@@ -444,9 +463,9 @@ int BMO_slot_bool_get(BMOperator *op, const char *slot_name)
|
||||
}
|
||||
|
||||
/* if you want a copy of the elem buffer */
|
||||
void *BMO_slot_as_arrayN(BMOperator *op, const char *slot_name, int *len)
|
||||
void *BMO_slot_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, int *len)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
void *ret;
|
||||
|
||||
/* could add support for mapping type */
|
||||
@@ -458,9 +477,9 @@ void *BMO_slot_as_arrayN(BMOperator *op, const char *slot_name, int *len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *BMO_slot_ptr_get(BMOperator *op, const char *slot_name)
|
||||
void *BMO_slot_ptr_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_PTR);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_PTR))
|
||||
return NULL;
|
||||
@@ -468,9 +487,9 @@ void *BMO_slot_ptr_get(BMOperator *op, const char *slot_name)
|
||||
return slot->data.p;
|
||||
}
|
||||
|
||||
void BMO_slot_vec_get(BMOperator *op, const char *slot_name, float r_vec[3])
|
||||
void BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_vec[3])
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_VEC);
|
||||
if (!(slot->slot_type == BMO_OP_SLOT_VEC))
|
||||
return;
|
||||
@@ -546,9 +565,9 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char hty
|
||||
}
|
||||
}
|
||||
|
||||
int BMO_slot_buffer_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name)
|
||||
int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
|
||||
|
||||
/* check if its actually a buffer */
|
||||
@@ -558,9 +577,9 @@ int BMO_slot_buffer_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_na
|
||||
return slot->len;
|
||||
}
|
||||
|
||||
int BMO_slot_map_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name)
|
||||
int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
|
||||
|
||||
/* check if its actually a buffer */
|
||||
@@ -573,12 +592,13 @@ int BMO_slot_map_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name)
|
||||
/* inserts a key/value mapping into a mapping slot. note that it copies the
|
||||
* value, it doesn't store a reference to it. */
|
||||
|
||||
void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_map_insert(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
void *element, void *data, int len)
|
||||
{
|
||||
BMOElemMapping *mapping;
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
|
||||
BLI_assert(op->slots_in == slot_args || op->slots_out == slot_args);
|
||||
|
||||
mapping = (BMOElemMapping *) BLI_memarena_alloc(op->arena, sizeof(*mapping) + len);
|
||||
|
||||
@@ -636,11 +656,11 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slot_code, int totadd)
|
||||
}
|
||||
#endif
|
||||
|
||||
void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_map_to_flag(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const short oflag)
|
||||
{
|
||||
GHashIterator it;
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BMElemF *ele_f;
|
||||
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
|
||||
@@ -656,10 +676,9 @@ void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
}
|
||||
}
|
||||
|
||||
void *BMO_slot_buffer_alloc(BMOperator *op, const char *slot_name, const int len)
|
||||
void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int len)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
|
||||
/* check if its actually a buffer */
|
||||
if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
|
||||
@@ -676,9 +695,10 @@ void *BMO_slot_buffer_alloc(BMOperator *op, const char *slot_name, const int len
|
||||
*
|
||||
* Copies all elements of a certain type into an operator slot.
|
||||
*/
|
||||
void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name, const char htype)
|
||||
void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
|
||||
const char *slot_name, const char htype)
|
||||
{
|
||||
BMOpSlot *output = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *output = BMO_slot_get(slot_args, slot_name);
|
||||
int totelement = 0, i = 0;
|
||||
|
||||
if (htype & BM_VERT) totelement += bm->totvert;
|
||||
@@ -689,7 +709,7 @@ void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
BMIter iter;
|
||||
BMHeader *ele;
|
||||
|
||||
BMO_slot_buffer_alloc(op, slot_name, totelement);
|
||||
BMO_slot_buffer_alloc(op, slot_args, slot_name, totelement);
|
||||
|
||||
/* TODO - collapse these loops into one */
|
||||
|
||||
@@ -722,11 +742,11 @@ void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
* Copies elements of a certain type, which have a certain header flag
|
||||
* enabled/disabled into a slot for an operator.
|
||||
*/
|
||||
static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const char hflag,
|
||||
const short test_for_enabled)
|
||||
{
|
||||
BMOpSlot *output = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *output = BMO_slot_get(slot_args, slot_name);
|
||||
int totelement = 0, i = 0;
|
||||
const int respecthide = (op->flag & BMO_FLAG_RESPECT_HIDE) != 0;
|
||||
|
||||
@@ -741,7 +761,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
|
||||
BMIter iter;
|
||||
BMElem *ele;
|
||||
|
||||
BMO_slot_buffer_alloc(op, slot_name, totelement);
|
||||
BMO_slot_buffer_alloc(op, slot_args, slot_name, totelement);
|
||||
|
||||
/* TODO - collapse these loops into one */
|
||||
|
||||
@@ -783,46 +803,51 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
|
||||
}
|
||||
}
|
||||
|
||||
void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const char hflag)
|
||||
{
|
||||
bmo_slot_buffer_from_hflag(bm, op, slot_name, htype, hflag, TRUE);
|
||||
bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, TRUE);
|
||||
}
|
||||
|
||||
void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const char hflag)
|
||||
{
|
||||
bmo_slot_buffer_from_hflag(bm, op, slot_name, htype, hflag, FALSE);
|
||||
bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the values from another slot to the end of the output slot.
|
||||
*/
|
||||
void BMO_slot_buffer_append(BMOperator *output_op, const char *output_slot_name,
|
||||
BMOperator *other_op, const char *other_slot_name)
|
||||
void _bmo_slot_buffer_append(BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
|
||||
BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
|
||||
struct MemArena *arena_dst)
|
||||
{
|
||||
BMOpSlot *output_slot = BMO_slot_get(output_op, output_slot_name);
|
||||
BMOpSlot *other_slot = BMO_slot_get(other_op, other_slot_name);
|
||||
BMOpSlot *slot_dst = BMO_slot_get(slot_args_dst, slot_name_dst);
|
||||
BMOpSlot *slot_src = BMO_slot_get(slot_args_src, slot_name_src);
|
||||
|
||||
BLI_assert(output_slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF &&
|
||||
other_slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
|
||||
BLI_assert(slot_dst->slot_type == BMO_OP_SLOT_ELEMENT_BUF &&
|
||||
slot_src->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
|
||||
|
||||
if (output_slot->len == 0) {
|
||||
if (slot_dst->len == 0) {
|
||||
/* output slot is empty, copy rather than append */
|
||||
BMO_slot_copy(other_op, output_op, other_slot_name, output_slot_name);
|
||||
_bmo_slot_copy(slot_args_src, slot_name_src,
|
||||
slot_args_dst, slot_name_dst,
|
||||
arena_dst);
|
||||
}
|
||||
else if (other_slot->len != 0) {
|
||||
int elem_size = BMO_OPSLOT_TYPEINFO[output_slot->slot_type];
|
||||
int alloc_size = elem_size * (output_slot->len + other_slot->len);
|
||||
else if (slot_src->len != 0) {
|
||||
int elem_size = BMO_OPSLOT_TYPEINFO[slot_dst->slot_type];
|
||||
int alloc_size = elem_size * (slot_dst->len + slot_src->len);
|
||||
/* allocate new buffer */
|
||||
void *buf = BLI_memarena_alloc(output_op->arena, alloc_size);
|
||||
void *buf = BLI_memarena_alloc(arena_dst, alloc_size);
|
||||
|
||||
/* copy slot data */
|
||||
memcpy(buf, output_slot->data.buf, elem_size * output_slot->len);
|
||||
memcpy(((char *)buf) + elem_size * output_slot->len, other_slot->data.buf, elem_size * other_slot->len);
|
||||
memcpy(buf, slot_dst->data.buf, elem_size * slot_dst->len);
|
||||
memcpy(((char *)buf) + elem_size * slot_dst->len, slot_src->data.buf, elem_size * slot_src->len);
|
||||
|
||||
output_slot->data.buf = buf;
|
||||
output_slot->len += other_slot->len;
|
||||
slot_dst->data.buf = buf;
|
||||
slot_dst->len += slot_src->len;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -832,13 +857,15 @@ void BMO_slot_buffer_append(BMOperator *output_op, const char *output_slot_name,
|
||||
* Copies elements of a certain type, which have a certain flag set
|
||||
* into an output slot for an operator.
|
||||
*/
|
||||
static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const short oflag,
|
||||
const short test_for_enabled)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
int totelement, i = 0;
|
||||
|
||||
BLI_assert(op->slots_in == slot_args || op->slots_out == slot_args);
|
||||
BLI_assert(ELEM(TRUE, FALSE, test_for_enabled));
|
||||
|
||||
if (test_for_enabled)
|
||||
@@ -853,7 +880,7 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo
|
||||
BMHeader *ele;
|
||||
BMHeader **ele_array;
|
||||
|
||||
BMO_slot_buffer_alloc(op, slot_name, totelement);
|
||||
BMO_slot_buffer_alloc(op, slot_args, slot_name, totelement);
|
||||
|
||||
ele_array = (BMHeader **)slot->data.p;
|
||||
|
||||
@@ -891,16 +918,18 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo
|
||||
}
|
||||
}
|
||||
|
||||
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const short oflag)
|
||||
{
|
||||
bmo_slot_buffer_from_flag(bm, op, slot_name, htype, oflag, TRUE);
|
||||
bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, TRUE);
|
||||
}
|
||||
|
||||
void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const short oflag)
|
||||
{
|
||||
bmo_slot_buffer_from_flag(bm, op, slot_name, htype, oflag, FALSE);
|
||||
bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -909,10 +938,11 @@ void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op, const char *s
|
||||
* Header Flags elements in a slots buffer, automatically
|
||||
* using the selection API where appropriate.
|
||||
*/
|
||||
void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_hflag_enable(BMesh *bm,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const char hflag, const char do_flush)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BMElem **data = slot->data.p;
|
||||
int i;
|
||||
const char do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
|
||||
@@ -942,10 +972,11 @@ void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slot_na
|
||||
* Removes flags from elements in a slots buffer, automatically
|
||||
* using the selection API where appropriate.
|
||||
*/
|
||||
void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_hflag_disable(BMesh *bm,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const char hflag, const char do_flush)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BMElem **data = slot->data.p;
|
||||
int i;
|
||||
const char do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
|
||||
@@ -993,10 +1024,11 @@ int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag)
|
||||
*
|
||||
* Flags elements in a slots buffer
|
||||
*/
|
||||
void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_flag_enable(BMesh *bm,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const short oflag)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BMHeader **data = slot->data.p;
|
||||
int i;
|
||||
|
||||
@@ -1015,10 +1047,11 @@ void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slot_nam
|
||||
*
|
||||
* Removes flags from elements in a slots buffer
|
||||
*/
|
||||
void BMO_slot_buffer_flag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
|
||||
void BMO_slot_buffer_flag_disable(BMesh *bm,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char htype, const short oflag)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BMHeader **data = slot->data.p;
|
||||
int i;
|
||||
|
||||
@@ -1171,9 +1204,9 @@ static void bmo_flag_layer_clear(BMesh *bm)
|
||||
bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE);
|
||||
}
|
||||
|
||||
void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slot_name)
|
||||
void *BMO_slot_buffer_elem_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
|
||||
if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
|
||||
return NULL;
|
||||
@@ -1187,10 +1220,11 @@ void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slot_name)
|
||||
* \param restrictmask restricts the iteration to certain element types
|
||||
* (e.g. combination of BM_VERT, BM_EDGE, BM_FACE), if iterating
|
||||
* over an element buffer (not a mapping). */
|
||||
void *BMO_iter_new(BMOIter *iter, BMesh *UNUSED(bm), BMOperator *op,
|
||||
const char *slot_name, const char restrictmask)
|
||||
void *BMO_iter_new(BMOIter *iter,
|
||||
BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
|
||||
const char restrictmask)
|
||||
{
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
|
||||
memset(iter, 0, sizeof(BMOIter));
|
||||
|
||||
@@ -1324,24 +1358,26 @@ int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op)
|
||||
|
||||
#define NEXT_CHAR(fmt) ((fmt)[0] != 0 ? (fmt)[1] : 0)
|
||||
|
||||
static int bmo_name_to_slotcode(BMOpDefine *def, const char *name)
|
||||
static int bmo_name_to_slotcode(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
|
||||
{
|
||||
int i;
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; def->slot_types[i].type; i++) {
|
||||
if (!strncmp(name, def->slot_types[i].name, MAX_SLOTNAME)) {
|
||||
while (slot_args->slot_name) {
|
||||
if (strncmp(identifier, slot_args->slot_name, MAX_SLOTNAME) == 0) {
|
||||
return i;
|
||||
}
|
||||
slot_args++;
|
||||
i++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int bmo_name_to_slotcode_check(BMOpDefine *def, const char *name)
|
||||
static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
|
||||
{
|
||||
int i = bmo_name_to_slotcode(def, name);
|
||||
int i = bmo_name_to_slotcode(slot_args, identifier);
|
||||
if (i < 0) {
|
||||
fprintf(stderr, "%s: ! could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, name);
|
||||
fprintf(stderr, "%s: ! could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, identifier);
|
||||
}
|
||||
|
||||
return i;
|
||||
@@ -1352,12 +1388,12 @@ static int bmo_opname_to_opcode(const char *opname)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < bmesh_total_ops; i++) {
|
||||
if (!strcmp(opname, opdefines[i]->name)) {
|
||||
if (!strcmp(opname, opdefines[i]->opname)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s: ! could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
|
||||
fprintf(stderr, "%s: could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1367,6 +1403,8 @@ static int bmo_opname_to_opcode(const char *opname)
|
||||
* i - int
|
||||
* b - boolean (same as int but 1/0 only)
|
||||
* f - float
|
||||
* s - slot_in
|
||||
* S - slot_out
|
||||
* hv - header flagged verts (hflag)
|
||||
* he - header flagged edges (hflag)
|
||||
* hf - header flagged faces (hflag)
|
||||
@@ -1380,7 +1418,7 @@ static int bmo_opname_to_opcode(const char *opname)
|
||||
|
||||
int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, va_list vlist)
|
||||
{
|
||||
BMOpDefine *def;
|
||||
// BMOpDefine *def;
|
||||
char *opname, *ofmt, *fmt;
|
||||
char slot_name[64] = {0};
|
||||
int i /*, n = strlen(fmt) */, stop /*, slot_code = -1 */, type, state;
|
||||
@@ -1419,7 +1457,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
|
||||
}
|
||||
|
||||
BMO_op_init(bm, op, flag, opname);
|
||||
def = opdefines[i];
|
||||
// def = opdefines[i];
|
||||
|
||||
i = 0;
|
||||
state = 1; /* 0: not inside slot_code name, 1: inside slot_code name */
|
||||
@@ -1442,7 +1480,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
|
||||
|
||||
fmt[i] = 0;
|
||||
|
||||
if (bmo_name_to_slotcode_check(def, fmt) < 0) {
|
||||
if (bmo_name_to_slotcode_check(op->slots_in, fmt) < 0) {
|
||||
GOTO_ERROR("name to slot code check failed");
|
||||
}
|
||||
|
||||
@@ -1468,20 +1506,20 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
|
||||
else if (c == '4') size = 4;
|
||||
else GOTO_ERROR("matrix size was not 3 or 4");
|
||||
|
||||
BMO_slot_mat_set(op, slot_name, va_arg(vlist, void *), size);
|
||||
BMO_slot_mat_set(op, op->slots_in, slot_name, va_arg(vlist, void *), size);
|
||||
state = 1;
|
||||
break;
|
||||
}
|
||||
case 'v':
|
||||
{
|
||||
BMO_slot_vec_set(op, slot_name, va_arg(vlist, float *));
|
||||
BMO_slot_vec_set(op->slots_in, slot_name, va_arg(vlist, float *));
|
||||
state = 1;
|
||||
break;
|
||||
}
|
||||
case 'e':
|
||||
{
|
||||
BMHeader *ele = va_arg(vlist, void *);
|
||||
BMOpSlot *slot = BMO_slot_get(op, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(op->slots_in, slot_name);
|
||||
|
||||
slot->data.buf = BLI_memarena_alloc(op->arena, sizeof(void *) * 4);
|
||||
slot->len = 1;
|
||||
@@ -1491,24 +1529,34 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
|
||||
break;
|
||||
}
|
||||
case 's':
|
||||
case 'S':
|
||||
{
|
||||
BMOperator *op2 = va_arg(vlist, void *);
|
||||
const char *slot_name2 = va_arg(vlist, char *);
|
||||
BMOperator *op_other = va_arg(vlist, void *);
|
||||
const char *slot_name_other = va_arg(vlist, char *);
|
||||
|
||||
BMO_slot_copy(op2, op, slot_name2, slot_name);
|
||||
if (*fmt == 's') {
|
||||
BLI_assert(bmo_name_to_slotcode_check(op_other->slots_in, slot_name_other) != -1);
|
||||
BMO_slot_copy(op_other, slots_in, slot_name_other,
|
||||
op, slots_in, slot_name);
|
||||
}
|
||||
else {
|
||||
BLI_assert(bmo_name_to_slotcode_check(op_other->slots_out, slot_name_other) != -1);
|
||||
BMO_slot_copy(op_other, slots_out, slot_name_other,
|
||||
op, slots_in, slot_name);
|
||||
}
|
||||
state = 1;
|
||||
break;
|
||||
}
|
||||
case 'i':
|
||||
BMO_slot_int_set(op, slot_name, va_arg(vlist, int));
|
||||
BMO_slot_int_set(op->slots_in, slot_name, va_arg(vlist, int));
|
||||
state = 1;
|
||||
break;
|
||||
case 'b':
|
||||
BMO_slot_bool_set(op, slot_name, va_arg(vlist, int));
|
||||
BMO_slot_bool_set(op->slots_in, slot_name, va_arg(vlist, int));
|
||||
state = 1;
|
||||
break;
|
||||
case 'p':
|
||||
BMO_slot_ptr_set(op, slot_name, va_arg(vlist, void *));
|
||||
BMO_slot_ptr_set(op->slots_in, slot_name, va_arg(vlist, void *));
|
||||
state = 1;
|
||||
break;
|
||||
case 'f':
|
||||
@@ -1519,7 +1567,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
|
||||
type = *fmt;
|
||||
|
||||
if (NEXT_CHAR(fmt) == ' ' || NEXT_CHAR(fmt) == '\0') {
|
||||
BMO_slot_float_set(op, slot_name, va_arg(vlist, double));
|
||||
BMO_slot_float_set(op->slots_in, slot_name, va_arg(vlist, double));
|
||||
}
|
||||
else {
|
||||
htype = 0;
|
||||
@@ -1541,19 +1589,19 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
|
||||
}
|
||||
|
||||
if (type == 'h') {
|
||||
BMO_slot_buffer_from_enabled_hflag(bm, op, slot_name, htype, va_arg(vlist, int));
|
||||
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
|
||||
}
|
||||
else if (type == 'H') {
|
||||
BMO_slot_buffer_from_disabled_hflag(bm, op, slot_name, htype, va_arg(vlist, int));
|
||||
BMO_slot_buffer_from_disabled_hflag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
|
||||
}
|
||||
else if (type == 'a') {
|
||||
BMO_slot_buffer_from_all(bm, op, slot_name, htype);
|
||||
BMO_slot_buffer_from_all(bm, op, op->slots_in, slot_name, htype);
|
||||
}
|
||||
else if (type == 'f') {
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, slot_name, htype, va_arg(vlist, int));
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
|
||||
}
|
||||
else if (type == 'F') {
|
||||
BMO_slot_buffer_from_disabled_flag(bm, op, slot_name, htype, va_arg(vlist, int));
|
||||
BMO_slot_buffer_from_disabled_flag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
void bmo_bevel_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
const float offset = BMO_slot_float_get(op, "offset");
|
||||
const int seg = BMO_slot_int_get(op, "segments");
|
||||
const float offset = BMO_slot_float_get(op->slots_in, "offset");
|
||||
const int seg = BMO_slot_int_get(op->slots_in, "segments");
|
||||
|
||||
if (offset > 0) {
|
||||
BMOIter siter;
|
||||
@@ -44,11 +44,11 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
|
||||
* BM_FACE is cleared so we can put newly created faces into a bmesh slot. */
|
||||
BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE);
|
||||
|
||||
BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
|
||||
BM_elem_flag_enable(v, BM_ELEM_TAG);
|
||||
}
|
||||
|
||||
BMO_ITER (e, &siter, bm, op, "geom", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "geom", BM_EDGE) {
|
||||
if (BM_edge_is_manifold(e)) {
|
||||
BM_elem_flag_enable(e, BM_ELEM_TAG);
|
||||
}
|
||||
@@ -56,6 +56,6 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
BM_mesh_bevel(bm, offset, seg);
|
||||
|
||||
BMO_slot_buffer_from_enabled_hflag(bm, op, "faceout", BM_FACE, BM_ELEM_TAG);
|
||||
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faceout", BM_FACE, BM_ELEM_TAG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
|
||||
BLI_array_declare(verts_pair);
|
||||
int i;
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_INPUT);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_INPUT);
|
||||
|
||||
for (f = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); f; f = BM_iter_step(&iter)) {
|
||||
BLI_array_empty(loops_split);
|
||||
@@ -117,7 +117,7 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_OUT);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edgeout", BM_EDGE, EDGE_OUT);
|
||||
|
||||
BLI_array_free(loops_split);
|
||||
BLI_array_free(verts_pair);
|
||||
@@ -219,12 +219,12 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
|
||||
int c = 0, cl1 = 0, cl2 = 0;
|
||||
|
||||
/* merge-bridge support */
|
||||
const int use_merge = BMO_slot_bool_get(op, "use_merge");
|
||||
const float merge_factor = BMO_slot_float_get(op, "merge_factor");
|
||||
const int use_merge = BMO_slot_bool_get(op->slots_in, "use_merge");
|
||||
const float merge_factor = BMO_slot_float_get(op->slots_in, "merge_factor");
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
|
||||
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
if (!BMO_elem_flag_test(bm, e, EDGE_DONE)) {
|
||||
BMVert *v, *ov;
|
||||
/* BMEdge *e2, *e3, *oe = e; */ /* UNUSED */
|
||||
@@ -523,7 +523,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_OUT);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faceout", BM_FACE, FACE_OUT);
|
||||
|
||||
cleanup:
|
||||
BLI_array_free(ee1);
|
||||
|
||||
@@ -741,7 +741,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
|
||||
BMVert *startv;
|
||||
BMVert *endv;
|
||||
EPathNode *node;
|
||||
int i, use_restrict = BMO_slot_bool_get(op, "use_restrict");
|
||||
int i, use_restrict = BMO_slot_bool_get(op->slots_in, "use_restrict");
|
||||
|
||||
startv = edata[BM_elem_index_get(edge)].ftag ? edge->v2 : edge->v1;
|
||||
endv = edata[BM_elem_index_get(edge)].ftag ? edge->v1 : edge->v2;
|
||||
@@ -806,8 +806,8 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
|
||||
continue;
|
||||
}
|
||||
|
||||
if (use_restrict && BMO_slot_map_contains(bm, op, "restrict", e)) {
|
||||
int group = BMO_slot_map_int_get(bm, op, "restrict", e);
|
||||
if (use_restrict && BMO_slot_map_contains(op->slots_in, "restrict", e)) {
|
||||
int group = BMO_slot_map_int_get(op->slots_in, "restrict", e);
|
||||
|
||||
if (!(group & path->group)) {
|
||||
v2 = NULL;
|
||||
@@ -895,10 +895,10 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
|
||||
BMEdge **edges = NULL;
|
||||
PathBase *pathbase;
|
||||
BLI_array_declare(edges);
|
||||
int use_restrict = BMO_slot_bool_get(op, "use_restrict");
|
||||
int use_fill_check = BMO_slot_bool_get(op, "use_fill_check");
|
||||
const short mat_nr = BMO_slot_int_get(op, "mat_nr");
|
||||
const short use_smooth = BMO_slot_bool_get(op, "use_smooth");
|
||||
int use_restrict = BMO_slot_bool_get(op->slots_in, "use_restrict");
|
||||
int use_fill_check = BMO_slot_bool_get(op->slots_in, "use_fill_check");
|
||||
const short mat_nr = BMO_slot_int_get(op->slots_in, "mat_nr");
|
||||
const short use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
|
||||
int i, j, group = 0;
|
||||
unsigned int winding[2]; /* accumulte winding directions for each edge which has a face */
|
||||
|
||||
@@ -910,8 +910,8 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
|
||||
edata = MEM_callocN(sizeof(EdgeData) * bm->totedge, "EdgeData");
|
||||
vdata = MEM_callocN(sizeof(VertData) * bm->totvert, "VertData");
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, op, "excludefaces", BM_FACE, FACE_IGNORE);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "excludefaces", BM_FACE, FACE_IGNORE);
|
||||
|
||||
BM_mesh_elem_index_ensure(bm, BM_VERT);
|
||||
|
||||
@@ -937,9 +937,9 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
|
||||
edge = NULL;
|
||||
group = 0;
|
||||
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
/* if restrict is on, only start on faces in the restrict map */
|
||||
if (use_restrict && !BMO_slot_map_contains(bm, op, "restrict", e))
|
||||
if (use_restrict && !BMO_slot_map_contains(op->slots_in, "restrict", e))
|
||||
continue;
|
||||
|
||||
if (edata[BM_elem_index_get(e)].tag < 2) {
|
||||
@@ -948,7 +948,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
|
||||
if (use_restrict) {
|
||||
int i = 0, j = 0, gi = 0;
|
||||
|
||||
group = BMO_slot_map_int_get(bm, op, "restrict", e);
|
||||
group = BMO_slot_map_int_get(op->slots_in, "restrict", e);
|
||||
|
||||
for (i = 0; i < 30; i++) {
|
||||
if (group & (1 << i)) {
|
||||
@@ -1055,7 +1055,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
if (use_restrict) {
|
||||
BMO_slot_map_int_insert(bm, op, "faceout_groupmap", f, path->group);
|
||||
BMO_slot_map_int_insert(op, op->slots_out, "face_groupmap_out", f, path->group);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1063,7 +1063,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
|
||||
edge_free_path(pathbase, path);
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_NEW);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faceout", BM_FACE, FACE_NEW);
|
||||
|
||||
BLI_array_free(edges);
|
||||
BLI_array_free(verts);
|
||||
@@ -1103,11 +1103,11 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
|
||||
int ok = 1;
|
||||
int i, count;
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
|
||||
|
||||
/* validate that each edge has at most one other tagged edge in the
|
||||
* disk cycle around each of it's vertices */
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
count = BMO_vert_edge_flags_count(bm, i ? e->v2 : e->v1, EDGE_MARK);
|
||||
if (count > 2) {
|
||||
@@ -1129,7 +1129,7 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
|
||||
/* find connected loops within the input edge */
|
||||
count = 0;
|
||||
while (1) {
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
if (!BMO_elem_flag_test(bm, e, EDGE_VIS)) {
|
||||
if (BMO_vert_edge_flags_count(bm, e->v1, EDGE_MARK) == 1 ||
|
||||
BMO_vert_edge_flags_count(bm, e->v2, EDGE_MARK) == 1)
|
||||
@@ -1260,7 +1260,7 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_NEW);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edgeout", BM_EDGE, ELE_NEW);
|
||||
|
||||
BLI_array_free(edges1);
|
||||
BLI_array_free(edges2);
|
||||
@@ -1280,11 +1280,11 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
||||
BMEdge *e;
|
||||
BMFace *f;
|
||||
int totv = 0, tote = 0, totf = 0, amount;
|
||||
const short mat_nr = BMO_slot_int_get(op, "mat_nr");
|
||||
const short use_smooth = BMO_slot_bool_get(op, "use_smooth");
|
||||
const short mat_nr = BMO_slot_int_get(op->slots_in, "mat_nr");
|
||||
const short use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
|
||||
|
||||
/* count number of each element type we were passe */
|
||||
BMO_ITER (h, &oiter, bm, op, "geom", BM_VERT | BM_EDGE | BM_FACE) {
|
||||
BMO_ITER (h, &oiter, op->slots_in, "geom", BM_VERT | BM_EDGE | BM_FACE) {
|
||||
switch (h->htype) {
|
||||
case BM_VERT: totv++; break;
|
||||
case BM_EDGE: tote++; break;
|
||||
@@ -1318,7 +1318,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
||||
int ok = TRUE;
|
||||
|
||||
|
||||
BMO_ITER (v, &oiter, bm, op, "geom", BM_VERT) {
|
||||
BMO_ITER (v, &oiter, op->slots_in, "geom", BM_VERT) {
|
||||
/* count how many flagged edges this vertex uses */
|
||||
int tot_edges = 0;
|
||||
BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
|
||||
@@ -1366,7 +1366,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
||||
/* call edgenet prepare op so additional face creation cases wore */
|
||||
BMO_op_initf(bm, &op2, op->flag, "edgenet_prepare edges=%fe", ELE_NEW);
|
||||
BMO_op_exec(bm, &op2);
|
||||
BMO_slot_buffer_flag_enable(bm, &op2, "edgeout", BM_EDGE, ELE_NEW);
|
||||
BMO_slot_buffer_flag_enable(bm, op2.slots_out, "edgeout", BM_EDGE, ELE_NEW);
|
||||
BMO_op_finish(bm, &op2);
|
||||
|
||||
BMO_op_initf(bm, &op2, op->flag,
|
||||
@@ -1376,8 +1376,9 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_op_exec(bm, &op2);
|
||||
|
||||
/* return if edge net create did something */
|
||||
if (BMO_slot_buffer_count(bm, &op2, "faceout")) {
|
||||
BMO_slot_copy(&op2, op, "faceout", "faceout");
|
||||
if (BMO_slot_buffer_count(op2.slots_out, "faceout")) {
|
||||
BMO_slot_copy(&op2, slots_out, "faceout",
|
||||
op, slots_out, "faceout");
|
||||
BMO_op_finish(bm, &op2);
|
||||
return;
|
||||
}
|
||||
@@ -1389,8 +1390,9 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_op_exec(bm, &op2);
|
||||
|
||||
/* if we dissolved anything, then return */
|
||||
if (BMO_slot_buffer_count(bm, &op2, "regionout")) {
|
||||
BMO_slot_copy(&op2, op, "regionout", "faceout");
|
||||
if (BMO_slot_buffer_count(op2.slots_out, "regionout")) {
|
||||
BMO_slot_copy(&op2, slots_out, "regionout",
|
||||
op, slots_out, "faceout");
|
||||
BMO_op_finish(bm, &op2);
|
||||
return;
|
||||
}
|
||||
@@ -1414,7 +1416,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
||||
/* create edge */
|
||||
e = BM_edge_create(bm, verts[0], verts[1], NULL, TRUE);
|
||||
BMO_elem_flag_enable(bm, e, ELE_OUT);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_OUT);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edgeout", BM_EDGE, ELE_OUT);
|
||||
}
|
||||
else if (0) { /* nice feature but perhaps it should be a different tool? */
|
||||
|
||||
@@ -1460,7 +1462,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
}
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_OUT);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edgeout", BM_EDGE, ELE_OUT);
|
||||
/* done creating edges */
|
||||
}
|
||||
else if (amount > 2) {
|
||||
@@ -1470,7 +1472,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
||||
BMVert **vert_arr = MEM_mallocN(sizeof(BMVert **) * totv, __func__);
|
||||
int i = 0;
|
||||
|
||||
BMO_ITER (v, &oiter, bm, op, "geom", BM_VERT) {
|
||||
BMO_ITER (v, &oiter, op->slots_in, "geom", BM_VERT) {
|
||||
vert_arr[i] = v;
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
|
||||
BMWalker regwalker;
|
||||
int i;
|
||||
|
||||
int use_verts = BMO_slot_bool_get(op, "use_verts");
|
||||
int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
|
||||
|
||||
if (use_verts) {
|
||||
/* tag verts that start out with only 2 edges,
|
||||
@@ -98,10 +98,10 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "faces", BM_FACE, FACE_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_MARK);
|
||||
|
||||
/* collect region */
|
||||
BMO_ITER (f, &oiter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
|
||||
|
||||
if (!BMO_elem_flag_test(bm, f, FACE_MARK)) {
|
||||
continue;
|
||||
@@ -184,7 +184,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "regionout", BM_FACE, FACE_NEW);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "regionout", BM_FACE, FACE_NEW);
|
||||
|
||||
cleanup:
|
||||
/* free/cleanup */
|
||||
@@ -208,7 +208,7 @@ void bmo_dissolve_edgeloop_exec(BMesh *bm, BMOperator *op)
|
||||
int i;
|
||||
|
||||
|
||||
BMO_ITER (e, &oiter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &oiter, op->slots_in, "edges", BM_EDGE) {
|
||||
if (BM_edge_face_pair(e, &fa, &fb)) {
|
||||
BMO_elem_flag_enable(bm, e->v1, VERT_MARK);
|
||||
BMO_elem_flag_enable(bm, e->v2, VERT_MARK);
|
||||
@@ -254,7 +254,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
|
||||
BMIter viter;
|
||||
BMVert *v;
|
||||
|
||||
int use_verts = BMO_slot_bool_get(op, "use_verts");
|
||||
int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
|
||||
|
||||
if (use_verts) {
|
||||
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
|
||||
@@ -262,7 +262,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_ITER (e, &eiter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &eiter, op->slots_in, "edges", BM_EDGE) {
|
||||
BMFace *fa, *fb;
|
||||
|
||||
if (BM_edge_face_pair(e, &fa, &fb)) {
|
||||
@@ -338,7 +338,7 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
|
||||
BMFace *f;
|
||||
/* int i; */
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_MARK);
|
||||
|
||||
for (v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); v; v = BM_iter_step(&iter)) {
|
||||
if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
|
||||
@@ -479,11 +479,11 @@ void dummy_exec(BMesh *bm, BMOperator *op)
|
||||
/* Limited Dissolve */
|
||||
void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
BMOpSlot *einput = BMO_slot_get(op, "edges");
|
||||
BMOpSlot *vinput = BMO_slot_get(op, "verts");
|
||||
BMOpSlot *einput = BMO_slot_get(op->slots_in, "edges");
|
||||
BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
|
||||
const float angle_max = (float)M_PI / 2.0f;
|
||||
const float angle_limit = min_ff(angle_max, BMO_slot_float_get(op, "angle_limit"));
|
||||
const int do_dissolve_boundaries = BMO_slot_bool_get(op, "use_dissolve_boundaries");
|
||||
const float angle_limit = min_ff(angle_max, BMO_slot_float_get(op->slots_in, "angle_limit"));
|
||||
const int do_dissolve_boundaries = BMO_slot_bool_get(op->slots_in, "use_dissolve_boundaries");
|
||||
|
||||
BM_mesh_decimate_dissolve_ex(bm, angle_limit, do_dissolve_boundaries,
|
||||
vinput->data.p, vinput->len,
|
||||
|
||||
@@ -102,7 +102,7 @@ static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
|
||||
if (rlen < 2) {
|
||||
/* not sure what non-manifold cases of greater then three
|
||||
* radial should do. */
|
||||
BMO_slot_map_ptr_insert(source_mesh, op, "boundarymap",
|
||||
BMO_slot_map_ptr_insert(op, op->slots_out, "boundarymap_out",
|
||||
source_edge, target_edge);
|
||||
}
|
||||
|
||||
@@ -154,8 +154,8 @@ static BMFace *copy_face(BMOperator *op, BMesh *source_mesh,
|
||||
|
||||
/* create new face */
|
||||
target_face = BM_face_create(target_mesh, vtar, edar, source_face->len, FALSE);
|
||||
BMO_slot_map_ptr_insert(source_mesh, op, "facemap", source_face, target_face);
|
||||
BMO_slot_map_ptr_insert(source_mesh, op, "facemap", target_face, source_face);
|
||||
BMO_slot_map_ptr_insert(op, op->slots_out, "facemap_out", source_face, target_face);
|
||||
BMO_slot_map_ptr_insert(op, op->slots_out, "facemap_out", target_face, source_face);
|
||||
|
||||
BM_elem_attrs_copy(source_mesh, target_mesh, source_face, target_face);
|
||||
|
||||
@@ -227,7 +227,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
|
||||
}
|
||||
|
||||
if (isolated) {
|
||||
BMO_slot_map_ptr_insert(source, op, "isovertmap", v, v2);
|
||||
BMO_slot_map_ptr_insert(op, op->slots_out, "isovertmap_out", v, v2);
|
||||
}
|
||||
|
||||
BMO_elem_flag_enable(source, v, DUPE_DONE);
|
||||
@@ -317,23 +317,24 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
|
||||
void bmo_duplicate_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
BMOperator *dupeop = op;
|
||||
BMesh *bm2 = BMO_slot_ptr_get(op, "dest");
|
||||
BMesh *bm2 = BMO_slot_ptr_get(op->slots_in, "dest");
|
||||
|
||||
if (!bm2)
|
||||
bm2 = bm;
|
||||
|
||||
/* flag input */
|
||||
BMO_slot_buffer_flag_enable(bm, dupeop, "geom", BM_ALL, DUPE_INPUT);
|
||||
BMO_slot_buffer_flag_enable(bm, dupeop->slots_in, "geom", BM_ALL, DUPE_INPUT);
|
||||
|
||||
/* use the internal copy function */
|
||||
bmo_mesh_copy(dupeop, bm, bm2);
|
||||
|
||||
/* Output */
|
||||
/* First copy the input buffers to output buffers - original data */
|
||||
BMO_slot_copy(dupeop, dupeop, "geom", "origout");
|
||||
BMO_slot_copy(dupeop, slots_in, "geom",
|
||||
dupeop, slots_out, "origout");
|
||||
|
||||
/* Now alloc the new output buffers */
|
||||
BMO_slot_buffer_from_enabled_flag(bm, dupeop, "newout", BM_ALL, DUPE_NEW);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, dupeop, dupeop->slots_out, "newout", BM_ALL, DUPE_NEW);
|
||||
}
|
||||
|
||||
#if 0 /* UNUSED */
|
||||
@@ -378,16 +379,17 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
|
||||
BMOperator *splitop = op;
|
||||
BMOperator dupeop;
|
||||
BMOperator delop;
|
||||
const short use_only_faces = BMO_slot_bool_get(op, "use_only_faces");
|
||||
const short use_only_faces = BMO_slot_bool_get(op->slots_in, "use_only_faces");
|
||||
|
||||
/* initialize our sub-operator */
|
||||
BMO_op_init(bm, &dupeop, op->flag, "duplicate");
|
||||
BMO_op_init(bm, &delop, op->flag, "delete");
|
||||
|
||||
BMO_slot_copy(splitop, &dupeop, "geom", "geom");
|
||||
BMO_slot_copy(splitop, slots_in, "geom",
|
||||
&dupeop, slots_in, "geom");
|
||||
BMO_op_exec(bm, &dupeop);
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, splitop, "geom", BM_ALL, SPLIT_INPUT);
|
||||
BMO_slot_buffer_flag_enable(bm, splitop->slots_in, "geom", BM_ALL, SPLIT_INPUT);
|
||||
|
||||
if (use_only_faces) {
|
||||
BMVert *v;
|
||||
@@ -427,16 +429,22 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
/* connect outputs of dupe to delete, exluding keep geometry */
|
||||
BMO_slot_int_set(&delop, "context", DEL_FACES);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, &delop, "geom", BM_ALL, SPLIT_INPUT);
|
||||
BMO_slot_int_set(delop.slots_in, "context", DEL_FACES);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, &delop, delop.slots_in, "geom", BM_ALL, SPLIT_INPUT);
|
||||
|
||||
BMO_op_exec(bm, &delop);
|
||||
|
||||
/* now we make our outputs by copying the dupe output */
|
||||
BMO_slot_copy(&dupeop, splitop, "newout", "geomout");
|
||||
BMO_slot_copy(&dupeop, splitop, "boundarymap", "boundarymap");
|
||||
BMO_slot_copy(&dupeop, splitop, "isovertmap", "isovertmap");
|
||||
|
||||
BMO_slot_copy(&dupeop, slots_out, "newout",
|
||||
splitop, slots_out, "geomout");
|
||||
|
||||
BMO_slot_copy(&dupeop, slots_out, "boundarymap_out",
|
||||
splitop, slots_out, "boundarymap_out");
|
||||
|
||||
BMO_slot_copy(&dupeop, slots_out, "isovertmap_out",
|
||||
splitop, slots_out, "isovertmap_out");
|
||||
|
||||
|
||||
/* cleanup */
|
||||
BMO_op_finish(bm, &delop);
|
||||
BMO_op_finish(bm, &dupeop);
|
||||
@@ -450,9 +458,9 @@ void bmo_delete_exec(BMesh *bm, BMOperator *op)
|
||||
BMOperator *delop = op;
|
||||
|
||||
/* Mark Buffer */
|
||||
BMO_slot_buffer_flag_enable(bm, delop, "geom", BM_ALL, DEL_INPUT);
|
||||
BMO_slot_buffer_flag_enable(bm, delop->slots_in, "geom", BM_ALL, DEL_INPUT);
|
||||
|
||||
BMO_remove_tagged_context(bm, DEL_INPUT, BMO_slot_int_get(op, "context"));
|
||||
BMO_remove_tagged_context(bm, DEL_INPUT, BMO_slot_int_get(op->slots_in, "context"));
|
||||
|
||||
#undef DEL_INPUT
|
||||
}
|
||||
@@ -473,43 +481,46 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op)
|
||||
float phi;
|
||||
int steps, do_dupli, a, usedvec;
|
||||
|
||||
BMO_slot_vec_get(op, "cent", cent);
|
||||
BMO_slot_vec_get(op, "axis", axis);
|
||||
BMO_slot_vec_get(op->slots_in, "cent", cent);
|
||||
BMO_slot_vec_get(op->slots_in, "axis", axis);
|
||||
normalize_v3(axis);
|
||||
BMO_slot_vec_get(op, "dvec", dvec);
|
||||
BMO_slot_vec_get(op->slots_in, "dvec", dvec);
|
||||
usedvec = !is_zero_v3(dvec);
|
||||
steps = BMO_slot_int_get(op, "steps");
|
||||
phi = BMO_slot_float_get(op, "ang") * DEG2RADF(1.0f) / steps;
|
||||
do_dupli = BMO_slot_bool_get(op, "do_dupli");
|
||||
steps = BMO_slot_int_get(op->slots_in, "steps");
|
||||
phi = BMO_slot_float_get(op->slots_in, "ang") * DEG2RADF(1.0f) / steps;
|
||||
do_dupli = BMO_slot_bool_get(op->slots_in, "do_dupli");
|
||||
|
||||
axis_angle_to_mat3(rmat, axis, phi);
|
||||
|
||||
BMO_slot_copy(op, op, "geom", "lastout");
|
||||
BMO_slot_copy(op, slots_in, "geom",
|
||||
op, slots_out, "lastout");
|
||||
for (a = 0; a < steps; a++) {
|
||||
if (do_dupli) {
|
||||
BMO_op_initf(bm, &dupop, op->flag, "duplicate geom=%s", op, "lastout");
|
||||
BMO_op_initf(bm, &dupop, op->flag, "duplicate geom=%S", op, "lastout");
|
||||
BMO_op_exec(bm, &dupop);
|
||||
BMO_op_callf(bm, op->flag,
|
||||
"rotate cent=%v mat=%m3 verts=%s",
|
||||
"rotate cent=%v mat=%m3 verts=%S",
|
||||
cent, rmat, &dupop, "newout");
|
||||
BMO_slot_copy(&dupop, op, "newout", "lastout");
|
||||
BMO_slot_copy(&dupop, slots_out, "newout",
|
||||
op, slots_out, "lastout");
|
||||
BMO_op_finish(bm, &dupop);
|
||||
}
|
||||
else {
|
||||
BMO_op_initf(bm, &extop, op->flag, "extrude_face_region edgefacein=%s",
|
||||
BMO_op_initf(bm, &extop, op->flag, "extrude_face_region edgefacein=%S",
|
||||
op, "lastout");
|
||||
BMO_op_exec(bm, &extop);
|
||||
BMO_op_callf(bm, op->flag,
|
||||
"rotate cent=%v mat=%m3 verts=%s",
|
||||
"rotate cent=%v mat=%m3 verts=%S",
|
||||
cent, rmat, &extop, "geomout");
|
||||
BMO_slot_copy(&extop, op, "geomout", "lastout");
|
||||
BMO_slot_copy(&extop, slots_out, "geomout",
|
||||
op, slots_out, "lastout");
|
||||
BMO_op_finish(bm, &extop);
|
||||
}
|
||||
|
||||
if (usedvec) {
|
||||
mul_m3_v3(rmat, dvec);
|
||||
BMO_op_callf(bm, op->flag,
|
||||
"translate vec=%v verts=%s",
|
||||
"translate vec=%v verts=%S",
|
||||
dvec, op, "lastout");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,14 +81,14 @@ static void bm_edgesplit_validate_seams(BMesh *bm, BMOperator *op)
|
||||
|
||||
/* single marked edges unconnected to any other marked edges
|
||||
* are illegal, go through and unmark them */
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
/* lame, but we don't want the count to exceed 255,
|
||||
* so just count to 2, its all we need */
|
||||
unsigned char *vt;
|
||||
vt = &vtouch[BM_elem_index_get(e->v1)]; if (*vt < 2) (*vt)++;
|
||||
vt = &vtouch[BM_elem_index_get(e->v2)]; if (*vt < 2) (*vt)++;
|
||||
}
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
if (vtouch[BM_elem_index_get(e->v1)] == 1 &&
|
||||
vtouch[BM_elem_index_get(e->v2)] == 1)
|
||||
{
|
||||
@@ -104,13 +104,13 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
BMOIter siter;
|
||||
BMEdge *e;
|
||||
const int use_verts = BMO_slot_bool_get(op, "use_verts");
|
||||
const int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_SEAM);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_SEAM);
|
||||
|
||||
if (use_verts) {
|
||||
/* this slows down the operation but its ok because the modifier doesn't use */
|
||||
BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_SEAM);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_SEAM);
|
||||
|
||||
/* prevent one edge having both verts unflagged
|
||||
* we could alternately disable these edges, either way its a corner case.
|
||||
@@ -118,7 +118,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
|
||||
* This is needed so we don't split off the edge but then none of its verts which
|
||||
* would leave a duplicate edge.
|
||||
*/
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
if (UNLIKELY((BMO_elem_flag_test(bm, e->v1, VERT_SEAM) == FALSE &&
|
||||
(BMO_elem_flag_test(bm, e->v2, VERT_SEAM) == FALSE))))
|
||||
{
|
||||
@@ -130,7 +130,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
bm_edgesplit_validate_seams(bm, op);
|
||||
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
if (BMO_elem_flag_test(bm, e, EDGE_SEAM)) {
|
||||
/* this flag gets copied so we can be sure duplicate edges get it too (important) */
|
||||
BM_elem_flag_enable(e, BM_ELEM_INTERNAL_TAG);
|
||||
@@ -146,7 +146,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
if (use_verts) {
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
if (BMO_elem_flag_test(bm, e->v1, VERT_SEAM) == FALSE) {
|
||||
BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
if (BMO_elem_flag_test(bm, e, EDGE_SEAM)) {
|
||||
if (BM_elem_flag_test(e->v1, BM_ELEM_TAG)) {
|
||||
BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
|
||||
@@ -169,5 +169,5 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_hflag(bm, op, "edgeout", BM_EDGE, BM_ELEM_INTERNAL_TAG);
|
||||
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edgeout", BM_EDGE, BM_ELEM_INTERNAL_TAG);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
|
||||
BLI_array_declare(edges);
|
||||
int i;
|
||||
|
||||
BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
|
||||
BLI_array_empty(edges);
|
||||
BLI_array_grow_items(edges, f->len);
|
||||
|
||||
@@ -122,7 +122,7 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_op_callf(bm, op->flag,
|
||||
"delete geom=%ff context=%i",
|
||||
EXT_DEL, DEL_ONLYFACES);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, EXT_KEEP);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faceout", BM_FACE, EXT_KEEP);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,7 +181,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
|
||||
BMFace *f;
|
||||
BMEdge *e, *e_new;
|
||||
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
BMO_elem_flag_enable(bm, e, EXT_INPUT);
|
||||
BMO_elem_flag_enable(bm, e->v1, EXT_INPUT);
|
||||
BMO_elem_flag_enable(bm, e->v2, EXT_INPUT);
|
||||
@@ -193,12 +193,12 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
|
||||
/* disable root flag on all new skin nodes */
|
||||
if (CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN)) {
|
||||
BMVert *v;
|
||||
BMO_ITER(v, &siter, bm, &dupeop, "newout", BM_VERT) {
|
||||
BMO_ITER(v, &siter, dupeop.slots_out, "newout", BM_VERT) {
|
||||
bm_extrude_disable_skin_root(bm, v);
|
||||
}
|
||||
}
|
||||
|
||||
for (e = BMO_iter_new(&siter, bm, &dupeop, "boundarymap", 0); e; e = BMO_iter_step(&siter)) {
|
||||
for (e = BMO_iter_new(&siter, dupeop.slots_out, "boundarymap_out", 0); e; e = BMO_iter_step(&siter)) {
|
||||
BMVert *f_verts[4];
|
||||
e_new = *(BMEdge **)BMO_iter_map_value(&siter);
|
||||
|
||||
@@ -230,7 +230,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
BMO_op_finish(bm, &dupeop);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, EXT_KEEP);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geomout", BM_ALL, EXT_KEEP);
|
||||
}
|
||||
|
||||
void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
|
||||
@@ -240,7 +240,7 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
|
||||
BMEdge *e;
|
||||
const int has_vskin = CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN);
|
||||
|
||||
for (v = BMO_iter_new(&siter, bm, op, "verts", BM_VERT); v; v = BMO_iter_step(&siter)) {
|
||||
for (v = BMO_iter_new(&siter, op->slots_in, "verts", BM_VERT); v; v = BMO_iter_step(&siter)) {
|
||||
dupev = BM_vert_create(bm, v->co, v);
|
||||
if (has_vskin)
|
||||
bm_extrude_disable_skin_root(bm, v);
|
||||
@@ -251,8 +251,8 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_elem_flag_enable(bm, dupev, EXT_KEEP);
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, EXT_KEEP);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EXT_KEEP);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vertout", BM_VERT, EXT_KEEP);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edgeout", BM_EDGE, EXT_KEEP);
|
||||
}
|
||||
|
||||
void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
|
||||
@@ -268,11 +268,11 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
|
||||
/* initialize our sub-operators */
|
||||
BMO_op_init(bm, &dupeop, op->flag, "duplicate");
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "edgefacein", BM_EDGE | BM_FACE, EXT_INPUT);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edgefacein", BM_EDGE | BM_FACE, EXT_INPUT);
|
||||
|
||||
/* if one flagged face is bordered by an un-flagged face, then we delete
|
||||
* original geometry unless caller explicitly asked to keep it. */
|
||||
if (!BMO_slot_bool_get(op, "alwayskeeporig")) {
|
||||
if (!BMO_slot_bool_get(op->slots_in, "alwayskeeporig")) {
|
||||
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
|
||||
|
||||
int edge_face_tot;
|
||||
@@ -339,18 +339,19 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
|
||||
EXT_DEL, DEL_ONLYTAGGED);
|
||||
}
|
||||
|
||||
BMO_slot_copy(op, &dupeop, "edgefacein", "geom");
|
||||
BMO_slot_copy(op, slots_in, "edgefacein",
|
||||
&dupeop, slots_in, "geom");
|
||||
BMO_op_exec(bm, &dupeop);
|
||||
|
||||
/* disable root flag on all new skin nodes */
|
||||
if (CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN)) {
|
||||
BMO_ITER(v, &siter, bm, &dupeop, "newout", BM_VERT) {
|
||||
BMO_ITER(v, &siter, dupeop.slots_out, "newout", BM_VERT) {
|
||||
bm_extrude_disable_skin_root(bm, v);
|
||||
}
|
||||
}
|
||||
|
||||
if (bm->act_face && BMO_elem_flag_test(bm, bm->act_face, EXT_INPUT))
|
||||
bm->act_face = BMO_slot_map_ptr_get(bm, &dupeop, "facemap", bm->act_face);
|
||||
bm->act_face = BMO_slot_map_ptr_get(dupeop.slots_out, "facemap_out", bm->act_face);
|
||||
|
||||
if (delorig) {
|
||||
BMO_op_exec(bm, &delop);
|
||||
@@ -365,13 +366,14 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_slot_copy(&dupeop, op, "newout", "geomout");
|
||||
BMO_slot_copy(&dupeop, slots_out, "newout",
|
||||
op, slots_out, "geomout");
|
||||
|
||||
for (e = BMO_iter_new(&siter, bm, &dupeop, "boundarymap", 0); e; e = BMO_iter_step(&siter)) {
|
||||
for (e = BMO_iter_new(&siter, dupeop.slots_out, "boundarymap_out", 0); e; e = BMO_iter_step(&siter)) {
|
||||
BMVert *f_verts[4];
|
||||
|
||||
/* this should always be wire, so this is mainly a speedup to avoid map lookup */
|
||||
if (BM_edge_is_wire(e) && BMO_slot_map_contains(bm, op, "exclude", e)) {
|
||||
if (BM_edge_is_wire(e) && BMO_slot_map_contains(op->slots_in, "exclude", e)) {
|
||||
BMVert *v1 = e->v1, *v2 = e->v2;
|
||||
|
||||
/* The original edge was excluded,
|
||||
@@ -421,7 +423,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
/* link isolated vert */
|
||||
for (v = BMO_iter_new(&siter, bm, &dupeop, "isovertmap", 0); v; v = BMO_iter_step(&siter)) {
|
||||
for (v = BMO_iter_new(&siter, dupeop.slots_out, "isovertmap_out", 0); v; v = BMO_iter_step(&siter)) {
|
||||
v2 = *((void **)BMO_iter_map_value(&siter));
|
||||
BM_edge_create(bm, v, v2, v->e, TRUE);
|
||||
}
|
||||
@@ -647,25 +649,28 @@ void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op)
|
||||
BMOperator reverseop;
|
||||
float thickness;
|
||||
|
||||
thickness = BMO_slot_float_get(op, "thickness");
|
||||
thickness = BMO_slot_float_get(op->slots_in, "thickness");
|
||||
|
||||
/* Flip original faces (so the shell is extruded inward) */
|
||||
BMO_op_init(bm, &reverseop, op->flag, "reverse_faces");
|
||||
BMO_slot_copy(op, &reverseop, "geom", "faces");
|
||||
BMO_slot_copy(op, slots_in, "geom",
|
||||
&reverseop, slots_in, "faces");
|
||||
BMO_op_exec(bm, &reverseop);
|
||||
BMO_op_finish(bm, &reverseop);
|
||||
|
||||
/* Extrude the region */
|
||||
BMO_op_initf(bm, &extrudeop, op->flag, "extrude_face_region alwayskeeporig=%b", TRUE);
|
||||
BMO_slot_copy(op, &extrudeop, "geom", "edgefacein");
|
||||
BMO_slot_copy(op, slots_in, "geom",
|
||||
&extrudeop, slots_in, "edgefacein");
|
||||
BMO_op_exec(bm, &extrudeop);
|
||||
|
||||
/* Push the verts of the extruded faces inward to create thickness */
|
||||
BMO_slot_buffer_flag_enable(bm, &extrudeop, "geomout", BM_FACE, FACE_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, extrudeop.slots_out, "geomout", BM_FACE, FACE_MARK);
|
||||
calc_solidify_normals(bm);
|
||||
solidify_add_thickness(bm, thickness);
|
||||
|
||||
BMO_slot_copy(&extrudeop, op, "geomout", "geomout");
|
||||
BMO_slot_copy(&extrudeop, slots_out, "geomout",
|
||||
op, slots_out, "geomout");
|
||||
|
||||
BMO_op_finish(bm, &extrudeop);
|
||||
}
|
||||
|
||||
@@ -304,14 +304,14 @@ static void hull_mark_interior_elements(BMesh *bm, BMOperator *op,
|
||||
BMOIter oiter;
|
||||
|
||||
/* Check for interior edges too */
|
||||
BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
|
||||
BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
|
||||
if (!hull_final_edges_lookup(final_edges, e->v1, e->v2))
|
||||
BMO_elem_flag_enable(bm, e, HULL_FLAG_INTERIOR_ELE);
|
||||
}
|
||||
|
||||
/* Mark all input faces as interior, some may be unmarked in
|
||||
* hull_remove_overlapping() */
|
||||
BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
|
||||
BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
|
||||
BMO_elem_flag_enable(bm, f, HULL_FLAG_INTERIOR_ELE);
|
||||
}
|
||||
}
|
||||
@@ -328,7 +328,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
|
||||
* interior (i.e. were already part of the input, but not part of
|
||||
* the hull), but that aren't also used by elements outside the
|
||||
* input set */
|
||||
BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
|
||||
BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
|
||||
if (BMO_elem_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) {
|
||||
int del = TRUE;
|
||||
|
||||
@@ -351,7 +351,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
|
||||
BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
|
||||
if (BMO_elem_flag_test(bm, e, HULL_FLAG_INTERIOR_ELE)) {
|
||||
int del = TRUE;
|
||||
|
||||
@@ -367,7 +367,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
|
||||
BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
|
||||
if (BMO_elem_flag_test(bm, f, HULL_FLAG_INTERIOR_ELE))
|
||||
BMO_elem_flag_enable(bm, f, HULL_FLAG_DEL);
|
||||
}
|
||||
@@ -382,7 +382,7 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
|
||||
|
||||
/* Unmark any hole faces if they are isolated or part of a
|
||||
* border */
|
||||
BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
|
||||
BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
|
||||
if (BMO_elem_flag_test(bm, f, HULL_FLAG_HOLE)) {
|
||||
BM_ITER_ELEM (e, &iter, f, BM_EDGES_OF_FACE) {
|
||||
if (BM_edge_is_boundary(e)) {
|
||||
@@ -395,7 +395,7 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
|
||||
|
||||
/* Mark edges too if all adjacent faces are holes and the edge is
|
||||
* not already isolated */
|
||||
BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
|
||||
BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
|
||||
int hole = TRUE;
|
||||
int any_faces = FALSE;
|
||||
|
||||
@@ -412,20 +412,20 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
static int hull_input_vert_count(BMesh *bm, BMOperator *op)
|
||||
static int hull_input_vert_count(BMOperator *op)
|
||||
{
|
||||
BMOIter oiter;
|
||||
BMVert *v;
|
||||
int count = 0;
|
||||
|
||||
BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
|
||||
BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static BMVert **hull_input_verts_copy(BMesh *bm, BMOperator *op,
|
||||
static BMVert **hull_input_verts_copy(BMOperator *op,
|
||||
const int num_input_verts)
|
||||
{
|
||||
BMOIter oiter;
|
||||
@@ -434,7 +434,7 @@ static BMVert **hull_input_verts_copy(BMesh *bm, BMOperator *op,
|
||||
num_input_verts, AT);
|
||||
int i = 0;
|
||||
|
||||
BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
|
||||
BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
|
||||
input_verts[i++] = v;
|
||||
}
|
||||
|
||||
@@ -492,9 +492,9 @@ static void hull_from_bullet(BMesh *bm, BMOperator *op,
|
||||
plConvexHull hull;
|
||||
int i, count = 0;
|
||||
|
||||
const int num_input_verts = hull_input_vert_count(bm, op);
|
||||
const int num_input_verts = hull_input_vert_count(op);
|
||||
|
||||
input_verts = hull_input_verts_copy(bm, op, num_input_verts);
|
||||
input_verts = hull_input_verts_copy(op, num_input_verts);
|
||||
coords = hull_verts_for_bullet(input_verts, num_input_verts);
|
||||
|
||||
hull = plConvexHullCompute(coords, num_input_verts);
|
||||
@@ -535,13 +535,13 @@ static void hull_from_bullet(BMesh *bm, BMOperator *op,
|
||||
}
|
||||
|
||||
/* Check that there are at least three vertices in the input */
|
||||
static int hull_num_input_verts_is_ok(BMesh *bm, BMOperator *op)
|
||||
static int hull_num_input_verts_is_ok(BMOperator *op)
|
||||
{
|
||||
BMOIter oiter;
|
||||
BMVert *v;
|
||||
int partial_num_verts = 0;
|
||||
|
||||
BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
|
||||
BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
|
||||
partial_num_verts++;
|
||||
if (partial_num_verts >= 3)
|
||||
break;
|
||||
@@ -559,14 +559,14 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
|
||||
GHash *hull_triangles;
|
||||
|
||||
/* Verify that at least three verts in the input */
|
||||
if (!hull_num_input_verts_is_ok(bm, op)) {
|
||||
if (!hull_num_input_verts_is_ok(op)) {
|
||||
BMO_error_raise(bm, op, BMERR_CONVEX_HULL_FAILED,
|
||||
"Requires at least three vertices");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Tag input elements */
|
||||
BMO_ITER (ele, &oiter, bm, op, "input", BM_ALL) {
|
||||
BMO_ITER (ele, &oiter, op->slots_in, "input", BM_ALL) {
|
||||
BMO_elem_flag_enable(bm, ele, HULL_FLAG_INPUT);
|
||||
|
||||
/* Mark all vertices as interior to begin with */
|
||||
@@ -584,7 +584,7 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
|
||||
hull_mark_interior_elements(bm, op, final_edges);
|
||||
|
||||
/* Remove hull triangles covered by an existing face */
|
||||
if (BMO_slot_bool_get(op, "use_existing_faces")) {
|
||||
if (BMO_slot_bool_get(op->slots_in, "use_existing_faces")) {
|
||||
hull_remove_overlapping(bm, hull_triangles, final_edges);
|
||||
|
||||
hull_tag_holes(bm, op);
|
||||
@@ -603,23 +603,23 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
/* Output slot of input elements that ended up inside the hull
|
||||
* rather than part of it */
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "interior_geom", BM_ALL,
|
||||
HULL_FLAG_INTERIOR_ELE);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "interior_geom_out",
|
||||
BM_ALL, HULL_FLAG_INTERIOR_ELE);
|
||||
|
||||
/* Output slot of input elements that ended up inside the hull and
|
||||
* are are unused by other geometry. */
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "unused_geom", BM_ALL,
|
||||
HULL_FLAG_DEL);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "unused_geom_out",
|
||||
BM_ALL, HULL_FLAG_DEL);
|
||||
|
||||
/* Output slot of faces and edges that were in the input and on
|
||||
* the hull (useful for cases like bridging where you want to
|
||||
* delete some input geometry) */
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "holes_geom", BM_ALL,
|
||||
HULL_FLAG_HOLE);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "holes_geom_out",
|
||||
BM_ALL, HULL_FLAG_HOLE);
|
||||
|
||||
/* Output slot of all hull vertices, faces, and edges */
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL,
|
||||
HULL_FLAG_OUTPUT_GEOM);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geomout",
|
||||
BM_ALL, HULL_FLAG_OUTPUT_GEOM);
|
||||
}
|
||||
|
||||
#endif /* WITH_BULLET */
|
||||
|
||||
@@ -92,13 +92,13 @@ static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l)
|
||||
|
||||
void bmo_inset_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
const int use_outset = BMO_slot_bool_get(op, "use_outset");
|
||||
const int use_boundary = BMO_slot_bool_get(op, "use_boundary") && (use_outset == FALSE);
|
||||
const int use_even_offset = BMO_slot_bool_get(op, "use_even_offset");
|
||||
const int use_outset = BMO_slot_bool_get(op->slots_in, "use_outset");
|
||||
const int use_boundary = BMO_slot_bool_get(op->slots_in, "use_boundary") && (use_outset == FALSE);
|
||||
const int use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
|
||||
const int use_even_boundry = use_even_offset; /* could make own option */
|
||||
const int use_relative_offset = BMO_slot_bool_get(op, "use_relative_offset");
|
||||
const float thickness = BMO_slot_float_get(op, "thickness");
|
||||
const float depth = BMO_slot_float_get(op, "depth");
|
||||
const int use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset");
|
||||
const float thickness = BMO_slot_float_get(op->slots_in, "thickness");
|
||||
const float depth = BMO_slot_float_get(op->slots_in, "depth");
|
||||
|
||||
int edge_info_len = 0;
|
||||
|
||||
@@ -113,11 +113,11 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
if (use_outset == FALSE) {
|
||||
BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
|
||||
BMO_slot_buffer_hflag_enable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
|
||||
BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
|
||||
}
|
||||
else {
|
||||
BM_mesh_elem_hflag_enable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
|
||||
BMO_slot_buffer_hflag_disable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
|
||||
BMO_slot_buffer_hflag_disable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
|
||||
}
|
||||
|
||||
/* first count all inset edges we will split */
|
||||
@@ -481,7 +481,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
/* we could flag new edges/verts too, is it useful? */
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, ELE_NEW);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faceout", BM_FACE, ELE_NEW);
|
||||
|
||||
/* cheap feature to add depth to the inset */
|
||||
if (depth != 0.0f) {
|
||||
@@ -514,7 +514,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
|
||||
BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, FALSE);
|
||||
|
||||
/* tag face verts */
|
||||
BMO_ITER (f, &oiter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
|
||||
BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) {
|
||||
BM_elem_flag_enable(v, BM_ELEM_TAG);
|
||||
}
|
||||
|
||||
@@ -204,16 +204,16 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
|
||||
BMEdge *e;
|
||||
BLI_array_declare(jedges);
|
||||
JoinEdge *jedges = NULL;
|
||||
int do_sharp = BMO_slot_bool_get(op, "cmp_sharp");
|
||||
int do_uv = BMO_slot_bool_get(op, "cmp_uvs");
|
||||
int do_sharp = BMO_slot_bool_get(op->slots_in, "cmp_sharp");
|
||||
int do_uv = BMO_slot_bool_get(op->slots_in, "cmp_uvs");
|
||||
int do_tf = do_uv; /* texture face, make make its own option eventually */
|
||||
int do_vcol = BMO_slot_bool_get(op, "cmp_vcols");
|
||||
int do_mat = BMO_slot_bool_get(op, "cmp_materials");
|
||||
float limit = BMO_slot_float_get(op, "limit");
|
||||
int do_vcol = BMO_slot_bool_get(op->slots_in, "cmp_vcols");
|
||||
int do_mat = BMO_slot_bool_get(op->slots_in, "cmp_materials");
|
||||
float limit = BMO_slot_float_get(op->slots_in, "limit");
|
||||
int i, totedge;
|
||||
|
||||
/* flag all edges of all input face */
|
||||
BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
|
||||
BMO_elem_flag_enable(bm, f, FACE_INPUT);
|
||||
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
|
||||
BMO_elem_flag_enable(bm, l->e, EDGE_MARK);
|
||||
|
||||
@@ -53,9 +53,9 @@
|
||||
|
||||
void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
Object *ob = BMO_slot_ptr_get(op, "object");
|
||||
Mesh *me = BMO_slot_ptr_get(op, "mesh");
|
||||
int set_key = BMO_slot_bool_get(op, "set_shapekey");
|
||||
Object *ob = BMO_slot_ptr_get(op->slots_in, "object");
|
||||
Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
|
||||
int set_key = BMO_slot_bool_get(op->slots_in, "set_shapekey");
|
||||
|
||||
BM_mesh_bm_from_me(bm, me, set_key, ob->shapenr);
|
||||
|
||||
@@ -66,7 +66,7 @@ void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
Object *ob = BMO_slot_ptr_get(op, "object");
|
||||
Object *ob = BMO_slot_ptr_get(op->slots_in, "object");
|
||||
/* Scene *scene = BMO_slot_ptr_get(op, "scene"); */
|
||||
Mesh *me = ob->data;
|
||||
|
||||
@@ -77,9 +77,9 @@ void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
Mesh *me = BMO_slot_ptr_get(op, "mesh");
|
||||
Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
|
||||
/* Object *ob = BMO_slot_ptr_get(op, "object"); */
|
||||
int dotess = !BMO_slot_bool_get(op, "notessellation");
|
||||
int dotess = !BMO_slot_bool_get(op->slots_in, "notessellation");
|
||||
|
||||
BM_mesh_bm_to_me(bm, me, dotess);
|
||||
}
|
||||
|
||||
@@ -50,27 +50,27 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
|
||||
float mtx[4][4];
|
||||
float imtx[4][4];
|
||||
float scale[3] = {1.0f, 1.0f, 1.0f};
|
||||
float dist = BMO_slot_float_get(op, "mergedist");
|
||||
float dist = BMO_slot_float_get(op->slots_in, "mergedist");
|
||||
int i, ototvert /*, ototedge */;
|
||||
int axis = BMO_slot_int_get(op, "axis");
|
||||
int mirroru = BMO_slot_bool_get(op, "mirror_u");
|
||||
int mirrorv = BMO_slot_bool_get(op, "mirror_v");
|
||||
int axis = BMO_slot_int_get(op->slots_in, "axis");
|
||||
int mirroru = BMO_slot_bool_get(op->slots_in, "mirror_u");
|
||||
int mirrorv = BMO_slot_bool_get(op->slots_in, "mirror_v");
|
||||
|
||||
ototvert = bm->totvert;
|
||||
/* ototedge = bm->totedge; */ /* UNUSED */
|
||||
|
||||
BMO_slot_mat4_get(op, "mat", mtx);
|
||||
BMO_slot_mat4_get(op->slots_in, "mat", mtx);
|
||||
invert_m4_m4(imtx, mtx);
|
||||
|
||||
BMO_op_initf(bm, &dupeop, op->flag, "duplicate geom=%s", op, "geom");
|
||||
BMO_op_exec(bm, &dupeop);
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, &dupeop, "newout", BM_ALL, ELE_NEW);
|
||||
BMO_slot_buffer_flag_enable(bm, dupeop.slots_out, "newout", BM_ALL, ELE_NEW);
|
||||
|
||||
/* create old -> new mappin */
|
||||
i = 0;
|
||||
/* v2 = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); */ /* UNUSED */
|
||||
BMO_ITER (v, &siter, bm, &dupeop, "newout", BM_VERT) {
|
||||
BMO_ITER (v, &siter, dupeop.slots_out, "newout", BM_VERT) {
|
||||
BLI_array_grow_one(vmap);
|
||||
vmap[i] = v;
|
||||
/* v2 = BM_iter_step(&iter); */ /* UNUSED */
|
||||
@@ -89,7 +89,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
|
||||
v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
|
||||
for (i = 0; i < ototvert; i++) {
|
||||
if (fabsf(v->co[axis]) <= dist) {
|
||||
BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", vmap[i], v);
|
||||
BMO_slot_map_ptr_insert(&weldop, weldop.slots_in, "targetmap", vmap[i], v);
|
||||
}
|
||||
v = BM_iter_step(&iter);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
|
||||
int totlayer;
|
||||
BMIter liter;
|
||||
|
||||
BMO_ITER (f, &siter, bm, &dupeop, "newout", BM_FACE) {
|
||||
BMO_ITER (f, &siter, dupeop.slots_out, "newout", BM_FACE) {
|
||||
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
|
||||
totlayer = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV);
|
||||
for (i = 0; i < totlayer; i++) {
|
||||
@@ -120,7 +120,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_op_finish(bm, &weldop);
|
||||
BMO_op_finish(bm, &dupeop);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "newout", BM_ALL, ELE_NEW);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "newout", BM_ALL, ELE_NEW);
|
||||
|
||||
BLI_array_free(vmap);
|
||||
BLI_array_free(emap);
|
||||
|
||||
@@ -230,13 +230,13 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
|
||||
BMOperator bmop, prevop;
|
||||
BMVert *eve, *preveve;
|
||||
BMEdge *e;
|
||||
float vec[3], mat[4][4], phi, phid, dia = BMO_slot_float_get(op, "size");
|
||||
int a, tot = BMO_slot_int_get(op, "xsegments"), seg = BMO_slot_int_get(op, "ysegments");
|
||||
float vec[3], mat[4][4], phi, phid, dia = BMO_slot_float_get(op->slots_in, "size");
|
||||
int a, tot = BMO_slot_int_get(op->slots_in, "xsegments"), seg = BMO_slot_int_get(op->slots_in, "ysegments");
|
||||
|
||||
if (tot < 2) tot = 2;
|
||||
if (seg < 2) seg = 2;
|
||||
|
||||
BMO_slot_mat4_get(op, "mat", mat);
|
||||
BMO_slot_mat4_get(op->slots_in, "mat", mat);
|
||||
|
||||
/* one segment first: the X axis */
|
||||
phi = 1.0f;
|
||||
@@ -267,26 +267,26 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
for (a = 0; a < seg - 1; a++) {
|
||||
if (a) {
|
||||
BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%s", &prevop, "geomout");
|
||||
BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%S", &prevop, "geomout");
|
||||
BMO_op_exec(bm, &bmop);
|
||||
BMO_op_finish(bm, &prevop);
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geomout", BM_VERT, VERT_MARK);
|
||||
}
|
||||
else {
|
||||
BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%fe", EDGE_ORIG);
|
||||
BMO_op_exec(bm, &bmop);
|
||||
BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geomout", BM_VERT, VERT_MARK);
|
||||
}
|
||||
|
||||
BMO_op_callf(bm, op->flag, "translate vec=%v verts=%s", vec, &bmop, "geomout");
|
||||
BMO_op_callf(bm, op->flag, "translate vec=%v verts=%S", vec, &bmop, "geomout");
|
||||
prevop = bmop;
|
||||
}
|
||||
|
||||
if (a)
|
||||
BMO_op_finish(bm, &bmop);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vertout", BM_VERT, VERT_MARK);
|
||||
}
|
||||
|
||||
void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
|
||||
@@ -296,10 +296,10 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
|
||||
BMEdge *e;
|
||||
BMIter iter;
|
||||
float vec[3], mat[4][4], cmat[3][3], phi, q[4];
|
||||
float phid, dia = BMO_slot_float_get(op, "diameter");
|
||||
int a, seg = BMO_slot_int_get(op, "segments"), tot = BMO_slot_int_get(op, "revolutions");
|
||||
float phid, dia = BMO_slot_float_get(op->slots_in, "diameter");
|
||||
int a, seg = BMO_slot_int_get(op->slots_in, "segments"), tot = BMO_slot_int_get(op->slots_in, "revolutions");
|
||||
|
||||
BMO_slot_mat4_get(op, "mat", mat);
|
||||
BMO_slot_mat4_get(op->slots_in, "mat", mat);
|
||||
|
||||
phid = 2.0f * (float)M_PI / tot;
|
||||
/* phi = 0.25f * (float)M_PI; */ /* UNUSED */
|
||||
@@ -333,7 +333,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
for (a = 0; a < seg; a++) {
|
||||
if (a) {
|
||||
BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%s", &prevop, "geomout");
|
||||
BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%S", &prevop, "geomout");
|
||||
BMO_op_exec(bm, &bmop);
|
||||
BMO_op_finish(bm, &prevop);
|
||||
}
|
||||
@@ -342,8 +342,8 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_op_exec(bm, &bmop);
|
||||
}
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
|
||||
BMO_op_callf(bm, op->flag, "rotate cent=%v mat=%m3 verts=%s", vec, cmat, &bmop, "geomout");
|
||||
BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geomout", BM_VERT, VERT_MARK);
|
||||
BMO_op_callf(bm, op->flag, "rotate cent=%v mat=%m3 verts=%S", vec, cmat, &bmop, "geomout");
|
||||
|
||||
prevop = bmop;
|
||||
}
|
||||
@@ -375,7 +375,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vertout", BM_VERT, VERT_MARK);
|
||||
}
|
||||
|
||||
void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
|
||||
@@ -386,10 +386,10 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
|
||||
BMIter viter;
|
||||
BMLoop *l;
|
||||
float vec[3], mat[4][4] /* , phi, phid */;
|
||||
float dia = BMO_slot_float_get(op, "diameter");
|
||||
int a, subdiv = BMO_slot_int_get(op, "subdivisions");
|
||||
float dia = BMO_slot_float_get(op->slots_in, "diameter");
|
||||
int a, subdiv = BMO_slot_int_get(op->slots_in, "subdivisions");
|
||||
|
||||
BMO_slot_mat4_get(op, "mat", mat);
|
||||
BMO_slot_mat4_get(op->slots_in, "mat", mat);
|
||||
|
||||
/* phid = 2.0f * (float)M_PI / subdiv; */ /* UNUSED */
|
||||
/* phi = 0.25f * (float)M_PI; */ /* UNUSED */
|
||||
@@ -435,8 +435,8 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
|
||||
TRUE, TRUE);
|
||||
|
||||
BMO_op_exec(bm, &bmop);
|
||||
BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_EDGE, EDGE_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geomout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geomout", BM_EDGE, EDGE_MARK);
|
||||
BMO_op_finish(bm, &bmop);
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vertout", BM_VERT, VERT_MARK);
|
||||
}
|
||||
|
||||
void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
|
||||
@@ -457,7 +457,7 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
|
||||
float mat[4][4];
|
||||
int i;
|
||||
|
||||
BMO_slot_mat4_get(op, "mat", mat);
|
||||
BMO_slot_mat4_get(op->slots_in, "mat", mat);
|
||||
|
||||
for (i = 0; i < monkeynv; i++) {
|
||||
float v[3];
|
||||
@@ -494,7 +494,7 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
MEM_freeN(tv);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vertout", BM_VERT, VERT_MARK);
|
||||
}
|
||||
|
||||
|
||||
@@ -502,16 +502,16 @@ void bmo_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 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");
|
||||
float dia = BMO_slot_float_get(op->slots_in, "diameter");
|
||||
int segs = BMO_slot_int_get(op->slots_in, "segments");
|
||||
int cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
|
||||
int cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
|
||||
int a;
|
||||
|
||||
if (!segs)
|
||||
return;
|
||||
|
||||
BMO_slot_mat4_get(op, "mat", mat);
|
||||
BMO_slot_mat4_get(op->slots_in, "mat", mat);
|
||||
|
||||
phid = 2.0f * (float)M_PI / segs;
|
||||
phi = 0;
|
||||
@@ -566,25 +566,25 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW);
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vertout", BM_VERT, VERT_MARK);
|
||||
}
|
||||
|
||||
void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
BMVert *v1, *v2, *lastv1 = NULL, *lastv2 = NULL, *cent1, *cent2, *firstv1, *firstv2;
|
||||
float vec[3], mat[4][4], phi, phid;
|
||||
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 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");
|
||||
float dia1 = BMO_slot_float_get(op->slots_in, "diameter1");
|
||||
float dia2 = BMO_slot_float_get(op->slots_in, "diameter2");
|
||||
float depth = BMO_slot_float_get(op->slots_in, "depth");
|
||||
int segs = BMO_slot_int_get(op->slots_in, "segments");
|
||||
int cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
|
||||
int cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
|
||||
int a;
|
||||
|
||||
if (!segs)
|
||||
return;
|
||||
|
||||
BMO_slot_mat4_get(op, "mat", mat);
|
||||
BMO_slot_mat4_get(op->slots_in, "mat", mat);
|
||||
|
||||
phid = 2.0f * (float)M_PI / segs;
|
||||
phi = 0;
|
||||
@@ -662,15 +662,15 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
|
||||
BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, FALSE);
|
||||
|
||||
BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, 0.000001);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vertout", BM_VERT, VERT_MARK);
|
||||
}
|
||||
|
||||
void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
BMVert *v1, *v2, *v3, *v4, *v5, *v6, *v7, *v8;
|
||||
float vec[3], mat[4][4], off = BMO_slot_float_get(op, "size") / 2.0f;
|
||||
float vec[3], mat[4][4], off = BMO_slot_float_get(op->slots_in, "size") / 2.0f;
|
||||
|
||||
BMO_slot_mat4_get(op, "mat", mat);
|
||||
BMO_slot_mat4_get(op->slots_in, "mat", mat);
|
||||
|
||||
if (!off) off = 0.5f;
|
||||
|
||||
@@ -740,5 +740,5 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
|
||||
BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, FALSE);
|
||||
BM_face_create_quad_tri(bm, v8, v7, v6, v5, NULL, FALSE);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vertout", BM_VERT, VERT_MARK);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op)
|
||||
int split = FALSE;
|
||||
|
||||
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
|
||||
v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", l->v);
|
||||
v2 = BMO_slot_map_ptr_get(op->slots_in, "targetmap", l->v);
|
||||
/* ok: if v2 is NULL (e.g. not in the map) then it's
|
||||
* a target vert, otherwise it's a double */
|
||||
if ((v2 && BM_vert_in_face(f, v2)) &&
|
||||
@@ -109,7 +109,7 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
/* mark merge verts for deletion */
|
||||
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
|
||||
if ((v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v))) {
|
||||
if ((v2 = BMO_slot_map_ptr_get(op->slots_in, "targetmap", v))) {
|
||||
BMO_elem_flag_enable(bm, v, ELE_DEL);
|
||||
|
||||
/* merge the vertex flags, else we get randomly selected/unselected verts */
|
||||
@@ -125,8 +125,8 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
|
||||
if (BMO_elem_flag_test(bm, e->v1, ELE_DEL) || BMO_elem_flag_test(bm, e->v2, ELE_DEL)) {
|
||||
v = BMO_slot_map_ptr_get(bm, op, "targetmap", e->v1);
|
||||
v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", e->v2);
|
||||
v = BMO_slot_map_ptr_get(op->slots_in, "targetmap", e->v1);
|
||||
v2 = BMO_slot_map_ptr_get(op->slots_in, "targetmap", e->v2);
|
||||
|
||||
if (!v) v = e->v1;
|
||||
if (!v2) v2 = e->v2;
|
||||
@@ -174,10 +174,10 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
|
||||
v = l->v;
|
||||
v2 = l->next->v;
|
||||
if (BMO_elem_flag_test(bm, v, ELE_DEL)) {
|
||||
v = BMO_slot_map_ptr_get(bm, op, "targetmap", v);
|
||||
v = BMO_slot_map_ptr_get(op->slots_in, "targetmap", v);
|
||||
}
|
||||
if (BMO_elem_flag_test(bm, v2, ELE_DEL)) {
|
||||
v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v2);
|
||||
v2 = BMO_slot_map_ptr_get(op->slots_in, "targetmap", v2);
|
||||
}
|
||||
|
||||
e2 = v != v2 ? BM_edge_exists(v, v2) : NULL;
|
||||
@@ -207,10 +207,10 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
|
||||
v2 = loops[1]->v;
|
||||
|
||||
if (BMO_elem_flag_test(bm, v, ELE_DEL)) {
|
||||
v = BMO_slot_map_ptr_get(bm, op, "targetmap", v);
|
||||
v = BMO_slot_map_ptr_get(op->slots_in, "targetmap", v);
|
||||
}
|
||||
if (BMO_elem_flag_test(bm, v2, ELE_DEL)) {
|
||||
v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v2);
|
||||
v2 = BMO_slot_map_ptr_get(op->slots_in, "targetmap", v2);
|
||||
}
|
||||
|
||||
f2 = BM_face_create_ngon(bm, v, v2, edges, a, TRUE);
|
||||
@@ -262,7 +262,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
|
||||
float fac;
|
||||
int i, tot;
|
||||
|
||||
snapv = BMO_iter_new(&siter, bm, op, "snapv", BM_VERT);
|
||||
snapv = BMO_iter_new(&siter, op->slots_in, "snapv", BM_VERT);
|
||||
tot = BM_vert_face_count(snapv);
|
||||
|
||||
if (!tot)
|
||||
@@ -290,7 +290,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
||||
BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
|
||||
if (l == firstl) {
|
||||
continue;
|
||||
@@ -318,7 +318,7 @@ void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op)
|
||||
type = bm->ldata.layers[i].type;
|
||||
CustomData_data_initminmax(type, &min, &max);
|
||||
|
||||
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
||||
BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
|
||||
block = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i);
|
||||
CustomData_data_dominmax(type, block, &min, &max);
|
||||
@@ -329,7 +329,7 @@ void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op)
|
||||
CustomData_data_multiply(type, &max, 0.5f);
|
||||
CustomData_data_add(type, &min, &max);
|
||||
|
||||
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
||||
BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
|
||||
block = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i);
|
||||
CustomData_data_copy_value(type, &min, block);
|
||||
@@ -345,18 +345,18 @@ void bmo_pointmerge_exec(BMesh *bm, BMOperator *op)
|
||||
BMVert *v, *snapv = NULL;
|
||||
float vec[3];
|
||||
|
||||
BMO_slot_vec_get(op, "merge_co", vec);
|
||||
BMO_slot_vec_get(op->slots_in, "merge_co", vec);
|
||||
|
||||
//BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges");
|
||||
BMO_op_init(bm, &weldop, op->flag, "weld_verts");
|
||||
|
||||
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
||||
if (!snapv) {
|
||||
snapv = v;
|
||||
copy_v3_v3(snapv->co, vec);
|
||||
}
|
||||
else {
|
||||
BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", v, snapv);
|
||||
BMO_slot_map_ptr_insert(&weldop, weldop.slots_in, "targetmap", v, snapv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges");
|
||||
BMO_op_init(bm, &weldop, op->flag, "weld_verts");
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
|
||||
|
||||
BMW_init(&walker, bm, BMW_SHELL,
|
||||
BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP,
|
||||
@@ -408,9 +408,9 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
|
||||
copy_v3_v3(edges[i]->v2->co, center);
|
||||
|
||||
if (edges[i]->v1 != edges[0]->v1)
|
||||
BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", edges[i]->v1, edges[0]->v1);
|
||||
BMO_slot_map_ptr_insert(&weldop, weldop.slots_in, "targetmap", edges[i]->v1, edges[0]->v1);
|
||||
if (edges[i]->v2 != edges[0]->v1)
|
||||
BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", edges[i]->v2, edges[0]->v1);
|
||||
BMO_slot_map_ptr_insert(&weldop, weldop.slots_in, "targetmap", edges[i]->v2, edges[0]->v1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,7 +436,7 @@ static void bmo_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer)
|
||||
/* clear all short flags */
|
||||
BMO_mesh_flag_disable_all(bm, op, BM_ALL, (1 << 16) - 1);
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
|
||||
|
||||
BMW_init(&walker, bm, BMW_LOOPDATA_ISLAND,
|
||||
BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP,
|
||||
@@ -486,31 +486,34 @@ void bmo_collapse_uvs_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, const char *targetmapname)
|
||||
static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op,
|
||||
BMOperator *optarget,
|
||||
BMOpSlot optarget_slot_args[BMO_OP_MAX_SLOTS],
|
||||
const char *targetmapname)
|
||||
{
|
||||
BMVert **verts;
|
||||
int verts_len;
|
||||
|
||||
int i, j, keepvert = 0;
|
||||
|
||||
const float dist = BMO_slot_float_get(op, "dist");
|
||||
const float dist = BMO_slot_float_get(op->slots_in, "dist");
|
||||
const float dist3 = dist * 3.0f;
|
||||
|
||||
/* Test whether keep_verts arg exists and is non-empty */
|
||||
if (BMO_slot_exists(op, "keep_verts")) {
|
||||
if (BMO_slot_exists(op->slots_in, "keep_verts")) {
|
||||
BMOIter oiter;
|
||||
keepvert = BMO_iter_new(&oiter, bm, op, "keep_verts", BM_VERT) != NULL;
|
||||
keepvert = BMO_iter_new(&oiter, op->slots_in, "keep_verts", BM_VERT) != NULL;
|
||||
}
|
||||
|
||||
/* get the verts as an array we can sort */
|
||||
verts = BMO_slot_as_arrayN(op, "verts", &verts_len);
|
||||
verts = BMO_slot_as_arrayN(op->slots_in, "verts", &verts_len);
|
||||
|
||||
/* sort by vertex coordinates added together */
|
||||
qsort(verts, verts_len, sizeof(BMVert *), vergaverco);
|
||||
|
||||
/* Flag keep_verts */
|
||||
if (keepvert) {
|
||||
BMO_slot_buffer_flag_enable(bm, op, "keep_verts", BM_VERT, VERT_KEEP);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "keep_verts", BM_VERT, VERT_KEEP);
|
||||
}
|
||||
|
||||
for (i = 0; i < verts_len; i++) {
|
||||
@@ -547,7 +550,7 @@ static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op, BMOperator *opt
|
||||
BMO_elem_flag_enable(bm, v_other, VERT_DOUBLE);
|
||||
BMO_elem_flag_enable(bm, v_check, VERT_TARGET);
|
||||
|
||||
BMO_slot_map_ptr_insert(bm, optarget, targetmapname, v_other, v_check);
|
||||
BMO_slot_map_ptr_insert(optarget, optarget_slot_args, targetmapname, v_other, v_check);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -560,7 +563,8 @@ void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op)
|
||||
BMOperator weldop;
|
||||
|
||||
BMO_op_init(bm, &weldop, op->flag, "weld_verts");
|
||||
bmesh_find_doubles_common(bm, op, &weldop, "targetmap");
|
||||
bmesh_find_doubles_common(bm, op,
|
||||
&weldop, weldop.slots_in, "targetmap");
|
||||
BMO_op_exec(bm, &weldop);
|
||||
BMO_op_finish(bm, &weldop);
|
||||
}
|
||||
@@ -568,7 +572,8 @@ void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
void bmo_find_doubles_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
bmesh_find_doubles_common(bm, op, op, "targetmapout");
|
||||
bmesh_find_doubles_common(bm, op,
|
||||
op, op->slots_out, "targetmapout");
|
||||
}
|
||||
|
||||
void bmo_automerge_exec(BMesh *bm, BMOperator *op)
|
||||
@@ -580,7 +585,7 @@ void bmo_automerge_exec(BMesh *bm, BMOperator *op)
|
||||
/* The "verts" input sent to this op is the set of verts that
|
||||
* can be merged away into any other verts. Mark all other verts
|
||||
* as VERT_KEEP. */
|
||||
BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_IN);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_IN);
|
||||
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
|
||||
if (!BMO_elem_flag_test(bm, v, VERT_IN)) {
|
||||
BMO_elem_flag_enable(bm, v, VERT_KEEP);
|
||||
@@ -590,12 +595,14 @@ void bmo_automerge_exec(BMesh *bm, BMOperator *op)
|
||||
/* Search for doubles among all vertices, but only merge non-VERT_KEEP
|
||||
* vertices into VERT_KEEP vertices. */
|
||||
BMO_op_initf(bm, &findop, op->flag, "find_doubles verts=%av keep_verts=%fv", VERT_KEEP);
|
||||
BMO_slot_copy(op, &findop, "dist", "dist");
|
||||
BMO_slot_copy(op, slots_in, "dist",
|
||||
&findop, slots_in, "dist");
|
||||
BMO_op_exec(bm, &findop);
|
||||
|
||||
/* weld the vertices */
|
||||
BMO_op_init(bm, &weldop, op->flag, "weld_verts");
|
||||
BMO_slot_copy(&findop, &weldop, "targetmapout", "targetmap");
|
||||
BMO_slot_copy(&findop, slots_out, "targetmapout",
|
||||
&weldop, slots_in, "targetmap");
|
||||
BMO_op_exec(bm, &weldop);
|
||||
|
||||
BMO_op_finish(bm, &findop);
|
||||
|
||||
@@ -103,10 +103,10 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
|
||||
SimSel_FaceExt *f_ext = NULL;
|
||||
int *indices = NULL;
|
||||
float t_no[3]; /* temporary normal */
|
||||
const int type = BMO_slot_int_get(op, "type");
|
||||
const float thresh = BMO_slot_float_get(op, "thresh");
|
||||
const int type = BMO_slot_int_get(op->slots_in, "type");
|
||||
const float thresh = BMO_slot_float_get(op->slots_in, "thresh");
|
||||
const float thresh_radians = thresh * (float)M_PI;
|
||||
const int compare = BMO_slot_int_get(op, "compare");
|
||||
const int compare = BMO_slot_int_get(op->slots_in, "compare");
|
||||
|
||||
/* initial_elem - other_elem */
|
||||
float delta_fl;
|
||||
@@ -121,7 +121,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
|
||||
* so the overall complexity will be less than $O(mn)$ where is the total number of selected faces,
|
||||
* and n is the total number of faces
|
||||
*/
|
||||
BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
|
||||
if (!BMO_elem_flag_test(bm, fs, FACE_MARK)) { /* is this really needed ? */
|
||||
BMO_elem_flag_enable(bm, fs, FACE_MARK);
|
||||
num_sels++;
|
||||
@@ -256,7 +256,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
|
||||
MEM_freeN(indices);
|
||||
|
||||
/* transfer all marked faces to the output slot */
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faceout", BM_FACE, FACE_MARK);
|
||||
#undef FACE_MARK
|
||||
}
|
||||
|
||||
@@ -299,9 +299,9 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
|
||||
float angle;
|
||||
|
||||
int num_sels = 0, num_total = 0;
|
||||
const int type = BMO_slot_int_get(op, "type");
|
||||
const float thresh = BMO_slot_float_get(op, "thresh");
|
||||
const int compare = BMO_slot_int_get(op, "compare");
|
||||
const int type = BMO_slot_int_get(op->slots_in, "type");
|
||||
const float thresh = BMO_slot_float_get(op->slots_in, "thresh");
|
||||
const int compare = BMO_slot_int_get(op->slots_in, "compare");
|
||||
|
||||
/* initial_elem - other_elem */
|
||||
float delta_fl;
|
||||
@@ -324,7 +324,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
|
||||
num_total = BM_mesh_elem_count(bm, BM_EDGE);
|
||||
|
||||
/* iterate through all selected edges and mark them */
|
||||
BMO_ITER (es, &es_iter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (es, &es_iter, op->slots_in, "edges", BM_EDGE) {
|
||||
BMO_elem_flag_enable(bm, es, EDGE_MARK);
|
||||
num_sels++;
|
||||
}
|
||||
@@ -474,7 +474,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
|
||||
MEM_freeN(indices);
|
||||
|
||||
/* transfer all marked edges to the output slot */
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edgeout", BM_EDGE, EDGE_MARK);
|
||||
|
||||
#undef EDGE_MARK
|
||||
}
|
||||
@@ -507,10 +507,10 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
|
||||
SimSel_VertExt *v_ext = NULL;
|
||||
int *indices = NULL;
|
||||
int num_total = 0, num_sels = 0, i = 0, idx = 0;
|
||||
const int type = BMO_slot_int_get(op, "type");
|
||||
const float thresh = BMO_slot_float_get(op, "thresh");
|
||||
const int type = BMO_slot_int_get(op->slots_in, "type");
|
||||
const float thresh = BMO_slot_float_get(op->slots_in, "thresh");
|
||||
const float thresh_radians = thresh * (float)M_PI;
|
||||
const int compare = BMO_slot_int_get(op, "compare");
|
||||
const int compare = BMO_slot_int_get(op->slots_in, "compare");
|
||||
|
||||
/* initial_elem - other_elem */
|
||||
// float delta_fl;
|
||||
@@ -519,7 +519,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
|
||||
num_total = BM_mesh_elem_count(bm, BM_VERT);
|
||||
|
||||
/* iterate through all selected edges and mark them */
|
||||
BMO_ITER (vs, &vs_iter, bm, op, "verts", BM_VERT) {
|
||||
BMO_ITER (vs, &vs_iter, op->slots_in, "verts", BM_VERT) {
|
||||
BMO_elem_flag_enable(bm, vs, VERT_MARK);
|
||||
num_sels++;
|
||||
}
|
||||
@@ -608,7 +608,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
|
||||
MEM_freeN(indices);
|
||||
MEM_freeN(v_ext);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vertout", BM_VERT, VERT_MARK);
|
||||
|
||||
#undef VERT_MARK
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ void bmo_slide_vert_exec(BMesh *bm, BMOperator *op)
|
||||
int selected_edges = 0;
|
||||
|
||||
/* Get slide amount */
|
||||
const float distance_t = BMO_slot_float_get(op, "distance_t");
|
||||
const float distance_t = BMO_slot_float_get(op->slots_in, "distance_t");
|
||||
|
||||
/* Get start vertex */
|
||||
vertex = BMO_iter_new(&oiter, bm, op, "vert", BM_VERT);
|
||||
vertex = BMO_iter_new(&oiter, op->slots_in, "vert", BM_VERT);
|
||||
|
||||
|
||||
if (!vertex) {
|
||||
@@ -68,7 +68,7 @@ void bmo_slide_vert_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
/* Count selected edges */
|
||||
BMO_ITER (h, &oiter, bm, op, "edge", BM_VERT | BM_EDGE) {
|
||||
BMO_ITER (h, &oiter, op->slots_in, "edge", BM_VERT | BM_EDGE) {
|
||||
switch (h->htype) {
|
||||
case BM_EDGE:
|
||||
selected_edges++;
|
||||
@@ -108,7 +108,7 @@ void bmo_slide_vert_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
/* Return the new edge. The same previously marked with VERT_MARK */
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vertout", BM_VERT, VERT_MARK);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ static void delete_void_pointer(void *data);
|
||||
static void fill_laplacian_matrix(LaplacianSystem *sys);
|
||||
static void memset_laplacian_system(LaplacianSystem *sys, int val);
|
||||
static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez, int volumepreservation);
|
||||
static void volume_preservation(BMesh *bm, BMOperator *op, float vini, float vend, int usex, int usey, int usez);
|
||||
static void volume_preservation(BMOperator *op, float vini, float vend, int usex, int usey, int usez);
|
||||
|
||||
static void delete_void_pointer(void *data)
|
||||
{
|
||||
@@ -455,7 +455,7 @@ static float compute_volume(BMesh *bm)
|
||||
return fabs(vol);
|
||||
}
|
||||
|
||||
static void volume_preservation(BMesh *bm, BMOperator *op, float vini, float vend, int usex, int usey, int usez)
|
||||
static void volume_preservation(BMOperator *op, float vini, float vend, int usex, int usey, int usez)
|
||||
{
|
||||
float beta;
|
||||
BMOIter siter;
|
||||
@@ -463,9 +463,9 @@ static void volume_preservation(BMesh *bm, BMOperator *op, float vini, float ven
|
||||
|
||||
if (vend != 0.0f) {
|
||||
beta = pow(vini / vend, 1.0f / 3.0f);
|
||||
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
||||
if (usex) {
|
||||
v->co[0] *= beta;
|
||||
v->co[0] *= beta;
|
||||
}
|
||||
if (usey) {
|
||||
v->co[1] *= beta;
|
||||
@@ -512,7 +512,7 @@ static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez
|
||||
if (volumepreservation) {
|
||||
vini = compute_volume(sys->bm);
|
||||
}
|
||||
BMO_ITER (v, &siter, sys->bm, sys->op, "verts", BM_VERT) {
|
||||
BMO_ITER (v, &siter, sys->op->slots_in, "verts", BM_VERT) {
|
||||
m_vertex_id = BM_elem_index_get(v);
|
||||
if (sys->zerola[m_vertex_id] == 0) {
|
||||
if (usex) {
|
||||
@@ -528,7 +528,7 @@ static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez
|
||||
}
|
||||
if (volumepreservation) {
|
||||
vend = compute_volume(sys->bm);
|
||||
volume_preservation(sys->bm, sys->op, vini, vend, usex, usey, usez);
|
||||
volume_preservation(sys->op, vini, vend, usex, usey, usez);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -552,13 +552,13 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
|
||||
memset_laplacian_system(sys, 0);
|
||||
|
||||
BM_mesh_elem_index_ensure(bm, BM_VERT);
|
||||
lambda = BMO_slot_float_get(op, "lambda");
|
||||
lambda_border = BMO_slot_float_get(op, "lambda_border");
|
||||
lambda = BMO_slot_float_get(op->slots_in, "lambda");
|
||||
lambda_border = BMO_slot_float_get(op->slots_in, "lambda_border");
|
||||
sys->min_area = 0.00001f;
|
||||
usex = BMO_slot_bool_get(op, "use_x");
|
||||
usey = BMO_slot_bool_get(op, "use_y");
|
||||
usez = BMO_slot_bool_get(op, "use_z");
|
||||
volumepreservation = BMO_slot_bool_get(op, "volume_preservation");
|
||||
usex = BMO_slot_bool_get(op->slots_in, "use_x");
|
||||
usey = BMO_slot_bool_get(op->slots_in, "use_y");
|
||||
usez = BMO_slot_bool_get(op->slots_in, "use_z");
|
||||
volumepreservation = BMO_slot_bool_get(op->slots_in, "volume_preservation");
|
||||
|
||||
|
||||
nlNewContext();
|
||||
@@ -573,7 +573,7 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
|
||||
for (i = 0; i < bm->totvert; i++) {
|
||||
nlLockVariable(i);
|
||||
}
|
||||
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
||||
m_vertex_id = BM_elem_index_get(v);
|
||||
nlUnlockVariable(m_vertex_id);
|
||||
nlSetVariable(0, m_vertex_id, v->co[0]);
|
||||
@@ -583,7 +583,7 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
nlBegin(NL_MATRIX);
|
||||
init_laplacian_matrix(sys);
|
||||
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
||||
m_vertex_id = BM_elem_index_get(v);
|
||||
nlRightHandSideAdd(0, m_vertex_id, v->co[0]);
|
||||
nlRightHandSideAdd(1, m_vertex_id, v->co[1]);
|
||||
|
||||
@@ -226,7 +226,7 @@ static BMVert *subdivideedgenum(BMesh *bm, BMEdge *edge, BMEdge *oedge,
|
||||
float percent, percent2 = 0.0f;
|
||||
|
||||
if (BMO_elem_flag_test(bm, edge, EDGE_PERCENT) && totpoint == 1)
|
||||
percent = BMO_slot_map_float_get(bm, params->op, "edgepercents", edge);
|
||||
percent = BMO_slot_map_float_get(params->op->slots_in, "edgepercents", edge);
|
||||
else {
|
||||
percent = 1.0f / (float)(totpoint + 1 - curpoint);
|
||||
percent2 = (float)(curpoint + 1) / (float)(totpoint + 1);
|
||||
@@ -717,18 +717,18 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
|
||||
int use_sphere, cornertype, use_singleedge, use_gridfill;
|
||||
int skey, seed, i, j, matched, a, b, numcuts, totesel;
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, SUBD_SPLIT);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, SUBD_SPLIT);
|
||||
|
||||
numcuts = BMO_slot_int_get(op, "numcuts");
|
||||
seed = BMO_slot_int_get(op, "seed");
|
||||
smooth = BMO_slot_float_get(op, "smooth");
|
||||
fractal = BMO_slot_float_get(op, "fractal");
|
||||
along_normal = BMO_slot_float_get(op, "along_normal");
|
||||
cornertype = BMO_slot_int_get(op, "quadcornertype");
|
||||
numcuts = BMO_slot_int_get(op->slots_in, "numcuts");
|
||||
seed = BMO_slot_int_get(op->slots_in, "seed");
|
||||
smooth = BMO_slot_float_get(op->slots_in, "smooth");
|
||||
fractal = BMO_slot_float_get(op->slots_in, "fractal");
|
||||
along_normal = BMO_slot_float_get(op->slots_in, "along_normal");
|
||||
cornertype = BMO_slot_int_get(op->slots_in, "quadcornertype");
|
||||
|
||||
use_singleedge = BMO_slot_bool_get(op, "use_singleedge");
|
||||
use_gridfill = BMO_slot_bool_get(op, "use_gridfill");
|
||||
use_sphere = BMO_slot_bool_get(op, "use_sphere");
|
||||
use_singleedge = BMO_slot_bool_get(op->slots_in, "use_singleedge");
|
||||
use_gridfill = BMO_slot_bool_get(op->slots_in, "use_gridfill");
|
||||
use_sphere = BMO_slot_bool_get(op->slots_in, "use_sphere");
|
||||
|
||||
BLI_srandom(seed);
|
||||
|
||||
@@ -774,7 +774,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
/* first go through and tag edges */
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "edges", BM_EDGE, SUBD_SPLIT);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_in, "edges", BM_EDGE, SUBD_SPLIT);
|
||||
|
||||
params.numcuts = numcuts;
|
||||
params.op = op;
|
||||
@@ -790,10 +790,10 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
|
||||
params.off[1] = (float)BLI_drand() * 200.0f;
|
||||
params.off[2] = (float)BLI_drand() * 200.0f;
|
||||
|
||||
BMO_slot_map_to_flag(bm, op, "custompatterns",
|
||||
BMO_slot_map_to_flag(bm, op->slots_in, "custompatterns",
|
||||
BM_FACE, FACE_CUSTOMFILL);
|
||||
|
||||
BMO_slot_map_to_flag(bm, op, "edgepercents",
|
||||
BMO_slot_map_to_flag(bm, op->slots_in, "edgepercents",
|
||||
BM_EDGE, EDGE_PERCENT);
|
||||
|
||||
|
||||
@@ -837,8 +837,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
if (BMO_elem_flag_test(bm, face, FACE_CUSTOMFILL)) {
|
||||
pat = BMO_slot_map_data_get(bm, op,
|
||||
"custompatterns", face);
|
||||
pat = BMO_slot_map_data_get(op->slots_in, "custompatterns", face);
|
||||
for (i = 0; i < pat->len; i++) {
|
||||
matched = 1;
|
||||
for (j = 0; j < pat->len; j++) {
|
||||
@@ -910,7 +909,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
einput = BMO_slot_get(op, "edges");
|
||||
einput = BMO_slot_get(op->slots_in, "edges");
|
||||
|
||||
/* go through and split edges */
|
||||
for (i = 0; i < einput->len; i++) {
|
||||
@@ -1075,10 +1074,10 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
|
||||
BLI_array_free(loops_split);
|
||||
BLI_array_free(loops);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "outinner", BM_ALL, ELE_INNER);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "outsplit", BM_ALL, ELE_SPLIT);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "innerout", BM_ALL, ELE_INNER);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "splitout", BM_ALL, ELE_SPLIT);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, ELE_INNER | ELE_SPLIT | SUBD_SPLIT);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geomout", BM_ALL, ELE_INNER | ELE_SPLIT | SUBD_SPLIT);
|
||||
}
|
||||
|
||||
/* editmesh-emulating function */
|
||||
@@ -1112,7 +1111,7 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
|
||||
BMOIter iter;
|
||||
BMElem *ele;
|
||||
|
||||
for (ele = BMO_iter_new(&iter, bm, &op, "outinner", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
|
||||
for (ele = BMO_iter_new(&iter, op.slots_out, "innerout", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
|
||||
BM_elem_select_set(bm, ele, TRUE);
|
||||
}
|
||||
}
|
||||
@@ -1123,7 +1122,7 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
|
||||
/* deselect input */
|
||||
BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
|
||||
|
||||
for (ele = BMO_iter_new(&iter, bm, &op, "outinner", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
|
||||
for (ele = BMO_iter_new(&iter, op.slots_out, "innerout", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
|
||||
BM_elem_select_set(bm, ele, TRUE);
|
||||
|
||||
if (ele->head.htype == BM_VERT) {
|
||||
@@ -1158,7 +1157,7 @@ void bmo_bisect_edges_exec(BMesh *bm, BMOperator *op)
|
||||
SubDParams params = {0};
|
||||
int skey;
|
||||
|
||||
params.numcuts = BMO_slot_int_get(op, "numcuts");
|
||||
params.numcuts = BMO_slot_int_get(op->slots_in, "numcuts");
|
||||
params.op = op;
|
||||
|
||||
BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
|
||||
@@ -1167,11 +1166,11 @@ void bmo_bisect_edges_exec(BMesh *bm, BMOperator *op)
|
||||
params.origkey = skey;
|
||||
|
||||
/* go through and split edges */
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
bm_subdivide_multicut(bm, e, ¶ms, e->v1, e->v2);
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "outsplit", BM_ALL, ELE_SPLIT);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "splitout", BM_ALL, ELE_SPLIT);
|
||||
|
||||
BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, skey);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ static void symm_verts_mirror(Symm *symm)
|
||||
|
||||
symm->vert_symm_map = BLI_ghash_ptr_new(AT);
|
||||
|
||||
BMO_ITER (src_v, &oiter, symm->bm, symm->op, "input", BM_VERT) {
|
||||
BMO_ITER (src_v, &oiter, symm->op->slots_in, "input", BM_VERT) {
|
||||
SymmSide side = symm_co_side(symm, src_v->co);
|
||||
float co[3];
|
||||
|
||||
@@ -145,7 +145,7 @@ static void symm_split_asymmetric_edges(Symm *symm)
|
||||
|
||||
symm->edge_split_map = BLI_ghash_ptr_new(AT);
|
||||
|
||||
BMO_ITER (e, &oiter, symm->bm, symm->op, "input", BM_EDGE) {
|
||||
BMO_ITER (e, &oiter, symm->op->slots_in, "input", BM_EDGE) {
|
||||
float flipped[3];
|
||||
|
||||
copy_v3_v3(flipped, e->v1->co);
|
||||
@@ -195,7 +195,7 @@ static void symm_mirror_edges(Symm *symm)
|
||||
BMOIter oiter;
|
||||
BMEdge *e;
|
||||
|
||||
BMO_ITER (e, &oiter, symm->bm, symm->op, "input", BM_EDGE) {
|
||||
BMO_ITER (e, &oiter, symm->op->slots_in, "input", BM_EDGE) {
|
||||
BMVert *v1 = NULL, *v2 = NULL;
|
||||
BMEdge *e_new;
|
||||
|
||||
@@ -448,7 +448,7 @@ static void symm_mirror_polygons(Symm *symm)
|
||||
BLI_array_declare(fv);
|
||||
BLI_array_declare(fe);
|
||||
|
||||
BMO_ITER (f, &oiter, symm->bm, symm->op, "input", BM_FACE) {
|
||||
BMO_ITER (f, &oiter, symm->op->slots_in, "input", BM_FACE) {
|
||||
BMIter iter;
|
||||
BMLoop *l;
|
||||
int mirror_all = TRUE, ignore_all = TRUE;
|
||||
@@ -607,7 +607,7 @@ static void symm_kill_unused(Symm *symm)
|
||||
BMVert *v;
|
||||
|
||||
/* Kill unused edges */
|
||||
BMO_ITER (e, &oiter, symm->bm, symm->op, "input", BM_EDGE) {
|
||||
BMO_ITER (e, &oiter, symm->op->slots_in, "input", BM_EDGE) {
|
||||
const int crosses = symm_edge_crosses_axis(symm, e);
|
||||
const int symmetric = (crosses &&
|
||||
(!BLI_ghash_haskey(symm->edge_split_map, e)));
|
||||
@@ -623,7 +623,7 @@ static void symm_kill_unused(Symm *symm)
|
||||
}
|
||||
|
||||
/* Kill unused vertices */
|
||||
BMO_ITER (v, &oiter, symm->bm, symm->op, "input", BM_VERT) {
|
||||
BMO_ITER (v, &oiter, symm->op->slots_in, "input", BM_VERT) {
|
||||
if (symm_co_side(symm, v->co) == SYMM_SIDE_KILL) {
|
||||
if (BM_vert_edge_count(v) == 0)
|
||||
BM_vert_kill(symm->bm, v);
|
||||
@@ -634,7 +634,7 @@ static void symm_kill_unused(Symm *symm)
|
||||
void bmo_symmetrize_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
Symm symm;
|
||||
BMO_SymmDirection direction = BMO_slot_int_get(op, "direction");
|
||||
BMO_SymmDirection direction = BMO_slot_int_get(op->slots_in, "direction");
|
||||
|
||||
symm.bm = bm;
|
||||
symm.op = op;
|
||||
@@ -658,6 +658,6 @@ void bmo_symmetrize_exec(BMesh *bm, BMOperator *op)
|
||||
BLI_ghash_free(symm.vert_symm_map, NULL, NULL);
|
||||
BLI_ghash_free(symm.edge_split_map, NULL, NULL);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL,
|
||||
SYMM_OUTPUT_GEOM);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geomout",
|
||||
BM_ALL, SYMM_OUTPUT_GEOM);
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
|
||||
float (*projectverts)[3] = NULL;
|
||||
BLI_array_declare(projectverts);
|
||||
int i;
|
||||
const int use_beauty = BMO_slot_bool_get(op, "use_beauty");
|
||||
const int use_beauty = BMO_slot_bool_get(op->slots_in, "use_beauty");
|
||||
|
||||
for (face = BMO_iter_new(&siter, bm, op, "faces", BM_FACE); face; face = BMO_iter_step(&siter)) {
|
||||
for (face = BMO_iter_new(&siter, op->slots_in, "faces", BM_FACE); face; face = BMO_iter_step(&siter)) {
|
||||
|
||||
BLI_array_empty(projectverts);
|
||||
BLI_array_empty(newfaces);
|
||||
@@ -64,16 +64,14 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
BM_face_triangulate(bm, face, projectverts, EDGE_NEW, FACE_NEW, newfaces, use_beauty);
|
||||
|
||||
BMO_slot_map_ptr_insert(bm, op, "facemap", face, face);
|
||||
BMO_slot_map_ptr_insert(op, op->slots_out, "facemap_out", face, face);
|
||||
for (i = 0; newfaces[i]; i++) {
|
||||
BMO_slot_map_ptr_insert(bm, op, "facemap",
|
||||
newfaces[i], face);
|
||||
|
||||
BMO_slot_map_ptr_insert(op, op->slots_out, "facemap_out", newfaces[i], face);
|
||||
}
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_NEW);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_NEW);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edgeout", BM_EDGE, EDGE_NEW);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faceout", BM_FACE, FACE_NEW);
|
||||
|
||||
BLI_array_free(projectverts);
|
||||
BLI_array_free(newfaces);
|
||||
@@ -87,9 +85,9 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
|
||||
BMEdge *e;
|
||||
int stop = 0;
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "constrain_edges", BM_EDGE, EDGE_MARK);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "constrain_edges", BM_EDGE, EDGE_MARK);
|
||||
|
||||
BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
|
||||
if (f->len == 3) {
|
||||
BMO_elem_flag_enable(bm, f, FACE_MARK);
|
||||
}
|
||||
@@ -152,7 +150,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE | BM_FACE, ELE_NEW);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geomout", BM_EDGE | BM_FACE, ELE_NEW);
|
||||
}
|
||||
|
||||
void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
|
||||
@@ -170,7 +168,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
BLI_scanfill_begin(&sf_ctx);
|
||||
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
BMO_elem_flag_enable(bm, e, EDGE_MARK);
|
||||
|
||||
if (!BLI_smallhash_haskey(&hash, (uintptr_t)e->v1)) {
|
||||
@@ -214,8 +212,8 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
|
||||
/* clean up fill */
|
||||
BMO_op_initf(bm, &bmop, op->flag, "beautify_fill faces=%ff constrain_edges=%fe", ELE_NEW, EDGE_MARK);
|
||||
BMO_op_exec(bm, &bmop);
|
||||
BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE | BM_EDGE, ELE_NEW);
|
||||
BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geomout", BM_FACE | BM_EDGE, ELE_NEW);
|
||||
BMO_op_finish(bm, &bmop);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE | BM_FACE, ELE_NEW);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geomout", BM_EDGE | BM_FACE, ELE_NEW);
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ void bmo_unsubdivide_exec(BMesh *bm, BMOperator *op)
|
||||
BMVert *v;
|
||||
BMIter iter;
|
||||
|
||||
const int iterations = max_ii(1, BMO_slot_int_get(op, "iterations"));
|
||||
const int iterations = max_ii(1, BMO_slot_int_get(op->slots_in, "iterations"));
|
||||
|
||||
BMOpSlot *vinput = BMO_slot_get(op, "verts");
|
||||
BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
|
||||
BMVert **vinput_arr = (BMVert **)vinput->data.p;
|
||||
int v_index;
|
||||
|
||||
|
||||
@@ -45,21 +45,21 @@ void bmo_create_vert_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
float vec[3];
|
||||
|
||||
BMO_slot_vec_get(op, "co", vec);
|
||||
BMO_slot_vec_get(op->slots_in, "co", vec);
|
||||
|
||||
BMO_elem_flag_enable(bm, BM_vert_create(bm, vec, NULL), 1);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "newvertout", BM_VERT, 1);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "newvertout", BM_VERT, 1);
|
||||
}
|
||||
|
||||
void bmo_transform_exec(BMesh *bm, BMOperator *op)
|
||||
void bmo_transform_exec(BMesh *UNUSED(bm), BMOperator *op)
|
||||
{
|
||||
BMOIter iter;
|
||||
BMVert *v;
|
||||
float mat[4][4];
|
||||
|
||||
BMO_slot_mat4_get(op, "mat", mat);
|
||||
BMO_slot_mat4_get(op->slots_in, "mat", mat);
|
||||
|
||||
BMO_ITER (v, &iter, bm, op, "verts", BM_VERT) {
|
||||
BMO_ITER (v, &iter, op->slots_in, "verts", BM_VERT) {
|
||||
mul_m4_v3(mat, v->co);
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ void bmo_translate_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
float mat[4][4], vec[3];
|
||||
|
||||
BMO_slot_vec_get(op, "vec", vec);
|
||||
BMO_slot_vec_get(op->slots_in, "vec", vec);
|
||||
|
||||
unit_m4(mat);
|
||||
copy_v3_v3(mat[3], vec);
|
||||
@@ -80,7 +80,7 @@ void bmo_scale_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
float mat[3][3], vec[3];
|
||||
|
||||
BMO_slot_vec_get(op, "vec", vec);
|
||||
BMO_slot_vec_get(op->slots_in, "vec", vec);
|
||||
|
||||
unit_m3(mat);
|
||||
mat[0][0] = vec[0];
|
||||
@@ -94,7 +94,7 @@ void bmo_rotate_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
float vec[3];
|
||||
|
||||
BMO_slot_vec_get(op, "cent", vec);
|
||||
BMO_slot_vec_get(op->slots_in, "cent", vec);
|
||||
|
||||
/* there has to be a proper matrix way to do this, but
|
||||
* this is how editmesh did it and I'm too tired to think
|
||||
@@ -113,7 +113,7 @@ void bmo_reverse_faces_exec(BMesh *bm, BMOperator *op)
|
||||
BMOIter siter;
|
||||
BMFace *f;
|
||||
|
||||
BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
|
||||
BM_face_normal_flip(bm, f);
|
||||
}
|
||||
}
|
||||
@@ -122,8 +122,8 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
BMOIter siter;
|
||||
BMEdge *e, *e2;
|
||||
int ccw = BMO_slot_bool_get(op, "ccw");
|
||||
int is_single = BMO_slot_buffer_count(bm, op, "edges") == 1;
|
||||
int ccw = BMO_slot_bool_get(op->slots_in, "ccw");
|
||||
int is_single = BMO_slot_buffer_count(op->slots_in, "edges") == 1;
|
||||
short check_flag = is_single ?
|
||||
BM_EDGEROT_CHECK_EXISTS :
|
||||
BM_EDGEROT_CHECK_EXISTS | BM_EDGEROT_CHECK_DEGENERATE;
|
||||
@@ -131,7 +131,7 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
|
||||
#define EDGE_OUT 1
|
||||
#define FACE_TAINT 1
|
||||
|
||||
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
|
||||
/**
|
||||
* this ends up being called twice, could add option to not to call check in
|
||||
* #BM_edge_rotate to get some extra speed */
|
||||
@@ -162,7 +162,7 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_OUT);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edgeout", BM_EDGE, EDGE_OUT);
|
||||
|
||||
#undef EDGE_OUT
|
||||
#undef FACE_TAINT
|
||||
@@ -180,7 +180,7 @@ static void bmo_region_extend_extend(BMesh *bm, BMOperator *op, int usefaces)
|
||||
BMOIter siter;
|
||||
|
||||
if (!usefaces) {
|
||||
BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
|
||||
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
|
||||
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
|
||||
if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
|
||||
@@ -202,7 +202,7 @@ static void bmo_region_extend_extend(BMesh *bm, BMOperator *op, int usefaces)
|
||||
BMFace *f, *f2;
|
||||
BMLoop *l;
|
||||
|
||||
BMO_ITER (f, &siter, bm, op, "geom", BM_FACE) {
|
||||
BMO_ITER (f, &siter, op->slots_in, "geom", BM_FACE) {
|
||||
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
|
||||
BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) {
|
||||
if (!BM_elem_flag_test(f2, BM_ELEM_HIDDEN)) {
|
||||
@@ -224,7 +224,7 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
|
||||
BMOIter siter;
|
||||
|
||||
if (!usefaces) {
|
||||
BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
|
||||
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
|
||||
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
|
||||
if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
|
||||
@@ -248,7 +248,7 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
|
||||
BMFace *f, *f2;
|
||||
BMLoop *l;
|
||||
|
||||
BMO_ITER (f, &siter, bm, op, "geom", BM_FACE) {
|
||||
BMO_ITER (f, &siter, op->slots_in, "geom", BM_FACE) {
|
||||
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
|
||||
BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) {
|
||||
if (!BM_elem_flag_test(f2, BM_ELEM_HIDDEN)) {
|
||||
@@ -265,17 +265,17 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
|
||||
|
||||
void bmo_region_extend_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
int use_faces = BMO_slot_bool_get(op, "use_faces");
|
||||
int constrict = BMO_slot_bool_get(op, "constrict");
|
||||
int use_faces = BMO_slot_bool_get(op->slots_in, "use_faces");
|
||||
int constrict = BMO_slot_bool_get(op->slots_in, "constrict");
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "geom", BM_ALL, SEL_ORIG);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "geom", BM_ALL, SEL_ORIG);
|
||||
|
||||
if (constrict)
|
||||
bmo_region_extend_constrict(bm, op, use_faces);
|
||||
else
|
||||
bmo_region_extend_extend(bm, op, use_faces);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, SEL_FLAG);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geomout", BM_ALL, SEL_FLAG);
|
||||
}
|
||||
|
||||
/********* righthand faces implementation ****** */
|
||||
@@ -314,15 +314,15 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
|
||||
BLI_array_declare(fstack);
|
||||
BMLoop *l, *l2;
|
||||
float maxx, maxx_test, cent[3];
|
||||
int i, i_max, flagflip = BMO_slot_bool_get(op, "do_flip");
|
||||
int i, i_max, flagflip = BMO_slot_bool_get(op->slots_in, "do_flip");
|
||||
|
||||
startf = NULL;
|
||||
maxx = -1.0e10;
|
||||
|
||||
BMO_slot_buffer_flag_enable(bm, op, "faces", BM_FACE, FACE_FLAG);
|
||||
BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_FLAG);
|
||||
|
||||
/* find a starting face */
|
||||
BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
|
||||
|
||||
/* clear dirty flag */
|
||||
BM_elem_flag_disable(f, BM_ELEM_TAG);
|
||||
@@ -405,7 +405,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
|
||||
BLI_array_free(fstack);
|
||||
|
||||
/* check if we have faces yet to do. if so, recurse */
|
||||
BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
|
||||
if (!BMO_elem_flag_test(bm, f, FACE_VIS)) {
|
||||
bmo_recalc_face_normals_exec(bm, op);
|
||||
break;
|
||||
@@ -413,7 +413,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
|
||||
void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op)
|
||||
{
|
||||
BMOIter siter;
|
||||
BMIter iter;
|
||||
@@ -421,20 +421,20 @@ void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
|
||||
BMEdge *e;
|
||||
BLI_array_declare(cos);
|
||||
float (*cos)[3] = NULL;
|
||||
float *co, *co2, clipdist = BMO_slot_float_get(op, "clipdist");
|
||||
float *co, *co2, clipdist = BMO_slot_float_get(op->slots_in, "clipdist");
|
||||
int i, j, clipx, clipy, clipz;
|
||||
int xaxis, yaxis, zaxis;
|
||||
|
||||
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");
|
||||
clipx = BMO_slot_bool_get(op->slots_in, "mirror_clip_x");
|
||||
clipy = BMO_slot_bool_get(op->slots_in, "mirror_clip_y");
|
||||
clipz = BMO_slot_bool_get(op->slots_in, "mirror_clip_z");
|
||||
|
||||
xaxis = BMO_slot_bool_get(op, "use_axis_x");
|
||||
yaxis = BMO_slot_bool_get(op, "use_axis_y");
|
||||
zaxis = BMO_slot_bool_get(op, "use_axis_z");
|
||||
xaxis = BMO_slot_bool_get(op->slots_in, "use_axis_x");
|
||||
yaxis = BMO_slot_bool_get(op->slots_in, "use_axis_y");
|
||||
zaxis = BMO_slot_bool_get(op->slots_in, "use_axis_z");
|
||||
|
||||
i = 0;
|
||||
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
||||
BLI_array_grow_one(cos);
|
||||
co = cos[i];
|
||||
|
||||
@@ -465,7 +465,7 @@ void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
i = 0;
|
||||
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
|
||||
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
||||
if (xaxis)
|
||||
v->co[0] = cos[i][0];
|
||||
if (yaxis)
|
||||
@@ -489,9 +489,9 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
|
||||
BMFace *fs; /* current face */
|
||||
BMIter l_iter; /* iteration loop */
|
||||
|
||||
int dir = BMO_slot_int_get(op, "dir");
|
||||
int dir = BMO_slot_int_get(op->slots_in, "dir");
|
||||
|
||||
BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
|
||||
if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) {
|
||||
if (dir == DIRECTION_CW) { /* same loops direction */
|
||||
BMLoop *lf; /* current face loops */
|
||||
@@ -556,7 +556,7 @@ void bmo_reverse_uvs_exec(BMesh *bm, BMOperator *op)
|
||||
BLI_array_declare(uvs);
|
||||
float (*uvs)[2] = NULL;
|
||||
|
||||
BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
|
||||
if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) {
|
||||
BMLoop *lf; /* current face loops */
|
||||
int i;
|
||||
@@ -594,9 +594,9 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
|
||||
BMFace *fs; /* current face */
|
||||
BMIter l_iter; /* iteration loop */
|
||||
|
||||
int dir = BMO_slot_int_get(op, "dir");
|
||||
int dir = BMO_slot_int_get(op->slots_in, "dir");
|
||||
|
||||
BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
|
||||
if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) {
|
||||
if (dir == DIRECTION_CW) { /* same loops direction */
|
||||
BMLoop *lf; /* current face loops */
|
||||
@@ -661,7 +661,7 @@ void bmo_reverse_colors_exec(BMesh *bm, BMOperator *op)
|
||||
BLI_array_declare(cols);
|
||||
MLoopCol *cols = NULL;
|
||||
|
||||
BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
|
||||
if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) {
|
||||
BMLoop *lf; /* current face loops */
|
||||
int i;
|
||||
@@ -710,12 +710,13 @@ void bmo_shortest_path_exec(BMesh *bm, BMOperator *op)
|
||||
ElemNode *vert_list = NULL;
|
||||
|
||||
int num_total = 0 /*, num_sels = 0 */, i = 0;
|
||||
const int type = BMO_slot_int_get(op, "type");
|
||||
const int type = BMO_slot_int_get(op->slots_in, "type");
|
||||
|
||||
BMO_ITER (vs, &vs_iter, bm, op, "startv", BM_VERT) {
|
||||
/* BMESH_TODO use BMO_slot_buffer_elem_first here? */
|
||||
BMO_ITER (vs, &vs_iter, op->slots_in, "startv", BM_VERT) {
|
||||
sv = vs;
|
||||
}
|
||||
BMO_ITER (vs, &vs_iter, bm, op, "endv", BM_VERT) {
|
||||
BMO_ITER (vs, &vs_iter, op->slots_in, "endv", BM_VERT) {
|
||||
ev = vs;
|
||||
}
|
||||
|
||||
@@ -795,5 +796,5 @@ void bmo_shortest_path_exec(BMesh *bm, BMOperator *op)
|
||||
BLI_heap_free(h, NULL);
|
||||
MEM_freeN(vert_list);
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vertout", BM_VERT, VERT_MARK);
|
||||
}
|
||||
|
||||
@@ -134,12 +134,12 @@ extern float BM_vert_calc_mean_tagged_edge_length(BMVert *v);
|
||||
|
||||
void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
const int use_boundary = BMO_slot_bool_get(op, "use_boundary");
|
||||
const int use_even_offset = BMO_slot_bool_get(op, "use_even_offset");
|
||||
const int use_relative_offset = BMO_slot_bool_get(op, "use_relative_offset");
|
||||
const int use_crease = (BMO_slot_bool_get(op, "use_crease") &&
|
||||
const int use_boundary = BMO_slot_bool_get(op->slots_in, "use_boundary");
|
||||
const int use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
|
||||
const int use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset");
|
||||
const int use_crease = (BMO_slot_bool_get(op->slots_in, "use_crease") &&
|
||||
CustomData_has_layer(&bm->edata, CD_CREASE));
|
||||
const float depth = BMO_slot_float_get(op, "thickness");
|
||||
const float depth = BMO_slot_float_get(op->slots_in, "thickness");
|
||||
const float inset = depth;
|
||||
|
||||
const int totvert_orig = bm->totvert;
|
||||
@@ -184,7 +184,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
|
||||
/* setup tags, all faces and verts will be tagged which will be duplicated */
|
||||
BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
|
||||
|
||||
BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (f_src, &oiter, op->slots_in, "faces", BM_FACE) {
|
||||
verts_loop_tot += f_src->len;
|
||||
BM_elem_flag_enable(f_src, BM_ELEM_TAG);
|
||||
BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
|
||||
@@ -230,7 +230,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
|
||||
verts_loop = MEM_mallocN(sizeof(BMVert **) * verts_loop_tot, __func__);
|
||||
verts_loop_tot = 0; /* count up again */
|
||||
|
||||
BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (f_src, &oiter, op->slots_in, "faces", BM_FACE) {
|
||||
BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
|
||||
BM_elem_index_set(l, verts_loop_tot); /* set_loop */
|
||||
|
||||
@@ -288,7 +288,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
|
||||
BMO_ITER (f_src, &oiter, op->slots_in, "faces", BM_FACE) {
|
||||
BM_elem_flag_disable(f_src, BM_ELEM_TAG);
|
||||
BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
|
||||
BMFace *f_new;
|
||||
@@ -400,5 +400,5 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
|
||||
MEM_freeN(verts_pos);
|
||||
MEM_freeN(verts_loop);
|
||||
|
||||
BMO_slot_buffer_from_enabled_hflag(bm, op, "faceout", BM_FACE, BM_ELEM_TAG);
|
||||
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faceout", BM_FACE, BM_ELEM_TAG);
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
|
||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||
|
||||
/* select the output */
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faceout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
/* finish the operator */
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
@@ -773,7 +773,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
|
||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||
|
||||
/* select the output */
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edgeout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
EDBM_selectmode_flush(em);
|
||||
|
||||
/* finish the operator */
|
||||
@@ -817,7 +817,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
|
||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||
|
||||
/* select the output */
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
/* finish the operator */
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
|
||||
@@ -738,10 +738,10 @@ static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_u
|
||||
BMO_op_exec(bm, &bmop);
|
||||
|
||||
/* Deselect the input edges */
|
||||
BMO_slot_buffer_hflag_disable(bm, &bmop, "edge", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_disable(bm, bmop.slots_in, "edge", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
/* Select the output vert */
|
||||
BMO_slot_buffer_hflag_enable(bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(bm, bmop.slots_out, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
/* Flush the select buffers */
|
||||
EDBM_selectmode_flush(em);
|
||||
|
||||
@@ -242,7 +242,7 @@ static short edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const c
|
||||
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
|
||||
BMO_ITER (f, &siter, em->bm, &bmop, "faceout", BM_FACE) {
|
||||
BMO_ITER (f, &siter, bmop.slots_out, "faceout", BM_FACE) {
|
||||
BM_face_select_set(em->bm, f, TRUE);
|
||||
|
||||
/* set face vertex normals to face normal */
|
||||
@@ -269,7 +269,7 @@ static short edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char
|
||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_VERT | BM_EDGE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geomout", BM_VERT | BM_EDGE, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
return 0;
|
||||
@@ -286,10 +286,10 @@ static short edbm_extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char
|
||||
EDBM_op_init(em, &bmop, op, "extrude_vert_indiv verts=%hv", hflag);
|
||||
|
||||
/* deselect original verts */
|
||||
BMO_slot_buffer_hflag_disable(em->bm, &bmop, "verts", BM_VERT, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "verts", BM_VERT, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_VERT, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "vertout", BM_VERT, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
return 0;
|
||||
@@ -310,7 +310,7 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
|
||||
BMElem *ele;
|
||||
|
||||
BMO_op_init(bm, &extop, BMO_FLAG_DEFAULTS, "extrude_face_region");
|
||||
BMO_slot_buffer_from_enabled_hflag(bm, &extop, "edgefacein", BM_VERT | BM_EDGE | BM_FACE, hflag);
|
||||
BMO_slot_buffer_from_enabled_hflag(bm, &extop, extop.slots_in, "edgefacein", BM_VERT | BM_EDGE | BM_FACE, hflag);
|
||||
|
||||
/* If a mirror modifier with clipping is on, we need to adjust some
|
||||
* of the cases above to handle edges on the line of symmetry.
|
||||
@@ -350,21 +350,21 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
|
||||
if ((fabsf(co1[0]) < mmd->tolerance) &&
|
||||
(fabsf(co2[0]) < mmd->tolerance))
|
||||
{
|
||||
BMO_slot_map_ptr_insert(bm, &extop, "exclude", edge, NULL);
|
||||
BMO_slot_map_ptr_insert(&extop, extop.slots_in, "exclude", edge, NULL);
|
||||
}
|
||||
}
|
||||
if (mmd->flag & MOD_MIR_AXIS_Y) {
|
||||
if ((fabsf(co1[1]) < mmd->tolerance) &&
|
||||
(fabsf(co2[1]) < mmd->tolerance))
|
||||
{
|
||||
BMO_slot_map_ptr_insert(bm, &extop, "exclude", edge, NULL);
|
||||
BMO_slot_map_ptr_insert(&extop, extop.slots_in, "exclude", edge, NULL);
|
||||
}
|
||||
}
|
||||
if (mmd->flag & MOD_MIR_AXIS_Z) {
|
||||
if ((fabsf(co1[2]) < mmd->tolerance) &&
|
||||
(fabsf(co2[2]) < mmd->tolerance))
|
||||
{
|
||||
BMO_slot_map_ptr_insert(bm, &extop, "exclude", edge, NULL);
|
||||
BMO_slot_map_ptr_insert(&extop, extop.slots_in, "exclude", edge, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -379,7 +379,7 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
|
||||
|
||||
zero_v3(nor);
|
||||
|
||||
BMO_ITER (ele, &siter, bm, &extop, "geomout", BM_ALL) {
|
||||
BMO_ITER (ele, &siter, extop.slots_out, "geomout", BM_ALL) {
|
||||
BM_elem_select_set(bm, ele, TRUE);
|
||||
|
||||
if (ele->head.htype == BM_FACE) {
|
||||
@@ -915,7 +915,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent
|
||||
EDBM_op_init(vc.em, &bmop, op, "create_vert co=%v", min);
|
||||
BMO_op_exec(vc.em->bm, &bmop);
|
||||
|
||||
BMO_ITER (v1, &oiter, vc.em->bm, &bmop, "newvertout", BM_VERT) {
|
||||
BMO_ITER (v1, &oiter, bmop.slots_out, "newvertout", BM_VERT) {
|
||||
BM_vert_select_set(vc.em->bm, v1, TRUE);
|
||||
}
|
||||
|
||||
@@ -1110,8 +1110,8 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edgeout", BM_EDGE, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
@@ -1261,7 +1261,7 @@ static int edbm_vert_connect(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
BMO_op_exec(bm, &bmop);
|
||||
len = BMO_slot_get(&bmop, "edgeout")->len;
|
||||
len = BMO_slot_get(bmop.slots_out, "edgeout")->len;
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -1301,7 +1301,7 @@ static int edbm_edge_split_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
BMO_op_exec(bm, &bmop);
|
||||
len = BMO_slot_get(&bmop, "edgeout")->len;
|
||||
len = BMO_slot_get(bmop.slots_out, "edgeout")->len;
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -1339,7 +1339,7 @@ static int edbm_duplicate_exec(bContext *C, wmOperator *op)
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "newout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "newout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
@@ -1453,12 +1453,12 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* avoids leaving old verts selected which can be a problem running multiple times,
|
||||
* since this means the edges become selected around the face which then attempt to rotate */
|
||||
BMO_slot_buffer_hflag_disable(em->bm, &bmop, "edges", BM_EDGE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "edges", BM_EDGE, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
/* edges may rotate into hidden vertices, if this does _not_ run we get an ilogical state */
|
||||
BMO_slot_buffer_hflag_disable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_HIDDEN, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "edgeout", BM_EDGE, BM_ELEM_HIDDEN, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edgeout", BM_EDGE, BM_ELEM_SELECT, TRUE);
|
||||
EDBM_selectmode_flush(em);
|
||||
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
@@ -2204,7 +2204,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
|
||||
BM_ELEM_SELECT, threshold);
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
|
||||
if (!EDBM_op_callf(em, op, "weld_verts targetmap=%s", &bmop, "targetmapout")) {
|
||||
if (!EDBM_op_callf(em, op, "weld_verts targetmap=%S", &bmop, "targetmapout")) {
|
||||
BMO_op_finish(em->bm, &bmop);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -2313,7 +2313,7 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
|
||||
/* EDBM_flag_disable_all(em, BM_ELEM_SELECT); */
|
||||
|
||||
/* select the output */
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
/* finish the operator */
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
@@ -2630,13 +2630,13 @@ static int edbm_solidify_exec(bContext *C, wmOperator *op)
|
||||
/* deselect only the faces in the region to be solidified (leave wire
|
||||
* edges and loose verts selected, as there will be no corresponding
|
||||
* geometry selected below) */
|
||||
BMO_slot_buffer_hflag_disable(bm, &bmop, "geom", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_disable(bm, bmop.slots_in, "geom", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
/* run the solidify operator */
|
||||
BMO_op_exec(bm, &bmop);
|
||||
|
||||
/* select the newly generated faces */
|
||||
BMO_slot_buffer_hflag_enable(bm, &bmop, "geomout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(bm, bmop.slots_out, "geomout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
@@ -2934,7 +2934,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (isect != 0.0f) {
|
||||
if (mode != KNIFE_MULTICUT && mode != KNIFE_MIDPOINT) {
|
||||
BMO_slot_map_float_insert(bm, &bmop,
|
||||
BMO_slot_map_float_insert(&bmop, bmop.slots_in,
|
||||
"edgepercents",
|
||||
be, isect);
|
||||
}
|
||||
@@ -2951,16 +2951,16 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
|
||||
MEM_freeN(mouse_path);
|
||||
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, &bmop, "edges", BM_EDGE, ELE_EDGE_CUT);
|
||||
BMO_slot_buffer_from_enabled_flag(bm, &bmop, bmop.slots_in, "edges", BM_EDGE, ELE_EDGE_CUT);
|
||||
|
||||
if (mode == KNIFE_MIDPOINT) numcuts = 1;
|
||||
BMO_slot_int_set(&bmop, "numcuts", numcuts);
|
||||
BMO_slot_int_set(bmop.slots_in, "numcuts", numcuts);
|
||||
|
||||
BMO_slot_int_set(&bmop, "quadcornertype", SUBD_STRAIGHT_CUT);
|
||||
BMO_slot_bool_set(&bmop, "use_singleedge", FALSE);
|
||||
BMO_slot_bool_set(&bmop, "use_gridfill", FALSE);
|
||||
BMO_slot_int_set(bmop.slots_in, "quadcornertype", SUBD_STRAIGHT_CUT);
|
||||
BMO_slot_bool_set(bmop.slots_in, "use_singleedge", FALSE);
|
||||
BMO_slot_bool_set(bmop.slots_in, "use_gridfill", FALSE);
|
||||
|
||||
BMO_slot_float_set(&bmop, "radius", 0);
|
||||
BMO_slot_float_set(bmop.slots_in, "radius", 0);
|
||||
|
||||
BMO_op_exec(bm, &bmop);
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
@@ -3303,7 +3303,7 @@ static int edbm_fill_exec(bContext *C, wmOperator *op)
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
|
||||
/* select new geometry */
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_FACE | BM_EDGE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geomout", BM_FACE | BM_EDGE, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
@@ -3575,7 +3575,7 @@ static int edbm_split_exec(bContext *C, wmOperator *op)
|
||||
EDBM_op_init(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, FALSE);
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geomout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -3637,7 +3637,7 @@ static int edbm_spin_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
BMO_op_exec(bm, &spinop);
|
||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||
BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
if (!EDBM_op_finish(em, &spinop, op, TRUE)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -3761,7 +3761,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
BMO_op_exec(bm, &spinop);
|
||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||
BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
if (!EDBM_op_finish(em, &spinop, op, TRUE)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -4771,7 +4771,7 @@ static int edbm_bevel_calc(bContext *C, wmOperator *op)
|
||||
/* not essential, but we may have some loose geometry that
|
||||
* won't get bevel'd and better not leave it selected */
|
||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -5105,7 +5105,7 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op)
|
||||
/* when merge is used the edges are joined and remain selected */
|
||||
if (use_merge == FALSE) {
|
||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
}
|
||||
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
@@ -5278,11 +5278,11 @@ static int edbm_inset_calc(bContext *C, wmOperator *op)
|
||||
if (use_select_inset) {
|
||||
/* deselect original faces/verts */
|
||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
}
|
||||
else {
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE, BM_ELEM_SELECT, FALSE);
|
||||
BMO_slot_buffer_hflag_disable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, FALSE);
|
||||
BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "faceout", BM_FACE, BM_ELEM_SELECT, FALSE);
|
||||
/* re-select faces so the verts and edges get selected too */
|
||||
BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, TRUE, BM_ELEM_SELECT);
|
||||
}
|
||||
@@ -5539,7 +5539,7 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (use_replace) {
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
|
||||
|
||||
BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS,
|
||||
"delete geom=%hvef context=%i",
|
||||
@@ -5547,7 +5547,7 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
@@ -5610,8 +5610,8 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* Delete unused vertices, edges, and faces */
|
||||
if (RNA_boolean_get(op->ptr, "delete_unused")) {
|
||||
if (!EDBM_op_callf(em, op, "delete geom=%s context=%i",
|
||||
&bmop, "unused_geom", DEL_ONLYTAGGED))
|
||||
if (!EDBM_op_callf(em, op, "delete geom=%S context=%i",
|
||||
&bmop, "unused_geom_out", DEL_ONLYTAGGED))
|
||||
{
|
||||
EDBM_op_finish(em, &bmop, op, TRUE);
|
||||
return OPERATOR_CANCELLED;
|
||||
@@ -5620,8 +5620,8 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* Delete hole edges/faces */
|
||||
if (RNA_boolean_get(op->ptr, "make_holes")) {
|
||||
if (!EDBM_op_callf(em, op, "delete geom=%s context=%i",
|
||||
&bmop, "holes_geom", DEL_ONLYTAGGED))
|
||||
if (!EDBM_op_callf(em, op, "delete geom=%S context=%i",
|
||||
&bmop, "holes_geom_out", DEL_ONLYTAGGED))
|
||||
{
|
||||
EDBM_op_finish(em, &bmop, op, TRUE);
|
||||
return OPERATOR_CANCELLED;
|
||||
@@ -5630,7 +5630,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* Merge adjacent triangles */
|
||||
if (RNA_boolean_get(op->ptr, "join_triangles")) {
|
||||
if (!EDBM_op_callf(em, op, "join_triangles faces=%s limit=%f",
|
||||
if (!EDBM_op_callf(em, op, "join_triangles faces=%S limit=%f",
|
||||
&bmop, "geomout",
|
||||
RNA_float_get(op->ptr, "limit")))
|
||||
{
|
||||
|
||||
@@ -263,7 +263,7 @@ int EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...)
|
||||
return EDBM_op_finish(em, &bmop, op, TRUE);
|
||||
}
|
||||
|
||||
int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *selectslot, const char *fmt, ...)
|
||||
int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *select_slot_out, const char *fmt, ...)
|
||||
{
|
||||
BMesh *bm = em->bm;
|
||||
BMOperator bmop;
|
||||
@@ -285,7 +285,7 @@ int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *selects
|
||||
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
|
||||
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, selectslot, BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, select_slot_out, BM_ALL, BM_ELEM_SELECT, TRUE);
|
||||
|
||||
va_end(list);
|
||||
return EDBM_op_finish(em, &bmop, op, TRUE);
|
||||
@@ -498,7 +498,7 @@ void EDBM_select_more(BMEditMesh *em)
|
||||
BM_ELEM_SELECT, FALSE, use_faces);
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
/* don't flush selection in edge/vertex mode */
|
||||
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
|
||||
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geomout", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
|
||||
BMO_op_finish(em->bm, &bmop);
|
||||
|
||||
EDBM_select_flush(em);
|
||||
@@ -514,7 +514,7 @@ void EDBM_select_less(BMEditMesh *em)
|
||||
BM_ELEM_SELECT, TRUE, use_faces);
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
/* don't flush selection in edge/vertex mode */
|
||||
BMO_slot_buffer_hflag_disable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
|
||||
BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "geomout", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
|
||||
BMO_op_finish(em->bm, &bmop);
|
||||
|
||||
EDBM_selectmode_flush(em);
|
||||
|
||||
@@ -178,14 +178,14 @@ static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
|
||||
amd->merge_dist, dupe_op, "geom");
|
||||
|
||||
BMO_op_exec(bm, &find_op);
|
||||
|
||||
|
||||
i = 0;
|
||||
BMO_ITER (ele, &oiter, bm, dupe_op, "geom", BM_ALL) {
|
||||
BMO_ITER (ele, &oiter, dupe_op->slots_in, "geom", BM_ALL) {
|
||||
BM_elem_index_set(ele, i); /* set_dirty */
|
||||
i++;
|
||||
}
|
||||
|
||||
BMO_ITER (ele, &oiter, bm, dupe_op, "newout", BM_ALL) {
|
||||
BMO_ITER (ele, &oiter, dupe_op->slots_out, "newout", BM_ALL) {
|
||||
BM_elem_index_set(ele, i); /* set_dirty */
|
||||
i++;
|
||||
}
|
||||
@@ -197,7 +197,7 @@ static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
|
||||
index_map = MEM_callocN(sizeof(int) * (*index_map_length), "index_map");
|
||||
|
||||
/*element type argument doesn't do anything here*/
|
||||
BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
|
||||
BMO_ITER (v, &oiter, find_op.slots_out, "targetmapout", 0) {
|
||||
v2 = BMO_iter_map_value_p(&oiter);
|
||||
|
||||
index_map[BM_elem_index_get(v)] = BM_elem_index_get(v2) + 1;
|
||||
@@ -218,9 +218,10 @@ static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
|
||||
static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
|
||||
const ArrayModifierData *amd,
|
||||
BMOperator *dupe_op,
|
||||
const char *dupe_slot_name,
|
||||
BMOpSlot dupe_op_slot_args[BMO_OP_MAX_SLOTS], const char *dupe_slot_name,
|
||||
BMOperator *weld_op)
|
||||
{
|
||||
const int is_input = (dupe_op->slots_in == dupe_op_slot_args);
|
||||
BMVert *v, *v2, *v3;
|
||||
BMIter iter;
|
||||
|
||||
@@ -236,12 +237,24 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
|
||||
BMOperator find_op;
|
||||
|
||||
BMO_op_initf(bm, &find_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
|
||||
"find_doubles verts=%Hv dist=%f keep_verts=%s",
|
||||
is_input ? /* ugh */
|
||||
"find_doubles verts=%Hv dist=%f keep_verts=%s" :
|
||||
"find_doubles verts=%Hv dist=%f keep_verts=%S",
|
||||
BM_ELEM_TAG, amd->merge_dist,
|
||||
dupe_op, dupe_slot_name);
|
||||
|
||||
/* append the dupe's geom to the findop input verts */
|
||||
BMO_slot_buffer_append(&find_op, "verts", dupe_op, dupe_slot_name);
|
||||
if (is_input) {
|
||||
BMO_slot_buffer_append(&find_op, slots_in, "verts",
|
||||
dupe_op, slots_in, dupe_slot_name);
|
||||
}
|
||||
else if (dupe_op->slots_out == dupe_op_slot_args) {
|
||||
BMO_slot_buffer_append(&find_op, slots_in, "verts",
|
||||
dupe_op, slots_out, dupe_slot_name);
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
}
|
||||
|
||||
/* transform and tag verts */
|
||||
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
|
||||
@@ -254,14 +267,14 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
|
||||
BMO_op_exec(bm, &find_op);
|
||||
|
||||
/* add new merge targets to weld operator */
|
||||
BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
|
||||
BMO_ITER (v, &oiter, find_op.slots_out, "targetmapout", 0) {
|
||||
v2 = BMO_iter_map_value_p(&oiter);
|
||||
/* check in case the target vertex (v2) is already marked
|
||||
* for merging */
|
||||
while ((v3 = BMO_slot_map_ptr_get(bm, weld_op, "targetmap", v2))) {
|
||||
while ((v3 = BMO_slot_map_ptr_get(weld_op->slots_in, "targetmap", v2))) {
|
||||
v2 = v3;
|
||||
}
|
||||
BMO_slot_map_ptr_insert(bm, weld_op, "targetmap", v, v2);
|
||||
BMO_slot_map_ptr_insert(weld_op, weld_op->slots_in, "targetmap", v, v2);
|
||||
}
|
||||
|
||||
BMO_op_finish(bm, &find_op);
|
||||
@@ -293,14 +306,15 @@ static void merge_first_last(BMesh *bm,
|
||||
dupe_first, "geom");
|
||||
|
||||
/* append the last dupe's geom to the findop input verts */
|
||||
BMO_slot_buffer_append(&find_op, "verts", dupe_last, "newout");
|
||||
BMO_slot_buffer_append(&find_op, slots_in, "verts",
|
||||
dupe_last, slots_out, "newout");
|
||||
|
||||
BMO_op_exec(bm, &find_op);
|
||||
|
||||
/* add new merge targets to weld operator */
|
||||
BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
|
||||
BMO_ITER (v, &oiter, find_op.slots_out, "targetmapout", 0) {
|
||||
v2 = BMO_iter_map_value_p(&oiter);
|
||||
BMO_slot_map_ptr_insert(bm, weld_op, "targetmap", v, v2);
|
||||
BMO_slot_map_ptr_insert(weld_op, weld_op->slots_in, "targetmap", v, v2);
|
||||
}
|
||||
|
||||
BMO_op_finish(bm, &find_op);
|
||||
@@ -429,12 +443,12 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
|
||||
if (j != 0) {
|
||||
BMO_op_initf(bm, &dupe_op,
|
||||
(BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
|
||||
"duplicate geom=%s", &old_dupe_op, "newout");
|
||||
"duplicate geom=%S", &old_dupe_op, "newout");
|
||||
}
|
||||
BMO_op_exec(bm, &dupe_op);
|
||||
|
||||
geom_slot = BMO_slot_get(&dupe_op, "geom");
|
||||
newout_slot = BMO_slot_get(&dupe_op, "newout");
|
||||
geom_slot = BMO_slot_get(dupe_op.slots_in, "geom");
|
||||
newout_slot = BMO_slot_get(dupe_op.slots_out, "newout");
|
||||
|
||||
if ((amd->flags & MOD_ARR_MERGEFINAL) && j == 0) {
|
||||
int first_geom_bytes = sizeof(BMVert *) * geom_slot->len;
|
||||
@@ -446,7 +460,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
|
||||
}
|
||||
|
||||
/* apply transformation matrix */
|
||||
BMO_ITER (v, &oiter, bm, &dupe_op, "newout", BM_VERT) {
|
||||
BMO_ITER (v, &oiter, dupe_op.slots_out, "newout", BM_VERT) {
|
||||
mul_m4_v3(offset, v->co);
|
||||
}
|
||||
|
||||
@@ -471,11 +485,11 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
|
||||
|
||||
/* check in case the target vertex (v2) is already marked
|
||||
* for merging */
|
||||
while ((v3 = BMO_slot_map_ptr_get(bm, &weld_op, "targetmap", v2))) {
|
||||
while ((v3 = BMO_slot_map_ptr_get(weld_op.slots_in, "targetmap", v2))) {
|
||||
v2 = v3;
|
||||
}
|
||||
|
||||
BMO_slot_map_ptr_insert(bm, &weld_op, "targetmap", v, v2);
|
||||
BMO_slot_map_ptr_insert(&weld_op, weld_op.slots_in, "targetmap", v, v2);
|
||||
}
|
||||
|
||||
#undef _E
|
||||
@@ -511,14 +525,15 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
|
||||
float startoffset[4][4];
|
||||
invert_m4_m4(startoffset, offset);
|
||||
bm_merge_dm_transform(bm, start_cap, startoffset, amd,
|
||||
&first_dupe_op, "geom", &weld_op);
|
||||
&first_dupe_op, first_dupe_op.slots_in, "geom", &weld_op);
|
||||
}
|
||||
|
||||
if (end_cap) {
|
||||
float endoffset[4][4];
|
||||
mult_m4_m4m4(endoffset, offset, final_offset);
|
||||
bm_merge_dm_transform(bm, end_cap, endoffset, amd,
|
||||
&dupe_op, count == 1 ? "geom" : "newout", &weld_op);
|
||||
&dupe_op, (count == 1) ? dupe_op.slots_in : dupe_op.slots_out,
|
||||
(count == 1) ? "geom" : "newout", &weld_op);
|
||||
}
|
||||
}
|
||||
/* done capping */
|
||||
|
||||
@@ -249,14 +249,14 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
|
||||
}
|
||||
|
||||
/* Apply face attributes to hull output */
|
||||
BMO_ITER (f, &oiter, bm, &op, "geomout", BM_FACE) {
|
||||
BMO_ITER (f, &oiter, op.slots_out, "geomout", BM_FACE) {
|
||||
if (so->smd->flag & MOD_SKIN_SMOOTH_SHADING)
|
||||
BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
|
||||
f->mat_nr = so->mat_nr;
|
||||
}
|
||||
|
||||
/* Mark interior frames */
|
||||
BMO_ITER (v, &oiter, bm, &op, "interior_geom", BM_VERT) {
|
||||
BMO_ITER (v, &oiter, op.slots_out, "interior_geom_out", BM_VERT) {
|
||||
for (i = 0; i < totframe; i++) {
|
||||
Frame *frame = frames[i];
|
||||
|
||||
@@ -309,7 +309,7 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
|
||||
|
||||
/* Check if removing triangles above will create wire triangles,
|
||||
* mark them too */
|
||||
BMO_ITER (e, &oiter, bm, &op, "geomout", BM_EDGE) {
|
||||
BMO_ITER (e, &oiter, op.slots_out, "geomout", BM_EDGE) {
|
||||
int is_wire = TRUE;
|
||||
BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
|
||||
if (!BM_elem_flag_test(f, BM_ELEM_TAG)) {
|
||||
@@ -1090,7 +1090,7 @@ static BMFace *collapse_face_corners(BMesh *bm, BMFace *f, int n,
|
||||
v_safe = shortest_edge->v1;
|
||||
v_merge = shortest_edge->v2;
|
||||
mid_v3_v3v3(v_safe->co, v_safe->co, v_merge->co);
|
||||
BMO_slot_map_ptr_insert(bm, &op, "targetmap", v_merge, v_safe);
|
||||
BMO_slot_map_ptr_insert(&op, op.slots_in, "targetmap", v_merge, v_safe);
|
||||
BMO_op_exec(bm, &op);
|
||||
BMO_op_finish(bm, &op);
|
||||
|
||||
@@ -1229,7 +1229,7 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
|
||||
/* Update split face (should only be one new face created
|
||||
* during extrusion) */
|
||||
split_face = NULL;
|
||||
BMO_ITER (f, &oiter, bm, &op, "faceout", BM_FACE) {
|
||||
BMO_ITER (f, &oiter, op.slots_out, "faceout", BM_FACE) {
|
||||
BLI_assert(!split_face);
|
||||
split_face = f;
|
||||
}
|
||||
@@ -1282,7 +1282,7 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
|
||||
BMO_op_init(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
|
||||
"weld_verts");
|
||||
for (i = 0; i < 4; i++) {
|
||||
BMO_slot_map_ptr_insert(bm, &op, "targetmap",
|
||||
BMO_slot_map_ptr_insert(&op, op.slots_in, "targetmap",
|
||||
verts[i], frame->verts[best_order[i]]);
|
||||
}
|
||||
BMO_op_exec(bm, &op);
|
||||
|
||||
@@ -122,7 +122,7 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
|
||||
Py_ssize_t pos = 0;
|
||||
while (PyDict_Next(kw, &pos, &key, &value)) {
|
||||
const char *slot_name = _PyUnicode_AsString(key);
|
||||
BMOpSlot *slot = BMO_slot_get(&bmop, slot_name);
|
||||
BMOpSlot *slot = BMO_slot_get(bmop.slots_in, slot_name);
|
||||
|
||||
if (slot == NULL) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
@@ -210,7 +210,7 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BMO_slot_mat_set(&bmop, slot_name, ((MatrixObject *)value)->matrix, size);
|
||||
BMO_slot_mat_set(&bmop, bmop.slots_in, slot_name, ((MatrixObject *)value)->matrix, size);
|
||||
break;
|
||||
}
|
||||
case BMO_OP_SLOT_VEC:
|
||||
@@ -243,15 +243,15 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
|
||||
|
||||
if (BPy_BMVertSeq_Check(value)) {
|
||||
BPY_BM_GENERIC_MESH_TEST("verts");
|
||||
BMO_slot_buffer_from_all(bm, &bmop, slot_name, BM_VERT);
|
||||
BMO_slot_buffer_from_all(bm, &bmop, bmop.slots_in, slot_name, BM_VERT);
|
||||
}
|
||||
else if (BPy_BMEdgeSeq_Check(value)) {
|
||||
BPY_BM_GENERIC_MESH_TEST("edges");
|
||||
BMO_slot_buffer_from_all(bm, &bmop, slot_name, BM_EDGE);
|
||||
BMO_slot_buffer_from_all(bm, &bmop, bmop.slots_in, slot_name, BM_EDGE);
|
||||
}
|
||||
else if (BPy_BMFaceSeq_Check(value)) {
|
||||
BPY_BM_GENERIC_MESH_TEST("faces");
|
||||
BMO_slot_buffer_from_all(bm, &bmop, slot_name, BM_FACE);
|
||||
BMO_slot_buffer_from_all(bm, &bmop, bmop.slots_in, slot_name, BM_FACE);
|
||||
}
|
||||
else if (BPy_BMElemSeq_Check(value)) {
|
||||
BMIter iter;
|
||||
@@ -266,7 +266,7 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
|
||||
/* calls bpy_bmelemseq_length() */
|
||||
tot = Py_TYPE(value)->tp_as_sequence->sq_length((PyObject *)self);
|
||||
|
||||
BMO_slot_buffer_alloc(&bmop, slot_name, tot);
|
||||
BMO_slot_buffer_alloc(&bmop, bmop.slots_in, slot_name, tot);
|
||||
|
||||
i = 0;
|
||||
BM_ITER_BPY_BM_SEQ (ele, &iter, ((BPy_BMElemSeq *)value)) {
|
||||
@@ -288,7 +288,7 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BMO_slot_buffer_alloc(&bmop, slot_name, elem_array_len);
|
||||
BMO_slot_buffer_alloc(&bmop, bmop.slots_in, slot_name, elem_array_len);
|
||||
memcpy(slot->data.buf, elem_array, sizeof(void *) * elem_array_len);
|
||||
PyMem_FREE(elem_array);
|
||||
}
|
||||
@@ -413,17 +413,17 @@ static PyObject *bpy_bmesh_fmod_getattro(PyObject *UNUSED(self), PyObject *pynam
|
||||
{
|
||||
const unsigned int tot = bmesh_total_ops;
|
||||
unsigned int i;
|
||||
const char *name = _PyUnicode_AsString(pyname);
|
||||
const char *opname = _PyUnicode_AsString(pyname);
|
||||
|
||||
for (i = 0; i < tot; i++) {
|
||||
if (strcmp(opdefines[i]->name, name) == 0) {
|
||||
return bpy_bmesh_op_CreatePyObject(opdefines[i]->name);
|
||||
if (strcmp(opdefines[i]->opname, opname) == 0) {
|
||||
return bpy_bmesh_op_CreatePyObject(opdefines[i]->opname);
|
||||
}
|
||||
}
|
||||
|
||||
PyErr_Format(PyExc_AttributeError,
|
||||
"BMeshOpsModule: operator \"%.200s\" doesn't exist",
|
||||
name);
|
||||
opname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -436,7 +436,7 @@ static PyObject *bpy_bmesh_fmod_dir(PyObject *UNUSED(self))
|
||||
ret = PyList_New(bmesh_total_ops);
|
||||
|
||||
for (i = 0; i < tot; i++) {
|
||||
PyList_SET_ITEM(ret, i, PyUnicode_FromString(opdefines[i]->name));
|
||||
PyList_SET_ITEM(ret, i, PyUnicode_FromString(opdefines[i]->opname));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user