Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_opdefines.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c202
1 files changed, 118 insertions, 84 deletions
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index 7abf05044dd..778ca89d70c 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -59,6 +59,8 @@
#include "bmesh.h"
#include "intern/bmesh_operators_private.h"
+#include "DNA_modifier_types.h"
+
/* The formatting of these bmesh operators is parsed by
* 'doc/python_api/rst_from_bmesh_opdefines.py'
* for use in python docs, so reStructuredText may be used
@@ -95,6 +97,25 @@
* note that '//' comments are ignored.
*/
+/* enums shared between multiple operators */
+
+static BMO_FlagSet bmo_enum_axis_xyz[] = {
+ {0, "X"},
+ {1, "Y"},
+ {2, "Z"},
+ {0, NULL},
+};
+
+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, NULL},
+};
+
/*
* Vertex Smooth.
*
@@ -290,7 +311,7 @@ static BMOpDefine bmo_mirror_def = {
{{"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}, /* the axis to use, 0, 1, or 2 for x, y, z */
+ {"axis", BMO_OP_SLOT_INT, {(int)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 */
{{'\0'}},
@@ -1113,6 +1134,15 @@ static BMOpDefine bmo_dissolve_faces_def = {
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, NULL}
+};
+
/*
* Limited Dissolve.
*
@@ -1125,7 +1155,7 @@ static BMOpDefine bmo_dissolve_limit_def = {
{"use_dissolve_boundaries", BMO_OP_SLOT_BOOL},
{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},
{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
- {"delimit", BMO_OP_SLOT_INT},
+ {"delimit", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_FLAG}, bmo_enum_dissolve_limit_flags},
{{'\0'}},
},
/* slots_out */
@@ -1159,6 +1189,20 @@ static BMOpDefine bmo_dissolve_degenerate_def = {
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"},
+ {0, NULL},
+};
+
+static BMO_FlagSet bmo_enum_triangulate_ngon_method[] = {
+ {MOD_TRIANGULATE_NGON_BEAUTY, "BEAUTY"},
+ {MOD_TRIANGULATE_NGON_EARCLIP, "EAR_CLIP"},
+ {0, NULL},
+};
+
/*
* Triangulate.
*/
@@ -1166,8 +1210,8 @@ static BMOpDefine bmo_triangulate_def = {
"triangulate",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
- {"quad_method", BMO_OP_SLOT_INT},
- {"ngon_method", BMO_OP_SLOT_INT},
+ {"quad_method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_triangulate_quad_method},
+ {"ngon_method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_triangulate_ngon_method},
{{'\0'}},
},
/* slots_out */
@@ -1203,6 +1247,14 @@ static BMOpDefine bmo_unsubdivide_def = {
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, NULL},
+};
+
/*
* Subdivide Edges.
*
@@ -1214,15 +1266,14 @@ static BMOpDefine bmo_subdivide_edges_def = {
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
{"smooth", BMO_OP_SLOT_FLT},
- {"smooth_falloff", BMO_OP_SLOT_INT}, /* SUBD_FALLOFF_ROOT and friends */
+ {"smooth_falloff", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_falloff_type}, /* smooth falloff type */
{"fractal", BMO_OP_SLOT_FLT},
{"along_normal", BMO_OP_SLOT_FLT},
{"cuts", BMO_OP_SLOT_INT},
{"seed", BMO_OP_SLOT_INT},
{"custom_patterns", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL}}, /* uses custom pointers */
{"edge_percents", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_FLT}},
-
- {"quad_corner_type", BMO_OP_SLOT_INT}, /* quad corner type, see bmesh_operators.h */
+ {"quad_corner_type", BMO_OP_SLOT_INT, {(int)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 loopcut) */
@@ -1244,6 +1295,13 @@ static BMOpDefine bmo_subdivide_edges_def = {
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, NULL},
+};
+
/*
* Subdivide Edge-Ring.
*
@@ -1253,10 +1311,10 @@ static BMOpDefine bmo_subdivide_edgering_def = {
"subdivide_edgering",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input vertices */
- {"interp_mode", BMO_OP_SLOT_INT},
+ {"interp_mode", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_subdivide_edgering_interp_mode}, /* interpolation method */
{"smooth", BMO_OP_SLOT_FLT},
{"cuts", BMO_OP_SLOT_INT},
- {"profile_shape", BMO_OP_SLOT_INT},
+ {"profile_shape", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_falloff_type}, /* profile shape type */
{"profile_shape_factor", BMO_OP_SLOT_FLT},
{{'\0'}},
},
@@ -1296,6 +1354,17 @@ static BMOpDefine bmo_bisect_plane_def = {
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, NULL},
+};
+
/*
* Delete Geometry.
*
@@ -1305,7 +1374,7 @@ static BMOpDefine bmo_delete_def = {
"delete",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
- {"context", BMO_OP_SLOT_INT}, /* enum DEL_VERTS ... */
+ {"context", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_delete_context}, /* geometry types to delete */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
@@ -1403,73 +1472,6 @@ static BMOpDefine bmo_spin_def = {
BMO_OPTYPE_FLAG_SELECT_FLUSH),
};
-
-/*
- * Similar Faces Search.
- *
- * Find similar faces (area/material/perimeter, ...).
- */
-static BMOpDefine bmo_similar_faces_def = {
- "similar_faces",
- /* slots_in */
- {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
- {"type", BMO_OP_SLOT_INT}, /* type of selection */
- {"thresh", BMO_OP_SLOT_FLT}, /* threshold of selection */
- {"compare", BMO_OP_SLOT_INT}, /* comparison method */
- {{'\0'}},
- },
- /* slots_out */
- {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
- {{'\0'}},
- },
- bmo_similar_faces_exec,
- (BMO_OPTYPE_FLAG_SELECT_FLUSH),
-};
-
-/*
- * Similar Edges Search.
- *
- * Find similar edges (length, direction, edge, seam, ...).
- */
-static BMOpDefine bmo_similar_edges_def = {
- "similar_edges",
- /* slots_in */
- {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
- {"type", BMO_OP_SLOT_INT}, /* type of selection */
- {"thresh", BMO_OP_SLOT_FLT}, /* threshold of selection */
- {"compare", BMO_OP_SLOT_INT}, /* comparison method */
- {{'\0'}},
- },
- /* slots_out */
- {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output edges */
- {{'\0'}},
- },
- bmo_similar_edges_exec,
- (BMO_OPTYPE_FLAG_SELECT_FLUSH),
-};
-
-/*
- * Similar Verts Search.
- *
- * Find similar vertices (normal, face, vertex group, ...).
- */
-static BMOpDefine bmo_similar_verts_def = {
- "similar_verts",
- /* slots_in */
- {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
- {"type", BMO_OP_SLOT_INT}, /* type of selection */
- {"thresh", BMO_OP_SLOT_FLT}, /* threshold of selection */
- {"compare", BMO_OP_SLOT_INT}, /* comparison method */
- {{'\0'}},
- },
- /* slots_out */
- {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output vertices */
- {{'\0'}},
- },
- bmo_similar_verts_exec,
- (BMO_OPTYPE_FLAG_SELECT_FLUSH),
-};
-
/*
* UV Rotation.
*
@@ -1724,6 +1726,22 @@ static BMOpDefine bmo_create_cube_def = {
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"},
+ {0, NULL},
+};
+
+static BMO_FlagSet bmo_enum_bevel_harden_normal_type[] = {
+ {BEVEL_HN_NONE, "NONE"},
+ {BEVEL_HN_FACE, "FACE"},
+ {BEVEL_HN_ADJ, "ADJACENT"},
+ {BEVEL_HN_FIX_SHA, "FIXED_NORMAL_SHADING"},
+ {0, NULL},
+};
+
/*
* Bevel.
*
@@ -1734,19 +1752,24 @@ static BMOpDefine bmo_bevel_def = {
/* slots_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}, /* how to measure offset (enum) */
+ {"offset_type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_bevel_offset_type}, /* how to measure the offset */
{"segments", BMO_OP_SLOT_INT}, /* number of segments in bevel */
{"profile", BMO_OP_SLOT_FLT}, /* profile shape, 0->1 (.5=>round) */
{"vertex_only", BMO_OP_SLOT_BOOL}, /* only bevel vertices, not 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 */
+ {"strength", BMO_OP_SLOT_FLT}, /* strength of calculated normal in range (0, 1) for custom clnors */
+ {"hnmode", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_bevel_harden_normal_type}, /* harden normals mode used in bevel, if enabled */
{{'\0'}},
},
/* slots_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 */
+ {"normals.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, /* output normals per vertex for beveled edges */
{{'\0'}},
},
@@ -1757,6 +1780,13 @@ static BMOpDefine bmo_bevel_def = {
BMO_OPTYPE_FLAG_SELECT_VALIDATE),
};
+/* no enum is defined for this */
+static BMO_FlagSet bmo_enum_beautify_fill_method[] = {
+ {0, "AREA"},
+ {1, "ANGLE"},
+ {0, NULL},
+};
+
/*
* Beautify Fill.
*
@@ -1768,7 +1798,7 @@ static BMOpDefine bmo_beautify_fill_def = {
{{"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}, /* method to define what is beautiful */
+ {"method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_beautify_fill_method}, /* method to define what is beautiful */
{{'\0'}},
},
/* slots_out */
@@ -1932,6 +1962,13 @@ static BMOpDefine bmo_wireframe_def = {
BMO_OPTYPE_FLAG_SELECT_VALIDATE),
};
+static BMO_FlagSet bmo_enum_poke_center_mode[] = {
+ {BMOP_POKE_MEAN_WEIGHTED, "MEAN_WEIGHTED"},
+ {BMOP_POKE_MEAN, "MEAN"},
+ {BMOP_POKE_BOUNDS, "BOUNDS"},
+ {0, NULL},
+};
+
/*
* Pokes a face.
*
@@ -1942,7 +1979,7 @@ static BMOpDefine bmo_poke_def = {
/* slots_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}, /* calculation mode for center vertex */
+ {"center_mode", BMO_OP_SLOT_INT, {(int)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'}},
},
@@ -2008,7 +2045,7 @@ static BMOpDefine bmo_symmetrize_def = {
"symmetrize",
/* slots_in */
{{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
- {"direction", BMO_OP_SLOT_INT},
+ {"direction", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_axis_xyz}, /* axis to use */
{"dist", BMO_OP_SLOT_FLT}, /* minimum distance */
{{'\0'}},
},
@@ -2088,9 +2125,6 @@ const BMOpDefine *bmo_opdefines[] = {
&bmo_rotate_edges_def,
&bmo_rotate_uvs_def,
&bmo_scale_def,
- &bmo_similar_edges_def,
- &bmo_similar_faces_def,
- &bmo_similar_verts_def,
&bmo_smooth_vert_def,
&bmo_smooth_laplacian_vert_def,
&bmo_solidify_def,