Blender  V3.3
bmesh_opdefines.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
36 #include "BLI_utildefines.h"
37 
38 #include "bmesh.h"
40 
41 #include "DNA_modifier_types.h"
42 
79 /* Keep struct definition from wrapping. */
80 /* clang-format off */
81 
82 /* enums shared between multiple operators */
83 
85  {0, "X"},
86  {1, "Y"},
87  {2, "Z"},
88  {0, NULL},
89 };
90 
92  {0, "-X"},
93  {1, "-Y"},
94  {2, "-Z"},
95  {3, "X"},
96  {4, "Y"},
97  {5, "Z"},
98  {0, NULL},
99 };
100 
102  {SUBD_FALLOFF_SMOOTH, "SMOOTH"},
103  {SUBD_FALLOFF_SPHERE, "SPHERE"},
104  {SUBD_FALLOFF_ROOT, "ROOT"},
105  {SUBD_FALLOFF_SHARP, "SHARP"},
106  {SUBD_FALLOFF_LIN, "LINEAR"},
107  {SUBD_FALLOFF_INVSQUARE, "INVERSE_SQUARE"},
108  {0, NULL},
109 };
110 
111 /* Quiet 'enum-conversion' warning. */
112 #define BM_FACE ((int)BM_FACE)
113 #define BM_EDGE ((int)BM_EDGE)
114 #define BM_VERT ((int)BM_VERT)
115 
116 /*
117  * Vertex Smooth.
118  *
119  * Smooths vertices by using a basic vertex averaging scheme.
120  */
122  "smooth_vert",
123  /* slots_in */
124  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
125  {"factor", BMO_OP_SLOT_FLT}, /* smoothing factor */
126  {"mirror_clip_x", BMO_OP_SLOT_BOOL}, /* set vertices close to the x axis before the operation to 0 */
127  {"mirror_clip_y", BMO_OP_SLOT_BOOL}, /* set vertices close to the y axis before the operation to 0 */
128  {"mirror_clip_z", BMO_OP_SLOT_BOOL}, /* set vertices close to the z axis before the operation to 0 */
129  {"clip_dist", BMO_OP_SLOT_FLT}, /* clipping threshold for the above three slots */
130  {"use_axis_x", BMO_OP_SLOT_BOOL}, /* smooth vertices along X axis */
131  {"use_axis_y", BMO_OP_SLOT_BOOL}, /* smooth vertices along Y axis */
132  {"use_axis_z", BMO_OP_SLOT_BOOL}, /* smooth vertices along Z axis */
133  {{'\0'}},
134  },
135  {{{'\0'}}}, /* no output */
138 };
139 
140 /*
141  * Vertex Smooth Laplacian.
142  *
143  * Smooths vertices by using Laplacian smoothing propose by.
144  * Desbrun, et al. Implicit Fairing of Irregular Meshes using Diffusion and Curvature Flow.
145  */
147  "smooth_laplacian_vert",
148  /* slots_in */
149  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
150  {"lambda_factor", BMO_OP_SLOT_FLT}, /* lambda param */
151  {"lambda_border", BMO_OP_SLOT_FLT}, /* lambda param in border */
152  {"use_x", BMO_OP_SLOT_BOOL}, /* Smooth object along X axis */
153  {"use_y", BMO_OP_SLOT_BOOL}, /* Smooth object along Y axis */
154  {"use_z", BMO_OP_SLOT_BOOL}, /* Smooth object along Z axis */
155  {"preserve_volume", BMO_OP_SLOT_BOOL}, /* Apply volume preservation after smooth */
156  {{'\0'}},
157  },
158  {{{'\0'}}}, /* no output */
161 };
162 
163 /*
164  * Right-Hand Faces.
165  *
166  * Computes an "outside" normal for the specified input faces.
167  */
169  "recalc_face_normals",
170  /* slots_in */
171  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
172  {{'\0'}},
173  },
174  {{{'\0'}}}, /* no output */
178 };
179 
180 /*
181  * Planar Faces.
182  *
183  * Iteratively flatten faces.
184  */
186  "planar_faces",
187  /* slots_in */
188  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input geometry. */
189  {"iterations", BMO_OP_SLOT_INT}, /* Number of times to flatten faces (for when connected faces are used) */
190  {"factor", BMO_OP_SLOT_FLT}, /* Influence for making planar each iteration */
191  {{'\0'}},
192  },
193  /* slots_out */
194  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output slot, computed boundary geometry. */
195  {{'\0'}},
196  },
200 };
201 
202 /*
203  * Region Extend.
204  *
205  * used to implement the select more/less tools.
206  * this puts some geometry surrounding regions of
207  * geometry in geom into geom.out.
208  *
209  * if use_faces is 0 then geom.out spits out verts and edges,
210  * otherwise it spits out faces.
211  */
213  "region_extend",
214  /* slots_in */
215  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
216  {"use_contract", BMO_OP_SLOT_BOOL}, /* find boundary inside the regions, not outside. */
217  {"use_faces", BMO_OP_SLOT_BOOL}, /* extend from faces instead of edges */
218  {"use_face_step", BMO_OP_SLOT_BOOL}, /* step over connected faces */
219  {{'\0'}},
220  },
221  /* slots_out */
222  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output slot, computed boundary geometry. */
223  {{'\0'}},
224  },
228 };
229 
230 /*
231  * Edge Rotate.
232  *
233  * Rotates edges topologically. Also known as "spin edge" to some people.
234  * Simple example: `[/] becomes [|] then [\]`.
235  */
237  "rotate_edges",
238  /* slots_in */
239  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
240  {"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate edge counter-clockwise if true, otherwise clockwise */
241  {{'\0'}},
242  },
243  /* slots_out */
244  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* newly spun edges */
245  {{'\0'}},
246  },
252 };
253 
254 /*
255  * Reverse Faces.
256  *
257  * Reverses the winding (vertex order) of faces.
258  * This has the effect of flipping the normal.
259  */
261  "reverse_faces",
262  /* slots_in */
263  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
264  {"flip_multires", BMO_OP_SLOT_BOOL}, /* maintain multi-res offset */
265  {{'\0'}},
266  },
267  {{{'\0'}}}, /* no output */
271 };
272 
273 /*
274  * Edge Bisect.
275  *
276  * Splits input edges (but doesn't do anything else).
277  * This creates a 2-valence vert.
278  */
280  "bisect_edges",
281  /* slots_in */
282  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
283  {"cuts", BMO_OP_SLOT_INT}, /* number of cuts */
284  {"edge_percents", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_FLT}},
285  {{'\0'}},
286  },
287  /* slots_out */
288  {{"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* newly created vertices and edges */
289  {{'\0'}},
290  },
296 };
297 
298 /*
299  * Mirror.
300  *
301  * Mirrors geometry along an axis. The resulting geometry is welded on using
302  * merge_dist. Pairs of original/mirrored vertices are welded using the merge_dist
303  * parameter (which defines the minimum distance for welding to happen).
304  */
306  "mirror",
307  /* slots_in */
308  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
309  {"matrix", BMO_OP_SLOT_MAT}, /* matrix defining the mirror transformation */
310  {"merge_dist", BMO_OP_SLOT_FLT}, /* maximum distance for merging. does no merging if 0. */
311  {"axis", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_axis_xyz}, /* the axis to use. */
312  {"mirror_u", BMO_OP_SLOT_BOOL}, /* mirror UVs across the u axis */
313  {"mirror_v", BMO_OP_SLOT_BOOL}, /* mirror UVs across the v axis */
314  {"mirror_udim", BMO_OP_SLOT_BOOL}, /* mirror UVs in each tile */
315  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
316  {{'\0'}},
317  },
318  /* slots_out */
319  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output geometry, mirrored */
320  {{'\0'}},
321  },
326 };
327 
328 /*
329  * Find Doubles.
330  *
331  * Takes input verts and find vertices they should weld to.
332  * Outputs a mapping slot suitable for use with the weld verts bmop.
333  *
334  * If keep_verts is used, vertices outside that set can only be merged
335  * with vertices in that set.
336  */
338  "find_doubles",
339  /* slots_in */
340  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
341  {"keep_verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* list of verts to keep */
342  {"dist", BMO_OP_SLOT_FLT}, /* maximum distance */
343  {{'\0'}},
344  },
345  /* slots_out */
346  {{"targetmap.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
347  {{'\0'}},
348  },
351 };
352 
353 /*
354  * Remove Doubles.
355  *
356  * Finds groups of vertices closer than dist and merges them together,
357  * using the weld verts bmop.
358  */
360  "remove_doubles",
361  /* slots_in */
362  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input verts */
363  {"dist", BMO_OP_SLOT_FLT}, /* minimum distance */
364  {{'\0'}},
365  },
366  {{{'\0'}}}, /* no output */
372 };
373 
374 /*
375  * Collapse Connected.
376  *
377  * Collapses connected vertices
378  */
380  "collapse",
381  /* slots_in */
382  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
383  {"uvs", BMO_OP_SLOT_BOOL}, /* also collapse UVs and such */
384  {{'\0'}},
385  },
386  {{{'\0'}}}, /* no output */
392 };
393 
394 /*
395  * Face-Data Point Merge.
396  *
397  * Merge uv/vcols at a specific vertex.
398  */
400  "pointmerge_facedata",
401  /* slots_in */
402  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
403  {"vert_snap", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | (int)BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* snap vertex */
404  {{'\0'}},
405  },
406  {{{'\0'}}}, /* no output */
409 };
410 
411 /*
412  * Average Vertices Facevert Data.
413  *
414  * Merge uv/vcols associated with the input vertices at
415  * the bounding box center. (I know, it's not averaging but
416  * the vert_snap_to_bb_center is just too long).
417  */
419  "average_vert_facedata",
420  /* slots_in */
421  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
422  {{'\0'}},
423  },
424  {{{'\0'}}}, /* no output */
427 };
428 
429 /*
430  * Point Merge.
431  *
432  * Merge verts together at a point.
433  */
435  "pointmerge",
436  /* slots_in */
437  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices (all verts will be merged into the first). */
438  {"merge_co", BMO_OP_SLOT_VEC}, /* Position to merge at. */
439  {{'\0'}},
440  },
441  {{{'\0'}}}, /* no output */
447 };
448 
449 /*
450  * Collapse Connected UV's.
451  *
452  * Collapses connected UV vertices.
453  */
455  "collapse_uvs",
456  /* slots_in */
457  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
458  {{'\0'}},
459  },
460  {{{'\0'}}}, /* no output */
463 };
464 
465 /*
466  * Weld Verts.
467  *
468  * Welds verts together (kind-of like remove doubles, merge, etc, all of which
469  * use or will use this bmop). You pass in mappings from vertices to the vertices
470  * they weld with.
471  */
473  "weld_verts",
474  /* slots_in */
475  {{"targetmap", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, /* maps welded vertices to verts they should weld to */
476  {{'\0'}},
477  },
478  {{{'\0'}}}, /* no output */
484 };
485 
486 /*
487  * Make Vertex.
488  *
489  * Creates a single vertex; this bmop was necessary
490  * for click-create-vertex.
491  */
493  "create_vert",
494  /* slots_in */
495  {{"co", BMO_OP_SLOT_VEC}, /* the coordinate of the new vert */
496  {{'\0'}},
497  },
498  /* slots_out */
499  {{"vert.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* the new vert */
500  {{'\0'}},
501  },
504 };
505 
506 /*
507  * Join Triangles.
508  *
509  * Tries to intelligently join triangles according
510  * to angle threshold and delimiters.
511  */
513  "join_triangles",
514  /* slots_in */
515  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input geometry. */
516  {"cmp_seam", BMO_OP_SLOT_BOOL}, /* Compare seam */
517  {"cmp_sharp", BMO_OP_SLOT_BOOL}, /* Compare sharp */
518  {"cmp_uvs", BMO_OP_SLOT_BOOL}, /* Compare UVs */
519  {"cmp_vcols", BMO_OP_SLOT_BOOL}, /* compare VCols */
520  {"cmp_materials", BMO_OP_SLOT_BOOL}, /* compare materials */
521  {"angle_face_threshold", BMO_OP_SLOT_FLT},
522  {"angle_shape_threshold", BMO_OP_SLOT_FLT},
523  {{'\0'}},
524  },
525  /* slots_out */
526  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* joined faces */
527  {{'\0'}},
528  },
534 };
535 
536 /*
537  * Contextual Create.
538  *
539  * This is basically F-key, it creates
540  * new faces from vertices, makes stuff from edge nets,
541  * makes wire edges, etc. It also dissolves faces.
542  *
543  * Three verts become a triangle, four become a quad. Two
544  * become a wire edge.
545  */
547  "contextual_create",
548  /* slots_in */
549  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry. */
550  {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
551  {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth to use */
552  {{'\0'}},
553  },
554  /* slots_out */
555  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* newly-made face(s) */
556  /* NOTE: this is for stand-alone edges only, not edges which are a part of newly created faces. */
557  {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* newly-made edge(s) */
558  {{'\0'}},
559  },
565 };
566 
567 /*
568  * Bridge edge loops with faces.
569  */
571  "bridge_loops",
572  /* slots_in */
573  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
574  {"use_pairs", BMO_OP_SLOT_BOOL},
575  {"use_cyclic", BMO_OP_SLOT_BOOL},
576  {"use_merge", BMO_OP_SLOT_BOOL}, /* merge rather than creating faces */
577  {"merge_factor", BMO_OP_SLOT_FLT}, /* merge factor */
578  {"twist_offset", BMO_OP_SLOT_INT}, /* twist offset for closed loops */
579  {{'\0'}},
580  },
581  /* slots_out */
582  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
583  {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* new edges */
584  {{'\0'}},
585  },
590 };
591 
592 /*
593  * Grid Fill.
594  *
595  * Create faces defined by 2 disconnected edge loops (which share edges).
596  */
598  "grid_fill",
599  /* slots_in */
600  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
601  /* restricts edges to groups. maps edges to integer */
602  {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
603  {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */
604  {"use_interp_simple", BMO_OP_SLOT_BOOL}, /* use simple interpolation */
605  {{'\0'}},
606  },
607  /* slots_out */
608  /* maps new faces to the group numbers they came from */
609  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
610  {{'\0'}},
611  },
615 };
616 
617 
618 /*
619  * Fill Holes.
620  *
621  * Fill boundary edges with faces, copying surrounding customdata.
622  */
624  "holes_fill",
625  /* slots_in */
626  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
627  {"sides", BMO_OP_SLOT_INT}, /* number of face sides to fill */
628  {{'\0'}},
629  },
630  /* slots_out */
631  /* maps new faces to the group numbers they came from */
632  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
633  {{'\0'}},
634  },
638 };
639 
640 
641 /*
642  * Face Attribute Fill.
643  *
644  * Fill in faces with data from adjacent faces.
645  */
647  "face_attribute_fill",
648  /* slots_in */
649  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
650  {"use_normals", BMO_OP_SLOT_BOOL}, /* copy face winding */
651  {"use_data", BMO_OP_SLOT_BOOL}, /* copy face data */
652  {{'\0'}},
653  },
654  /* slots_out */
655  /* maps new faces to the group numbers they came from */
656  {{"faces_fail.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* faces that could not be handled */
657  {{'\0'}},
658  },
661 };
662 
663 /*
664  * Edge Loop Fill.
665  *
666  * Create faces defined by one or more non overlapping edge loops.
667  */
669  "edgeloop_fill",
670  /* slots_in */
671  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
672  /* restricts edges to groups. maps edges to integer */
673  {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
674  {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */
675  {{'\0'}},
676  },
677  /* slots_out */
678  /* maps new faces to the group numbers they came from */
679  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
680  {{'\0'}},
681  },
685 };
686 
687 
688 /*
689  * Edge Net Fill.
690  *
691  * Create faces defined by enclosed edges.
692  */
694  "edgenet_fill",
695  /* slots_in */
696  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
697  {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
698  {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */
699  {"sides", BMO_OP_SLOT_INT}, /* number of sides */
700  {{'\0'}},
701  },
702  /* slots_out */
703  /* maps new faces to the group numbers they came from */
704  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
705  {{'\0'}},
706  },
710 };
711 
712 /*
713  * Edge-net Prepare.
714  *
715  * Identifies several useful edge loop cases and modifies them so
716  * they'll become a face when edgenet_fill is called. The cases covered are:
717  *
718  * - One single loop; an edge is added to connect the ends
719  * - Two loops; two edges are added to connect the endpoints (based on the
720  * shortest distance between each endpoint).
721  */
723  "edgenet_prepare",
724  /* slots_in */
725  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
726  {{'\0'}},
727  },
728  /* slots_out */
729  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* new edges */
730  {{'\0'}},
731  },
734 };
735 
736 /*
737  * Rotate.
738  *
739  * Rotate vertices around a center, using a 3x3 rotation matrix.
740  */
742  "rotate",
743  /* slots_in */
744  {{"cent", BMO_OP_SLOT_VEC}, /* center of rotation */
745  {"matrix", BMO_OP_SLOT_MAT}, /* matrix defining rotation */
746  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
747  {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
748  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
749  {{'\0'}},
750  },
751  {{{'\0'}}}, /* no output */
754 };
755 
756 /*
757  * Translate.
758  *
759  * Translate vertices by an offset.
760  */
762  "translate",
763  /* slots_in */
764  {{"vec", BMO_OP_SLOT_VEC}, /* translation offset */
765  {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
766  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
767  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
768  {{'\0'}},
769  },
770  {{{'\0'}}}, /* no output */
773 };
774 
775 /*
776  * Scale.
777  *
778  * Scales vertices by an offset.
779  */
781  "scale",
782  /* slots_in */
783  {{"vec", BMO_OP_SLOT_VEC}, /* scale factor */
784  {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
785  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
786  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
787  {{'\0'}},
788  },
789  {{{'\0'}}}, /* no output */
792 };
793 
794 
795 /*
796  * Transform.
797  *
798  * Transforms a set of vertices by a matrix. Multiplies
799  * the vertex coordinates with the matrix.
800  */
802  "transform",
803  /* slots_in */
804  {{"matrix", BMO_OP_SLOT_MAT}, /* transform matrix */
805  {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
806  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
807  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
808  {{'\0'}},
809  },
810  {{{'\0'}}}, /* no output */
813 };
814 
815 /*
816  * Object Load BMesh.
817  *
818  * Loads a bmesh into an object/mesh. This is a "private"
819  * bmop.
820  */
822  "object_load_bmesh",
823  /* slots_in */
824  {{"scene", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_SCENE}}, /* pointer to an scene structure */
825  {"object", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, /* pointer to an object structure */
826  {{'\0'}},
827  },
828  {{{'\0'}}}, /* no output */
831 };
832 
833 
834 /*
835  * BMesh to Mesh.
836  *
837  * Converts a bmesh to a Mesh. This is reserved for exiting editmode.
838  */
840  "bmesh_to_mesh",
841  /* slots_in */
842  {
843  {"mesh", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_MESH}}, /* pointer to a mesh structure to fill in */
844  {"object", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, /* pointer to an object structure */
845  {{'\0'}},
846  },
847  {{{'\0'}}}, /* no output */
850 };
851 
852 /*
853  * Mesh to BMesh.
854  *
855  * Load the contents of a mesh into the bmesh. this bmop is private, it's
856  * reserved exclusively for entering editmode.
857  */
859  "mesh_to_bmesh",
860  /* slots_in */
861  {
862  {"mesh", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_MESH}}, /* pointer to a Mesh structure */
863  {"object", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, /* pointer to an Object structure */
864  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* load active shapekey coordinates into verts */
865  {{'\0'}},
866  },
867  {{{'\0'}}}, /* no output */
870 };
871 
872 /*
873  * Individual Face Extrude.
874  *
875  * Extrudes faces individually.
876  */
878  "extrude_discrete_faces",
879  /* slots_in */
880  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
881  {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */
882  {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */
883  {{'\0'}},
884  },
885  /* slots_out */
886  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
887  {{'\0'}},
888  },
891 };
892 
893 /*
894  * Extrude Only Edges.
895  *
896  * Extrudes Edges into faces, note that this is very simple, there's no fancy
897  * winged extrusion.
898  */
900  "extrude_edge_only",
901  /* slots_in */
902  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input vertices */
903  {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */
904  {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */
905  {{'\0'}},
906  },
907  /* slots_out */
908  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output geometry */
909  {{'\0'}},
910  },
913 };
914 
915 /*
916  * Individual Vertex Extrude.
917  *
918  * Extrudes wire edges from vertices.
919  */
921  "extrude_vert_indiv",
922  /* slots_in */
923  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
924  {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */
925  {{'\0'}},
926  },
927  /* slots_out */
928  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output wire edges */
929  {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output vertices */
930  {{'\0'}},
931  },
934 };
935 
936 /*
937  * Connect Verts.
938  *
939  * Split faces by adding edges that connect **verts**.
940  */
942  "connect_verts",
943  /* slots_in */
944  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
945  {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces to explicitly exclude from connecting */
946  {"check_degenerate", BMO_OP_SLOT_BOOL}, /* prevent splits with overlaps & intersections */
947  {{'\0'}},
948  },
949  /* slots_out */
950  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
951  {{'\0'}},
952  },
957 };
958 
959 /*
960  * Connect Verts to form Convex Faces.
961  *
962  * Ensures all faces are convex **faces**.
963  */
965  "connect_verts_concave",
966  /* slots_in */
967  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
968  {{'\0'}},
969  },
970  /* slots_out */
971  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
972  {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
973  {{'\0'}},
974  },
979 };
980 
981 /*
982  * Connect Verts Across non Planer Faces.
983  *
984  * Split faces by connecting edges along non planer **faces**.
985  */
987  "connect_verts_nonplanar",
988  /* slots_in */
989  {{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */
990  {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
991  {{'\0'}},
992  },
993  /* slots_out */
994  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
995  {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
996  {{'\0'}},
997  },
1002 };
1003 
1004 /*
1005  * Connect Verts.
1006  *
1007  * Split faces by adding edges that connect **verts**.
1008  */
1010  "connect_vert_pair",
1011  /* slots_in */
1012  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
1013  {"verts_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices to explicitly exclude from connecting */
1014  {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces to explicitly exclude from connecting */
1015  {{'\0'}},
1016  },
1017  /* slots_out */
1018  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
1019  {{'\0'}},
1020  },
1025 };
1026 
1027 
1028 /*
1029  * Extrude Faces.
1030  *
1031  * Extrude operator (does not transform)
1032  */
1034  "extrude_face_region",
1035  /* slots_in */
1036  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* edges and faces */
1037  {"edges_exclude", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_EMPTY}}, /* input edges to explicitly exclude from extrusion */
1038  {"use_keep_orig", BMO_OP_SLOT_BOOL}, /* keep original geometry (requires ``geom`` to include edges). */
1039  {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */
1040  {"use_normal_from_adjacent", BMO_OP_SLOT_BOOL}, /* Use winding from surrounding faces instead of this region. */
1041  {"use_dissolve_ortho_edges", BMO_OP_SLOT_BOOL}, /* Dissolve edges whose faces form a flat surface. */
1042  {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */
1043  {{'\0'}},
1044  },
1045  /* slots_out */
1046  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1047  {{'\0'}},
1048  },
1051 };
1052 
1053 /*
1054  * Dissolve Verts.
1055  */
1057  "dissolve_verts",
1058  /* slots_in */
1059  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
1060  {"use_face_split", BMO_OP_SLOT_BOOL}, /* split off face corners to maintain surrounding geometry */
1061  {"use_boundary_tear", BMO_OP_SLOT_BOOL}, /* split off face corners instead of merging faces */
1062  {{'\0'}},
1063  },
1064  {{{'\0'}}}, /* no output */
1070 };
1071 
1072 /*
1073  * Dissolve Edges.
1074  */
1076  "dissolve_edges",
1077  /* slots_in */
1078  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1079  {"use_verts", BMO_OP_SLOT_BOOL}, /* dissolve verts left between only 2 edges. */
1080  {"use_face_split", BMO_OP_SLOT_BOOL}, /* split off face corners to maintain surrounding geometry */
1081  {{'\0'}},
1082  },
1083  /* slots_out */
1084  {{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
1085  {{'\0'}},
1086  },
1092 };
1093 
1094 /*
1095  * Dissolve Faces.
1096  */
1098  "dissolve_faces",
1099  /* slots_in */
1100  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1101  {"use_verts", BMO_OP_SLOT_BOOL}, /* dissolve verts left between only 2 edges. */
1102  {{'\0'}},
1103  },
1104  /* slots_out */
1105  {{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
1106  {{'\0'}},
1107  },
1113 };
1114 
1116  {BMO_DELIM_NORMAL, "NORMAL"},
1117  {BMO_DELIM_MATERIAL, "MATERIAL"},
1118  {BMO_DELIM_SEAM, "SEAM"},
1119  {BMO_DELIM_SHARP, "SHARP"},
1120  {BMO_DELIM_UV, "UV"},
1121  {0, NULL},
1122 };
1123 
1124 /*
1125  * Limited Dissolve.
1126  *
1127  * Dissolve planar faces and co-linear edges.
1128  */
1130  "dissolve_limit",
1131  /* slots_in */
1132  {{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */
1133  {"use_dissolve_boundaries", BMO_OP_SLOT_BOOL}, /* dissolve all vertices in between face boundaries */
1134  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
1135  {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1136  {"delimit", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_FLAG}, bmo_enum_dissolve_limit_flags}, /* delimit dissolve operation */
1137  {{'\0'}},
1138  },
1139  /* slots_out */
1140  {{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
1141  {{'\0'}}},
1147 };
1148 
1149 /*
1150  * Degenerate Dissolve.
1151  *
1152  * Dissolve edges with no length, faces with no area.
1153  */
1155  "dissolve_degenerate",
1156  /* slots_in */
1157  {{"dist", BMO_OP_SLOT_FLT}, /* maximum distance to consider degenerate */
1158  {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1159  {{'\0'}},
1160  },
1161  /* slots_out */
1162  {{{'\0'}}},
1168 };
1169 
1171  {MOD_TRIANGULATE_QUAD_BEAUTY, "BEAUTY"},
1172  {MOD_TRIANGULATE_QUAD_FIXED, "FIXED"},
1173  {MOD_TRIANGULATE_QUAD_ALTERNATE, "ALTERNATE"},
1174  {MOD_TRIANGULATE_QUAD_SHORTEDGE, "SHORT_EDGE"},
1175  {MOD_TRIANGULATE_QUAD_LONGEDGE, "LONG_EDGE"},
1176  {0, NULL},
1177 };
1178 
1180  {MOD_TRIANGULATE_NGON_BEAUTY, "BEAUTY"},
1181  {MOD_TRIANGULATE_NGON_EARCLIP, "EAR_CLIP"},
1182  {0, NULL},
1183 };
1184 
1185 /*
1186  * Triangulate.
1187  */
1189  "triangulate",
1190  /* slots_in */
1191  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1192  {"quad_method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_triangulate_quad_method}, /* method for splitting the quads into triangles */
1193  {"ngon_method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_triangulate_ngon_method}, /* method for splitting the polygons into triangles */
1194  {{'\0'}},
1195  },
1196  /* slots_out */
1197  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
1198  {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
1199  {"face_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1200  {"face_map_double.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, /* duplicate faces */
1201  {{'\0'}},
1202  },
1207 };
1208 
1209 /*
1210  * Un-Subdivide.
1211  *
1212  * Reduce detail in geometry containing grids.
1213  */
1215  "unsubdivide",
1216  /* slots_in */
1217  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
1218  {"iterations", BMO_OP_SLOT_INT}, /* number of times to unsubdivide */
1219  {{'\0'}},
1220  },
1221  {{{'\0'}}}, /* no output */
1227 };
1228 
1230  {SUBD_CORNER_STRAIGHT_CUT, "STRAIGHT_CUT"},
1231  {SUBD_CORNER_INNERVERT, "INNER_VERT"},
1232  {SUBD_CORNER_PATH, "PATH"},
1233  {SUBD_CORNER_FAN, "FAN"},
1234  {0, NULL},
1235 };
1236 
1237 /*
1238  * Subdivide Edges.
1239  *
1240  * Advanced operator for subdividing edges
1241  * with options for face patterns, smoothing and randomization.
1242  */
1244  "subdivide_edges",
1245  /* slots_in */
1246  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1247  {"smooth", BMO_OP_SLOT_FLT}, /* smoothness factor */
1248  {"smooth_falloff", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_falloff_type}, /* smooth falloff type */
1249  {"fractal", BMO_OP_SLOT_FLT}, /* fractal randomness factor */
1250  {"along_normal", BMO_OP_SLOT_FLT}, /* apply fractal displacement along normal only */
1251  {"cuts", BMO_OP_SLOT_INT}, /* number of cuts */
1252  {"seed", BMO_OP_SLOT_INT}, /* seed for the random number generator */
1253  {"custom_patterns", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL}}, /* uses custom pointers */
1254  {"edge_percents", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_FLT}},
1255  {"quad_corner_type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_subdivide_edges_quad_corner_type}, /* quad corner type */
1256  {"use_grid_fill", BMO_OP_SLOT_BOOL}, /* fill in fully-selected faces with a grid */
1257  {"use_single_edge", BMO_OP_SLOT_BOOL}, /* tessellate the case of one edge selected in a quad or triangle */
1258  {"use_only_quads", BMO_OP_SLOT_BOOL}, /* Only subdivide quads (for loop-cut). */
1259  {"use_sphere", BMO_OP_SLOT_BOOL}, /* for making new primitives only */
1260  {"use_smooth_even", BMO_OP_SLOT_BOOL}, /* maintain even offset when smoothing */
1261  {{'\0'}},
1262  },
1263  /* slots_out */
1264  {/* these next three can have multiple types of elements in them */
1265  {"geom_inner.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1266  {"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1267  {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* contains all output geometry */
1268  {{'\0'}},
1269  },
1275 };
1276 
1278  {SUBD_RING_INTERP_LINEAR, "LINEAR"},
1279  {SUBD_RING_INTERP_PATH, "PATH"},
1280  {SUBD_RING_INTERP_SURF, "SURFACE"},
1281  {0, NULL},
1282 };
1283 
1284 /*
1285  * Subdivide Edge-Ring.
1286  *
1287  * Take an edge-ring, and subdivide with interpolation options.
1288  */
1290  "subdivide_edgering",
1291  /* slots_in */
1292  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input vertices */
1293  {"interp_mode", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_subdivide_edgering_interp_mode}, /* interpolation method */
1294  {"smooth", BMO_OP_SLOT_FLT}, /* smoothness factor */
1295  {"cuts", BMO_OP_SLOT_INT}, /* number of cuts */
1296  {"profile_shape", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_falloff_type}, /* profile shape type */
1297  {"profile_shape_factor", BMO_OP_SLOT_FLT}, /* how much intermediary new edges are shrunk/expanded */
1298  {{'\0'}},
1299  },
1300  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
1301  {{'\0'}}},
1307 };
1308 
1309 /*
1310  * Bisect Plane.
1311  *
1312  * Bisects the mesh by a plane (cut the mesh in half).
1313  */
1315  "bisect_plane",
1316  /* slots_in */
1317  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1318  {"dist", BMO_OP_SLOT_FLT}, /* minimum distance when testing if a vert is exactly on the plane */
1319  {"plane_co", BMO_OP_SLOT_VEC}, /* point on the plane */
1320  {"plane_no", BMO_OP_SLOT_VEC}, /* direction of the plane */
1321  {"use_snap_center", BMO_OP_SLOT_BOOL}, /* snap axis aligned verts to the center */
1322  {"clear_outer", BMO_OP_SLOT_BOOL}, /* when enabled. remove all geometry on the positive side of the plane */
1323  {"clear_inner", BMO_OP_SLOT_BOOL}, /* when enabled. remove all geometry on the negative side of the plane */
1324  {{'\0'}},
1325  },
1326  {{"geom_cut.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE}}, /* output geometry aligned with the plane (new and existing) */
1327  {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input and output geometry (result of cut). */
1328  {{'\0'}}},
1334 };
1335 
1337  {DEL_VERTS, "VERTS"},
1338  {DEL_EDGES, "EDGES"},
1339  {DEL_ONLYFACES, "FACES_ONLY"},
1340  {DEL_EDGESFACES, "EDGES_FACES"},
1341  {DEL_FACES, "FACES"},
1342  {DEL_FACES_KEEP_BOUNDARY, "FACES_KEEP_BOUNDARY"},
1343  {DEL_ONLYTAGGED, "TAGGED_ONLY"},
1344  {0, NULL},
1345 };
1346 
1347 /*
1348  * Delete Geometry.
1349  *
1350  * Utility operator to delete geometry.
1351  */
1353  "delete",
1354  /* slots_in */
1355  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1356  {"context", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_delete_context}, /* geometry types to delete */
1357  {{'\0'}},
1358  },
1359  {{{'\0'}}}, /* no output */
1364 };
1365 
1366 /*
1367  * Duplicate Geometry.
1368  *
1369  * Utility operator to duplicate geometry,
1370  * optionally into a destination mesh.
1371  */
1373  "duplicate",
1374  /* slots_in */
1375  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1376  {"dest", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_BMESH}}, /* destination bmesh, if NULL will use current on */
1377  {"use_select_history", BMO_OP_SLOT_BOOL},
1378  {"use_edge_flip_from_face", BMO_OP_SLOT_BOOL},
1379  {{'\0'}},
1380  },
1381  /* slots_out */
1382  {{"geom_orig.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1383  {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1384  /* face_map maps from source faces to dupe
1385  * faces, and from dupe faces to source faces */
1386  {"vert_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1387  {"edge_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1388  {"face_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1389  {"boundary_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1390  {"isovert_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1391  {{'\0'}},
1392  },
1396 };
1397 
1398 /*
1399  * Split Off Geometry.
1400  *
1401  * Disconnect geometry from adjacent edges and faces,
1402  * optionally into a destination mesh.
1403  */
1405  "split",
1406  /* slots_in */
1407  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1408  {"dest", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_BMESH}}, /* destination bmesh, if NULL will use current one */
1409  {"use_only_faces", BMO_OP_SLOT_BOOL}, /* when enabled. don't duplicate loose verts/edges */
1410  {{'\0'}},
1411  },
1412  /* slots_out */
1413  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1414  {"boundary_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1415  {"isovert_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1416  {{'\0'}},
1417  },
1421 };
1422 
1423 /*
1424  * Spin.
1425  *
1426  * Extrude or duplicate geometry a number of times,
1427  * rotating and possibly translating after each step
1428  */
1430  "spin",
1431  /* slots_in */
1432  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1433  {"cent", BMO_OP_SLOT_VEC}, /* rotation center */
1434  {"axis", BMO_OP_SLOT_VEC}, /* rotation axis */
1435  {"dvec", BMO_OP_SLOT_VEC}, /* translation delta per step */
1436  {"angle", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */
1437  {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
1438  {"steps", BMO_OP_SLOT_INT}, /* number of steps */
1439  {"use_merge", BMO_OP_SLOT_BOOL}, /* Merge first/last when the angle is a full revolution. */
1440  {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */
1441  {"use_duplicate", BMO_OP_SLOT_BOOL}, /* duplicate or extrude? */
1442  {{'\0'}},
1443  },
1444  /* slots_out */
1445  {{"geom_last.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* result of last step */
1446  {{'\0'}},
1447  },
1448  bmo_spin_exec,
1451 };
1452 
1453 /*
1454  * UV Rotation.
1455  *
1456  * Cycle the loop UV's
1457  */
1459  "rotate_uvs",
1460  /* slots_in */
1461  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1462  {"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate counter-clockwise if true, otherwise clockwise */
1463  {{'\0'}},
1464  },
1465  {{{'\0'}}}, /* no output */
1468 };
1469 
1470 /*
1471  * UV Reverse.
1472  *
1473  * Reverse the UV's
1474  */
1476  "reverse_uvs",
1477  /* slots_in */
1478  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1479  {{'\0'}},
1480  },
1481  {{{'\0'}}}, /* no output */
1484 };
1485 
1486 /*
1487  * Color Rotation.
1488  *
1489  * Cycle the loop colors
1490  */
1492  "rotate_colors",
1493  /* slots_in */
1494  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1495  {"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate counter-clockwise if true, otherwise clockwise */
1496  {"color_index", BMO_OP_SLOT_INT}, /* index into color attribute list */
1497  {{'\0'}},
1498  },
1499  {{{'\0'}}}, /* no output */
1502 };
1503 
1504 /*
1505  * Color Reverse
1506  *
1507  * Reverse the loop colors.
1508  */
1510  "reverse_colors",
1511  /* slots_in */
1512  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1513  {"color_index", BMO_OP_SLOT_INT}, /* index into color attribute list */
1514  {{'\0'}},
1515  },
1516  {{{'\0'}}}, /* no output */
1519 };
1520 
1521 /*
1522  * Edge Split.
1523  *
1524  * Disconnects faces along input edges.
1525  */
1527  "split_edges",
1528  /* slots_in */
1529  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1530  /* needed for vertex rip so we can rip only half an edge at a boundary which would otherwise split off */
1531  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* optional tag verts, use to have greater control of splits */
1532  {"use_verts", BMO_OP_SLOT_BOOL}, /* use 'verts' for splitting, else just find verts to split from edges */
1533  {{'\0'}},
1534  },
1535  /* slots_out */
1536  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* old output disconnected edges */
1537  {{'\0'}},
1538  },
1543 };
1544 
1545 /*
1546  * Create Grid.
1547  *
1548  * Creates a grid with a variable number of subdivisions
1549  */
1551  "create_grid",
1552  /* slots_in */
1553  {{"x_segments", BMO_OP_SLOT_INT}, /* number of x segments */
1554  {"y_segments", BMO_OP_SLOT_INT}, /* number of y segments */
1555  {"size", BMO_OP_SLOT_FLT}, /* size of the grid */
1556  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1557  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1558  {{'\0'}},
1559  },
1560  /* slots_out */
1561  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1562  {{'\0'}},
1563  },
1567 };
1568 
1569 /*
1570  * Create UV Sphere.
1571  *
1572  * Creates a grid with a variable number of subdivisions
1573  */
1575  "create_uvsphere",
1576  /* slots_in */
1577  {{"u_segments", BMO_OP_SLOT_INT}, /* number of u segments */
1578  {"v_segments", BMO_OP_SLOT_INT}, /* number of v segment */
1579  {"radius", BMO_OP_SLOT_FLT}, /* radius */
1580  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1581  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1582  {{'\0'}},
1583  },
1584  /* slots_out */
1585  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1586  {{'\0'}},
1587  },
1591 };
1592 
1593 /*
1594  * Create Ico-Sphere.
1595  *
1596  * Creates a grid with a variable number of subdivisions
1597  */
1599  "create_icosphere",
1600  /* slots_in */
1601  {{"subdivisions", BMO_OP_SLOT_INT}, /* how many times to recursively subdivide the sphere */
1602  {"radius", BMO_OP_SLOT_FLT}, /* radius */
1603  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1604  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1605  {{'\0'}},
1606  },
1607  /* slots_out */
1608  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1609  {{'\0'}},
1610  },
1614 };
1615 
1616 /*
1617  * Create Suzanne.
1618  *
1619  * Creates a monkey (standard blender primitive).
1620  */
1622  "create_monkey",
1623  /* slots_in */
1624  {{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1625  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1626  {{'\0'}},
1627  },
1628  /* slots_out */
1629  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1630  {{'\0'}},
1631  },
1635 };
1636 
1637 /*
1638  * Create Cone.
1639  *
1640  * Creates a cone with variable depth at both ends
1641  */
1643  "create_cone",
1644  /* slots_in */
1645  {{"cap_ends", BMO_OP_SLOT_BOOL}, /* whether or not to fill in the ends with faces */
1646  {"cap_tris", BMO_OP_SLOT_BOOL}, /* fill ends with triangles instead of ngons */
1647  {"segments", BMO_OP_SLOT_INT}, /* number of vertices in the base circle */
1648  {"radius1", BMO_OP_SLOT_FLT}, /* radius of one end */
1649  {"radius2", BMO_OP_SLOT_FLT}, /* radius of the opposite */
1650  {"depth", BMO_OP_SLOT_FLT}, /* distance between ends */
1651  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1652  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1653  {{'\0'}},
1654  },
1655  /* slots_out */
1656  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1657  {{'\0'}},
1658  },
1662 };
1663 
1664 /*
1665  * Creates a Circle.
1666  */
1668  "create_circle",
1669  /* slots_in */
1670  {{"cap_ends", BMO_OP_SLOT_BOOL}, /* whether or not to fill in the ends with faces */
1671  {"cap_tris", BMO_OP_SLOT_BOOL}, /* fill ends with triangles instead of ngons */
1672  {"segments", BMO_OP_SLOT_INT}, /* number of vertices in the circle */
1673  {"radius", BMO_OP_SLOT_FLT}, /* Radius of the circle. */
1674  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1675  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1676  {{'\0'}},
1677  },
1678  /* slots_out */
1679  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1680  {{'\0'}},
1681  },
1685 };
1686 
1687 /*
1688  * Create Cube
1689  *
1690  * Creates a cube.
1691  */
1693  "create_cube",
1694  /* slots_in */
1695  {{"size", BMO_OP_SLOT_FLT}, /* size of the cube */
1696  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1697  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1698  {{'\0'}},
1699  },
1700  /* slots_out */
1701  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1702  {{'\0'}},
1703  },
1707 };
1708 
1710  {BEVEL_AMT_OFFSET, "OFFSET"},
1711  {BEVEL_AMT_WIDTH, "WIDTH"},
1712  {BEVEL_AMT_DEPTH, "DEPTH"},
1713  {BEVEL_AMT_PERCENT, "PERCENT"},
1714  {BEVEL_AMT_ABSOLUTE, "ABSOLUTE"},
1715  {0, NULL},
1716 };
1717 
1719  {BEVEL_PROFILE_SUPERELLIPSE, "SUPERELLIPSE"},
1720  {BEVEL_PROFILE_CUSTOM, "CUSTOM"},
1721  {0, NULL},
1722 };
1723 
1725  {BEVEL_FACE_STRENGTH_NONE, "NONE"},
1726  {BEVEL_FACE_STRENGTH_NEW, "NEW"},
1727  {BEVEL_FACE_STRENGTH_AFFECTED, "AFFECTED"},
1728  {BEVEL_FACE_STRENGTH_ALL, "ALL"},
1729  {0, NULL},
1730 };
1731 
1733  {BEVEL_MITER_SHARP, "SHARP"},
1734  {BEVEL_MITER_PATCH, "PATCH"},
1735  {BEVEL_MITER_ARC, "ARC"},
1736  {0, NULL},
1737 };
1738 
1740  {BEVEL_VMESH_ADJ, "ADJ"},
1741  {BEVEL_VMESH_CUTOFF, "CUTOFF"},
1742  {0, NULL},
1743 };
1744 
1746  {BEVEL_AFFECT_VERTICES, "VERTICES"},
1747  {BEVEL_AFFECT_EDGES, "EDGES"},
1748  {0, NULL},
1749 };
1750 
1751 /*
1752  * Bevel.
1753  *
1754  * Bevels edges and vertices
1755  */
1757  "bevel",
1758  /* slots_in */
1759  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input edges and vertices */
1760  {"offset", BMO_OP_SLOT_FLT}, /* amount to offset beveled edge */
1761  {"offset_type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1762  bmo_enum_bevel_offset_type}, /* how to measure the offset */
1763  {"profile_type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1764  bmo_enum_bevel_profile_type}, /* The profile type to use for bevel. */
1765  {"segments", BMO_OP_SLOT_INT}, /* number of segments in bevel */
1766  {"profile", BMO_OP_SLOT_FLT}, /* profile shape, 0->1 (.5=>round) */
1767  {"affect", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1768  bmo_enum_bevel_affect_type}, /* Whether to bevel vertices or edges. */
1769  {"clamp_overlap", BMO_OP_SLOT_BOOL}, /* do not allow beveled edges/vertices to overlap each other */
1770  {"material", BMO_OP_SLOT_INT}, /* material for bevel faces, -1 means get from adjacent faces */
1771  {"loop_slide", BMO_OP_SLOT_BOOL}, /* prefer to slide along edges to having even widths */
1772  {"mark_seam", BMO_OP_SLOT_BOOL}, /* extend edge data to allow seams to run across bevels */
1773  {"mark_sharp", BMO_OP_SLOT_BOOL}, /* extend edge data to allow sharp edges to run across bevels */
1774  {"harden_normals", BMO_OP_SLOT_BOOL}, /* harden normals */
1775  {"face_strength_mode", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1776  bmo_enum_bevel_face_strength_type}, /* whether to set face strength, and which faces to set if so */
1777  {"miter_outer", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1778  bmo_enum_bevel_miter_type}, /* outer miter kind */
1779  {"miter_inner", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1780  bmo_enum_bevel_miter_type}, /* outer miter kind */
1781  {"spread", BMO_OP_SLOT_FLT}, /* amount to offset beveled edge */
1782  {"smoothresh", BMO_OP_SLOT_FLT}, /* for passing mesh's smoothresh, used in hardening */
1783  {"custom_profile", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_STRUCT}}, /* CurveProfile */
1784  {"vmesh_method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1785  bmo_enum_bevel_vmesh_method}, /* The method to use to create meshes at intersections. */
1786  {{'\0'}},
1787  },
1788  /* slots_out */
1789  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
1790  {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output edges */
1791  {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1792  {{'\0'}},
1793  },
1794 
1800 };
1801 
1802 /* no enum is defined for this */
1804  {0, "AREA"},
1805  {1, "ANGLE"},
1806  {0, NULL},
1807 };
1808 
1809 /*
1810  * Beautify Fill.
1811  *
1812  * Rotate edges to create more evenly spaced triangles.
1813  */
1815  "beautify_fill",
1816  /* slots_in */
1817  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1818  {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* edges that can be flipped */
1819  {"use_restrict_tag", BMO_OP_SLOT_BOOL}, /* restrict edge rotation to mixed tagged vertices */
1820  {"method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_beautify_fill_method}, /* method to define what is beautiful */
1821  {{'\0'}},
1822  },
1823  /* slots_out */
1824  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* new flipped faces and edges */
1825  {{'\0'}},
1826  },
1832 };
1833 
1834 /*
1835  * Triangle Fill.
1836  *
1837  * Fill edges with triangles
1838  */
1840  "triangle_fill",
1841  /* slots_in */
1842  {{"use_beauty", BMO_OP_SLOT_BOOL}, /* use best triangulation division */
1843  {"use_dissolve", BMO_OP_SLOT_BOOL}, /* dissolve resulting faces */
1844  {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1845  {"normal", BMO_OP_SLOT_VEC}, /* optionally pass the fill normal to use */
1846  {{'\0'}},
1847  },
1848  /* slots_out */
1849  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* new faces and edges */
1850  {{'\0'}},
1851  },
1856 };
1857 
1858 /*
1859  * Solidify.
1860  *
1861  * Turns a mesh into a shell with thickness
1862  */
1864  "solidify",
1865  /* slots_in */
1866  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1867  {"thickness", BMO_OP_SLOT_FLT}, /* thickness */
1868  {{'\0'}},
1869  },
1870  /* slots_out */
1871  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1872  {{'\0'}},
1873  },
1877 };
1878 
1879 /*
1880  * Face Inset (Individual).
1881  *
1882  * Insets individual faces.
1883  */
1885  "inset_individual",
1886  /* slots_in */
1887  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1888  {"thickness", BMO_OP_SLOT_FLT}, /* thickness */
1889  {"depth", BMO_OP_SLOT_FLT}, /* depth */
1890  {"use_even_offset", BMO_OP_SLOT_BOOL}, /* scale the offset to give more even thickness */
1891  {"use_interpolate", BMO_OP_SLOT_BOOL}, /* blend face data across the inset */
1892  {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* scale the offset by surrounding geometry */
1893  {{'\0'}},
1894  },
1895  /* slots_out */
1896  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
1897  {{'\0'}},
1898  },
1900  /* caller needs to handle BMO_OPTYPE_FLAG_SELECT_FLUSH */
1902 };
1903 
1904 /*
1905  * Face Inset (Regions).
1906  *
1907  * Inset or outset face regions.
1908  */
1910  "inset_region",
1911  /* slots_in */
1912  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1913  {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces to explicitly exclude from inset */
1914  {"use_boundary", BMO_OP_SLOT_BOOL}, /* inset face boundaries */
1915  {"use_even_offset", BMO_OP_SLOT_BOOL}, /* scale the offset to give more even thickness */
1916  {"use_interpolate", BMO_OP_SLOT_BOOL}, /* blend face data across the inset */
1917  {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* scale the offset by surrounding geometry */
1918  {"use_edge_rail", BMO_OP_SLOT_BOOL}, /* inset the region along existing edges */
1919  {"thickness", BMO_OP_SLOT_FLT}, /* thickness */
1920  {"depth", BMO_OP_SLOT_FLT}, /* depth */
1921  {"use_outset", BMO_OP_SLOT_BOOL}, /* outset rather than inset */
1922  {{'\0'}},
1923  },
1924  /* slots_out */
1925  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
1926  {{'\0'}},
1927  },
1931 };
1932 
1933 /*
1934  * Edge-loop Offset.
1935  *
1936  * Creates edge loops based on simple edge-outset method.
1937  */
1939  "offset_edgeloops",
1940  /* slots_in */
1941  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1942  {"use_cap_endpoint", BMO_OP_SLOT_BOOL}, /* extend loop around end-points */
1943  {{'\0'}},
1944  },
1945  /* slots_out */
1946  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output edges */
1947  {{'\0'}},
1948  },
1952 };
1953 
1954 /*
1955  * Wire Frame.
1956  *
1957  * Makes a wire-frame copy of faces.
1958  */
1960  "wireframe",
1961  /* slots_in */
1962  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1963  {"thickness", BMO_OP_SLOT_FLT}, /* thickness */
1964  {"offset", BMO_OP_SLOT_FLT}, /* offset the thickness from the center */
1965  {"use_replace", BMO_OP_SLOT_BOOL}, /* remove original geometry */
1966  {"use_boundary", BMO_OP_SLOT_BOOL}, /* inset face boundaries */
1967  {"use_even_offset", BMO_OP_SLOT_BOOL}, /* scale the offset to give more even thickness */
1968  {"use_crease", BMO_OP_SLOT_BOOL}, /* crease hub edges for improved subdivision surface */
1969  {"crease_weight", BMO_OP_SLOT_FLT}, /* the mean crease weight for resulting edges */
1970  {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* scale the offset by surrounding geometry */
1971  {"material_offset", BMO_OP_SLOT_INT}, /* offset material index of generated faces */
1972  {{'\0'}},
1973  },
1974  /* slots_out */
1975  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
1976  {{'\0'}},
1977  },
1982 };
1983 
1985  {BMOP_POKE_MEDIAN_WEIGHTED, "MEAN_WEIGHTED"},
1986  {BMOP_POKE_MEDIAN, "MEAN"},
1987  {BMOP_POKE_BOUNDS, "BOUNDS"},
1988  {0, NULL},
1989 };
1990 
1991 /*
1992  * Pokes a face.
1993  *
1994  * Splits a face into a triangle fan.
1995  */
1997  "poke",
1998  /* slots_in */
1999  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
2000  {"offset", BMO_OP_SLOT_FLT}, /* center vertex offset along normal */
2001  {"center_mode", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_poke_center_mode}, /* calculation mode for center vertex */
2002  {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* apply offset */
2003  {{'\0'}},
2004  },
2005  /* slots_out */
2006  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
2007  {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
2008  {{'\0'}},
2009  },
2010  bmo_poke_exec,
2014 };
2015 
2016 #ifdef WITH_BULLET
2017 /*
2018  * Convex Hull
2019  *
2020  * Builds a convex hull from the vertices in 'input'.
2021  *
2022  * If 'use_existing_faces' is true, the hull will not output triangles
2023  * that are covered by a pre-existing face.
2024  *
2025  * All hull vertices, faces, and edges are added to 'geom.out'. Any
2026  * input elements that end up inside the hull (i.e. are not used by an
2027  * output face) are added to the 'interior_geom' slot. The
2028  * 'unused_geom' slot will contain all interior geometry that is
2029  * completely unused. Lastly, 'holes_geom' contains edges and faces
2030  * that were in the input and are part of the hull.
2031  */
2032 static BMOpDefine bmo_convex_hull_def = {
2033  "convex_hull",
2034  /* slots_in */
2035  {{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
2036  {"use_existing_faces", BMO_OP_SLOT_BOOL}, /* skip hull triangles that are covered by a pre-existing face */
2037  {{'\0'}},
2038  },
2039  /* slots_out */
2040  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
2041  {"geom_interior.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
2042  {"geom_unused.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
2043  {"geom_holes.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
2044  {{'\0'}},
2045  },
2050 };
2051 #endif
2052 
2053 /*
2054  * Symmetrize.
2055  *
2056  * Makes the mesh elements in the "input" slot symmetrical. Unlike
2057  * normal mirroring, it only copies in one direction, as specified by
2058  * the "direction" slot. The edges and faces that cross the plane of
2059  * symmetry are split as needed to enforce symmetry.
2060  *
2061  * All new vertices, edges, and faces are added to the "geom.out" slot.
2062  */
2064  "symmetrize",
2065  /* slots_in */
2066  {{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
2067  {"direction", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_axis_neg_xyz_and_xyz}, /* axis to use */
2068  {"dist", BMO_OP_SLOT_FLT}, /* minimum distance */
2069  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
2070  {{'\0'}},
2071  },
2072  /* slots_out */
2073  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
2074  {{'\0'}},
2075  },
2080 };
2081 
2082 /* clang-format on */
2083 
2084 #undef BM_FACE
2085 #undef BM_EDGE
2086 #undef BM_VERT
2087 
2091  &bmo_bevel_def,
2102 #ifdef WITH_BULLET
2103  &bmo_convex_hull_def,
2104 #endif
2113  &bmo_delete_def,
2136  &bmo_mirror_def,
2140  &bmo_poke_def,
2149  &bmo_rotate_def,
2152  &bmo_scale_def,
2156  &bmo_spin_def,
2157  &bmo_split_def,
2170 };
2171 
#define ARRAY_SIZE(arr)
@ MOD_TRIANGULATE_NGON_BEAUTY
@ MOD_TRIANGULATE_NGON_EARCLIP
@ MOD_TRIANGULATE_QUAD_SHORTEDGE
@ MOD_TRIANGULATE_QUAD_FIXED
@ MOD_TRIANGULATE_QUAD_LONGEDGE
@ MOD_TRIANGULATE_QUAD_BEAUTY
@ MOD_TRIANGULATE_QUAD_ALTERNATE
static BMOpDefine bmo_planar_faces_def
static BMOpDefine bmo_edgenet_fill_def
static BMOpDefine bmo_bevel_def
static BMOpDefine bmo_reverse_colors_def
static BMOpDefine bmo_find_doubles_def
static BMOpDefine bmo_connect_verts_concave_def
static BMOpDefine bmo_create_cone_def
static BMOpDefine bmo_unsubdivide_def
static BMOpDefine bmo_create_monkey_def
static BMOpDefine bmo_rotate_colors_def
static BMO_FlagSet bmo_enum_delete_context[]
static BMOpDefine bmo_dissolve_limit_def
static BMOpDefine bmo_join_triangles_def
static BMOpDefine bmo_reverse_uvs_def
static BMOpDefine bmo_extrude_face_region_def
static BMO_FlagSet bmo_enum_triangulate_quad_method[]
static BMO_FlagSet bmo_enum_bevel_miter_type[]
static BMOpDefine bmo_dissolve_edges_def
static BMOpDefine bmo_bmesh_to_mesh_def
static BMOpDefine bmo_extrude_edge_only_def
static BMO_FlagSet bmo_enum_dissolve_limit_flags[]
static BMO_FlagSet bmo_enum_bevel_offset_type[]
static BMOpDefine bmo_create_cube_def
static BMOpDefine bmo_edgeloop_fill_def
static BMOpDefine bmo_solidify_def
static BMOpDefine bmo_extrude_vert_indiv_def
static BMOpDefine bmo_offset_edgeloops_def
static BMOpDefine bmo_bisect_edges_def
#define BM_FACE
static BMOpDefine bmo_create_uvsphere_def
static BMOpDefine bmo_mesh_to_bmesh_def
static BMOpDefine bmo_inset_region_def
static BMOpDefine bmo_create_vert_def
static BMOpDefine bmo_smooth_laplacian_vert_def
static BMOpDefine bmo_bisect_plane_def
static BMOpDefine bmo_rotate_edges_def
static BMO_FlagSet bmo_enum_bevel_profile_type[]
static BMOpDefine bmo_create_grid_def
static BMOpDefine bmo_dissolve_verts_def
static BMOpDefine bmo_split_def
static BMOpDefine bmo_average_vert_facedata_def
static BMO_FlagSet bmo_enum_beautify_fill_method[]
static BMOpDefine bmo_connect_verts_nonplanar_def
static BMOpDefine bmo_edgenet_prepare_def
#define BM_EDGE
static BMOpDefine bmo_triangle_fill_def
static BMOpDefine bmo_region_extend_def
static BMOpDefine bmo_split_edges_def
static BMOpDefine bmo_wireframe_def
static BMOpDefine bmo_poke_def
static BMOpDefine bmo_face_attribute_fill_def
static BMOpDefine bmo_translate_def
static BMOpDefine bmo_dissolve_faces_def
static BMOpDefine bmo_mirror_def
static BMO_FlagSet bmo_enum_bevel_face_strength_type[]
static BMOpDefine bmo_contextual_create_def
static BMO_FlagSet bmo_enum_falloff_type[]
static BMOpDefine bmo_smooth_vert_def
static BMOpDefine bmo_reverse_faces_def
static BMOpDefine bmo_dissolve_degenerate_def
static BMOpDefine bmo_pointmerge_facedata_def
static BMOpDefine bmo_duplicate_def
static BMOpDefine bmo_extrude_discrete_faces_def
static BMO_FlagSet bmo_enum_bevel_vmesh_method[]
static BMOpDefine bmo_collapse_uvs_def
static BMO_FlagSet bmo_enum_subdivide_edgering_interp_mode[]
static BMOpDefine bmo_subdivide_edgering_def
static BMOpDefine bmo_remove_doubles_def
static BMOpDefine bmo_beautify_fill_def
static BMOpDefine bmo_pointmerge_def
static BMOpDefine bmo_weld_verts_def
static BMOpDefine bmo_rotate_uvs_def
static BMOpDefine bmo_triangulate_def
static BMOpDefine bmo_bridge_loops_def
static BMOpDefine bmo_spin_def
static BMOpDefine bmo_subdivide_edges_def
static BMOpDefine bmo_delete_def
static BMOpDefine bmo_object_load_bmesh_def
static BMOpDefine bmo_inset_individual_def
static BMOpDefine bmo_symmetrize_def
static BMOpDefine bmo_holes_fill_def
const int bmo_opdefines_total
const BMOpDefine * bmo_opdefines[]
static BMOpDefine bmo_transform_def
static BMO_FlagSet bmo_enum_axis_neg_xyz_and_xyz[]
static BMOpDefine bmo_grid_fill_def
static BMO_FlagSet bmo_enum_bevel_affect_type[]
static BMOpDefine bmo_connect_verts_def
static BMOpDefine bmo_collapse_def
static BMO_FlagSet bmo_enum_subdivide_edges_quad_corner_type[]
static BMOpDefine bmo_rotate_def
static BMOpDefine bmo_connect_vert_pair_def
static BMOpDefine bmo_create_circle_def
#define BM_VERT
static BMO_FlagSet bmo_enum_triangulate_ngon_method[]
static BMO_FlagSet bmo_enum_poke_center_mode[]
static BMOpDefine bmo_create_icosphere_def
static BMOpDefine bmo_scale_def
static BMO_FlagSet bmo_enum_axis_xyz[]
static BMOpDefine bmo_recalc_face_normals_def
@ BMO_OP_SLOT_SUBTYPE_PTR_BMESH
@ BMO_OP_SLOT_SUBTYPE_PTR_OBJECT
@ BMO_OP_SLOT_SUBTYPE_PTR_SCENE
@ BMO_OP_SLOT_SUBTYPE_PTR_MESH
@ BMO_OP_SLOT_SUBTYPE_PTR_STRUCT
@ BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE
@ BMO_OP_SLOT_ELEMENT_BUF
@ BMO_OP_SLOT_PTR
@ BMO_OP_SLOT_BOOL
@ BMO_OP_SLOT_FLT
@ BMO_OP_SLOT_INT
@ BMO_OP_SLOT_VEC
@ BMO_OP_SLOT_MAPPING
@ BMO_OP_SLOT_MAT
@ DEL_ONLYTAGGED
@ DEL_FACES_KEEP_BOUNDARY
@ DEL_EDGESFACES
@ DEL_EDGES
@ DEL_FACES
@ DEL_ONLYFACES
@ DEL_VERTS
@ BMO_OP_SLOT_SUBTYPE_MAP_ELEM
@ BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL
@ BMO_OP_SLOT_SUBTYPE_MAP_EMPTY
@ BMO_OP_SLOT_SUBTYPE_MAP_FLT
@ BMO_OP_SLOT_SUBTYPE_INT_FLAG
@ BMO_OP_SLOT_SUBTYPE_INT_ENUM
@ BMO_OPTYPE_FLAG_NOP
@ BMO_OPTYPE_FLAG_SELECT_VALIDATE
@ BMO_OPTYPE_FLAG_UNTAN_MULTIRES
@ BMO_OPTYPE_FLAG_NORMALS_CALC
@ BMO_OPTYPE_FLAG_SELECT_FLUSH
@ BMO_DELIM_NORMAL
@ BMO_DELIM_MATERIAL
@ BMO_DELIM_SEAM
@ BMO_DELIM_SHARP
@ BMO_DELIM_UV
@ BEVEL_VMESH_ADJ
@ BEVEL_VMESH_CUTOFF
@ BEVEL_PROFILE_SUPERELLIPSE
@ BEVEL_PROFILE_CUSTOM
@ BEVEL_AFFECT_VERTICES
@ BEVEL_AFFECT_EDGES
@ BEVEL_FACE_STRENGTH_NONE
@ BEVEL_FACE_STRENGTH_AFFECTED
@ BEVEL_FACE_STRENGTH_NEW
@ BEVEL_FACE_STRENGTH_ALL
@ BEVEL_MITER_PATCH
@ BEVEL_MITER_SHARP
@ BEVEL_MITER_ARC
@ SUBD_RING_INTERP_SURF
@ SUBD_RING_INTERP_PATH
@ SUBD_RING_INTERP_LINEAR
@ SUBD_CORNER_FAN
@ SUBD_CORNER_STRAIGHT_CUT
@ SUBD_CORNER_PATH
@ SUBD_CORNER_INNERVERT
@ SUBD_FALLOFF_SHARP
@ SUBD_FALLOFF_SMOOTH
@ SUBD_FALLOFF_INVSQUARE
@ SUBD_FALLOFF_SPHERE
@ SUBD_FALLOFF_LIN
@ SUBD_FALLOFF_ROOT
@ BEVEL_AMT_WIDTH
@ BEVEL_AMT_ABSOLUTE
@ BEVEL_AMT_PERCENT
@ BEVEL_AMT_OFFSET
@ BEVEL_AMT_DEPTH
@ BMOP_POKE_MEDIAN_WEIGHTED
@ BMOP_POKE_BOUNDS
@ BMOP_POKE_MEDIAN
void bmo_rotate_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:114
void bmo_region_extend_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:362
void bmo_offset_edgeloops_exec(BMesh *bm, BMOperator *op)
void bmo_symmetrize_exec(BMesh *bm, BMOperator *op)
void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
void bmo_reverse_uvs_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:544
void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dissolve.c:113
void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
Definition: bmo_extrude.c:37
void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
Definition: bmo_inset.c:651
void bmo_face_attribute_fill_exec(BMesh *bm, BMOperator *op)
void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
Definition: bmo_bridge.c:544
void bmo_bevel_exec(BMesh *bm, BMOperator *op)
Definition: bmo_bevel.c:18
void bmo_mirror_exec(BMesh *bm, BMOperator *op)
Definition: bmo_mirror.c:22
void bmo_collapse_exec(BMesh *bm, BMOperator *op)
void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
Definition: bmo_extrude.c:162
void bmo_split_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dupe.c:390
void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op)
void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dissolve.c:477
void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
void bmo_transform_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:39
void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op)
void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
Definition: bmo_extrude.c:230
void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op)
void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op)
void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dissolve.c:359
void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op)
Definition: bmo_extrude.c:825
void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
void bmo_reverse_colors_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:688
void bmo_connect_verts_nonplanar_exec(BMesh *bm, BMOperator *op)
void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
Definition: bmo_create.c:20
void bmo_inset_individual_exec(BMesh *bm, BMOperator *op)
Definition: bmo_inset.c:401
void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:584
void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:458
void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
Definition: bmo_edgenet.c:24
void bmo_bisect_edges_exec(BMesh *bm, BMOperator *op)
void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op)
void bmo_bisect_plane_exec(BMesh *bm, BMOperator *op)
void bmo_pointmerge_exec(BMesh *bm, BMOperator *op)
void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op)
void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
Definition: bmo_connect.c:155
void bmo_connect_verts_concave_exec(BMesh *bm, BMOperator *op)
void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dissolve.c:258
void bmo_duplicate_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dupe.c:327
void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
void bmo_translate_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:70
void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
Definition: bmo_edgenet.c:92
void bmo_create_vert_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:29
void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
void bmo_holes_fill_exec(BMesh *bm, BMOperator *op)
void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
void bmo_spin_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dupe.c:472
void bmo_planar_faces_exec(BMesh *bm, BMOperator *op)
void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
Definition: bmo_beautify.c:21
void bmo_dissolve_degenerate_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dissolve.c:507
void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
Definition: bmo_normals.c:254
void bmo_find_doubles_exec(BMesh *bm, BMOperator *op)
void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
void bmo_poke_exec(BMesh *bm, BMOperator *op)
Definition: bmo_poke.c:28
void bmo_delete_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dupe.c:452
void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
Definition: bmo_wireframe.c:20
void bmo_grid_fill_exec(BMesh *bm, BMOperator *op)
void bmo_scale_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:91
void bmo_collapse_uvs_exec(BMesh *bm, BMOperator *op)
void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
void bmo_unsubdivide_exec(BMesh *bm, BMOperator *op)
void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
Definition: bmo_extrude.c:311
void bmo_reverse_faces_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:135
void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)