From 2d86699209e0a3bd55a74c15fb2dcdb3ca740e2d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 5 Jun 2025 05:26:56 +0000 Subject: [PATCH] PyDoc: improve BMesh operator docs - Place doc-strings before arguments (avoid over long lines). - Enable clang-format for BMesh operator definitions. - Remove invalid comments (likely left in from copy-paste). - Use double back-ticks for RST. - Use full sentences. No functional changes. --- doc/python_api/rst_from_bmesh_opdefines.py | 34 +- .../blender/bmesh/intern/bmesh_opdefines.cc | 3083 ++++++++++------- 2 files changed, 1812 insertions(+), 1305 deletions(-) diff --git a/doc/python_api/rst_from_bmesh_opdefines.py b/doc/python_api/rst_from_bmesh_opdefines.py index bd06ae09ca3..9bdee231a44 100644 --- a/doc/python_api/rst_from_bmesh_opdefines.py +++ b/doc/python_api/rst_from_bmesh_opdefines.py @@ -166,6 +166,7 @@ def main(): if l.startswith("/*"): l = l.replace("/*", "'''own <") else: + # NOTE: `inline <...>` aren't used anymore, all doc-string comments require their own line. l = l.replace("/*", "'''inline <") l = l.replace("*/", ">''',") @@ -256,27 +257,17 @@ def main(): tp_str = "" - comment_prev = "" - comment_next = "" - if i != 0: - comment_prev = args[i + 1] - if type(comment_prev) == str and comment_prev.startswith("our <"): - comment_prev = comment_next[5:-1] # strip inline <...> - else: - comment_prev = "" - - if i + 1 < len(args): - comment_next = args[i + 1] - if type(comment_next) == str and comment_next.startswith("inline <"): - comment_next = comment_next[8:-1] # strip inline <...> - else: - comment_next = "" - comment = "" - if comment_prev: - comment += comment_prev.strip() - if comment_next: - comment += ("\n" if comment_prev else "") + comment_next.strip() + if i != 0: + comment = args[i - 1] + if type(args[i - 1]) == str: + if args[i - 1].startswith("own <"): + comment = args[i - 1][5:-1].strip() # strip `our <...>` + else: + comment = "" + + if comment.startswith("NOTE"): + comment = "" default_value = None if tp == BMO_OP_SLOT_FLT: @@ -387,6 +378,9 @@ def main(): continue if l.strip(): l = " " + l + + # Use double back-ticks for literals (C++ comments only use a single, RST expected two). + l = l.replace("`", "``") comment_washed.append(l) fw("\n".join(comment_washed)) diff --git a/source/blender/bmesh/intern/bmesh_opdefines.cc b/source/blender/bmesh/intern/bmesh_opdefines.cc index d1d7ae9fc1a..c3e2117dd27 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.cc +++ b/source/blender/bmesh/intern/bmesh_opdefines.cc @@ -79,50 +79,52 @@ */ /* Keep struct definition from wrapping. */ -/* clang-format off */ -/* enums shared between multiple operators */ +/* Enums shared between multiple operators. */ static BMO_FlagSet bmo_enum_axis_xyz[] = { - {0, "X"}, - {1, "Y"}, - {2, "Z"}, - {0, nullptr}, + {0, "X"}, + {1, "Y"}, + {2, "Z"}, + {0, nullptr}, }; static BMO_FlagSet bmo_enum_axis_neg_xyz_and_xyz[] = { - {0, "-X"}, - {1, "-Y"}, - {2, "-Z"}, - {3, "X"}, - {4, "Y"}, - {5, "Z"}, - {0, nullptr}, + {0, "-X"}, + {1, "-Y"}, + {2, "-Z"}, + {3, "X"}, + {4, "Y"}, + {5, "Z"}, + {0, nullptr}, }; static BMO_FlagSet bmo_enum_falloff_type[] = { - {SUBD_FALLOFF_SMOOTH, "SMOOTH"}, - {SUBD_FALLOFF_SPHERE, "SPHERE"}, - {SUBD_FALLOFF_ROOT, "ROOT"}, - {SUBD_FALLOFF_SHARP, "SHARP"}, - {SUBD_FALLOFF_LIN, "LINEAR"}, - {SUBD_FALLOFF_INVSQUARE, "INVERSE_SQUARE"}, - {0, nullptr}, + {SUBD_FALLOFF_SMOOTH, "SMOOTH"}, + {SUBD_FALLOFF_SPHERE, "SPHERE"}, + {SUBD_FALLOFF_ROOT, "ROOT"}, + {SUBD_FALLOFF_SHARP, "SHARP"}, + {SUBD_FALLOFF_LIN, "LINEAR"}, + {SUBD_FALLOFF_INVSQUARE, "INVERSE_SQUARE"}, + {0, nullptr}, }; -static eBMOpSlotSubType_Union to_subtype_union(const eBMOpSlotSubType_Ptr ptr) { +static eBMOpSlotSubType_Union to_subtype_union(const eBMOpSlotSubType_Ptr ptr) +{ eBMOpSlotSubType_Union value; value.ptr = ptr; return value; } -static eBMOpSlotSubType_Union to_subtype_union(const eBMOpSlotSubType_Map map) { +static eBMOpSlotSubType_Union to_subtype_union(const eBMOpSlotSubType_Map map) +{ eBMOpSlotSubType_Union value; value.map = map; return value; } -static eBMOpSlotSubType_Union to_subtype_union(const eBMOpSlotSubType_Int intg) { +static eBMOpSlotSubType_Union to_subtype_union(const eBMOpSlotSubType_Int intg) +{ eBMOpSlotSubType_Union value; value.intg = intg; return value; @@ -139,22 +141,33 @@ static eBMOpSlotSubType_Union to_subtype_union(const eBMOpSlotSubType_Int intg) * Smooths vertices by using a basic vertex averaging scheme. */ static BMOpDefine bmo_smooth_vert_def = { - "smooth_vert", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"factor", BMO_OP_SLOT_FLT}, /* smoothing factor */ - {"mirror_clip_x", BMO_OP_SLOT_BOOL}, /* set vertices close to the x axis before the operation to 0 */ - {"mirror_clip_y", BMO_OP_SLOT_BOOL}, /* set vertices close to the y axis before the operation to 0 */ - {"mirror_clip_z", BMO_OP_SLOT_BOOL}, /* set vertices close to the z axis before the operation to 0 */ - {"clip_dist", BMO_OP_SLOT_FLT}, /* clipping threshold for the above three slots */ - {"use_axis_x", BMO_OP_SLOT_BOOL}, /* smooth vertices along X axis */ - {"use_axis_y", BMO_OP_SLOT_BOOL}, /* smooth vertices along Y axis */ - {"use_axis_z", BMO_OP_SLOT_BOOL}, /* smooth vertices along Z axis */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_smooth_vert_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC), + "smooth_vert", + /*slot_types_in*/ + { + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Smoothing factor. */ + {"factor", BMO_OP_SLOT_FLT}, + /* Set vertices close to the x axis before the operation to 0. */ + {"mirror_clip_x", BMO_OP_SLOT_BOOL}, + /* Set vertices close to the y axis before the operation to 0. */ + {"mirror_clip_y", BMO_OP_SLOT_BOOL}, + /* Set vertices close to the z axis before the operation to 0. */ + {"mirror_clip_z", BMO_OP_SLOT_BOOL}, + /* Clipping threshold for the above three slots. */ + {"clip_dist", BMO_OP_SLOT_FLT}, + /* Smooth vertices along X axis. */ + {"use_axis_x", BMO_OP_SLOT_BOOL}, + /* Smooth vertices along Y axis. */ + {"use_axis_y", BMO_OP_SLOT_BOOL}, + /* Smooth vertices along Z axis. */ + {"use_axis_z", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_smooth_vert_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -164,20 +177,29 @@ static BMOpDefine bmo_smooth_vert_def = { * Desbrun, et al. Implicit Fairing of Irregular Meshes using Diffusion and Curvature Flow. */ static BMOpDefine bmo_smooth_laplacian_vert_def = { - "smooth_laplacian_vert", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"lambda_factor", BMO_OP_SLOT_FLT}, /* lambda param */ - {"lambda_border", BMO_OP_SLOT_FLT}, /* lambda param in border */ - {"use_x", BMO_OP_SLOT_BOOL}, /* Smooth object along X axis */ - {"use_y", BMO_OP_SLOT_BOOL}, /* Smooth object along Y axis */ - {"use_z", BMO_OP_SLOT_BOOL}, /* Smooth object along Z axis */ - {"preserve_volume", BMO_OP_SLOT_BOOL}, /* Apply volume preservation after smooth */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_smooth_laplacian_vert_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC), + "smooth_laplacian_vert", + /*slot_types_in*/ + { + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Lambda parameter. */ + {"lambda_factor", BMO_OP_SLOT_FLT}, + /* Lambda param in border. */ + {"lambda_border", BMO_OP_SLOT_FLT}, + /* Smooth object along X axis. */ + {"use_x", BMO_OP_SLOT_BOOL}, + /* Smooth object along Y axis. */ + {"use_y", BMO_OP_SLOT_BOOL}, + /* Smooth object along Z axis. */ + {"use_z", BMO_OP_SLOT_BOOL}, + /* Apply volume preservation after smooth. */ + {"preserve_volume", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_smooth_laplacian_vert_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -186,15 +208,17 @@ static BMOpDefine bmo_smooth_laplacian_vert_def = { * Computes an "outside" normal for the specified input faces. */ static BMOpDefine bmo_recalc_face_normals_def = { - "recalc_face_normals", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_recalc_face_normals_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC), + "recalc_face_normals", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_recalc_face_normals_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -203,20 +227,25 @@ static BMOpDefine bmo_recalc_face_normals_def = { * Iteratively flatten faces. */ static BMOpDefine bmo_planar_faces_def = { - "planar_faces", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input geometry. */ - {"iterations", BMO_OP_SLOT_INT}, /* Number of times to flatten faces (for when connected faces are used) */ - {"factor", BMO_OP_SLOT_FLT}, /* Influence for making planar each iteration */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output slot, computed boundary geometry. */ - {{'\0'}}, - }, - bmo_planar_faces_exec, - (BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "planar_faces", + /*slot_types_in*/ + { + /* Input geometry. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Number of times to flatten faces (for when connected faces are used) */ + {"iterations", BMO_OP_SLOT_INT}, + /* Influence for making planar each iteration */ + {"factor", BMO_OP_SLOT_FLT}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output slot, computed boundary geometry. */ + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_planar_faces_exec, + (BMO_OPTYPE_FLAG_SELECT_FLUSH | BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -230,21 +259,27 @@ static BMOpDefine bmo_planar_faces_def = { * otherwise it spits out faces. */ static BMOpDefine bmo_region_extend_def = { - "region_extend", - /*slot_types_in*/ - {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */ - {"use_contract", BMO_OP_SLOT_BOOL}, /* find boundary inside the regions, not outside. */ - {"use_faces", BMO_OP_SLOT_BOOL}, /* extend from faces instead of edges */ - {"use_face_step", BMO_OP_SLOT_BOOL}, /* step over connected faces */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output slot, computed boundary geometry. */ - {{'\0'}}, - }, - bmo_region_extend_exec, - (BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "region_extend", + /*slot_types_in*/ + { + /* Input geometry. */ + {"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Find boundary inside the regions, not outside. */ + {"use_contract", BMO_OP_SLOT_BOOL}, + /* Extend from faces instead of edges. */ + {"use_faces", BMO_OP_SLOT_BOOL}, + /* Step over connected faces. */ + {"use_face_step", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output slot, computed boundary geometry. */ + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_region_extend_exec, + (BMO_OPTYPE_FLAG_SELECT_FLUSH | BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -254,21 +289,24 @@ static BMOpDefine bmo_region_extend_def = { * Simple example: `[/] becomes [|] then [\]`. */ static BMOpDefine bmo_rotate_edges_def = { - "rotate_edges", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate edge counter-clockwise if true, otherwise clockwise */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* newly spun edges */ - {{'\0'}}, - }, - bmo_rotate_edges_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "rotate_edges", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Rotate edge counter-clockwise if true, otherwise clockwise. */ + {"use_ccw", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Newly spun edges. */ + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {{'\0'}}, + }, + bmo_rotate_edges_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -278,16 +316,19 @@ static BMOpDefine bmo_rotate_edges_def = { * This has the effect of flipping the normal. */ static BMOpDefine bmo_reverse_faces_def = { - "reverse_faces", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"flip_multires", BMO_OP_SLOT_BOOL}, /* maintain multi-res offset */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_reverse_faces_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC), + "reverse_faces", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Maintain multi-res offset. */ + {"flip_multires", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_reverse_faces_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -296,15 +337,17 @@ static BMOpDefine bmo_reverse_faces_def = { * Flip the tessellation direction of the selected quads. */ static BMOpDefine bmo_flip_quad_tessellation_def = { - "flip_quad_tessellation", - /* slot_in */ - { - {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, - {{'\0'}} - }, - {{{'\0'}}}, /* no output */ - bmo_flip_quad_tessellation_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC), + "flip_quad_tessellation", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_flip_quad_tessellation_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -314,22 +357,27 @@ static BMOpDefine bmo_flip_quad_tessellation_def = { * This creates a 2-valence vert. */ static BMOpDefine bmo_bisect_edges_def = { - "bisect_edges", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {"cuts", BMO_OP_SLOT_INT}, /* number of cuts */ - {"edge_percents", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_FLT)}}, - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* newly created vertices and edges */ - {{'\0'}}, - }, - bmo_bisect_edges_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "bisect_edges", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Number of cuts. */ + {"cuts", BMO_OP_SLOT_INT}, + {"edge_percents", + BMO_OP_SLOT_MAPPING, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_FLT)}}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Newly created vertices and edges. */ + {"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_bisect_edges_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -340,26 +388,39 @@ static BMOpDefine bmo_bisect_edges_def = { * parameter (which defines the minimum distance for welding to happen). */ static BMOpDefine bmo_mirror_def = { - "mirror", - /*slot_types_in*/ - {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */ - {"matrix", BMO_OP_SLOT_MAT}, /* matrix defining the mirror transformation */ - {"merge_dist", BMO_OP_SLOT_FLT}, /* maximum distance for merging. does no merging if 0. */ - {"axis", BMO_OP_SLOT_INT, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_INT_ENUM)}, bmo_enum_axis_xyz}, /* the axis to use. */ - {"mirror_u", BMO_OP_SLOT_BOOL}, /* mirror UVs across the u axis */ - {"mirror_v", BMO_OP_SLOT_BOOL}, /* mirror UVs across the v axis */ - {"mirror_udim", BMO_OP_SLOT_BOOL}, /* mirror UVs in each tile */ - {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output geometry, mirrored */ - {{'\0'}}, - }, - bmo_mirror_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "mirror", + /*slot_types_in*/ + { + /* Input geometry. */ + {"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Matrix defining the mirror transformation. */ + {"matrix", BMO_OP_SLOT_MAT}, + /* Maximum distance for merging. does no merging if 0. */ + {"merge_dist", BMO_OP_SLOT_FLT}, + /* The axis to use. */ + {"axis", + BMO_OP_SLOT_INT, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_INT_ENUM)}, + bmo_enum_axis_xyz}, + /* Mirror UVs across the u axis. */ + {"mirror_u", BMO_OP_SLOT_BOOL}, + /* Mirror UVs across the v axis. */ + {"mirror_v", BMO_OP_SLOT_BOOL}, + /* Mirror UVs in each tile. */ + {"mirror_udim", BMO_OP_SLOT_BOOL}, + /* Transform shape keys too. */ + {"use_shapekey", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output geometry, mirrored. */ + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_mirror_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -372,19 +433,26 @@ static BMOpDefine bmo_mirror_def = { * with vertices in that set. */ static BMOpDefine bmo_find_doubles_def = { - "find_doubles", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"keep_verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* list of verts to keep */ - {"dist", BMO_OP_SLOT_FLT}, /* maximum distance */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"targetmap.out", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, - {{'\0'}}, - }, - bmo_find_doubles_exec, - (BMO_OPTYPE_FLAG_NOP), + "find_doubles", + /*slot_types_in*/ + { + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* List of verts to keep. */ + {"keep_verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Maximum distance. */ + {"dist", BMO_OP_SLOT_FLT}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"targetmap.out", + BMO_OP_SLOT_MAPPING, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, + {{'\0'}}, + }, + bmo_find_doubles_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* @@ -394,18 +462,21 @@ static BMOpDefine bmo_find_doubles_def = { * using the weld verts BMOP. */ static BMOpDefine bmo_remove_doubles_def = { - "remove_doubles", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input verts */ - {"dist", BMO_OP_SLOT_FLT}, /* minimum distance */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_remove_doubles_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "remove_doubles", + /*slot_types_in*/ + { + /* Input verts. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + + /* Minimum distance. */ + {"dist", BMO_OP_SLOT_FLT}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_remove_doubles_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -414,18 +485,20 @@ static BMOpDefine bmo_remove_doubles_def = { * Collapses connected vertices */ static BMOpDefine bmo_collapse_def = { - "collapse", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {"uvs", BMO_OP_SLOT_BOOL}, /* also collapse UVs and such */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_collapse_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "collapse", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Also collapse UVs and such. */ + {"uvs", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_collapse_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -434,15 +507,19 @@ static BMOpDefine bmo_collapse_def = { * Merge uv/vcols at a specific vertex. */ static BMOpDefine bmo_pointmerge_facedata_def = { - "pointmerge_facedata", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"vert_snap", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* snap vertex */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_pointmerge_facedata_exec, - (BMO_OPTYPE_FLAG_NOP), + "pointmerge_facedata", + /*slot_types_in*/ + { + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Snap vertex. */ + {"vert_snap", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_pointmerge_facedata_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* @@ -453,14 +530,17 @@ static BMOpDefine bmo_pointmerge_facedata_def = { * the vert_snap_to_bb_center is just too long). */ static BMOpDefine bmo_average_vert_facedata_def = { - "average_vert_facedata", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_average_vert_facedata_exec, - (BMO_OPTYPE_FLAG_NOP), + "average_vert_facedata", + /*slot_types_in*/ + { + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_average_vert_facedata_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* @@ -469,18 +549,20 @@ static BMOpDefine bmo_average_vert_facedata_def = { * Merge verts together at a point. */ static BMOpDefine bmo_pointmerge_def = { - "pointmerge", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices (all verts will be merged into the first). */ - {"merge_co", BMO_OP_SLOT_VEC}, /* Position to merge at. */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_pointmerge_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "pointmerge", + /*slot_types_in*/ + { + /* Input vertices (all verts will be merged into the first). */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Position to merge at. */ + {"merge_co", BMO_OP_SLOT_VEC}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_pointmerge_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -489,14 +571,17 @@ static BMOpDefine bmo_pointmerge_def = { * Collapses connected UV vertices. */ static BMOpDefine bmo_collapse_uvs_def = { - "collapse_uvs", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_collapse_uvs_exec, - (BMO_OPTYPE_FLAG_NOP), + "collapse_uvs", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_collapse_uvs_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* @@ -507,17 +592,18 @@ static BMOpDefine bmo_collapse_uvs_def = { * they weld with. */ static BMOpDefine bmo_weld_verts_def = { - "weld_verts", - /*slot_types_in*/ - {{"targetmap", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, /* maps welded vertices to verts they should weld to */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_weld_verts_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "weld_verts", + /*slot_types_in*/ + { + /* Maps welded vertices to verts they should weld to. */ + {"targetmap", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_weld_verts_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -527,17 +613,21 @@ static BMOpDefine bmo_weld_verts_def = { * for click-create-vertex. */ static BMOpDefine bmo_create_vert_def = { - "create_vert", - /*slot_types_in*/ - {{"co", BMO_OP_SLOT_VEC}, /* the coordinate of the new vert */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"vert.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* the new vert */ - {{'\0'}}, - }, - bmo_create_vert_exec, - (BMO_OPTYPE_FLAG_NOP), + "create_vert", + /*slot_types_in*/ + { + /* The coordinate of the new vert. */ + {"co", BMO_OP_SLOT_VEC}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* The new vert. */ + {"vert.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {{'\0'}}, + }, + bmo_create_vert_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* @@ -552,33 +642,40 @@ static BMOpDefine bmo_create_vert_def = { #endif static BMOpDefine bmo_join_triangles_def = { - "join_triangles", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input geometry. */ - {"cmp_seam", BMO_OP_SLOT_BOOL}, /* Compare seam */ - {"cmp_sharp", BMO_OP_SLOT_BOOL}, /* Compare sharp */ - {"cmp_uvs", BMO_OP_SLOT_BOOL}, /* Compare UVs */ - {"cmp_vcols", BMO_OP_SLOT_BOOL}, /* compare VCols */ - {"cmp_materials", BMO_OP_SLOT_BOOL}, /* compare materials */ - {"angle_face_threshold", BMO_OP_SLOT_FLT}, - {"angle_shape_threshold", BMO_OP_SLOT_FLT}, - {"topology_influence", BMO_OP_SLOT_FLT}, - {"deselect_joined", BMO_OP_SLOT_BOOL}, + "join_triangles", + /*slot_types_in*/ + { + /* Input geometry. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Compare seam */ + {"cmp_seam", BMO_OP_SLOT_BOOL}, + /* Compare sharp */ + {"cmp_sharp", BMO_OP_SLOT_BOOL}, + /* Compare UVs */ + {"cmp_uvs", BMO_OP_SLOT_BOOL}, + /* Compare VCols. */ + {"cmp_vcols", BMO_OP_SLOT_BOOL}, + /* Compare materials. */ + {"cmp_materials", BMO_OP_SLOT_BOOL}, + {"angle_face_threshold", BMO_OP_SLOT_FLT}, + {"angle_shape_threshold", BMO_OP_SLOT_FLT}, + {"topology_influence", BMO_OP_SLOT_FLT}, + {"deselect_joined", BMO_OP_SLOT_BOOL}, #ifdef USE_JOIN_TRIANGLE_INTERACTIVE_TESTING - {"merge_limit", BMO_OP_SLOT_INT}, - {"neighbor_debug", BMO_OP_SLOT_INT}, + {"merge_limit", BMO_OP_SLOT_INT}, + {"neighbor_debug", BMO_OP_SLOT_INT}, #endif - {{'\0'}}, - }, - /*slot_types_out*/ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* joined faces */ - {{'\0'}}, - }, - bmo_join_triangles_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Joined faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_join_triangles_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -592,49 +689,64 @@ static BMOpDefine bmo_join_triangles_def = { * become a wire edge. */ static BMOpDefine bmo_contextual_create_def = { - "contextual_create", - /*slot_types_in*/ - {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry. */ - {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */ - {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth to use */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* newly-made face(s) */ - /* NOTE: this is for stand-alone edges only, not edges which are a part of newly created faces. */ - {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* newly-made edge(s) */ - {{'\0'}}, - }, - bmo_contextual_create_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "contextual_create", + /*slot_types_in*/ + { + /* Input geometry. */ + {"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Material to use. */ + {"mat_nr", BMO_OP_SLOT_INT}, + /* Smooth to use. */ + {"use_smooth", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Newly-made face(s). */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + + /* NOTE: this is for stand-alone edges only, + * not edges which are a part of newly created faces. */ + + /* Newly-made edge(s). */ + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {{'\0'}}, + }, + bmo_contextual_create_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* * Bridge edge loops with faces. */ static BMOpDefine bmo_bridge_loops_def = { - "bridge_loops", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {"use_pairs", BMO_OP_SLOT_BOOL}, - {"use_cyclic", BMO_OP_SLOT_BOOL}, - {"use_merge", BMO_OP_SLOT_BOOL}, /* merge rather than creating faces */ - {"merge_factor", BMO_OP_SLOT_FLT}, /* merge factor */ - {"twist_offset", BMO_OP_SLOT_INT}, /* twist offset for closed loops */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */ - {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* new edges */ - {{'\0'}}, - }, - bmo_bridge_loops_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "bridge_loops", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {"use_pairs", BMO_OP_SLOT_BOOL}, + {"use_cyclic", BMO_OP_SLOT_BOOL}, + /* Merge rather than creating faces. */ + {"use_merge", BMO_OP_SLOT_BOOL}, + /* merge factor */ + {"merge_factor", BMO_OP_SLOT_FLT}, + /* Twist offset for closed loops. */ + {"twist_offset", BMO_OP_SLOT_INT}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* New faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* New edges. */ + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {{'\0'}}, + }, + bmo_bridge_loops_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -643,25 +755,32 @@ static BMOpDefine bmo_bridge_loops_def = { * Create faces defined by 2 disconnected edge loops (which share edges). */ static BMOpDefine bmo_grid_fill_def = { - "grid_fill", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - /* restricts edges to groups. maps edges to integer */ - {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */ - {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */ - {"use_interp_simple", BMO_OP_SLOT_BOOL}, /* use simple interpolation */ - {{'\0'}}, - }, - /*slot_types_out*/ - /* maps new faces to the group numbers they came from */ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */ - {{'\0'}}, - }, - bmo_grid_fill_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), -}; + "grid_fill", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Restricts edges to groups. maps edges to integer. */ + + /* Material to use. */ + {"mat_nr", BMO_OP_SLOT_INT}, + /* Smooth state to use. */ + {"use_smooth", BMO_OP_SLOT_BOOL}, + /* Use simple interpolation. */ + {"use_interp_simple", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + + /*slot_types_out*/ + { + /* New faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_grid_fill_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), +}; /* * Fill Holes. @@ -669,43 +788,50 @@ static BMOpDefine bmo_grid_fill_def = { * Fill boundary edges with faces, copying surrounding custom-data. */ static BMOpDefine bmo_holes_fill_def = { - "holes_fill", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {"sides", BMO_OP_SLOT_INT}, /* number of face sides to fill */ - {{'\0'}}, - }, - /*slot_types_out*/ - /* maps new faces to the group numbers they came from */ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */ - {{'\0'}}, - }, - bmo_holes_fill_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "holes_fill", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Number of face sides to fill. */ + {"sides", BMO_OP_SLOT_INT}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* New faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_holes_fill_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; - /* * Face Attribute Fill. * * Fill in faces with data from adjacent faces. */ static BMOpDefine bmo_face_attribute_fill_def = { - "face_attribute_fill", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"use_normals", BMO_OP_SLOT_BOOL}, /* copy face winding */ - {"use_data", BMO_OP_SLOT_BOOL}, /* copy face data */ - {{'\0'}}, - }, - /*slot_types_out*/ - /* maps new faces to the group numbers they came from */ - {{"faces_fail.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* faces that could not be handled */ - {{'\0'}}, - }, - bmo_face_attribute_fill_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC), + "face_attribute_fill", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Copy face winding. */ + {"use_normals", BMO_OP_SLOT_BOOL}, + /* Copy face data. */ + {"use_data", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Faces that could not be handled. */ + {"faces_fail.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_face_attribute_fill_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -714,24 +840,29 @@ static BMOpDefine bmo_face_attribute_fill_def = { * Create faces defined by one or more non overlapping edge loops. */ static BMOpDefine bmo_edgeloop_fill_def = { - "edgeloop_fill", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - /* restricts edges to groups. maps edges to integer */ - {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */ - {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */ - {{'\0'}}, - }, - /*slot_types_out*/ - /* maps new faces to the group numbers they came from */ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */ - {{'\0'}}, - }, - bmo_edgeloop_fill_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), -}; + "edgeloop_fill", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Restricts edges to groups. maps edges to integer. */ + + /* Material to use. */ + {"mat_nr", BMO_OP_SLOT_INT}, + /* Smooth state to use. */ + {"use_smooth", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* New faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_edgeloop_fill_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), +}; /* * Edge Net Fill. @@ -739,22 +870,27 @@ static BMOpDefine bmo_edgeloop_fill_def = { * Create faces defined by enclosed edges. */ static BMOpDefine bmo_edgenet_fill_def = { - "edgenet_fill", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */ - {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */ - {"sides", BMO_OP_SLOT_INT}, /* number of sides */ - {{'\0'}}, - }, - /*slot_types_out*/ - /* maps new faces to the group numbers they came from */ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */ - {{'\0'}}, - }, - bmo_edgenet_fill_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "edgenet_fill", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Material to use. */ + {"mat_nr", BMO_OP_SLOT_INT}, + /* Smooth state to use. */ + {"use_smooth", BMO_OP_SLOT_BOOL}, + /* Number of sides. */ + {"sides", BMO_OP_SLOT_INT}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* New faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_edgenet_fill_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -768,17 +904,21 @@ static BMOpDefine bmo_edgenet_fill_def = { * shortest distance between each endpoint). */ static BMOpDefine bmo_edgenet_prepare_def = { - "edgenet_prepare", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* new edges */ - {{'\0'}}, - }, - bmo_edgenet_prepare_exec, - (BMO_OPTYPE_FLAG_NOP), + "edgenet_prepare", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* New edges. */ + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {{'\0'}}, + }, + bmo_edgenet_prepare_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* @@ -787,18 +927,25 @@ static BMOpDefine bmo_edgenet_prepare_def = { * Rotate vertices around a center, using a 3x3 rotation matrix. */ static BMOpDefine bmo_rotate_def = { - "rotate", - /*slot_types_in*/ - {{"cent", BMO_OP_SLOT_VEC}, /* center of rotation */ - {"matrix", BMO_OP_SLOT_MAT}, /* matrix defining rotation */ - {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */ - {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_rotate_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC), + "rotate", + /*slot_types_in*/ + { + /* Center of rotation. */ + {"cent", BMO_OP_SLOT_VEC}, + /* Matrix defining rotation. */ + {"matrix", BMO_OP_SLOT_MAT}, + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Matrix to define the space (typically object matrix). */ + {"space", BMO_OP_SLOT_MAT}, + /* Transform shape keys too. */ + {"use_shapekey", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_rotate_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -807,17 +954,23 @@ static BMOpDefine bmo_rotate_def = { * Translate vertices by an offset. */ static BMOpDefine bmo_translate_def = { - "translate", - /*slot_types_in*/ - {{"vec", BMO_OP_SLOT_VEC}, /* translation offset */ - {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */ - {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_translate_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC), + "translate", + /*slot_types_in*/ + { + /* Translation offset. */ + {"vec", BMO_OP_SLOT_VEC}, + /* Matrix to define the space (typically object matrix). */ + {"space", BMO_OP_SLOT_MAT}, + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Transform shape keys too. */ + {"use_shapekey", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_translate_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -826,20 +979,25 @@ static BMOpDefine bmo_translate_def = { * Scales vertices by an offset. */ static BMOpDefine bmo_scale_def = { - "scale", - /*slot_types_in*/ - {{"vec", BMO_OP_SLOT_VEC}, /* scale factor */ - {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */ - {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_scale_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC), + "scale", + /*slot_types_in*/ + { + /* Scale factor. */ + {"vec", BMO_OP_SLOT_VEC}, + /* Matrix to define the space (typically object matrix). */ + {"space", BMO_OP_SLOT_MAT}, + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Transform shape keys too. */ + {"use_shapekey", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_scale_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC), }; - /* * Transform. * @@ -847,17 +1005,23 @@ static BMOpDefine bmo_scale_def = { * the vertex coordinates with the matrix. */ static BMOpDefine bmo_transform_def = { - "transform", - /*slot_types_in*/ - {{"matrix", BMO_OP_SLOT_MAT}, /* transform matrix */ - {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */ - {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_transform_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC), + "transform", + /*slot_types_in*/ + { + /* Transform matrix. */ + {"matrix", BMO_OP_SLOT_MAT}, + /* Matrix to define the space (typically object matrix). */ + {"space", BMO_OP_SLOT_MAT}, + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Transform shape keys too. */ + {"use_shapekey", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_transform_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -867,54 +1031,66 @@ static BMOpDefine bmo_transform_def = { * BMOP. */ static BMOpDefine bmo_object_load_bmesh_def = { - "object_load_bmesh", - /*slot_types_in*/ - {{"scene", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_SCENE)}, /* pointer to an scene structure */ - {"object", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_OBJECT)}, /* pointer to an object structure */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_object_load_bmesh_exec, - (BMO_OPTYPE_FLAG_NOP), -}; + "object_load_bmesh", + /*slot_types_in*/ + { + /* Pointer to an scene structure. */ + {"scene", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_SCENE)}, + /* Pointer to an object structure. */ + {"object", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_OBJECT)}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_object_load_bmesh_exec, + (BMO_OPTYPE_FLAG_NOP), +}; /* * BMesh to Mesh. * - * Converts a bmesh to a Mesh. This is reserved for exiting editmode. + * Converts a bmesh to a Mesh. This is reserved for exiting edit-mode. */ static BMOpDefine bmo_bmesh_to_mesh_def = { - "bmesh_to_mesh", - /*slot_types_in*/ - { - {"mesh", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_MESH)}, /* pointer to a mesh structure to fill in */ - {"object", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_OBJECT)}, /* pointer to an object structure */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_bmesh_to_mesh_exec, - (BMO_OPTYPE_FLAG_NOP), + "bmesh_to_mesh", + /*slot_types_in*/ + { + + /* Pointer to a mesh structure to fill in. */ + {"mesh", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_MESH)}, + /* Pointer to an object structure. */ + {"object", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_OBJECT)}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_bmesh_to_mesh_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* * Mesh to BMesh. * * Load the contents of a mesh into the bmesh. this BMOP is private, it's - * reserved exclusively for entering editmode. + * reserved exclusively for entering edit-mode. */ static BMOpDefine bmo_mesh_to_bmesh_def = { - "mesh_to_bmesh", - /*slot_types_in*/ - { - {"mesh", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_MESH)}, /* pointer to a Mesh structure */ - {"object", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_OBJECT)}, /* pointer to an Object structure */ - {"use_shapekey", BMO_OP_SLOT_BOOL}, /* load active shapekey coordinates into verts */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_mesh_to_bmesh_exec, - (BMO_OPTYPE_FLAG_NOP), + "mesh_to_bmesh", + /*slot_types_in*/ + { + /* Pointer to a Mesh structure. */ + {"mesh", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_MESH)}, + /* Pointer to an Object structure. */ + {"object", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_OBJECT)}, + /* Load active shapekey coordinates into verts. */ + {"use_shapekey", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_mesh_to_bmesh_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* @@ -923,19 +1099,25 @@ static BMOpDefine bmo_mesh_to_bmesh_def = { * Extrudes faces individually. */ static BMOpDefine bmo_extrude_discrete_faces_def = { - "extrude_discrete_faces", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */ - {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ - {{'\0'}}, - }, - bmo_extrude_discrete_faces_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC), + "extrude_discrete_faces", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Create faces with reversed direction. */ + {"use_normal_flip", BMO_OP_SLOT_BOOL}, + /* Pass to duplicate. */ + {"use_select_history", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_extrude_discrete_faces_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -945,19 +1127,25 @@ static BMOpDefine bmo_extrude_discrete_faces_def = { * winged extrusion. */ static BMOpDefine bmo_extrude_edge_only_def = { - "extrude_edge_only", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input vertices */ - {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */ - {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output geometry */ - {{'\0'}}, - }, - bmo_extrude_edge_only_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC), + "extrude_edge_only", + /*slot_types_in*/ + { + /* Input vertices. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Create faces with reversed direction. */ + {"use_normal_flip", BMO_OP_SLOT_BOOL}, + /* Pass to duplicate. */ + {"use_select_history", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output geometry. */ + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_extrude_edge_only_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -966,19 +1154,25 @@ static BMOpDefine bmo_extrude_edge_only_def = { * Extrudes wire edges from vertices. */ static BMOpDefine bmo_extrude_vert_indiv_def = { - "extrude_vert_indiv", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output wire edges */ - {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output vertices */ - {{'\0'}}, - }, - bmo_extrude_vert_indiv_exec, - (BMO_OPTYPE_FLAG_SELECT_FLUSH), + "extrude_vert_indiv", + /*slot_types_in*/ + { + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Pass to duplicate. */ + {"use_select_history", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output wire edges. */ + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Output vertices. */ + {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {{'\0'}}, + }, + bmo_extrude_vert_indiv_exec, + (BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -987,21 +1181,24 @@ static BMOpDefine bmo_extrude_vert_indiv_def = { * Split faces by adding edges that connect **verts**. */ static BMOpDefine bmo_connect_verts_def = { - "connect_verts", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces to explicitly exclude from connecting */ - {"check_degenerate", BMO_OP_SLOT_BOOL}, /* prevent splits with overlaps & intersections */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, - {{'\0'}}, - }, - bmo_connect_verts_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "connect_verts", + /*slot_types_in*/ + { + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Input faces to explicitly exclude from connecting. */ + {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Prevent splits with overlaps & intersections. */ + {"check_degenerate", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {{'\0'}}, + }, + bmo_connect_verts_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1010,20 +1207,21 @@ static BMOpDefine bmo_connect_verts_def = { * Ensures all faces are convex **faces**. */ static BMOpDefine bmo_connect_verts_concave_def = { - "connect_verts_concave", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, - {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, - {{'\0'}}, - }, - bmo_connect_verts_concave_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "connect_verts_concave", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_connect_verts_concave_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1032,21 +1230,23 @@ static BMOpDefine bmo_connect_verts_concave_def = { * Split faces by connecting edges along non planer **faces**. */ static BMOpDefine bmo_connect_verts_nonplanar_def = { - "connect_verts_nonplanar", - /*slot_types_in*/ - {{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */ - {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, - {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, - {{'\0'}}, - }, - bmo_connect_verts_nonplanar_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "connect_verts_nonplanar", + /*slot_types_in*/ + { + /* Total rotation angle (radians). */ + {"angle_limit", BMO_OP_SLOT_FLT}, + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_connect_verts_nonplanar_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1055,118 +1255,137 @@ static BMOpDefine bmo_connect_verts_nonplanar_def = { * Split faces by adding edges that connect **verts**. */ static BMOpDefine bmo_connect_vert_pair_def = { - "connect_vert_pair", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"verts_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices to explicitly exclude from connecting */ - {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces to explicitly exclude from connecting */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, - {{'\0'}}, - }, - bmo_connect_vert_pair_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "connect_vert_pair", + /*slot_types_in*/ + { + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Input vertices to explicitly exclude from connecting. */ + {"verts_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Input faces to explicitly exclude from connecting. */ + {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {{'\0'}}, + }, + bmo_connect_vert_pair_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; - /* * Extrude Faces. * * Extrude operator (does not transform) */ static BMOpDefine bmo_extrude_face_region_def = { - "extrude_face_region", - /*slot_types_in*/ - {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* edges and faces */ - {"edges_exclude", BMO_OP_SLOT_MAPPING, to_subtype_union(BMO_OP_SLOT_SUBTYPE_MAP_EMPTY)}, /* input edges to explicitly exclude from extrusion */ - {"use_keep_orig", BMO_OP_SLOT_BOOL}, /* keep original geometry (requires ``geom`` to include edges). */ - {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */ - {"use_normal_from_adjacent", BMO_OP_SLOT_BOOL}, /* Use winding from surrounding faces instead of this region. */ - {"use_dissolve_ortho_edges", BMO_OP_SLOT_BOOL}, /* Dissolve edges whose faces form a flat surface. */ - {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {{'\0'}}, - }, - bmo_extrude_face_region_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC), + "extrude_face_region", + /*slot_types_in*/ + { + /* Edges and faces. */ + {"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Input edges to explicitly exclude from extrusion. */ + {"edges_exclude", BMO_OP_SLOT_MAPPING, to_subtype_union(BMO_OP_SLOT_SUBTYPE_MAP_EMPTY)}, + /* Keep original geometry (requires ``geom`` to include edges). */ + {"use_keep_orig", BMO_OP_SLOT_BOOL}, + /* Create faces with reversed direction. */ + {"use_normal_flip", BMO_OP_SLOT_BOOL}, + /* Use winding from surrounding faces instead of this region. */ + {"use_normal_from_adjacent", BMO_OP_SLOT_BOOL}, + /* Dissolve edges whose faces form a flat surface. */ + {"use_dissolve_ortho_edges", BMO_OP_SLOT_BOOL}, + /* Pass to duplicate. */ + {"use_select_history", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_extrude_face_region_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* * Dissolve Verts. */ static BMOpDefine bmo_dissolve_verts_def = { - "dissolve_verts", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"use_face_split", BMO_OP_SLOT_BOOL}, /* split off face corners to maintain surrounding geometry */ - {"use_boundary_tear", BMO_OP_SLOT_BOOL}, /* split off face corners instead of merging faces */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_dissolve_verts_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "dissolve_verts", + /*slot_types_in*/ + { + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Split off face corners to maintain surrounding geometry. */ + {"use_face_split", BMO_OP_SLOT_BOOL}, + /* Split off face corners instead of merging faces. */ + {"use_boundary_tear", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_dissolve_verts_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* * Dissolve Edges. */ static BMOpDefine bmo_dissolve_edges_def = { - "dissolve_edges", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {"use_verts", BMO_OP_SLOT_BOOL}, /* dissolve verts left between only 2 edges. */ - {"use_face_split", BMO_OP_SLOT_BOOL}, /* split off face corners to maintain surrounding geometry */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, - {{'\0'}}, - }, - bmo_dissolve_edges_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "dissolve_edges", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Dissolve verts left between only 2 edges. */ + {"use_verts", BMO_OP_SLOT_BOOL}, + /* Split off face corners to maintain surrounding geometry. */ + {"use_face_split", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_dissolve_edges_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* * Dissolve Faces. */ static BMOpDefine bmo_dissolve_faces_def = { - "dissolve_faces", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"use_verts", BMO_OP_SLOT_BOOL}, /* dissolve verts left between only 2 edges. */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, - {{'\0'}}, - }, - bmo_dissolve_faces_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "dissolve_faces", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Dissolve verts left between only 2 edges. */ + {"use_verts", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_dissolve_faces_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; static BMO_FlagSet bmo_enum_dissolve_limit_flags[] = { - {BMO_DELIM_NORMAL, "NORMAL"}, - {BMO_DELIM_MATERIAL, "MATERIAL"}, - {BMO_DELIM_SEAM, "SEAM"}, - {BMO_DELIM_SHARP, "SHARP"}, - {BMO_DELIM_UV, "UV"}, - {0, nullptr}, + {BMO_DELIM_NORMAL, "NORMAL"}, + {BMO_DELIM_MATERIAL, "MATERIAL"}, + {BMO_DELIM_SEAM, "SEAM"}, + {BMO_DELIM_SHARP, "SHARP"}, + {BMO_DELIM_UV, "UV"}, + {0, nullptr}, }; /* @@ -1175,23 +1394,32 @@ static BMO_FlagSet bmo_enum_dissolve_limit_flags[] = { * Dissolve planar faces and co-linear edges. */ static BMOpDefine bmo_dissolve_limit_def = { - "dissolve_limit", - /*slot_types_in*/ - {{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */ - {"use_dissolve_boundaries", BMO_OP_SLOT_BOOL}, /* dissolve all vertices in between face boundaries */ - {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {"delimit", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_FLAG), bmo_enum_dissolve_limit_flags}, /* delimit dissolve operation */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, - {{'\0'}}}, - bmo_dissolve_limit_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "dissolve_limit", + /*slot_types_in*/ + { + /* Total rotation angle (radians). */ + {"angle_limit", BMO_OP_SLOT_FLT}, + /* Dissolve all vertices in between face boundaries. */ + {"use_dissolve_boundaries", BMO_OP_SLOT_BOOL}, + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Delimit dissolve operation. */ + {"delimit", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_FLAG), + bmo_enum_dissolve_limit_flags}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_dissolve_limit_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -1200,58 +1428,73 @@ static BMOpDefine bmo_dissolve_limit_def = { * Dissolve edges with no length, faces with no area. */ static BMOpDefine bmo_dissolve_degenerate_def = { - "dissolve_degenerate", - /*slot_types_in*/ - {{"dist", BMO_OP_SLOT_FLT}, /* maximum distance to consider degenerate */ - {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{{'\0'}}}, - bmo_dissolve_degenerate_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "dissolve_degenerate", + /*slot_types_in*/ + { + /* Maximum distance to consider degenerate. */ + {"dist", BMO_OP_SLOT_FLT}, + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_dissolve_degenerate_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; static BMO_FlagSet bmo_enum_triangulate_quad_method[] = { - {MOD_TRIANGULATE_QUAD_BEAUTY, "BEAUTY"}, - {MOD_TRIANGULATE_QUAD_FIXED, "FIXED"}, - {MOD_TRIANGULATE_QUAD_ALTERNATE, "ALTERNATE"}, - {MOD_TRIANGULATE_QUAD_SHORTEDGE, "SHORT_EDGE"}, - {MOD_TRIANGULATE_QUAD_LONGEDGE, "LONG_EDGE"}, - {0, nullptr}, + {MOD_TRIANGULATE_QUAD_BEAUTY, "BEAUTY"}, + {MOD_TRIANGULATE_QUAD_FIXED, "FIXED"}, + {MOD_TRIANGULATE_QUAD_ALTERNATE, "ALTERNATE"}, + {MOD_TRIANGULATE_QUAD_SHORTEDGE, "SHORT_EDGE"}, + {MOD_TRIANGULATE_QUAD_LONGEDGE, "LONG_EDGE"}, + {0, nullptr}, }; static BMO_FlagSet bmo_enum_triangulate_ngon_method[] = { - {MOD_TRIANGULATE_NGON_BEAUTY, "BEAUTY"}, - {MOD_TRIANGULATE_NGON_EARCLIP, "EAR_CLIP"}, - {0, nullptr}, + {MOD_TRIANGULATE_NGON_BEAUTY, "BEAUTY"}, + {MOD_TRIANGULATE_NGON_EARCLIP, "EAR_CLIP"}, + {0, nullptr}, }; /* * Triangulate. */ static BMOpDefine bmo_triangulate_def = { - "triangulate", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"quad_method", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), bmo_enum_triangulate_quad_method}, /* method for splitting the quads into triangles */ - {"ngon_method", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), bmo_enum_triangulate_ngon_method}, /* method for splitting the polygons into triangles */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, - {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, - {"face_map.out", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, - {"face_map_double.out", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, /* duplicate faces */ - {{'\0'}}, - }, - bmo_triangulate_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "triangulate", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Method for splitting the quads into triangles. */ + {"quad_method", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_triangulate_quad_method}, + /* Method for splitting the polygons into triangles. */ + {"ngon_method", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_triangulate_ngon_method}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {"face_map.out", + BMO_OP_SLOT_MAPPING, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, + /* Duplicate faces. */ + {"face_map_double.out", + BMO_OP_SLOT_MAPPING, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, + {{'\0'}}, + }, + bmo_triangulate_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1260,26 +1503,28 @@ static BMOpDefine bmo_triangulate_def = { * Reduce detail in geometry containing grids. */ static BMOpDefine bmo_unsubdivide_def = { - "unsubdivide", - /*slot_types_in*/ - {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ - {"iterations", BMO_OP_SLOT_INT}, /* number of times to unsubdivide */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_unsubdivide_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "unsubdivide", + /*slot_types_in*/ + { + /* Input vertices. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Number of times to unsubdivide. */ + {"iterations", BMO_OP_SLOT_INT}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_unsubdivide_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; static BMO_FlagSet bmo_enum_subdivide_edges_quad_corner_type[] = { - {SUBD_CORNER_STRAIGHT_CUT, "STRAIGHT_CUT"}, - {SUBD_CORNER_INNERVERT, "INNER_VERT"}, - {SUBD_CORNER_PATH, "PATH"}, - {SUBD_CORNER_FAN, "FAN"}, - {0, nullptr}, + {SUBD_CORNER_STRAIGHT_CUT, "STRAIGHT_CUT"}, + {SUBD_CORNER_INNERVERT, "INNER_VERT"}, + {SUBD_CORNER_PATH, "PATH"}, + {SUBD_CORNER_FAN, "FAN"}, + {0, nullptr}, }; /* @@ -1289,44 +1534,67 @@ static BMO_FlagSet bmo_enum_subdivide_edges_quad_corner_type[] = { * with options for face patterns, smoothing and randomization. */ static BMOpDefine bmo_subdivide_edges_def = { - "subdivide_edges", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {"smooth", BMO_OP_SLOT_FLT}, /* smoothness factor */ - {"smooth_falloff", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), bmo_enum_falloff_type}, /* smooth falloff type */ - {"fractal", BMO_OP_SLOT_FLT}, /* fractal randomness factor */ - {"along_normal", BMO_OP_SLOT_FLT}, /* apply fractal displacement along normal only */ - {"cuts", BMO_OP_SLOT_INT}, /* number of cuts */ - {"seed", BMO_OP_SLOT_INT}, /* seed for the random number generator */ - {"custom_patterns", BMO_OP_SLOT_MAPPING, to_subtype_union(BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL)}, /* uses custom pointers */ - {"edge_percents", BMO_OP_SLOT_MAPPING, to_subtype_union(BMO_OP_SLOT_SUBTYPE_MAP_FLT)}, - {"quad_corner_type", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), bmo_enum_subdivide_edges_quad_corner_type}, /* quad corner type */ - {"use_grid_fill", BMO_OP_SLOT_BOOL}, /* fill in fully-selected faces with a grid */ - {"use_single_edge", BMO_OP_SLOT_BOOL}, /* tessellate the case of one edge selected in a quad or triangle */ - {"use_only_quads", BMO_OP_SLOT_BOOL}, /* Only subdivide quads (for loop-cut). */ - {"use_sphere", BMO_OP_SLOT_BOOL}, /* for making new primitives only */ - {"use_smooth_even", BMO_OP_SLOT_BOOL}, /* maintain even offset when smoothing */ - {{'\0'}}, - }, - /*slot_types_out*/ - {/* these next three can have multiple types of elements in them */ - {"geom_inner.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* contains all output geometry */ - {{'\0'}}, - }, - bmo_subdivide_edges_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "subdivide_edges", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Smoothness factor. */ + {"smooth", BMO_OP_SLOT_FLT}, + /* Smooth falloff type. */ + {"smooth_falloff", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_falloff_type}, + /* Fractal randomness factor. */ + {"fractal", BMO_OP_SLOT_FLT}, + /* Apply fractal displacement along normal only. */ + {"along_normal", BMO_OP_SLOT_FLT}, + /* Number of cuts. */ + {"cuts", BMO_OP_SLOT_INT}, + /* Seed for the random number generator. */ + {"seed", BMO_OP_SLOT_INT}, + /* Uses custom pointers. */ + {"custom_patterns", + BMO_OP_SLOT_MAPPING, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL)}, + {"edge_percents", BMO_OP_SLOT_MAPPING, to_subtype_union(BMO_OP_SLOT_SUBTYPE_MAP_FLT)}, + /* Quad corner type. */ + {"quad_corner_type", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_subdivide_edges_quad_corner_type}, + /* Fill in fully-selected faces with a grid. */ + {"use_grid_fill", BMO_OP_SLOT_BOOL}, + /* Tessellate the case of one edge selected in a quad or triangle. */ + {"use_single_edge", BMO_OP_SLOT_BOOL}, + /* Only subdivide quads (for loop-cut). */ + {"use_only_quads", BMO_OP_SLOT_BOOL}, + /* For making new primitives only. */ + {"use_sphere", BMO_OP_SLOT_BOOL}, + /* Maintain even offset when smoothing. */ + {"use_smooth_even", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* NOTE: these next three can have multiple types of elements in them. */ + {"geom_inner.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Contains all output geometry. */ + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_subdivide_edges_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; static BMO_FlagSet bmo_enum_subdivide_edgering_interp_mode[] = { - {SUBD_RING_INTERP_LINEAR, "LINEAR"}, - {SUBD_RING_INTERP_PATH, "PATH"}, - {SUBD_RING_INTERP_SURF, "SURFACE"}, - {0, nullptr}, + {SUBD_RING_INTERP_LINEAR, "LINEAR"}, + {SUBD_RING_INTERP_PATH, "PATH"}, + {SUBD_RING_INTERP_SURF, "SURFACE"}, + {0, nullptr}, }; /* @@ -1335,23 +1603,38 @@ static BMO_FlagSet bmo_enum_subdivide_edgering_interp_mode[] = { * Take an edge-ring, and subdivide with interpolation options. */ static BMOpDefine bmo_subdivide_edgering_def = { - "subdivide_edgering", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input vertices */ - {"interp_mode", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), bmo_enum_subdivide_edgering_interp_mode}, /* interpolation method */ - {"smooth", BMO_OP_SLOT_FLT}, /* smoothness factor */ - {"cuts", BMO_OP_SLOT_INT}, /* number of cuts */ - {"profile_shape", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), bmo_enum_falloff_type}, /* profile shape type */ - {"profile_shape_factor", BMO_OP_SLOT_FLT}, /* how much intermediary new edges are shrunk/expanded */ - {{'\0'}}, - }, - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ - {{'\0'}}}, - bmo_subdivide_edgering_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "subdivide_edgering", + /*slot_types_in*/ + { + /* Input vertices. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Interpolation method. */ + {"interp_mode", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_subdivide_edgering_interp_mode}, + /* Smoothness factor. */ + {"smooth", BMO_OP_SLOT_FLT}, + /* Number of cuts. */ + {"cuts", BMO_OP_SLOT_INT}, + /* Profile shape type. */ + {"profile_shape", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_falloff_type}, + /* How much intermediary new edges are shrunk/expanded. */ + {"profile_shape_factor", BMO_OP_SLOT_FLT}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_subdivide_edgering_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -1360,36 +1643,47 @@ static BMOpDefine bmo_subdivide_edgering_def = { * Bisects the mesh by a plane (cut the mesh in half). */ static BMOpDefine bmo_bisect_plane_def = { - "bisect_plane", - /*slot_types_in*/ - {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */ - {"dist", BMO_OP_SLOT_FLT}, /* minimum distance when testing if a vert is exactly on the plane */ - {"plane_co", BMO_OP_SLOT_VEC}, /* point on the plane */ - {"plane_no", BMO_OP_SLOT_VEC}, /* direction of the plane */ - {"use_snap_center", BMO_OP_SLOT_BOOL}, /* snap axis aligned verts to the center */ - {"clear_outer", BMO_OP_SLOT_BOOL}, /* when enabled. remove all geometry on the positive side of the plane */ - {"clear_inner", BMO_OP_SLOT_BOOL}, /* when enabled. remove all geometry on the negative side of the plane */ - {{'\0'}}, - }, - {{"geom_cut.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE}}, /* output geometry aligned with the plane (new and existing) */ - {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input and output geometry (result of cut). */ - {{'\0'}}}, - bmo_bisect_plane_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "bisect_plane", + /*slot_types_in*/ + { + /* Input geometry. */ + {"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Minimum distance when testing if a vert is exactly on the plane. */ + {"dist", BMO_OP_SLOT_FLT}, + /* Point on the plane. */ + {"plane_co", BMO_OP_SLOT_VEC}, + /* Direction of the plane. */ + {"plane_no", BMO_OP_SLOT_VEC}, + /* Snap axis aligned verts to the center. */ + {"use_snap_center", BMO_OP_SLOT_BOOL}, + /* When enabled. remove all geometry on the positive side of the plane. */ + {"clear_outer", BMO_OP_SLOT_BOOL}, + /* When enabled. remove all geometry on the negative side of the plane. */ + {"clear_inner", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output geometry aligned with the plane (new and existing). */ + {"geom_cut.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE}}, + /* Input and output geometry (result of cut). */ + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_bisect_plane_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; static BMO_FlagSet bmo_enum_delete_context[] = { - {DEL_VERTS, "VERTS"}, - {DEL_EDGES, "EDGES"}, - {DEL_ONLYFACES, "FACES_ONLY"}, - {DEL_EDGESFACES, "EDGES_FACES"}, - {DEL_FACES, "FACES"}, - {DEL_FACES_KEEP_BOUNDARY, "FACES_KEEP_BOUNDARY"}, - {DEL_ONLYTAGGED, "TAGGED_ONLY"}, - {0, nullptr}, + {DEL_VERTS, "VERTS"}, + {DEL_EDGES, "EDGES"}, + {DEL_ONLYFACES, "FACES_ONLY"}, + {DEL_EDGESFACES, "EDGES_FACES"}, + {DEL_FACES, "FACES"}, + {DEL_FACES_KEEP_BOUNDARY, "FACES_KEEP_BOUNDARY"}, + {DEL_ONLYTAGGED, "TAGGED_ONLY"}, + {0, nullptr}, }; /* @@ -1398,17 +1692,23 @@ static BMO_FlagSet bmo_enum_delete_context[] = { * Utility operator to delete geometry. */ static BMOpDefine bmo_delete_def = { - "delete", - /*slot_types_in*/ - {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */ - {"context", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), bmo_enum_delete_context}, /* geometry types to delete */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_delete_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "delete", + /*slot_types_in*/ + { + /* Input geometry. */ + {"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Geometry types to delete. */ + {"context", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_delete_context}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_delete_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -1418,29 +1718,44 @@ static BMOpDefine bmo_delete_def = { * optionally into a destination mesh. */ static BMOpDefine bmo_duplicate_def = { - "duplicate", - /*slot_types_in*/ - {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */ - {"dest", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_BMESH)}, /* destination bmesh, if None will use current on */ - {"use_select_history", BMO_OP_SLOT_BOOL}, - {"use_edge_flip_from_face", BMO_OP_SLOT_BOOL}, - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom_orig.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - /* face_map maps from source faces to dupe - * faces, and from dupe faces to source faces */ - {"vert_map.out", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, - {"edge_map.out", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, - {"face_map.out", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, - {"boundary_map.out", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, - {"isovert_map.out", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, - {{'\0'}}, - }, - bmo_duplicate_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "duplicate", + /*slot_types_in*/ + { + /* Input geometry. */ + {"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Destination bmesh, if None will use current on. */ + {"dest", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_BMESH)}, + {"use_select_history", BMO_OP_SLOT_BOOL}, + {"use_edge_flip_from_face", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"geom_orig.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + + /* NOTE: face_map maps from source faces to dupe faces, + * and from dupe faces to source faces. */ + + {"vert_map.out", + BMO_OP_SLOT_MAPPING, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, + {"edge_map.out", + BMO_OP_SLOT_MAPPING, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, + {"face_map.out", + BMO_OP_SLOT_MAPPING, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, + {"boundary_map.out", + BMO_OP_SLOT_MAPPING, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, + {"isovert_map.out", + BMO_OP_SLOT_MAPPING, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, + {{'\0'}}, + }, + bmo_duplicate_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1450,22 +1765,30 @@ static BMOpDefine bmo_duplicate_def = { * optionally into a destination mesh. */ static BMOpDefine bmo_split_def = { - "split", - /*slot_types_in*/ - {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */ - {"dest", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_BMESH)}, /* destination bmesh, if None will use current one */ - {"use_only_faces", BMO_OP_SLOT_BOOL}, /* when enabled. don't duplicate loose verts/edges */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {"boundary_map.out", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, - {"isovert_map.out", BMO_OP_SLOT_MAPPING, {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, - {{'\0'}}, - }, - bmo_split_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "split", + /*slot_types_in*/ + { + /* Input geometry. */ + {"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Destination bmesh, if None will use current one. */ + {"dest", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_BMESH)}, + /* When enabled. don't duplicate loose verts/edges. */ + {"use_only_faces", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {"boundary_map.out", + BMO_OP_SLOT_MAPPING, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, + {"isovert_map.out", + BMO_OP_SLOT_MAPPING, + {eBMOpSlotSubType_Elem(BMO_OP_SLOT_SUBTYPE_MAP_ELEM)}}, + {{'\0'}}, + }, + bmo_split_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1475,27 +1798,39 @@ static BMOpDefine bmo_split_def = { * rotating and possibly translating after each step */ static BMOpDefine bmo_spin_def = { - "spin", - /*slot_types_in*/ - {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */ - {"cent", BMO_OP_SLOT_VEC}, /* rotation center */ - {"axis", BMO_OP_SLOT_VEC}, /* rotation axis */ - {"dvec", BMO_OP_SLOT_VEC}, /* translation delta per step */ - {"angle", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */ - {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */ - {"steps", BMO_OP_SLOT_INT}, /* number of steps */ - {"use_merge", BMO_OP_SLOT_BOOL}, /* Merge first/last when the angle is a full revolution. */ - {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */ - {"use_duplicate", BMO_OP_SLOT_BOOL}, /* duplicate or extrude? */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom_last.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* result of last step */ - {{'\0'}}, - }, - bmo_spin_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "spin", + /*slot_types_in*/ + { + /* Input geometry. */ + {"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Rotation center. */ + {"cent", BMO_OP_SLOT_VEC}, + /* Rotation axis. */ + {"axis", BMO_OP_SLOT_VEC}, + /* Translation delta per step. */ + {"dvec", BMO_OP_SLOT_VEC}, + /* Total rotation angle (radians). */ + {"angle", BMO_OP_SLOT_FLT}, + /* Matrix to define the space (typically object matrix). */ + {"space", BMO_OP_SLOT_MAT}, + /* Number of steps. */ + {"steps", BMO_OP_SLOT_INT}, + /* Merge first/last when the angle is a full revolution. */ + {"use_merge", BMO_OP_SLOT_BOOL}, + /* Create faces with reversed direction. */ + {"use_normal_flip", BMO_OP_SLOT_BOOL}, + /* Duplicate or extrude?. */ + {"use_duplicate", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Result of last step. */ + {"geom_last.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_spin_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1504,15 +1839,19 @@ static BMOpDefine bmo_spin_def = { * Cycle the loop UVs */ static BMOpDefine bmo_rotate_uvs_def = { - "rotate_uvs", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate counter-clockwise if true, otherwise clockwise */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_rotate_uvs_exec, - (BMO_OPTYPE_FLAG_NOP), + "rotate_uvs", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Rotate counter-clockwise if true, otherwise clockwise. */ + {"use_ccw", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_rotate_uvs_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* @@ -1521,14 +1860,17 @@ static BMOpDefine bmo_rotate_uvs_def = { * Reverse the UVs */ static BMOpDefine bmo_reverse_uvs_def = { - "reverse_uvs", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_reverse_uvs_exec, - (BMO_OPTYPE_FLAG_NOP), + "reverse_uvs", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_reverse_uvs_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* @@ -1537,16 +1879,21 @@ static BMOpDefine bmo_reverse_uvs_def = { * Cycle the loop colors */ static BMOpDefine bmo_rotate_colors_def = { - "rotate_colors", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate counter-clockwise if true, otherwise clockwise */ - {"color_index", BMO_OP_SLOT_INT}, /* index into color attribute list */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_rotate_colors_exec, - (BMO_OPTYPE_FLAG_NOP), + "rotate_colors", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Rotate counter-clockwise if true, otherwise clockwise. */ + {"use_ccw", BMO_OP_SLOT_BOOL}, + /* Index into color attribute list. */ + {"color_index", BMO_OP_SLOT_INT}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_rotate_colors_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* @@ -1555,15 +1902,19 @@ static BMOpDefine bmo_rotate_colors_def = { * Reverse the loop colors. */ static BMOpDefine bmo_reverse_colors_def = { - "reverse_colors", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"color_index", BMO_OP_SLOT_INT}, /* index into color attribute list */ - {{'\0'}}, - }, - {{{'\0'}}}, /* no output */ - bmo_reverse_colors_exec, - (BMO_OPTYPE_FLAG_NOP), + "reverse_colors", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Index into color attribute list. */ + {"color_index", BMO_OP_SLOT_INT}, + {{'\0'}}, + }, + /*slot_types_out*/ + {{{'\0'}}}, + bmo_reverse_colors_exec, + (BMO_OPTYPE_FLAG_NOP), }; /* @@ -1572,22 +1923,29 @@ static BMOpDefine bmo_reverse_colors_def = { * Disconnects faces along input edges. */ static BMOpDefine bmo_split_edges_def = { - "split_edges", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - /* needed for vertex rip so we can rip only half an edge at a boundary which would otherwise split off */ - {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* optional tag verts, use to have greater control of splits */ - {"use_verts", BMO_OP_SLOT_BOOL}, /* use 'verts' for splitting, else just find verts to split from edges */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* old output disconnected edges */ - {{'\0'}}, - }, - bmo_split_edges_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "split_edges", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + + /* NOTE: needed for vertex rip so we can rip only half an edge + * at a boundary which would otherwise split off. */ + + /* Optional tag verts, use to have greater control of splits. */ + {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Use 'verts' for splitting, else just find verts to split from edges. */ + {"use_verts", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Old output disconnected edges. */ + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {{'\0'}}, + }, + bmo_split_edges_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1596,22 +1954,29 @@ static BMOpDefine bmo_split_edges_def = { * Creates a grid with a variable number of subdivisions */ static BMOpDefine bmo_create_grid_def = { - "create_grid", - /*slot_types_in*/ - {{"x_segments", BMO_OP_SLOT_INT}, /* number of x segments */ - {"y_segments", BMO_OP_SLOT_INT}, /* number of y segments */ - {"size", BMO_OP_SLOT_FLT}, /* size of the grid */ - {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */ - {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */ - {{'\0'}}, - }, - bmo_create_grid_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "create_grid", + /*slot_types_in*/ + { + /* Number of x segments. */ + {"x_segments", BMO_OP_SLOT_INT}, + /* Number of y segments. */ + {"y_segments", BMO_OP_SLOT_INT}, + /* Size of the grid. */ + {"size", BMO_OP_SLOT_FLT}, + /* Matrix to multiply the new geometry with. */ + {"matrix", BMO_OP_SLOT_MAT}, + /* Calculate default UVs. */ + {"calc_uvs", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output verts. */ + {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {{'\0'}}, + }, + bmo_create_grid_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1620,22 +1985,29 @@ static BMOpDefine bmo_create_grid_def = { * Creates a grid with a variable number of subdivisions */ static BMOpDefine bmo_create_uvsphere_def = { - "create_uvsphere", - /*slot_types_in*/ - {{"u_segments", BMO_OP_SLOT_INT}, /* number of u segments */ - {"v_segments", BMO_OP_SLOT_INT}, /* number of v segment */ - {"radius", BMO_OP_SLOT_FLT}, /* radius */ - {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */ - {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */ - {{'\0'}}, - }, - bmo_create_uvsphere_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "create_uvsphere", + /*slot_types_in*/ + { + /* Number of u segments. */ + {"u_segments", BMO_OP_SLOT_INT}, + /* Number of v segment. */ + {"v_segments", BMO_OP_SLOT_INT}, + /* Radius. */ + {"radius", BMO_OP_SLOT_FLT}, + /* Matrix to multiply the new geometry with. */ + {"matrix", BMO_OP_SLOT_MAT}, + /* Calculate default UVs. */ + {"calc_uvs", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output verts. */ + {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {{'\0'}}, + }, + bmo_create_uvsphere_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1644,21 +2016,27 @@ static BMOpDefine bmo_create_uvsphere_def = { * Creates a grid with a variable number of subdivisions */ static BMOpDefine bmo_create_icosphere_def = { - "create_icosphere", - /*slot_types_in*/ - {{"subdivisions", BMO_OP_SLOT_INT}, /* how many times to recursively subdivide the sphere */ - {"radius", BMO_OP_SLOT_FLT}, /* radius */ - {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */ - {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */ - {{'\0'}}, - }, - bmo_create_icosphere_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "create_icosphere", + /*slot_types_in*/ + { + /* How many times to recursively subdivide the sphere. */ + {"subdivisions", BMO_OP_SLOT_INT}, + /* Radius. */ + {"radius", BMO_OP_SLOT_FLT}, + /* Matrix to multiply the new geometry with. */ + {"matrix", BMO_OP_SLOT_MAT}, + /* Calculate default UVs. */ + {"calc_uvs", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output verts. */ + {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {{'\0'}}, + }, + bmo_create_icosphere_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1667,19 +2045,23 @@ static BMOpDefine bmo_create_icosphere_def = { * Creates a monkey (standard blender primitive). */ static BMOpDefine bmo_create_monkey_def = { - "create_monkey", - /*slot_types_in*/ - {{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */ - {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */ - {{'\0'}}, - }, - bmo_create_monkey_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "create_monkey", + /*slot_types_in*/ + { + /* Matrix to multiply the new geometry with. */ + {"matrix", BMO_OP_SLOT_MAT}, + /* Calculate default UVs. */ + {"calc_uvs", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output verts. */ + {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {{'\0'}}, + }, + bmo_create_monkey_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1688,48 +2070,66 @@ static BMOpDefine bmo_create_monkey_def = { * Creates a cone with variable depth at both ends */ static BMOpDefine bmo_create_cone_def = { - "create_cone", - /*slot_types_in*/ - {{"cap_ends", BMO_OP_SLOT_BOOL}, /* whether or not to fill in the ends with faces */ - {"cap_tris", BMO_OP_SLOT_BOOL}, /* fill ends with triangles instead of ngons */ - {"segments", BMO_OP_SLOT_INT}, /* number of vertices in the base circle */ - {"radius1", BMO_OP_SLOT_FLT}, /* radius of one end */ - {"radius2", BMO_OP_SLOT_FLT}, /* radius of the opposite */ - {"depth", BMO_OP_SLOT_FLT}, /* distance between ends */ - {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */ - {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */ - {{'\0'}}, - }, - bmo_create_cone_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "create_cone", + /*slot_types_in*/ + { + /* Whether or not to fill in the ends with faces. */ + {"cap_ends", BMO_OP_SLOT_BOOL}, + /* Fill ends with triangles instead of ngons. */ + {"cap_tris", BMO_OP_SLOT_BOOL}, + /* Number of vertices in the base circle. */ + {"segments", BMO_OP_SLOT_INT}, + /* Radius of one end. */ + {"radius1", BMO_OP_SLOT_FLT}, + /* Radius of the opposite. */ + {"radius2", BMO_OP_SLOT_FLT}, + /* Distance between ends. */ + {"depth", BMO_OP_SLOT_FLT}, + /* Matrix to multiply the new geometry with. */ + {"matrix", BMO_OP_SLOT_MAT}, + /* Calculate default UVs. */ + {"calc_uvs", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output verts. */ + {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {{'\0'}}, + }, + bmo_create_cone_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* * Creates a Circle. */ static BMOpDefine bmo_create_circle_def = { - "create_circle", - /*slot_types_in*/ - {{"cap_ends", BMO_OP_SLOT_BOOL}, /* whether or not to fill in the ends with faces */ - {"cap_tris", BMO_OP_SLOT_BOOL}, /* fill ends with triangles instead of ngons */ - {"segments", BMO_OP_SLOT_INT}, /* number of vertices in the circle */ - {"radius", BMO_OP_SLOT_FLT}, /* Radius of the circle. */ - {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */ - {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */ - {{'\0'}}, - }, - bmo_create_circle_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "create_circle", + /*slot_types_in*/ + { + /* Whether or not to fill in the ends with faces. */ + {"cap_ends", BMO_OP_SLOT_BOOL}, + /* Fill ends with triangles instead of ngons. */ + {"cap_tris", BMO_OP_SLOT_BOOL}, + /* Number of vertices in the circle. */ + {"segments", BMO_OP_SLOT_INT}, + /* Radius of the circle. */ + {"radius", BMO_OP_SLOT_FLT}, + /* Matrix to multiply the new geometry with. */ + {"matrix", BMO_OP_SLOT_MAT}, + /* Calculate default UVs. */ + {"calc_uvs", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output verts. */ + {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {{'\0'}}, + }, + bmo_create_circle_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1738,62 +2138,67 @@ static BMOpDefine bmo_create_circle_def = { * Creates a cube. */ static BMOpDefine bmo_create_cube_def = { - "create_cube", - /*slot_types_in*/ - {{"size", BMO_OP_SLOT_FLT}, /* size of the cube */ - {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */ - {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */ - {{'\0'}}, - }, - bmo_create_cube_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "create_cube", + /*slot_types_in*/ + { + /* Size of the cube. */ + {"size", BMO_OP_SLOT_FLT}, + /* Matrix to multiply the new geometry with. */ + {"matrix", BMO_OP_SLOT_MAT}, + /* Calculate default UVs. */ + {"calc_uvs", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output verts. */ + {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {{'\0'}}, + }, + bmo_create_cube_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; static BMO_FlagSet bmo_enum_bevel_offset_type[] = { - {BEVEL_AMT_OFFSET, "OFFSET"}, - {BEVEL_AMT_WIDTH, "WIDTH"}, - {BEVEL_AMT_DEPTH, "DEPTH"}, - {BEVEL_AMT_PERCENT, "PERCENT"}, - {BEVEL_AMT_ABSOLUTE, "ABSOLUTE"}, - {0, nullptr}, + {BEVEL_AMT_OFFSET, "OFFSET"}, + {BEVEL_AMT_WIDTH, "WIDTH"}, + {BEVEL_AMT_DEPTH, "DEPTH"}, + {BEVEL_AMT_PERCENT, "PERCENT"}, + {BEVEL_AMT_ABSOLUTE, "ABSOLUTE"}, + {0, nullptr}, }; static BMO_FlagSet bmo_enum_bevel_profile_type[] = { - {BEVEL_PROFILE_SUPERELLIPSE, "SUPERELLIPSE"}, - {BEVEL_PROFILE_CUSTOM, "CUSTOM"}, - {0, nullptr}, + {BEVEL_PROFILE_SUPERELLIPSE, "SUPERELLIPSE"}, + {BEVEL_PROFILE_CUSTOM, "CUSTOM"}, + {0, nullptr}, }; static BMO_FlagSet bmo_enum_bevel_face_strength_type[] = { - {BEVEL_FACE_STRENGTH_NONE, "NONE"}, - {BEVEL_FACE_STRENGTH_NEW, "NEW"}, - {BEVEL_FACE_STRENGTH_AFFECTED, "AFFECTED"}, - {BEVEL_FACE_STRENGTH_ALL, "ALL"}, - {0, nullptr}, + {BEVEL_FACE_STRENGTH_NONE, "NONE"}, + {BEVEL_FACE_STRENGTH_NEW, "NEW"}, + {BEVEL_FACE_STRENGTH_AFFECTED, "AFFECTED"}, + {BEVEL_FACE_STRENGTH_ALL, "ALL"}, + {0, nullptr}, }; static BMO_FlagSet bmo_enum_bevel_miter_type[] = { - {BEVEL_MITER_SHARP, "SHARP"}, - {BEVEL_MITER_PATCH, "PATCH"}, - {BEVEL_MITER_ARC, "ARC"}, - {0, nullptr}, + {BEVEL_MITER_SHARP, "SHARP"}, + {BEVEL_MITER_PATCH, "PATCH"}, + {BEVEL_MITER_ARC, "ARC"}, + {0, nullptr}, }; static BMO_FlagSet bmo_enum_bevel_vmesh_method[] = { - {BEVEL_VMESH_ADJ, "ADJ"}, - {BEVEL_VMESH_CUTOFF, "CUTOFF"}, - {0, nullptr}, + {BEVEL_VMESH_ADJ, "ADJ"}, + {BEVEL_VMESH_CUTOFF, "CUTOFF"}, + {0, nullptr}, }; static BMO_FlagSet bmo_enum_bevel_affect_type[] = { - {BEVEL_AFFECT_VERTICES, "VERTICES"}, - {BEVEL_AFFECT_EDGES, "EDGES"}, - {0, nullptr}, + {BEVEL_AFFECT_VERTICES, "VERTICES"}, + {BEVEL_AFFECT_EDGES, "EDGES"}, + {0, nullptr}, }; /* @@ -1802,55 +2207,91 @@ static BMO_FlagSet bmo_enum_bevel_affect_type[] = { * Bevels edges and vertices */ static BMOpDefine bmo_bevel_def = { - "bevel", - /*slot_types_in*/ - {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input edges and vertices */ - {"offset", BMO_OP_SLOT_FLT}, /* amount to offset beveled edge */ - {"offset_type", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), - bmo_enum_bevel_offset_type}, /* how to measure the offset */ - {"profile_type", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), - bmo_enum_bevel_profile_type}, /* The profile type to use for bevel. */ - {"segments", BMO_OP_SLOT_INT}, /* number of segments in bevel */ - {"profile", BMO_OP_SLOT_FLT}, /* profile shape, 0->1 (.5=>round) */ - {"affect", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), - bmo_enum_bevel_affect_type}, /* Whether to bevel vertices or edges. */ - {"clamp_overlap", BMO_OP_SLOT_BOOL}, /* do not allow beveled edges/vertices to overlap each other */ - {"material", BMO_OP_SLOT_INT}, /* material for bevel faces, -1 means get from adjacent faces */ - {"loop_slide", BMO_OP_SLOT_BOOL}, /* prefer to slide along edges to having even widths */ - {"mark_seam", BMO_OP_SLOT_BOOL}, /* extend edge data to allow seams to run across bevels */ - {"mark_sharp", BMO_OP_SLOT_BOOL}, /* extend edge data to allow sharp edges to run across bevels */ - {"harden_normals", BMO_OP_SLOT_BOOL}, /* harden normals */ - {"face_strength_mode", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), - bmo_enum_bevel_face_strength_type}, /* whether to set face strength, and which faces to set if so */ - {"miter_outer", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), - bmo_enum_bevel_miter_type}, /* outer miter kind */ - {"miter_inner", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), - bmo_enum_bevel_miter_type}, /* outer miter kind */ - {"spread", BMO_OP_SLOT_FLT}, /* amount to offset beveled edge */ - {"custom_profile", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_STRUCT)}, /* CurveProfile, if None ignored */ - {"vmesh_method", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), - bmo_enum_bevel_vmesh_method}, /* The method to use to create meshes at intersections. */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ - {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output edges */ - {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */ - {{'\0'}}, - }, + "bevel", + /*slot_types_in*/ + { + /* Input edges and vertices. */ + {"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Amount to offset beveled edge. */ + {"offset", BMO_OP_SLOT_FLT}, + /* How to measure the offset. */ + {"offset_type", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_bevel_offset_type}, + /* The profile type to use for bevel. */ + {"profile_type", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_bevel_profile_type}, + /* Number of segments in bevel. */ + {"segments", BMO_OP_SLOT_INT}, + /* Profile shape, 0->1 (.5=>round). */ + {"profile", BMO_OP_SLOT_FLT}, + /* Whether to bevel vertices or edges. */ + {"affect", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_bevel_affect_type}, + /* Do not allow beveled edges/vertices to overlap each other. */ + {"clamp_overlap", BMO_OP_SLOT_BOOL}, + /* Material for bevel faces, -1 means get from adjacent faces. */ + {"material", BMO_OP_SLOT_INT}, + /* Prefer to slide along edges to having even widths. */ + {"loop_slide", BMO_OP_SLOT_BOOL}, + /* Extend edge data to allow seams to run across bevels. */ + {"mark_seam", BMO_OP_SLOT_BOOL}, + /* Extend edge data to allow sharp edges to run across bevels. */ + {"mark_sharp", BMO_OP_SLOT_BOOL}, + /* Harden normals. */ + {"harden_normals", BMO_OP_SLOT_BOOL}, + /* Whether to set face strength, and which faces to set if so. */ + {"face_strength_mode", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_bevel_face_strength_type}, + /* Outer miter kind. */ + {"miter_outer", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_bevel_miter_type}, + /* Outer miter kind. */ + {"miter_inner", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_bevel_miter_type}, + /* Amount to offset beveled edge. */ + {"spread", BMO_OP_SLOT_FLT}, + /* CurveProfile, if None ignored */ + {"custom_profile", BMO_OP_SLOT_PTR, to_subtype_union(BMO_OP_SLOT_SUBTYPE_PTR_STRUCT)}, + /* The method to use to create meshes at intersections. */ + {"vmesh_method", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_bevel_vmesh_method}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Output edges. */ + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Output verts. */ + {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {{'\0'}}, + }, - bmo_bevel_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + bmo_bevel_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; -/* no enum is defined for this */ +/* No enum is defined for this. */ static BMO_FlagSet bmo_enum_beautify_fill_method[] = { - {0, "AREA"}, - {1, "ANGLE"}, - {0, nullptr}, + {0, "AREA"}, + {1, "ANGLE"}, + {0, nullptr}, }; /* @@ -1859,23 +2300,31 @@ static BMO_FlagSet bmo_enum_beautify_fill_method[] = { * Rotate edges to create more evenly spaced triangles. */ static BMOpDefine bmo_beautify_fill_def = { - "beautify_fill", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* edges that can be flipped */ - {"use_restrict_tag", BMO_OP_SLOT_BOOL}, /* restrict edge rotation to mixed tagged vertices */ - {"method", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), bmo_enum_beautify_fill_method}, /* method to define what is beautiful */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* new flipped faces and edges */ - {{'\0'}}, - }, - bmo_beautify_fill_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "beautify_fill", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Edges that can be flipped. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Restrict edge rotation to mixed tagged vertices. */ + {"use_restrict_tag", BMO_OP_SLOT_BOOL}, + /* Method to define what is beautiful. */ + {"method", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_beautify_fill_method}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* New flipped faces and edges. */ + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_beautify_fill_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; /* @@ -1884,22 +2333,27 @@ static BMOpDefine bmo_beautify_fill_def = { * Fill edges with triangles */ static BMOpDefine bmo_triangle_fill_def = { - "triangle_fill", - /*slot_types_in*/ - {{"use_beauty", BMO_OP_SLOT_BOOL}, /* use best triangulation division */ - {"use_dissolve", BMO_OP_SLOT_BOOL}, /* dissolve resulting faces */ - {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {"normal", BMO_OP_SLOT_VEC}, /* optionally pass the fill normal to use */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* new faces and edges */ - {{'\0'}}, - }, - bmo_triangle_fill_exec, - (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | - BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "triangle_fill", + /*slot_types_in*/ + { + /* Use best triangulation division. */ + {"use_beauty", BMO_OP_SLOT_BOOL}, + /* Dissolve resulting faces. */ + {"use_dissolve", BMO_OP_SLOT_BOOL}, + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Optionally pass the fill normal to use. */ + {"normal", BMO_OP_SLOT_VEC}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* New faces and edges. */ + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_triangle_fill_exec, + (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1908,19 +2362,22 @@ static BMOpDefine bmo_triangle_fill_def = { * Turns a mesh into a shell with thickness */ static BMOpDefine bmo_solidify_def = { - "solidify", - /*slot_types_in*/ - {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */ - {"thickness", BMO_OP_SLOT_FLT}, /* thickness */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {{'\0'}}, - }, - bmo_solidify_face_region_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "solidify", + /*slot_types_in*/ + { + /* Input geometry. */ + {"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Thickness. */ + {"thickness", BMO_OP_SLOT_FLT}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_solidify_face_region_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1929,23 +2386,32 @@ static BMOpDefine bmo_solidify_def = { * Insets individual faces. */ static BMOpDefine bmo_inset_individual_def = { - "inset_individual", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"thickness", BMO_OP_SLOT_FLT}, /* thickness */ - {"depth", BMO_OP_SLOT_FLT}, /* depth */ - {"use_even_offset", BMO_OP_SLOT_BOOL}, /* scale the offset to give more even thickness */ - {"use_interpolate", BMO_OP_SLOT_BOOL}, /* blend face data across the inset */ - {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* scale the offset by surrounding geometry */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ - {{'\0'}}, - }, - bmo_inset_individual_exec, - /* caller needs to handle BMO_OPTYPE_FLAG_SELECT_FLUSH */ - (BMO_OPTYPE_FLAG_NORMALS_CALC), + "inset_individual", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Thickness. */ + {"thickness", BMO_OP_SLOT_FLT}, + /* Depth. */ + {"depth", BMO_OP_SLOT_FLT}, + /* Scale the offset to give more even thickness. */ + {"use_even_offset", BMO_OP_SLOT_BOOL}, + /* Blend face data across the inset. */ + {"use_interpolate", BMO_OP_SLOT_BOOL}, + /* Scale the offset by surrounding geometry. */ + {"use_relative_offset", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_inset_individual_exec, + /* Caller needs to handle BMO_OPTYPE_FLAG_SELECT_FLUSH. */ + (BMO_OPTYPE_FLAG_NORMALS_CALC), }; /* @@ -1954,27 +2420,39 @@ static BMOpDefine bmo_inset_individual_def = { * Inset or outset face regions. */ static BMOpDefine bmo_inset_region_def = { - "inset_region", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces to explicitly exclude from inset */ - {"use_boundary", BMO_OP_SLOT_BOOL}, /* inset face boundaries */ - {"use_even_offset", BMO_OP_SLOT_BOOL}, /* scale the offset to give more even thickness */ - {"use_interpolate", BMO_OP_SLOT_BOOL}, /* blend face data across the inset */ - {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* scale the offset by surrounding geometry */ - {"use_edge_rail", BMO_OP_SLOT_BOOL}, /* inset the region along existing edges */ - {"thickness", BMO_OP_SLOT_FLT}, /* thickness */ - {"depth", BMO_OP_SLOT_FLT}, /* depth */ - {"use_outset", BMO_OP_SLOT_BOOL}, /* outset rather than inset */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ - {{'\0'}}, - }, - bmo_inset_region_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "inset_region", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Input faces to explicitly exclude from inset. */ + {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Inset face boundaries. */ + {"use_boundary", BMO_OP_SLOT_BOOL}, + /* Scale the offset to give more even thickness. */ + {"use_even_offset", BMO_OP_SLOT_BOOL}, + /* Blend face data across the inset. */ + {"use_interpolate", BMO_OP_SLOT_BOOL}, + /* Scale the offset by surrounding geometry. */ + {"use_relative_offset", BMO_OP_SLOT_BOOL}, + /* Inset the region along existing edges. */ + {"use_edge_rail", BMO_OP_SLOT_BOOL}, + /* Thickness. */ + {"thickness", BMO_OP_SLOT_FLT}, + /* Depth. */ + {"depth", BMO_OP_SLOT_FLT}, + /* Outset rather than inset. */ + {"use_outset", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_inset_region_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -1983,19 +2461,23 @@ static BMOpDefine bmo_inset_region_def = { * Creates edge loops based on simple edge-outset method. */ static BMOpDefine bmo_offset_edgeloops_def = { - "offset_edgeloops", - /*slot_types_in*/ - {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ - {"use_cap_endpoint", BMO_OP_SLOT_BOOL}, /* extend loop around end-points */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output edges */ - {{'\0'}}, - }, - bmo_offset_edgeloops_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH), + "offset_edgeloops", + /*slot_types_in*/ + { + /* Input edges. */ + {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + /* Extend loop around end-points. */ + {"use_cap_endpoint", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output edges. */ + {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {{'\0'}}, + }, + bmo_offset_edgeloops_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH), }; /* @@ -2004,35 +2486,47 @@ static BMOpDefine bmo_offset_edgeloops_def = { * Makes a wire-frame copy of faces. */ static BMOpDefine bmo_wireframe_def = { - "wireframe", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"thickness", BMO_OP_SLOT_FLT}, /* thickness */ - {"offset", BMO_OP_SLOT_FLT}, /* offset the thickness from the center */ - {"use_replace", BMO_OP_SLOT_BOOL}, /* remove original geometry */ - {"use_boundary", BMO_OP_SLOT_BOOL}, /* inset face boundaries */ - {"use_even_offset", BMO_OP_SLOT_BOOL}, /* scale the offset to give more even thickness */ - {"use_crease", BMO_OP_SLOT_BOOL}, /* crease hub edges for improved subdivision surface */ - {"crease_weight", BMO_OP_SLOT_FLT}, /* the mean crease weight for resulting edges */ - {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* scale the offset by surrounding geometry */ - {"material_offset", BMO_OP_SLOT_INT}, /* offset material index of generated faces */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ - {{'\0'}}, - }, - bmo_wireframe_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "wireframe", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Thickness. */ + {"thickness", BMO_OP_SLOT_FLT}, + /* Offset the thickness from the center. */ + {"offset", BMO_OP_SLOT_FLT}, + /* Remove original geometry. */ + {"use_replace", BMO_OP_SLOT_BOOL}, + /* Inset face boundaries. */ + {"use_boundary", BMO_OP_SLOT_BOOL}, + /* Scale the offset to give more even thickness. */ + {"use_even_offset", BMO_OP_SLOT_BOOL}, + /* Crease hub edges for improved subdivision surface. */ + {"use_crease", BMO_OP_SLOT_BOOL}, + /* The mean crease weight for resulting edges. */ + {"crease_weight", BMO_OP_SLOT_FLT}, + /* Scale the offset by surrounding geometry. */ + {"use_relative_offset", BMO_OP_SLOT_BOOL}, + /* Offset material index of generated faces. */ + {"material_offset", BMO_OP_SLOT_INT}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_wireframe_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; static BMO_FlagSet bmo_enum_poke_center_mode[] = { - {BMOP_POKE_MEDIAN_WEIGHTED, "MEAN_WEIGHTED"}, - {BMOP_POKE_MEDIAN, "MEAN"}, - {BMOP_POKE_BOUNDS, "BOUNDS"}, - {0, nullptr}, + {BMOP_POKE_MEDIAN_WEIGHTED, "MEAN_WEIGHTED"}, + {BMOP_POKE_MEDIAN, "MEAN"}, + {BMOP_POKE_BOUNDS, "BOUNDS"}, + {0, nullptr}, }; /* @@ -2041,23 +2535,33 @@ static BMO_FlagSet bmo_enum_poke_center_mode[] = { * Splits a face into a triangle fan. */ static BMOpDefine bmo_poke_def = { - "poke", - /*slot_types_in*/ - {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ - {"offset", BMO_OP_SLOT_FLT}, /* center vertex offset along normal */ - {"center_mode", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), bmo_enum_poke_center_mode}, /* calculation mode for center vertex */ - {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* apply offset */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */ - {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ - {{'\0'}}, - }, - bmo_poke_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "poke", + /*slot_types_in*/ + { + /* Input faces. */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + /* Center vertex offset along normal. */ + {"offset", BMO_OP_SLOT_FLT}, + /* Calculation mode for center vertex. */ + {"center_mode", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_poke_center_mode}, + /* Apply offset. */ + {"use_relative_offset", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + /* Output verts. */ + {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + /* Output faces. */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_poke_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; #ifdef WITH_BULLET @@ -2077,23 +2581,26 @@ static BMOpDefine bmo_poke_def = { * that were in the input and are part of the hull. */ static BMOpDefine bmo_convex_hull_def = { - "convex_hull", - /*slot_types_in*/ - {{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */ - {"use_existing_faces", BMO_OP_SLOT_BOOL}, /* skip hull triangles that are covered by a pre-existing face */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {"geom_interior.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {"geom_unused.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {"geom_holes.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {{'\0'}}, - }, - bmo_convex_hull_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "convex_hull", + /*slot_types_in*/ + { + /* Input geometry. */ + {"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Skip hull triangles that are covered by a pre-existing face. */ + {"use_existing_faces", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {"geom_interior.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {"geom_unused.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {"geom_holes.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_convex_hull_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; #endif @@ -2108,26 +2615,32 @@ static BMOpDefine bmo_convex_hull_def = { * All new vertices, edges, and faces are added to the "geom.out" slot. */ static BMOpDefine bmo_symmetrize_def = { - "symmetrize", - /*slot_types_in*/ - {{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */ - {"direction", BMO_OP_SLOT_INT, to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), bmo_enum_axis_neg_xyz_and_xyz}, /* axis to use */ - {"dist", BMO_OP_SLOT_FLT}, /* minimum distance */ - {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */ - {{'\0'}}, - }, - /*slot_types_out*/ - {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, - {{'\0'}}, - }, - bmo_symmetrize_exec, - (BMO_OPTYPE_FLAG_NORMALS_CALC | - BMO_OPTYPE_FLAG_SELECT_FLUSH | - BMO_OPTYPE_FLAG_SELECT_VALIDATE), + "symmetrize", + /*slot_types_in*/ + { + /* Input geometry. */ + {"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + /* Axis to use. */ + {"direction", + BMO_OP_SLOT_INT, + to_subtype_union(BMO_OP_SLOT_SUBTYPE_INT_ENUM), + bmo_enum_axis_neg_xyz_and_xyz}, + /* Minimum distance. */ + {"dist", BMO_OP_SLOT_FLT}, + /* Transform shape keys too. */ + {"use_shapekey", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /*slot_types_out*/ + { + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {{'\0'}}, + }, + bmo_symmetrize_exec, + (BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH | + BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; -/* clang-format on */ - #undef BM_FACE #undef BM_EDGE #undef BM_VERT