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.c185
1 files changed, 164 insertions, 21 deletions
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index ef9c510aea1..c054089480f 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,32 @@
* 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},
+};
+
+static BMO_FlagSet bmo_enum_compare_types[] = {
+ {SIM_CMP_EQ, "EQUAL"},
+ {SIM_CMP_GT, "GREATER_THAN"},
+ {SIM_CMP_LT, "LESS_THAN"},
+ {0, NULL},
+};
+
/*
* Vertex Smooth.
*
@@ -290,7 +318,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'}},
@@ -1110,6 +1138,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.
*
@@ -1122,7 +1159,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 */
@@ -1156,6 +1193,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.
*/
@@ -1163,8 +1214,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 */
@@ -1200,6 +1251,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.
*
@@ -1211,15 +1270,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) */
@@ -1241,6 +1299,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.
*
@@ -1250,10 +1315,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'}},
},
@@ -1293,6 +1358,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.
*
@@ -1302,7 +1378,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 */
@@ -1398,6 +1474,20 @@ static BMOpDefine bmo_spin_def = {
BMO_OPTYPE_FLAG_SELECT_FLUSH),
};
+static BMO_FlagSet bmo_enum_similar_faces_types[] = {
+ {SIMFACE_MATERIAL, "MATERIAL"},
+ {SIMFACE_AREA, "AREA"},
+ {SIMFACE_SIDES, "SIDES"},
+ {SIMFACE_PERIMETER, "PERIMETER"},
+ {SIMFACE_NORMAL, "NORMAL"},
+ {SIMFACE_COPLANAR, "COPLANAR"},
+ {SIMFACE_SMOOTH, "SMOOTH"},
+ {SIMFACE_FACEMAP, "FACE_MAP"},
+#ifdef WITH_FREESTYLE
+ {SIMFACE_FREESTYLE, "FREESTYLE"},
+#endif
+ {0, NULL},
+};
/*
* Similar Faces Search.
@@ -1408,9 +1498,9 @@ 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 */
+ {"type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_similar_faces_types}, /* type of selection */
{"thresh", BMO_OP_SLOT_FLT}, /* threshold of selection */
- {"compare", BMO_OP_SLOT_INT}, /* comparison method */
+ {"compare", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_compare_types}, /* comparison method */
{{'\0'}},
},
/* slots_out */
@@ -1421,6 +1511,21 @@ static BMOpDefine bmo_similar_faces_def = {
(BMO_OPTYPE_FLAG_SELECT_FLUSH),
};
+static BMO_FlagSet bmo_enum_similar_edges_types[] = {
+ {SIMEDGE_LENGTH, "LENGTH"},
+ {SIMEDGE_DIR, "DIRECTION"},
+ {SIMEDGE_FACE, "FACE"},
+ {SIMEDGE_FACE_ANGLE, "FACE_ANGLE"},
+ {SIMEDGE_CREASE, "CREASE"},
+ {SIMEDGE_BEVEL, "BEVEL"},
+ {SIMEDGE_SEAM, "SEAM"},
+ {SIMEDGE_SHARP, "SHARP"},
+#ifdef WITH_FREESTYLE
+ {SIMEDGE_FREESTYLE, "FREESTYLE"},
+#endif
+ {0, NULL},
+};
+
/*
* Similar Edges Search.
*
@@ -1430,9 +1535,9 @@ 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 */
+ {"type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_similar_edges_types}, /* type of selection */
{"thresh", BMO_OP_SLOT_FLT}, /* threshold of selection */
- {"compare", BMO_OP_SLOT_INT}, /* comparison method */
+ {"compare", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_compare_types}, /* comparison method */
{{'\0'}},
},
/* slots_out */
@@ -1443,6 +1548,14 @@ static BMOpDefine bmo_similar_edges_def = {
(BMO_OPTYPE_FLAG_SELECT_FLUSH),
};
+static BMO_FlagSet bmo_enum_similar_verts_types[] = {
+ {SIMVERT_NORMAL, "NORMAL"},
+ {SIMVERT_FACE, "FACE"},
+ {SIMVERT_VGROUP, "VERTEX_GROUP"},
+ {SIMVERT_EDGE, "EDGE"},
+ {0, NULL},
+};
+
/*
* Similar Verts Search.
*
@@ -1452,9 +1565,9 @@ 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 */
+ {"type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_similar_verts_types}, /* type of selection */
{"thresh", BMO_OP_SLOT_FLT}, /* threshold of selection */
- {"compare", BMO_OP_SLOT_INT}, /* comparison method */
+ {"compare", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_compare_types}, /* comparison method */
{{'\0'}},
},
/* slots_out */
@@ -1719,6 +1832,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.
*
@@ -1729,7 +1858,7 @@ 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 */
@@ -1739,7 +1868,7 @@ static BMOpDefine bmo_bevel_def = {
{"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}, /* harden normals mode used in bevel if enabled */
+ {"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 */
@@ -1757,6 +1886,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 +1904,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 +2068,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 +2085,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 +2151,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'}},
},