Blender  V2.93
bmesh_opdefines.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
50 #include "BLI_utildefines.h"
51 
52 #include "bmesh.h"
54 
55 #include "DNA_modifier_types.h"
56 
93 /* Keep struct definition from wrapping. */
94 /* clang-format off */
95 
96 /* enums shared between multiple operators */
97 
99  {0, "X"},
100  {1, "Y"},
101  {2, "Z"},
102  {0, NULL},
103 };
104 
106  {0, "-X"},
107  {1, "-Y"},
108  {2, "-Z"},
109  {3, "X"},
110  {4, "Y"},
111  {5, "Z"},
112  {0, NULL},
113 };
114 
116  {SUBD_FALLOFF_SMOOTH, "SMOOTH"},
117  {SUBD_FALLOFF_SPHERE, "SPHERE"},
118  {SUBD_FALLOFF_ROOT, "ROOT"},
119  {SUBD_FALLOFF_SHARP, "SHARP"},
120  {SUBD_FALLOFF_LIN, "LINEAR"},
121  {SUBD_FALLOFF_INVSQUARE, "INVERSE_SQUARE"},
122  {0, NULL},
123 };
124 
125 /* Quiet 'enum-conversion' warning. */
126 #define BM_FACE ((int)BM_FACE)
127 #define BM_EDGE ((int)BM_EDGE)
128 #define BM_VERT ((int)BM_VERT)
129 
130 /*
131  * Vertex Smooth.
132  *
133  * Smooths vertices by using a basic vertex averaging scheme.
134  */
136  "smooth_vert",
137  /* slots_in */
138  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
139  {"factor", BMO_OP_SLOT_FLT}, /* smoothing factor */
140  {"mirror_clip_x", BMO_OP_SLOT_BOOL}, /* set vertices close to the x axis before the operation to 0 */
141  {"mirror_clip_y", BMO_OP_SLOT_BOOL}, /* set vertices close to the y axis before the operation to 0 */
142  {"mirror_clip_z", BMO_OP_SLOT_BOOL}, /* set vertices close to the z axis before the operation to 0 */
143  {"clip_dist", BMO_OP_SLOT_FLT}, /* clipping threshold for the above three slots */
144  {"use_axis_x", BMO_OP_SLOT_BOOL}, /* smooth vertices along X axis */
145  {"use_axis_y", BMO_OP_SLOT_BOOL}, /* smooth vertices along Y axis */
146  {"use_axis_z", BMO_OP_SLOT_BOOL}, /* smooth vertices along Z axis */
147  {{'\0'}},
148  },
149  {{{'\0'}}}, /* no output */
152 };
153 
154 /*
155  * Vertex Smooth Laplacian.
156  *
157  * Smooths vertices by using Laplacian smoothing propose by.
158  * Desbrun, et al. Implicit Fairing of Irregular Meshes using Diffusion and Curvature Flow.
159  */
161  "smooth_laplacian_vert",
162  /* slots_in */
163  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
164  {"lambda_factor", BMO_OP_SLOT_FLT}, /* lambda param */
165  {"lambda_border", BMO_OP_SLOT_FLT}, /* lambda param in border */
166  {"use_x", BMO_OP_SLOT_BOOL}, /* Smooth object along X axis */
167  {"use_y", BMO_OP_SLOT_BOOL}, /* Smooth object along Y axis */
168  {"use_z", BMO_OP_SLOT_BOOL}, /* Smooth object along Z axis */
169  {"preserve_volume", BMO_OP_SLOT_BOOL}, /* Apply volume preservation after smooth */
170  {{'\0'}},
171  },
172  {{{'\0'}}}, /* no output */
175 };
176 
177 /*
178  * Right-Hand Faces.
179  *
180  * Computes an "outside" normal for the specified input faces.
181  */
183  "recalc_face_normals",
184  /* slots_in */
185  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
186  {{'\0'}},
187  },
188  {{{'\0'}}}, /* no output */
192 };
193 
194 /*
195  * Planar Faces.
196  *
197  * Iteratively flatten faces.
198  */
200  "planar_faces",
201  /* slots_in */
202  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input geometry. */
203  {"iterations", BMO_OP_SLOT_INT}, /* Number of times to flatten faces (for when connected faces are used) */
204  {"factor", BMO_OP_SLOT_FLT}, /* Influence for making planar each iteration */
205  {{'\0'}},
206  },
207  /* slots_out */
208  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output slot, computed boundary geometry. */
209  {{'\0'}},
210  },
214 };
215 
216 /*
217  * Region Extend.
218  *
219  * used to implement the select more/less tools.
220  * this puts some geometry surrounding regions of
221  * geometry in geom into geom.out.
222  *
223  * if use_faces is 0 then geom.out spits out verts and edges,
224  * otherwise it spits out faces.
225  */
227  "region_extend",
228  /* slots_in */
229  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
230  {"use_contract", BMO_OP_SLOT_BOOL}, /* find boundary inside the regions, not outside. */
231  {"use_faces", BMO_OP_SLOT_BOOL}, /* extend from faces instead of edges */
232  {"use_face_step", BMO_OP_SLOT_BOOL}, /* step over connected faces */
233  {{'\0'}},
234  },
235  /* slots_out */
236  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output slot, computed boundary geometry. */
237  {{'\0'}},
238  },
242 };
243 
244 /*
245  * Edge Rotate.
246  *
247  * Rotates edges topologically. Also known as "spin edge" to some people.
248  * Simple example: ``[/] becomes [|] then [\]``.
249  */
251  "rotate_edges",
252  /* slots_in */
253  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
254  {"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate edge counter-clockwise if true, otherwise clockwise */
255  {{'\0'}},
256  },
257  /* slots_out */
258  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* newly spun edges */
259  {{'\0'}},
260  },
266 };
267 
268 /*
269  * Reverse Faces.
270  *
271  * Reverses the winding (vertex order) of faces.
272  * This has the effect of flipping the normal.
273  */
275  "reverse_faces",
276  /* slots_in */
277  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
278  {"flip_multires", BMO_OP_SLOT_BOOL}, /* maintain multi-res offset */
279  {{'\0'}},
280  },
281  {{{'\0'}}}, /* no output */
285 };
286 
287 /*
288  * Edge Bisect.
289  *
290  * Splits input edges (but doesn't do anything else).
291  * This creates a 2-valence vert.
292  */
294  "bisect_edges",
295  /* slots_in */
296  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
297  {"cuts", BMO_OP_SLOT_INT}, /* number of cuts */
298  {"edge_percents", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_FLT}},
299  {{'\0'}},
300  },
301  /* slots_out */
302  {{"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* newly created vertices and edges */
303  {{'\0'}},
304  },
310 };
311 
312 /*
313  * Mirror.
314  *
315  * Mirrors geometry along an axis. The resulting geometry is welded on using
316  * merge_dist. Pairs of original/mirrored vertices are welded using the merge_dist
317  * parameter (which defines the minimum distance for welding to happen).
318  */
320  "mirror",
321  /* slots_in */
322  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
323  {"matrix", BMO_OP_SLOT_MAT}, /* matrix defining the mirror transformation */
324  {"merge_dist", BMO_OP_SLOT_FLT}, /* maximum distance for merging. does no merging if 0. */
325  {"axis", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_axis_xyz}, /* the axis to use. */
326  {"mirror_u", BMO_OP_SLOT_BOOL}, /* mirror UVs across the u axis */
327  {"mirror_v", BMO_OP_SLOT_BOOL}, /* mirror UVs across the v axis */
328  {"mirror_udim", BMO_OP_SLOT_BOOL}, /* mirror UVs in each tile */
329  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
330  {{'\0'}},
331  },
332  /* slots_out */
333  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output geometry, mirrored */
334  {{'\0'}},
335  },
340 };
341 
342 /*
343  * Find Doubles.
344  *
345  * Takes input verts and find vertices they should weld to.
346  * Outputs a mapping slot suitable for use with the weld verts bmop.
347  *
348  * If keep_verts is used, vertices outside that set can only be merged
349  * with vertices in that set.
350  */
352  "find_doubles",
353  /* slots_in */
354  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
355  {"keep_verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* list of verts to keep */
356  {"dist", BMO_OP_SLOT_FLT}, /* maximum distance */
357  {{'\0'}},
358  },
359  /* slots_out */
360  {{"targetmap.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
361  {{'\0'}},
362  },
365 };
366 
367 /*
368  * Remove Doubles.
369  *
370  * Finds groups of vertices closer than dist and merges them together,
371  * using the weld verts bmop.
372  */
374  "remove_doubles",
375  /* slots_in */
376  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input verts */
377  {"dist", BMO_OP_SLOT_FLT}, /* minimum distance */
378  {{'\0'}},
379  },
380  {{{'\0'}}}, /* no output */
386 };
387 
388 /*
389  * Collapse Connected.
390  *
391  * Collapses connected vertices
392  */
394  "collapse",
395  /* slots_in */
396  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
397  {"uvs", BMO_OP_SLOT_BOOL}, /* also collapse UVs and such */
398  {{'\0'}},
399  },
400  {{{'\0'}}}, /* no output */
406 };
407 
408 /*
409  * Face-Data Point Merge.
410  *
411  * Merge uv/vcols at a specific vertex.
412  */
414  "pointmerge_facedata",
415  /* slots_in */
416  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
417  {"vert_snap", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | (int)BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* snap vertex */
418  {{'\0'}},
419  },
420  {{{'\0'}}}, /* no output */
423 };
424 
425 /*
426  * Average Vertices Facevert Data.
427  *
428  * Merge uv/vcols associated with the input vertices at
429  * the bounding box center. (I know, it's not averaging but
430  * the vert_snap_to_bb_center is just too long).
431  */
433  "average_vert_facedata",
434  /* slots_in */
435  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
436  {{'\0'}},
437  },
438  {{{'\0'}}}, /* no output */
441 };
442 
443 /*
444  * Point Merge.
445  *
446  * Merge verts together at a point.
447  */
449  "pointmerge",
450  /* slots_in */
451  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices (all verts will be merged into the first). */
452  {"merge_co", BMO_OP_SLOT_VEC}, /* Position to merge at. */
453  {{'\0'}},
454  },
455  {{{'\0'}}}, /* no output */
461 };
462 
463 /*
464  * Collapse Connected UV's.
465  *
466  * Collapses connected UV vertices.
467  */
469  "collapse_uvs",
470  /* slots_in */
471  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
472  {{'\0'}},
473  },
474  {{{'\0'}}}, /* no output */
477 };
478 
479 /*
480  * Weld Verts.
481  *
482  * Welds verts together (kind-of like remove doubles, merge, etc, all of which
483  * use or will use this bmop). You pass in mappings from vertices to the vertices
484  * they weld with.
485  */
487  "weld_verts",
488  /* slots_in */
489  {{"targetmap", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, /* maps welded vertices to verts they should weld to */
490  {{'\0'}},
491  },
492  {{{'\0'}}}, /* no output */
498 };
499 
500 /*
501  * Make Vertex.
502  *
503  * Creates a single vertex; this bmop was necessary
504  * for click-create-vertex.
505  */
507  "create_vert",
508  /* slots_in */
509  {{"co", BMO_OP_SLOT_VEC}, /* the coordinate of the new vert */
510  {{'\0'}},
511  },
512  /* slots_out */
513  {{"vert.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* the new vert */
514  {{'\0'}},
515  },
518 };
519 
520 /*
521  * Join Triangles.
522  *
523  * Tries to intelligently join triangles according
524  * to angle threshold and delimiters.
525  */
527  "join_triangles",
528  /* slots_in */
529  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input geometry. */
530  {"cmp_seam", BMO_OP_SLOT_BOOL}, /* Compare seam */
531  {"cmp_sharp", BMO_OP_SLOT_BOOL}, /* Compare sharp */
532  {"cmp_uvs", BMO_OP_SLOT_BOOL}, /* Compare UVs */
533  {"cmp_vcols", BMO_OP_SLOT_BOOL}, /* compare VCols */
534  {"cmp_materials", BMO_OP_SLOT_BOOL}, /* compare materials */
535  {"angle_face_threshold", BMO_OP_SLOT_FLT},
536  {"angle_shape_threshold", BMO_OP_SLOT_FLT},
537  {{'\0'}},
538  },
539  /* slots_out */
540  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* joined faces */
541  {{'\0'}},
542  },
548 };
549 
550 /*
551  * Contextual Create.
552  *
553  * This is basically F-key, it creates
554  * new faces from vertices, makes stuff from edge nets,
555  * makes wire edges, etc. It also dissolves faces.
556  *
557  * Three verts become a triangle, four become a quad. Two
558  * become a wire edge.
559  */
561  "contextual_create",
562  /* slots_in */
563  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry. */
564  {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
565  {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth to use */
566  {{'\0'}},
567  },
568  /* slots_out */
569  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* newly-made face(s) */
570  /* note, this is for stand-alone edges only, not edges which are a part of newly created faces */
571  {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* newly-made edge(s) */
572  {{'\0'}},
573  },
579 };
580 
581 /*
582  * Bridge edge loops with faces.
583  */
585  "bridge_loops",
586  /* slots_in */
587  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
588  {"use_pairs", BMO_OP_SLOT_BOOL},
589  {"use_cyclic", BMO_OP_SLOT_BOOL},
590  {"use_merge", BMO_OP_SLOT_BOOL}, /* merge rather than creating faces */
591  {"merge_factor", BMO_OP_SLOT_FLT}, /* merge factor */
592  {"twist_offset", BMO_OP_SLOT_INT}, /* twist offset for closed loops */
593  {{'\0'}},
594  },
595  /* slots_out */
596  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
597  {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* new edges */
598  {{'\0'}},
599  },
604 };
605 
606 /*
607  * Grid Fill.
608  *
609  * Create faces defined by 2 disconnected edge loops (which share edges).
610  */
612  "grid_fill",
613  /* slots_in */
614  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
615  /* restricts edges to groups. maps edges to integer */
616  {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
617  {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */
618  {"use_interp_simple", BMO_OP_SLOT_BOOL}, /* use simple interpolation */
619  {{'\0'}},
620  },
621  /* slots_out */
622  /* maps new faces to the group numbers they came from */
623  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
624  {{'\0'}},
625  },
629 };
630 
631 
632 /*
633  * Fill Holes.
634  *
635  * Fill boundary edges with faces, copying surrounding customdata.
636  */
638  "holes_fill",
639  /* slots_in */
640  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
641  {"sides", BMO_OP_SLOT_INT}, /* number of face sides to fill */
642  {{'\0'}},
643  },
644  /* slots_out */
645  /* maps new faces to the group numbers they came from */
646  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
647  {{'\0'}},
648  },
652 };
653 
654 
655 /*
656  * Face Attribute Fill.
657  *
658  * Fill in faces with data from adjacent faces.
659  */
661  "face_attribute_fill",
662  /* slots_in */
663  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
664  {"use_normals", BMO_OP_SLOT_BOOL}, /* copy face winding */
665  {"use_data", BMO_OP_SLOT_BOOL}, /* copy face data */
666  {{'\0'}},
667  },
668  /* slots_out */
669  /* maps new faces to the group numbers they came from */
670  {{"faces_fail.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* faces that could not be handled */
671  {{'\0'}},
672  },
675 };
676 
677 /*
678  * Edge Loop Fill.
679  *
680  * Create faces defined by one or more non overlapping edge loops.
681  */
683  "edgeloop_fill",
684  /* slots_in */
685  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
686  /* restricts edges to groups. maps edges to integer */
687  {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
688  {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */
689  {{'\0'}},
690  },
691  /* slots_out */
692  /* maps new faces to the group numbers they came from */
693  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
694  {{'\0'}},
695  },
699 };
700 
701 
702 /*
703  * Edge Net Fill.
704  *
705  * Create faces defined by enclosed edges.
706  */
708  "edgenet_fill",
709  /* slots_in */
710  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
711  {"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
712  {"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */
713  {"sides", BMO_OP_SLOT_INT}, /* number of sides */
714  {{'\0'}},
715  },
716  /* slots_out */
717  /* maps new faces to the group numbers they came from */
718  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
719  {{'\0'}},
720  },
724 };
725 
726 /*
727  * Edgenet Prepare.
728  *
729  * Identifies several useful edge loop cases and modifies them so
730  * they'll become a face when edgenet_fill is called. The cases covered are:
731  *
732  * - One single loop; an edge is added to connect the ends
733  * - Two loops; two edges are added to connect the endpoints (based on the
734  * shortest distance between each endpoint).
735  */
737  "edgenet_prepare",
738  /* slots_in */
739  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
740  {{'\0'}},
741  },
742  /* slots_out */
743  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* new edges */
744  {{'\0'}},
745  },
748 };
749 
750 /*
751  * Rotate.
752  *
753  * Rotate vertices around a center, using a 3x3 rotation matrix.
754  */
756  "rotate",
757  /* slots_in */
758  {{"cent", BMO_OP_SLOT_VEC}, /* center of rotation */
759  {"matrix", BMO_OP_SLOT_MAT}, /* matrix defining rotation */
760  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
761  {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
762  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
763  {{'\0'}},
764  },
765  {{{'\0'}}}, /* no output */
768 };
769 
770 /*
771  * Translate.
772  *
773  * Translate vertices by an offset.
774  */
776  "translate",
777  /* slots_in */
778  {{"vec", BMO_OP_SLOT_VEC}, /* translation offset */
779  {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
780  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
781  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
782  {{'\0'}},
783  },
784  {{{'\0'}}}, /* no output */
787 };
788 
789 /*
790  * Scale.
791  *
792  * Scales vertices by an offset.
793  */
795  "scale",
796  /* slots_in */
797  {{"vec", BMO_OP_SLOT_VEC}, /* scale factor */
798  {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
799  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
800  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
801  {{'\0'}},
802  },
803  {{{'\0'}}}, /* no output */
806 };
807 
808 
809 /*
810  * Transform.
811  *
812  * Transforms a set of vertices by a matrix. Multiplies
813  * the vertex coordinates with the matrix.
814  */
816  "transform",
817  /* slots_in */
818  {{"matrix", BMO_OP_SLOT_MAT}, /* transform matrix */
819  {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
820  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
821  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
822  {{'\0'}},
823  },
824  {{{'\0'}}}, /* no output */
827 };
828 
829 /*
830  * Object Load BMesh.
831  *
832  * Loads a bmesh into an object/mesh. This is a "private"
833  * bmop.
834  */
836  "object_load_bmesh",
837  /* slots_in */
838  {{"scene", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_SCENE}}, /* pointer to an scene structure */
839  {"object", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, /* pointer to an object structure */
840  {{'\0'}},
841  },
842  {{{'\0'}}}, /* no output */
845 };
846 
847 
848 /*
849  * BMesh to Mesh.
850  *
851  * Converts a bmesh to a Mesh. This is reserved for exiting editmode.
852  */
854  "bmesh_to_mesh",
855  /* slots_in */
856  {
857  {"mesh", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_MESH}}, /* pointer to a mesh structure to fill in */
858  {"object", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, /* pointer to an object structure */
859  {{'\0'}},
860  },
861  {{{'\0'}}}, /* no output */
864 };
865 
866 /*
867  * Mesh to BMesh.
868  *
869  * Load the contents of a mesh into the bmesh. this bmop is private, it's
870  * reserved exclusively for entering editmode.
871  */
873  "mesh_to_bmesh",
874  /* slots_in */
875  {
876  {"mesh", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_MESH}}, /* pointer to a Mesh structure */
877  {"object", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}}, /* pointer to an Object structure */
878  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* load active shapekey coordinates into verts */
879  {{'\0'}},
880  },
881  {{{'\0'}}}, /* no output */
884 };
885 
886 /*
887  * Individual Face Extrude.
888  *
889  * Extrudes faces individually.
890  */
892  "extrude_discrete_faces",
893  /* slots_in */
894  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
895  {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */
896  {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */
897  {{'\0'}},
898  },
899  /* slots_out */
900  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
901  {{'\0'}},
902  },
905 };
906 
907 /*
908  * Extrude Only Edges.
909  *
910  * Extrudes Edges into faces, note that this is very simple, there's no fancy
911  * winged extrusion.
912  */
914  "extrude_edge_only",
915  /* slots_in */
916  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input vertices */
917  {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */
918  {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */
919  {{'\0'}},
920  },
921  /* slots_out */
922  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output geometry */
923  {{'\0'}},
924  },
927 };
928 
929 /*
930  * Individual Vertex Extrude.
931  *
932  * Extrudes wire edges from vertices.
933  */
935  "extrude_vert_indiv",
936  /* slots_in */
937  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
938  {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */
939  {{'\0'}},
940  },
941  /* slots_out */
942  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output wire edges */
943  {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output vertices */
944  {{'\0'}},
945  },
948 };
949 
950 /*
951  * Connect Verts.
952  *
953  * Split faces by adding edges that connect **verts**.
954  */
956  "connect_verts",
957  /* slots_in */
958  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
959  {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces to explicitly exclude from connecting */
960  {"check_degenerate", BMO_OP_SLOT_BOOL}, /* prevent splits with overlaps & intersections */
961  {{'\0'}},
962  },
963  /* slots_out */
964  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
965  {{'\0'}},
966  },
971 };
972 
973 /*
974  * Connect Verts to form Convex Faces.
975  *
976  * Ensures all faces are convex **faces**.
977  */
979  "connect_verts_concave",
980  /* slots_in */
981  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
982  {{'\0'}},
983  },
984  /* slots_out */
985  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
986  {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
987  {{'\0'}},
988  },
993 };
994 
995 /*
996  * Connect Verts Across non Planer Faces.
997  *
998  * Split faces by connecting edges along non planer **faces**.
999  */
1001  "connect_verts_nonplanar",
1002  /* slots_in */
1003  {{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */
1004  {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1005  {{'\0'}},
1006  },
1007  /* slots_out */
1008  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
1009  {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
1010  {{'\0'}},
1011  },
1016 };
1017 
1018 /*
1019  * Connect Verts.
1020  *
1021  * Split faces by adding edges that connect **verts**.
1022  */
1024  "connect_vert_pair",
1025  /* slots_in */
1026  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
1027  {"verts_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices to explicitly exclude from connecting */
1028  {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces to explicitly exclude from connecting */
1029  {{'\0'}},
1030  },
1031  /* slots_out */
1032  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
1033  {{'\0'}},
1034  },
1039 };
1040 
1041 
1042 /*
1043  * Extrude Faces.
1044  *
1045  * Extrude operator (does not transform)
1046  */
1048  "extrude_face_region",
1049  /* slots_in */
1050  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* edges and faces */
1051  {"edges_exclude", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_EMPTY}}, /* input edges to explicitly exclude from extrusion */
1052  {"use_keep_orig", BMO_OP_SLOT_BOOL}, /* keep original geometry (requires ``geom`` to include edges). */
1053  {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */
1054  {"use_normal_from_adjacent", BMO_OP_SLOT_BOOL}, /* Use winding from surrounding faces instead of this region. */
1055  {"use_dissolve_ortho_edges", BMO_OP_SLOT_BOOL}, /* Dissolve edges whose faces form a flat surface. */
1056  {"use_select_history", BMO_OP_SLOT_BOOL}, /* pass to duplicate */
1057  {{'\0'}},
1058  },
1059  /* slots_out */
1060  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1061  {{'\0'}},
1062  },
1065 };
1066 
1067 /*
1068  * Dissolve Verts.
1069  */
1071  "dissolve_verts",
1072  /* slots_in */
1073  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
1074  {"use_face_split", BMO_OP_SLOT_BOOL}, /* split off face corners to maintain surrounding geometry */
1075  {"use_boundary_tear", BMO_OP_SLOT_BOOL}, /* split off face corners instead of merging faces */
1076  {{'\0'}},
1077  },
1078  {{{'\0'}}}, /* no output */
1084 };
1085 
1086 /*
1087  * Dissolve Edges.
1088  */
1090  "dissolve_edges",
1091  /* slots_in */
1092  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1093  {"use_verts", BMO_OP_SLOT_BOOL}, /* dissolve verts left between only 2 edges. */
1094  {"use_face_split", BMO_OP_SLOT_BOOL}, /* split off face corners to maintain surrounding geometry */
1095  {{'\0'}},
1096  },
1097  /* slots_out */
1098  {{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
1099  {{'\0'}},
1100  },
1106 };
1107 
1108 /*
1109  * Dissolve Faces.
1110  */
1112  "dissolve_faces",
1113  /* slots_in */
1114  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1115  {"use_verts", BMO_OP_SLOT_BOOL}, /* dissolve verts left between only 2 edges. */
1116  {{'\0'}},
1117  },
1118  /* slots_out */
1119  {{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
1120  {{'\0'}},
1121  },
1127 };
1128 
1130  {BMO_DELIM_NORMAL, "NORMAL"},
1131  {BMO_DELIM_MATERIAL, "MATERIAL"},
1132  {BMO_DELIM_SEAM, "SEAM"},
1133  {BMO_DELIM_SHARP, "SHARP"},
1134  {BMO_DELIM_UV, "UV"},
1135  {0, NULL},
1136 };
1137 
1138 /*
1139  * Limited Dissolve.
1140  *
1141  * Dissolve planar faces and co-linear edges.
1142  */
1144  "dissolve_limit",
1145  /* slots_in */
1146  {{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */
1147  {"use_dissolve_boundaries", BMO_OP_SLOT_BOOL}, /* dissolve all vertices in between face boundaries */
1148  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
1149  {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1150  {"delimit", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_FLAG}, bmo_enum_dissolve_limit_flags}, /* delimit dissolve operation */
1151  {{'\0'}},
1152  },
1153  /* slots_out */
1154  {{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
1155  {{'\0'}}},
1161 };
1162 
1163 /*
1164  * Degenerate Dissolve.
1165  *
1166  * Dissolve edges with no length, faces with no area.
1167  */
1169  "dissolve_degenerate",
1170  /* slots_in */
1171  {{"dist", BMO_OP_SLOT_FLT}, /* maximum distance to consider degenerate */
1172  {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1173  {{'\0'}},
1174  },
1175  /* slots_out */
1176  {{{'\0'}}},
1182 };
1183 
1185  {MOD_TRIANGULATE_QUAD_BEAUTY, "BEAUTY"},
1186  {MOD_TRIANGULATE_QUAD_FIXED, "FIXED"},
1187  {MOD_TRIANGULATE_QUAD_ALTERNATE, "ALTERNATE"},
1188  {MOD_TRIANGULATE_QUAD_SHORTEDGE, "SHORT_EDGE"},
1189  {0, NULL},
1190 };
1191 
1193  {MOD_TRIANGULATE_NGON_BEAUTY, "BEAUTY"},
1194  {MOD_TRIANGULATE_NGON_EARCLIP, "EAR_CLIP"},
1195  {0, NULL},
1196 };
1197 
1198 /*
1199  * Triangulate.
1200  */
1202  "triangulate",
1203  /* slots_in */
1204  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1205  {"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 */
1206  {"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 */
1207  {{'\0'}},
1208  },
1209  /* slots_out */
1210  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
1211  {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
1212  {"face_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1213  {"face_map_double.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}}, /* duplicate faces */
1214  {{'\0'}},
1215  },
1220 };
1221 
1222 /*
1223  * Un-Subdivide.
1224  *
1225  * Reduce detail in geometry containing grids.
1226  */
1228  "unsubdivide",
1229  /* slots_in */
1230  {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
1231  {"iterations", BMO_OP_SLOT_INT}, /* number of times to unsubdivide */
1232  {{'\0'}},
1233  },
1234  {{{'\0'}}}, /* no output */
1240 };
1241 
1243  {SUBD_CORNER_STRAIGHT_CUT, "STRAIGHT_CUT"},
1244  {SUBD_CORNER_INNERVERT, "INNER_VERT"},
1245  {SUBD_CORNER_PATH, "PATH"},
1246  {SUBD_CORNER_FAN, "FAN"},
1247  {0, NULL},
1248 };
1249 
1250 /*
1251  * Subdivide Edges.
1252  *
1253  * Advanced operator for subdividing edges
1254  * with options for face patterns, smoothing and randomization.
1255  */
1257  "subdivide_edges",
1258  /* slots_in */
1259  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1260  {"smooth", BMO_OP_SLOT_FLT}, /* smoothness factor */
1261  {"smooth_falloff", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_falloff_type}, /* smooth falloff type */
1262  {"fractal", BMO_OP_SLOT_FLT}, /* fractal randomness factor */
1263  {"along_normal", BMO_OP_SLOT_FLT}, /* apply fractal displacement along normal only */
1264  {"cuts", BMO_OP_SLOT_INT}, /* number of cuts */
1265  {"seed", BMO_OP_SLOT_INT}, /* seed for the random number generator */
1266  {"custom_patterns", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL}}, /* uses custom pointers */
1267  {"edge_percents", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_FLT}},
1268  {"quad_corner_type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_subdivide_edges_quad_corner_type}, /* quad corner type */
1269  {"use_grid_fill", BMO_OP_SLOT_BOOL}, /* fill in fully-selected faces with a grid */
1270  {"use_single_edge", BMO_OP_SLOT_BOOL}, /* tessellate the case of one edge selected in a quad or triangle */
1271  {"use_only_quads", BMO_OP_SLOT_BOOL}, /* Only subdivide quads (for loop-cut). */
1272  {"use_sphere", BMO_OP_SLOT_BOOL}, /* for making new primitives only */
1273  {"use_smooth_even", BMO_OP_SLOT_BOOL}, /* maintain even offset when smoothing */
1274  {{'\0'}},
1275  },
1276  /* slots_out */
1277  {/* these next three can have multiple types of elements in them */
1278  {"geom_inner.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1279  {"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1280  {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* contains all output geometry */
1281  {{'\0'}},
1282  },
1288 };
1289 
1291  {SUBD_RING_INTERP_LINEAR, "LINEAR"},
1292  {SUBD_RING_INTERP_PATH, "PATH"},
1293  {SUBD_RING_INTERP_SURF, "SURFACE"},
1294  {0, NULL},
1295 };
1296 
1297 /*
1298  * Subdivide Edge-Ring.
1299  *
1300  * Take an edge-ring, and subdivide with interpolation options.
1301  */
1303  "subdivide_edgering",
1304  /* slots_in */
1305  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input vertices */
1306  {"interp_mode", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_subdivide_edgering_interp_mode}, /* interpolation method */
1307  {"smooth", BMO_OP_SLOT_FLT}, /* smoothness factor */
1308  {"cuts", BMO_OP_SLOT_INT}, /* number of cuts */
1309  {"profile_shape", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_falloff_type}, /* profile shape type */
1310  {"profile_shape_factor", BMO_OP_SLOT_FLT}, /* how much intermediary new edges are shrunk/expanded */
1311  {{'\0'}},
1312  },
1313  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
1314  {{'\0'}}},
1320 };
1321 
1322 /*
1323  * Bisect Plane.
1324  *
1325  * Bisects the mesh by a plane (cut the mesh in half).
1326  */
1328  "bisect_plane",
1329  /* slots_in */
1330  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1331  {"dist", BMO_OP_SLOT_FLT}, /* minimum distance when testing if a vert is exactly on the plane */
1332  {"plane_co", BMO_OP_SLOT_VEC}, /* point on the plane */
1333  {"plane_no", BMO_OP_SLOT_VEC}, /* direction of the plane */
1334  {"use_snap_center", BMO_OP_SLOT_BOOL}, /* snap axis aligned verts to the center */
1335  {"clear_outer", BMO_OP_SLOT_BOOL}, /* when enabled. remove all geometry on the positive side of the plane */
1336  {"clear_inner", BMO_OP_SLOT_BOOL}, /* when enabled. remove all geometry on the negative side of the plane */
1337  {{'\0'}},
1338  },
1339  {{"geom_cut.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE}}, /* output geometry aligned with the plane (new and existing) */
1340  {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input and output geometry (result of cut) */
1341  {{'\0'}}},
1347 };
1348 
1350  {DEL_VERTS, "VERTS"},
1351  {DEL_EDGES, "EDGES"},
1352  {DEL_ONLYFACES, "FACES_ONLY"},
1353  {DEL_EDGESFACES, "EDGES_FACES"},
1354  {DEL_FACES, "FACES"},
1355  {DEL_FACES_KEEP_BOUNDARY, "FACES_KEEP_BOUNDARY"},
1356  {DEL_ONLYTAGGED, "TAGGED_ONLY"},
1357  {0, NULL},
1358 };
1359 
1360 /*
1361  * Delete Geometry.
1362  *
1363  * Utility operator to delete geometry.
1364  */
1366  "delete",
1367  /* slots_in */
1368  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1369  {"context", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_delete_context}, /* geometry types to delete */
1370  {{'\0'}},
1371  },
1372  {{{'\0'}}}, /* no output */
1377 };
1378 
1379 /*
1380  * Duplicate Geometry.
1381  *
1382  * Utility operator to duplicate geometry,
1383  * optionally into a destination mesh.
1384  */
1386  "duplicate",
1387  /* slots_in */
1388  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1389  {"dest", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_BMESH}}, /* destination bmesh, if NULL will use current on */
1390  {"use_select_history", BMO_OP_SLOT_BOOL},
1391  {"use_edge_flip_from_face", BMO_OP_SLOT_BOOL},
1392  {{'\0'}},
1393  },
1394  /* slots_out */
1395  {{"geom_orig.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1396  {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1397  /* face_map maps from source faces to dupe
1398  * faces, and from dupe faces to source faces */
1399  {"vert_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1400  {"edge_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1401  {"face_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1402  {"boundary_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1403  {"isovert_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1404  {{'\0'}},
1405  },
1409 };
1410 
1411 /*
1412  * Split Off Geometry.
1413  *
1414  * Disconnect geometry from adjacent edges and faces,
1415  * optionally into a destination mesh.
1416  */
1418  "split",
1419  /* slots_in */
1420  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1421  {"dest", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_BMESH}}, /* destination bmesh, if NULL will use current one */
1422  {"use_only_faces", BMO_OP_SLOT_BOOL}, /* when enabled. don't duplicate loose verts/edges */
1423  {{'\0'}},
1424  },
1425  /* slots_out */
1426  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1427  {"boundary_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1428  {"isovert_map.out", BMO_OP_SLOT_MAPPING, {(int)BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
1429  {{'\0'}},
1430  },
1434 };
1435 
1436 /*
1437  * Spin.
1438  *
1439  * Extrude or duplicate geometry a number of times,
1440  * rotating and possibly translating after each step
1441  */
1443  "spin",
1444  /* slots_in */
1445  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1446  {"cent", BMO_OP_SLOT_VEC}, /* rotation center */
1447  {"axis", BMO_OP_SLOT_VEC}, /* rotation axis */
1448  {"dvec", BMO_OP_SLOT_VEC}, /* translation delta per step */
1449  {"angle", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */
1450  {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
1451  {"steps", BMO_OP_SLOT_INT}, /* number of steps */
1452  {"use_merge", BMO_OP_SLOT_BOOL}, /* Merge first/last when the angle is a full revolution. */
1453  {"use_normal_flip", BMO_OP_SLOT_BOOL}, /* Create faces with reversed direction. */
1454  {"use_duplicate", BMO_OP_SLOT_BOOL}, /* duplicate or extrude? */
1455  {{'\0'}},
1456  },
1457  /* slots_out */
1458  {{"geom_last.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* result of last step */
1459  {{'\0'}},
1460  },
1461  bmo_spin_exec,
1464 };
1465 
1466 /*
1467  * UV Rotation.
1468  *
1469  * Cycle the loop UV's
1470  */
1472  "rotate_uvs",
1473  /* slots_in */
1474  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1475  {"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate counter-clockwise if true, otherwise clockwise */
1476  {{'\0'}},
1477  },
1478  {{{'\0'}}}, /* no output */
1481 };
1482 
1483 /*
1484  * UV Reverse.
1485  *
1486  * Reverse the UV's
1487  */
1489  "reverse_uvs",
1490  /* slots_in */
1491  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1492  {{'\0'}},
1493  },
1494  {{{'\0'}}}, /* no output */
1497 };
1498 
1499 /*
1500  * Color Rotation.
1501  *
1502  * Cycle the loop colors
1503  */
1505  "rotate_colors",
1506  /* slots_in */
1507  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1508  {"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate counter-clockwise if true, otherwise clockwise */
1509  {{'\0'}},
1510  },
1511  {{{'\0'}}}, /* no output */
1514 };
1515 
1516 /*
1517  * Color Reverse
1518  *
1519  * Reverse the loop colors.
1520  */
1522  "reverse_colors",
1523  /* slots_in */
1524  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1525  {{'\0'}},
1526  },
1527  {{{'\0'}}}, /* no output */
1530 };
1531 
1532 /*
1533  * Edge Split.
1534  *
1535  * Disconnects faces along input edges.
1536  */
1538  "split_edges",
1539  /* slots_in */
1540  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1541  /* needed for vertex rip so we can rip only half an edge at a boundary which would otherwise split off */
1542  {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* optional tag verts, use to have greater control of splits */
1543  {"use_verts", BMO_OP_SLOT_BOOL}, /* use 'verts' for splitting, else just find verts to split from edges */
1544  {{'\0'}},
1545  },
1546  /* slots_out */
1547  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* old output disconnected edges */
1548  {{'\0'}},
1549  },
1554 };
1555 
1556 /*
1557  * Create Grid.
1558  *
1559  * Creates a grid with a variable number of subdivisions
1560  */
1562  "create_grid",
1563  /* slots_in */
1564  {{"x_segments", BMO_OP_SLOT_INT}, /* number of x segments */
1565  {"y_segments", BMO_OP_SLOT_INT}, /* number of y segments */
1566  {"size", BMO_OP_SLOT_FLT}, /* size of the grid */
1567  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1568  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1569  {{'\0'}},
1570  },
1571  /* slots_out */
1572  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1573  {{'\0'}},
1574  },
1578 };
1579 
1580 /*
1581  * Create UV Sphere.
1582  *
1583  * Creates a grid with a variable number of subdivisions
1584  */
1586  "create_uvsphere",
1587  /* slots_in */
1588  {{"u_segments", BMO_OP_SLOT_INT}, /* number of u segments */
1589  {"v_segments", BMO_OP_SLOT_INT}, /* number of v segment */
1590  {"diameter", BMO_OP_SLOT_FLT}, /* diameter */
1591  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1592  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1593  {{'\0'}},
1594  },
1595  /* slots_out */
1596  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1597  {{'\0'}},
1598  },
1602 };
1603 
1604 /*
1605  * Create Ico-Sphere.
1606  *
1607  * Creates a grid with a variable number of subdivisions
1608  */
1610  "create_icosphere",
1611  /* slots_in */
1612  {{"subdivisions", BMO_OP_SLOT_INT}, /* how many times to recursively subdivide the sphere */
1613  {"diameter", BMO_OP_SLOT_FLT}, /* diameter */
1614  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1615  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1616  {{'\0'}},
1617  },
1618  /* slots_out */
1619  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1620  {{'\0'}},
1621  },
1625 };
1626 
1627 /*
1628  * Create Suzanne.
1629  *
1630  * Creates a monkey (standard blender primitive).
1631  */
1633  "create_monkey",
1634  /* slots_in */
1635  {{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1636  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1637  {{'\0'}},
1638  },
1639  /* slots_out */
1640  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1641  {{'\0'}},
1642  },
1646 };
1647 
1648 /*
1649  * Create Cone.
1650  *
1651  * Creates a cone with variable depth at both ends
1652  */
1654  "create_cone",
1655  /* slots_in */
1656  {{"cap_ends", BMO_OP_SLOT_BOOL}, /* whether or not to fill in the ends with faces */
1657  {"cap_tris", BMO_OP_SLOT_BOOL}, /* fill ends with triangles instead of ngons */
1658  {"segments", BMO_OP_SLOT_INT}, /* number of vertices in the base circle */
1659  {"diameter1", BMO_OP_SLOT_FLT}, /* diameter of one end */
1660  {"diameter2", BMO_OP_SLOT_FLT}, /* diameter of the opposite */
1661  {"depth", BMO_OP_SLOT_FLT}, /* distance between ends */
1662  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1663  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1664  {{'\0'}},
1665  },
1666  /* slots_out */
1667  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1668  {{'\0'}},
1669  },
1673 };
1674 
1675 /*
1676  * Creates a Circle.
1677  */
1679  "create_circle",
1680  /* slots_in */
1681  {{"cap_ends", BMO_OP_SLOT_BOOL}, /* whether or not to fill in the ends with faces */
1682  {"cap_tris", BMO_OP_SLOT_BOOL}, /* fill ends with triangles instead of ngons */
1683  {"segments", BMO_OP_SLOT_INT}, /* number of vertices in the circle */
1684  {"radius", BMO_OP_SLOT_FLT}, /* Radius of the circle. */
1685  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1686  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1687  {{'\0'}},
1688  },
1689  /* slots_out */
1690  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1691  {{'\0'}},
1692  },
1696 };
1697 
1698 /*
1699  * Create Cube
1700  *
1701  * Creates a cube.
1702  */
1704  "create_cube",
1705  /* slots_in */
1706  {{"size", BMO_OP_SLOT_FLT}, /* size of the cube */
1707  {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
1708  {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
1709  {{'\0'}},
1710  },
1711  /* slots_out */
1712  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1713  {{'\0'}},
1714  },
1718 };
1719 
1721  {BEVEL_AMT_OFFSET, "OFFSET"},
1722  {BEVEL_AMT_WIDTH, "WIDTH"},
1723  {BEVEL_AMT_DEPTH, "DEPTH"},
1724  {BEVEL_AMT_PERCENT, "PERCENT"},
1725  {BEVEL_AMT_ABSOLUTE, "ABSOLUTE"},
1726  {0, NULL},
1727 };
1728 
1730  {BEVEL_PROFILE_SUPERELLIPSE, "SUPERELLIPSE"},
1731  {BEVEL_PROFILE_CUSTOM, "CUSTOM"},
1732  {0, NULL},
1733 };
1734 
1736  {BEVEL_FACE_STRENGTH_NONE, "NONE"},
1737  {BEVEL_FACE_STRENGTH_NEW, "NEW"},
1738  {BEVEL_FACE_STRENGTH_AFFECTED, "AFFECTED"},
1739  {BEVEL_FACE_STRENGTH_ALL, "ALL"},
1740  {0, NULL},
1741 };
1742 
1744  {BEVEL_MITER_SHARP, "SHARP"},
1745  {BEVEL_MITER_PATCH, "PATCH"},
1746  {BEVEL_MITER_ARC, "ARC"},
1747  {0, NULL},
1748 };
1749 
1751  {BEVEL_VMESH_ADJ, "ADJ"},
1752  {BEVEL_VMESH_CUTOFF, "CUTOFF"},
1753  {0, NULL},
1754 };
1755 
1757  {BEVEL_AFFECT_VERTICES, "VERTICES"},
1758  {BEVEL_AFFECT_EDGES, "EDGES"},
1759  {0, NULL},
1760 };
1761 
1762 /*
1763  * Bevel.
1764  *
1765  * Bevels edges and vertices
1766  */
1768  "bevel",
1769  /* slots_in */
1770  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input edges and vertices */
1771  {"offset", BMO_OP_SLOT_FLT}, /* amount to offset beveled edge */
1772  {"offset_type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1773  bmo_enum_bevel_offset_type}, /* how to measure the offset */
1774  {"profile_type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1775  bmo_enum_bevel_profile_type}, /* The profile type to use for bevel. */
1776  {"segments", BMO_OP_SLOT_INT}, /* number of segments in bevel */
1777  {"profile", BMO_OP_SLOT_FLT}, /* profile shape, 0->1 (.5=>round) */
1778  {"affect", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1779  bmo_enum_bevel_affect_type}, /* Whether to bevel vertices or edges. */
1780  {"clamp_overlap", BMO_OP_SLOT_BOOL}, /* do not allow beveled edges/vertices to overlap each other */
1781  {"material", BMO_OP_SLOT_INT}, /* material for bevel faces, -1 means get from adjacent faces */
1782  {"loop_slide", BMO_OP_SLOT_BOOL}, /* prefer to slide along edges to having even widths */
1783  {"mark_seam", BMO_OP_SLOT_BOOL}, /* extend edge data to allow seams to run across bevels */
1784  {"mark_sharp", BMO_OP_SLOT_BOOL}, /* extend edge data to allow sharp edges to run across bevels */
1785  {"harden_normals", BMO_OP_SLOT_BOOL}, /* harden normals */
1786  {"face_strength_mode", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1787  bmo_enum_bevel_face_strength_type}, /* whether to set face strength, and which faces to set if so */
1788  {"miter_outer", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1789  bmo_enum_bevel_miter_type}, /* outer miter kind */
1790  {"miter_inner", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1791  bmo_enum_bevel_miter_type}, /* outer miter kind */
1792  {"spread", BMO_OP_SLOT_FLT}, /* amount to offset beveled edge */
1793  {"smoothresh", BMO_OP_SLOT_FLT}, /* for passing mesh's smoothresh, used in hardening */
1794  {"custom_profile", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_STRUCT}}, /* CurveProfile */
1795  {"vmesh_method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
1796  bmo_enum_bevel_vmesh_method}, /* The method to use to create meshes at intersections. */
1797  {{'\0'}},
1798  },
1799  /* slots_out */
1800  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
1801  {"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output edges */
1802  {"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
1803  {{'\0'}},
1804  },
1805 
1811 };
1812 
1813 /* no enum is defined for this */
1815  {0, "AREA"},
1816  {1, "ANGLE"},
1817  {0, NULL},
1818 };
1819 
1820 /*
1821  * Beautify Fill.
1822  *
1823  * Rotate edges to create more evenly spaced triangles.
1824  */
1826  "beautify_fill",
1827  /* slots_in */
1828  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1829  {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* edges that can be flipped */
1830  {"use_restrict_tag", BMO_OP_SLOT_BOOL}, /* restrict edge rotation to mixed tagged vertices */
1831  {"method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_beautify_fill_method}, /* method to define what is beautiful */
1832  {{'\0'}},
1833  },
1834  /* slots_out */
1835  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* new flipped faces and edges */
1836  {{'\0'}},
1837  },
1843 };
1844 
1845 /*
1846  * Triangle Fill.
1847  *
1848  * Fill edges with triangles
1849  */
1851  "triangle_fill",
1852  /* slots_in */
1853  {{"use_beauty", BMO_OP_SLOT_BOOL}, /* use best triangulation division */
1854  {"use_dissolve", BMO_OP_SLOT_BOOL}, /* dissolve resulting faces */
1855  {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1856  {"normal", BMO_OP_SLOT_VEC}, /* optionally pass the fill normal to use */
1857  {{'\0'}},
1858  },
1859  /* slots_out */
1860  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* new faces and edges */
1861  {{'\0'}},
1862  },
1867 };
1868 
1869 /*
1870  * Solidify.
1871  *
1872  * Turns a mesh into a shell with thickness
1873  */
1875  "solidify",
1876  /* slots_in */
1877  {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
1878  {"thickness", BMO_OP_SLOT_FLT}, /* thickness */
1879  {{'\0'}},
1880  },
1881  /* slots_out */
1882  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
1883  {{'\0'}},
1884  },
1888 };
1889 
1890 /*
1891  * Face Inset (Individual).
1892  *
1893  * Insets individual faces.
1894  */
1896  "inset_individual",
1897  /* slots_in */
1898  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1899  {"thickness", BMO_OP_SLOT_FLT}, /* thickness */
1900  {"depth", BMO_OP_SLOT_FLT}, /* depth */
1901  {"use_even_offset", BMO_OP_SLOT_BOOL}, /* scale the offset to give more even thickness */
1902  {"use_interpolate", BMO_OP_SLOT_BOOL}, /* blend face data across the inset */
1903  {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* scale the offset by surrounding geometry */
1904  {{'\0'}},
1905  },
1906  /* slots_out */
1907  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
1908  {{'\0'}},
1909  },
1911  /* caller needs to handle BMO_OPTYPE_FLAG_SELECT_FLUSH */
1913 };
1914 
1915 /*
1916  * Face Inset (Regions).
1917  *
1918  * Inset or outset face regions.
1919  */
1921  "inset_region",
1922  /* slots_in */
1923  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1924  {"faces_exclude", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces to explicitly exclude from inset */
1925  {"use_boundary", BMO_OP_SLOT_BOOL}, /* inset face boundaries */
1926  {"use_even_offset", BMO_OP_SLOT_BOOL}, /* scale the offset to give more even thickness */
1927  {"use_interpolate", BMO_OP_SLOT_BOOL}, /* blend face data across the inset */
1928  {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* scale the offset by surrounding geometry */
1929  {"use_edge_rail", BMO_OP_SLOT_BOOL}, /* inset the region along existing edges */
1930  {"thickness", BMO_OP_SLOT_FLT}, /* thickness */
1931  {"depth", BMO_OP_SLOT_FLT}, /* depth */
1932  {"use_outset", BMO_OP_SLOT_BOOL}, /* outset rather than inset */
1933  {{'\0'}},
1934  },
1935  /* slots_out */
1936  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
1937  {{'\0'}},
1938  },
1942 };
1943 
1944 /*
1945  * Edgeloop Offset.
1946  *
1947  * Creates edge loops based on simple edge-outset method.
1948  */
1950  "offset_edgeloops",
1951  /* slots_in */
1952  {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
1953  {"use_cap_endpoint", BMO_OP_SLOT_BOOL}, /* extend loop around end-points */
1954  {{'\0'}},
1955  },
1956  /* slots_out */
1957  {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output edges */
1958  {{'\0'}},
1959  },
1963 };
1964 
1965 /*
1966  * Wire Frame.
1967  *
1968  * Makes a wire-frame copy of faces.
1969  */
1971  "wireframe",
1972  /* slots_in */
1973  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
1974  {"thickness", BMO_OP_SLOT_FLT}, /* thickness */
1975  {"offset", BMO_OP_SLOT_FLT}, /* offset the thickness from the center */
1976  {"use_replace", BMO_OP_SLOT_BOOL}, /* remove original geometry */
1977  {"use_boundary", BMO_OP_SLOT_BOOL}, /* inset face boundaries */
1978  {"use_even_offset", BMO_OP_SLOT_BOOL}, /* scale the offset to give more even thickness */
1979  {"use_crease", BMO_OP_SLOT_BOOL}, /* crease hub edges for improved subdivision surface */
1980  {"crease_weight", BMO_OP_SLOT_FLT}, /* the mean crease weight for resulting edges */
1981  {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* scale the offset by surrounding geometry */
1982  {"material_offset", BMO_OP_SLOT_INT}, /* offset material index of generated faces */
1983  {{'\0'}},
1984  },
1985  /* slots_out */
1986  {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
1987  {{'\0'}},
1988  },
1993 };
1994 
1996  {BMOP_POKE_MEDIAN_WEIGHTED, "MEAN_WEIGHTED"},
1997  {BMOP_POKE_MEDIAN, "MEAN"},
1998  {BMOP_POKE_BOUNDS, "BOUNDS"},
1999  {0, NULL},
2000 };
2001 
2002 /*
2003  * Pokes a face.
2004  *
2005  * Splits a face into a triangle fan.
2006  */
2008  "poke",
2009  /* slots_in */
2010  {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
2011  {"offset", BMO_OP_SLOT_FLT}, /* center vertex offset along normal */
2012  {"center_mode", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_poke_center_mode}, /* calculation mode for center vertex */
2013  {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* apply offset */
2014  {{'\0'}},
2015  },
2016  /* slots_out */
2017  {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
2018  {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
2019  {{'\0'}},
2020  },
2021  bmo_poke_exec,
2025 };
2026 
2027 #ifdef WITH_BULLET
2028 /*
2029  * Convex Hull
2030  *
2031  * Builds a convex hull from the vertices in 'input'.
2032  *
2033  * If 'use_existing_faces' is true, the hull will not output triangles
2034  * that are covered by a pre-existing face.
2035  *
2036  * All hull vertices, faces, and edges are added to 'geom.out'. Any
2037  * input elements that end up inside the hull (i.e. are not used by an
2038  * output face) are added to the 'interior_geom' slot. The
2039  * 'unused_geom' slot will contain all interior geometry that is
2040  * completely unused. Lastly, 'holes_geom' contains edges and faces
2041  * that were in the input and are part of the hull.
2042  */
2043 static BMOpDefine bmo_convex_hull_def = {
2044  "convex_hull",
2045  /* slots_in */
2046  {{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
2047  {"use_existing_faces", BMO_OP_SLOT_BOOL}, /* skip hull triangles that are covered by a pre-existing face */
2048  {{'\0'}},
2049  },
2050  /* slots_out */
2051  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
2052  {"geom_interior.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
2053  {"geom_unused.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
2054  {"geom_holes.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
2055  {{'\0'}},
2056  },
2061 };
2062 #endif
2063 
2064 /*
2065  * Symmetrize.
2066  *
2067  * Makes the mesh elements in the "input" slot symmetrical. Unlike
2068  * normal mirroring, it only copies in one direction, as specified by
2069  * the "direction" slot. The edges and faces that cross the plane of
2070  * symmetry are split as needed to enforce symmetry.
2071  *
2072  * All new vertices, edges, and faces are added to the "geom.out" slot.
2073  */
2075  "symmetrize",
2076  /* slots_in */
2077  {{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
2078  {"direction", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_axis_neg_xyz_and_xyz}, /* axis to use */
2079  {"dist", BMO_OP_SLOT_FLT}, /* minimum distance */
2080  {"use_shapekey", BMO_OP_SLOT_BOOL}, /* Transform shape keys too. */
2081  {{'\0'}},
2082  },
2083  /* slots_out */
2084  {{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
2085  {{'\0'}},
2086  },
2091 };
2092 
2093 /* clang-format on */
2094 
2095 #undef BM_FACE
2096 #undef BM_EDGE
2097 #undef BM_VERT
2098 
2102  &bmo_bevel_def,
2113 #ifdef WITH_BULLET
2114  &bmo_convex_hull_def,
2115 #endif
2124  &bmo_delete_def,
2147  &bmo_mirror_def,
2151  &bmo_poke_def,
2160  &bmo_rotate_def,
2163  &bmo_scale_def,
2167  &bmo_spin_def,
2168  &bmo_split_def,
2181 };
2182 
#define ARRAY_SIZE(arr)
@ MOD_TRIANGULATE_QUAD_SHORTEDGE
@ MOD_TRIANGULATE_QUAD_FIXED
@ MOD_TRIANGULATE_QUAD_BEAUTY
@ MOD_TRIANGULATE_QUAD_ALTERNATE
@ MOD_TRIANGULATE_NGON_BEAUTY
@ MOD_TRIANGULATE_NGON_EARCLIP
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
@ 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
@ DEL_ONLYTAGGED
@ DEL_FACES_KEEP_BOUNDARY
@ DEL_EDGESFACES
@ DEL_EDGES
@ DEL_FACES
@ DEL_ONLYFACES
@ DEL_VERTS
@ 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
@ SUBD_FALLOFF_SHARP
@ SUBD_FALLOFF_SMOOTH
@ SUBD_FALLOFF_INVSQUARE
@ SUBD_FALLOFF_SPHERE
@ SUBD_FALLOFF_LIN
@ SUBD_FALLOFF_ROOT
@ SUBD_CORNER_FAN
@ SUBD_CORNER_STRAIGHT_CUT
@ SUBD_CORNER_PATH
@ SUBD_CORNER_INNERVERT
@ SUBD_RING_INTERP_SURF
@ SUBD_RING_INTERP_PATH
@ SUBD_RING_INTERP_LINEAR
@ BEVEL_AMT_WIDTH
@ BEVEL_AMT_ABSOLUTE
@ BEVEL_AMT_PERCENT
@ BEVEL_AMT_OFFSET
@ BEVEL_AMT_DEPTH
@ BEVEL_MITER_PATCH
@ BEVEL_MITER_SHARP
@ BEVEL_MITER_ARC
@ BEVEL_PROFILE_SUPERELLIPSE
@ BEVEL_PROFILE_CUSTOM
@ BMOP_POKE_MEDIAN_WEIGHTED
@ BMOP_POKE_BOUNDS
@ BMOP_POKE_MEDIAN
@ BEVEL_FACE_STRENGTH_NONE
@ BEVEL_FACE_STRENGTH_AFFECTED
@ BEVEL_FACE_STRENGTH_NEW
@ BEVEL_FACE_STRENGTH_ALL
@ BEVEL_AFFECT_VERTICES
@ BEVEL_AFFECT_EDGES
void bmo_rotate_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:124
void bmo_region_extend_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:372
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:554
void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dissolve.c:127
void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
Definition: bmo_extrude.c:51
void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
Definition: bmo_inset.c:665
void bmo_face_attribute_fill_exec(BMesh *bm, BMOperator *op)
void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
Definition: bmo_bridge.c:558
void bmo_bevel_exec(BMesh *bm, BMOperator *op)
Definition: bmo_bevel.c:32
void bmo_mirror_exec(BMesh *bm, BMOperator *op)
Definition: bmo_mirror.c:36
void bmo_collapse_exec(BMesh *bm, BMOperator *op)
void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
Definition: bmo_extrude.c:176
void bmo_split_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dupe.c:402
void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op)
void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dissolve.c:488
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:49
void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op)
void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
Definition: bmo_extrude.c:244
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:369
void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op)
Definition: bmo_extrude.c:837
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:656
void bmo_connect_verts_nonplanar_exec(BMesh *bm, BMOperator *op)
void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
Definition: bmo_create.c:38
void bmo_inset_individual_exec(BMesh *bm, BMOperator *op)
Definition: bmo_inset.c:415
void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:571
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:468
void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
Definition: bmo_edgenet.c:38
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:169
void bmo_connect_verts_concave_exec(BMesh *bm, BMOperator *op)
void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dissolve.c:268
void bmo_duplicate_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dupe.c:341
void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
void bmo_translate_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:80
void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
Definition: bmo_edgenet.c:106
void bmo_create_vert_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:39
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:484
void bmo_planar_faces_exec(BMesh *bm, BMOperator *op)
void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
Definition: bmo_beautify.c:35
void bmo_dissolve_degenerate_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dissolve.c:518
void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
Definition: bmo_normals.c:268
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:42
void bmo_delete_exec(BMesh *bm, BMOperator *op)
Definition: bmo_dupe.c:464
void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
Definition: bmo_wireframe.c:34
void bmo_grid_fill_exec(BMesh *bm, BMOperator *op)
void bmo_scale_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:101
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:325
void bmo_reverse_faces_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:145
void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)