1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
|
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Joseph Eagar, Geoffrey Bantle, Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/bmesh/intern/bmesh_opdefines.c
* \ingroup bmesh
*
* BMesh operator definitions.
*
* This file defines (and documents) all bmesh operators (bmops).
*
* Do not rename any operator or slot names! otherwise you must go
* through the code and find all references to them!
*
* A word on slot names:
*
* For geometry input slots, the following are valid names:
* - verts
* - edges
* - faces
* - edgefacein
* - vertfacein
* - vertedgein
* - vertfacein
* - geom
*
* The basic rules are, for single-type geometry slots, use the plural of the
* type name (e.g. edges). for double-type slots, use the two type names plus
* "in" (e.g. edgefacein). for three-type slots, use geom.
*
* for output slots, for single-type geometry slots, use the type name plus "out",
* (e.g. verts.out), for double-type slots, use the two type names plus "out",
* (e.g. vertfaces.out), for three-type slots, use geom. note that you can also
* use more esohteric names (e.g. geom_skirt.out) so long as the comment next to the
* slot definition tells you what types of elements are in it.
*
*/
#include "BLI_utildefines.h"
#include "bmesh.h"
#include "intern/bmesh_operators_private.h"
/* The formatting of these bmesh operators is parsed by
* 'doc/python_api/rst_from_bmesh_opdefines.py'
* for use in python docs, so reStructuredText may be used
* rather then doxygen syntax.
*
* template (py quotes used because nested comments don't work
* on all C compilers):
*
* """
* Region Extend.
*
* paragraph1, Extends bleh bleh bleh.
* Bleh Bleh bleh.
*
* Another paragraph.
*
* Another paragraph.
* """
*
* so the first line is the "title" of the bmop.
* subsequent line blocks separated by blank lines
* are paragraphs. individual descriptions of slots
* are extracted from comments next to them.
*
* eg:
* {BMO_OP_SLOT_ELEMENT_BUF, "geom.out"}, """ output slot, boundary region """
*
* ... or:
*
* """ output slot, boundary region """
* {BMO_OP_SLOT_ELEMENT_BUF, "geom.out"},
*
* Both are acceptable.
* note that '//' comments are ignored.
*/
/*
* Vertex Smooth.
*
* Smooths vertices by using a basic vertex averaging scheme.
*/
static BMOpDefine bmo_smooth_vert_def = {
"smooth_vert",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{"mirror_clip_x", BMO_OP_SLOT_BOOL}, /* set vertices close to the x axis before the operation to 0 */
{"mirror_clip_y", BMO_OP_SLOT_BOOL}, /* set vertices close to the y axis before the operation to 0 */
{"mirror_clip_z", BMO_OP_SLOT_BOOL}, /* set vertices close to the z axis before the operation to 0 */
{"clip_dist", BMO_OP_SLOT_FLT}, /* clipping threshold for the above three slots */
{"use_axis_x", BMO_OP_SLOT_BOOL}, /* smooth vertices along X axis */
{"use_axis_y", BMO_OP_SLOT_BOOL}, /* smooth vertices along Y axis */
{"use_axis_z", BMO_OP_SLOT_BOOL}, /* smooth vertices along Z axis */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_smooth_vert_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
* Vertext Smooth Laplacian.
*
* Smooths vertices by using Laplacian smoothing propose by.
* Desbrun, et al. Implicit Fairing of Irregular Meshes using Diffusion and Curvature Flow.
*/
static BMOpDefine bmo_smooth_laplacian_vert_def = {
"smooth_laplacian_vert",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{"lambda_factor", BMO_OP_SLOT_FLT}, /* lambda param */
{"lambda_border", BMO_OP_SLOT_FLT}, /* lambda param in border */
{"use_x", BMO_OP_SLOT_BOOL}, /* Smooth object along X axis */
{"use_y", BMO_OP_SLOT_BOOL}, /* Smooth object along Y axis */
{"use_z", BMO_OP_SLOT_BOOL}, /* Smooth object along Z axis */
{"preserve_volume", BMO_OP_SLOT_BOOL}, /* Apply volume preservation after smooth */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_smooth_laplacian_vert_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
* Right-Hand Faces.
*
* Computes an "outside" normal for the specified input faces.
*/
static BMOpDefine bmo_recalc_face_normals_def = {
"recalc_face_normals",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_recalc_face_normals_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
* Region Extend.
*
* used to implement the select more/less tools.
* this puts some geometry surrounding regions of
* geometry in geom into geom.out.
*
* if use_faces is 0 then geom.out spits out verts and edges,
* otherwise it spits out faces.
*/
static BMOpDefine bmo_region_extend_def = {
"region_extend",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
{"use_constrict", BMO_OP_SLOT_BOOL}, /* find boundary inside the regions, not outside. */
{"use_faces", BMO_OP_SLOT_BOOL}, /* extend from faces instead of edges */
{{'\0'}},
},
/* slots_out */
{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output slot, computed boundary geometry. */
{{'\0'}},
},
bmo_region_extend_exec,
BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Edge Rotate.
*
* Rotates edges topologically. Also known as "spin edge" to some people.
* Simple example: ``[/] becomes [|] then [\]``.
*/
static BMOpDefine bmo_rotate_edges_def = {
"rotate_edges",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
{"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate edge counter-clockwise if true, otherwise clockwise */
{{'\0'}},
},
/* slots_out */
{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* newly spun edges */
{{'\0'}},
},
bmo_rotate_edges_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Reverse Faces.
*
* Reverses the winding (vertex order) of faces.
* This has the effect of flipping the normal.
*/
static BMOpDefine bmo_reverse_faces_def = {
"reverse_faces",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_reverse_faces_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
* Edge Bisect.
*
* Splits input edges (but doesn't do anything else).
* This creates a 2-valence vert.
*/
static BMOpDefine bmo_bisect_edges_def = {
"bisect_edges",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
{"cuts", BMO_OP_SLOT_INT}, /* number of cuts */
{"edge_percents", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_FLT}},
{{'\0'}},
},
/* slots_out */
{{"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* newly created vertices and edges */
{{'\0'}},
},
bmo_bisect_edges_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Mirror.
*
* Mirrors geometry along an axis. The resulting geometry is welded on using
* merge_dist. Pairs of original/mirrored vertices are welded using the merge_dist
* parameter (which defines the minimum distance for welding to happen).
*/
static BMOpDefine bmo_mirror_def = {
"mirror",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix defining the mirror transformation */
{"merge_dist", BMO_OP_SLOT_FLT}, /* maximum distance for merging. does no merging if 0. */
{"axis", BMO_OP_SLOT_INT}, /* the axis to use, 0, 1, or 2 for x, y, z */
{"mirror_u", BMO_OP_SLOT_BOOL}, /* mirror UVs across the u axis */
{"mirror_v", BMO_OP_SLOT_BOOL}, /* mirror UVs across the v axis */
{{'\0'}},
},
/* slots_out */
{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output geometry, mirrored */
{{'\0'}},
},
bmo_mirror_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Find Doubles.
*
* Takes input verts and find vertices they should weld to.
* Outputs a mapping slot suitable for use with the weld verts bmop.
*
* If keep_verts is used, vertices outside that set can only be merged
* with vertices in that set.
*/
static BMOpDefine bmo_find_doubles_def = {
"find_doubles",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{"keep_verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* list of verts to keep */
{"dist", BMO_OP_SLOT_FLT}, /* minimum distance */
{{'\0'}},
},
/* slots_out */
{{"targetmap.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
{{'\0'}},
},
bmo_find_doubles_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Remove Doubles.
*
* Finds groups of vertices closer then dist and merges them together,
* using the weld verts bmop.
*/
static BMOpDefine bmo_remove_doubles_def = {
"remove_doubles",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input verts */
{"dist", BMO_OP_SLOT_FLT}, /* minimum distance */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_remove_doubles_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Auto Merge.
*
* Finds groups of vertices closer then **dist** and merges them together,
* using the weld verts bmop. The merges must go from a vert not in
* **verts** to one in **verts**.
*/
static BMOpDefine bmo_automerge_def = {
"automerge",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input verts */
{"dist", BMO_OP_SLOT_FLT}, /* minimum distance */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_automerge_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Collapse Connected.
*
* Collapses connected vertices
*/
static BMOpDefine bmo_collapse_def = {
"collapse",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_collapse_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Face-Data Point Merge.
*
* Merge uv/vcols at a specific vertex.
*/
static BMOpDefine bmo_pointmerge_facedata_def = {
"pointmerge_facedata",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{"vert_snap", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* snap vertex */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_pointmerge_facedata_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Average Vertices Facevert Data.
*
* Merge uv/vcols associated with the input vertices at
* the bounding box center. (I know, it's not averaging but
* the vert_snap_to_bb_center is just too long).
*/
static BMOpDefine bmo_average_vert_facedata_def = {
"average_vert_facedata",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_average_vert_facedata_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Point Merge.
*
* Merge verts together at a point.
*/
static BMOpDefine bmo_pointmerge_def = {
"pointmerge",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{"merge_co", BMO_OP_SLOT_VEC},
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_pointmerge_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Collapse Connected UV's.
*
* Collapses connected UV vertices.
*/
static BMOpDefine bmo_collapse_uvs_def = {
"collapse_uvs",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_collapse_uvs_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Weld Verts.
*
* Welds verts together (kind-of like remove doubles, merge, etc, all of which
* use or will use this bmop). You pass in mappings from vertices to the vertices
* they weld with.
*/
static BMOpDefine bmo_weld_verts_def = {
"weld_verts",
/* slots_in */
/* maps welded vertices to verts they should weld to */
{{"targetmap", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_weld_verts_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Make Vertex.
*
* Creates a single vertex; this bmop was necessary
* for click-create-vertex.
*/
static BMOpDefine bmo_create_vert_def = {
"create_vert",
/* slots_in */
{{"co", BMO_OP_SLOT_VEC}, /* the coordinate of the new vert */
{{'\0'}},
},
/* slots_out */
{{"vert.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* the new vert */
{{'\0'}},
},
bmo_create_vert_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Join Triangles.
*
* Tries to intelligently join triangles according
* to various settings and stuff.
*/
static BMOpDefine bmo_join_triangles_def = {
"join_triangles",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input geometry. */
{"cmp_sharp", BMO_OP_SLOT_BOOL},
{"cmp_uvs", BMO_OP_SLOT_BOOL},
{"cmp_vcols", BMO_OP_SLOT_BOOL},
{"cmp_materials", BMO_OP_SLOT_BOOL},
{"limit", BMO_OP_SLOT_FLT},
{{'\0'}},
},
/* slots_out */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* joined faces */
{{'\0'}},
},
bmo_join_triangles_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Contextual Create.
*
* This is basically F-key, it creates
* new faces from vertices, makes stuff from edge nets,
* makes wire edges, etc. It also dissolves faces.
*
* Three verts become a triangle, four become a quad. Two
* become a wire edge.
*/
static BMOpDefine bmo_contextual_create_def = {
"contextual_create",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input geometry. */
{"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
{"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth to use */
{{'\0'}},
},
/* slots_out */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* newly-made face(s) */
/* note, this is for stand-alone edges only, not edges which are apart of newly created faces */
{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* newly-made edge(s) */
{{'\0'}},
},
bmo_contextual_create_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Bridge edge loops with faces.
*/
static BMOpDefine bmo_bridge_loops_def = {
"bridge_loops",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
{"use_pairs", BMO_OP_SLOT_BOOL},
{"use_cyclic", BMO_OP_SLOT_BOOL},
{"use_merge", BMO_OP_SLOT_BOOL},
{"merge_factor", BMO_OP_SLOT_FLT},
{"twist_offset", BMO_OP_SLOT_INT},
{{'\0'}},
},
/* slots_out */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* new edges */
{{'\0'}},
},
bmo_bridge_loops_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Grid Fill.
*
* Create faces defined by 2 disconnected edge loops (which share edges).
*/
static BMOpDefine bmo_grid_fill_def = {
"grid_fill",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
/* restricts edges to groups. maps edges to integer */
{"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
{"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */
{"use_interp_simple", BMO_OP_SLOT_BOOL}, /* use simple interpolation */
{{'\0'}},
},
/* slots_out */
/* maps new faces to the group numbers they came from */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
{{'\0'}},
},
bmo_grid_fill_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Fill Holes.
*
* Fill boundary edges with faces, copying surrounding customdata.
*/
static BMOpDefine bmo_holes_fill_def = {
"holes_fill",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
{"sides", BMO_OP_SLOT_INT}, /* number of face sides to fill */
{{'\0'}},
},
/* slots_out */
/* maps new faces to the group numbers they came from */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
{{'\0'}},
},
bmo_holes_fill_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Face Attribute Fill.
*
* Fill in faces with data from adjacent faces.
*/
static BMOpDefine bmo_face_attribute_fill_def = {
"face_attribute_fill",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"use_normals", BMO_OP_SLOT_BOOL}, /* copy face winding */
{"use_data", BMO_OP_SLOT_BOOL}, /* copy face data */
{{'\0'}},
},
/* slots_out */
/* maps new faces to the group numbers they came from */
{{"faces_fail.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* faces that could not be handled */
{{'\0'}},
},
bmo_face_attribute_fill_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Edge Loop Fill.
*
* Create faces defined by one or more non overlapping edge loops.
*/
static BMOpDefine bmo_edgeloop_fill_def = {
"edgeloop_fill",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
/* restricts edges to groups. maps edges to integer */
{"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
{"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */
{{'\0'}},
},
/* slots_out */
/* maps new faces to the group numbers they came from */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
{{'\0'}},
},
bmo_edgeloop_fill_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Edge Net Fill.
*
* Create faces defined by enclosed edges.
*/
static BMOpDefine bmo_edgenet_fill_def = {
"edgenet_fill",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
{"mat_nr", BMO_OP_SLOT_INT}, /* material to use */
{"use_smooth", BMO_OP_SLOT_BOOL}, /* smooth state to use */
{"sides", BMO_OP_SLOT_INT}, /* number of sides */
{{'\0'}},
},
/* slots_out */
/* maps new faces to the group numbers they came from */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */
{{'\0'}},
},
bmo_edgenet_fill_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Edgenet Prepare.
*
* Identifies several useful edge loop cases and modifies them so
* they'll become a face when edgenet_fill is called. The cases covered are:
*
* - One single loop; an edge is added to connect the ends
* - Two loops; two edges are added to connect the endpoints (based on the
* shortest distance between each endpont).
*/
static BMOpDefine bmo_edgenet_prepare_def = {
"edgenet_prepare",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
{{'\0'}},
},
/* slots_out */
{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* new edges */
{{'\0'}},
},
bmo_edgenet_prepare_exec,
BMO_OPTYPE_FLAG_NOP,
};
/*
* Rotate.
*
* Rotate vertices around a center, using a 3x3 rotation matrix.
*/
static BMOpDefine bmo_rotate_def = {
"rotate",
/* slots_in */
{{"cent", BMO_OP_SLOT_VEC}, /* center of rotation */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix defining rotation */
{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_rotate_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
* Translate.
*
* Translate vertices by an offset.
*/
static BMOpDefine bmo_translate_def = {
"translate",
/* slots_in */
{{"vec", BMO_OP_SLOT_VEC}, /* translation offset */
{"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_translate_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
* Scale.
*
* Scales vertices by an offset.
*/
static BMOpDefine bmo_scale_def = {
"scale",
/* slots_in */
{{"vec", BMO_OP_SLOT_VEC}, /* scale factor */
{"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_scale_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
* Transform.
*
* Transforms a set of vertices by a matrix. Multiplies
* the vertex coordinates with the matrix.
*/
static BMOpDefine bmo_transform_def = {
"transform",
/* slots_in */
{{"matrix", BMO_OP_SLOT_MAT}, /* transform matrix */
{"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_transform_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
* Object Load BMesh.
*
* Loads a bmesh into an object/mesh. This is a "private"
* bmop.
*/
static BMOpDefine bmo_object_load_bmesh_def = {
"object_load_bmesh",
/* slots_in */
{{"scene", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_SCENE}},
{"object", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}},
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_object_load_bmesh_exec,
BMO_OPTYPE_FLAG_NOP,
};
/*
* BMesh to Mesh.
*
* Converts a bmesh to a Mesh. This is reserved for exiting editmode.
*/
static BMOpDefine bmo_bmesh_to_mesh_def = {
"bmesh_to_mesh",
/* slots_in */
{
/* pointer to a mesh structure to fill in */
{"mesh", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_MESH}},
/* pointer to an object structure */
{"object", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}},
{"skip_tessface", BMO_OP_SLOT_BOOL}, /* don't calculate mfaces */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_bmesh_to_mesh_exec,
BMO_OPTYPE_FLAG_NOP,
};
/*
* Mesh to BMesh.
*
* Load the contents of a mesh into the bmesh. this bmop is private, it's
* reserved exclusively for entering editmode.
*/
static BMOpDefine bmo_mesh_to_bmesh_def = {
"mesh_to_bmesh",
/* slots_in */
{
/* pointer to a Mesh structure */
{"mesh", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_MESH}},
/* pointer to an Object structure */
{"object", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_OBJECT}},
{"use_shapekey", BMO_OP_SLOT_BOOL}, /* load active shapekey coordinates into verts */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_mesh_to_bmesh_exec,
BMO_OPTYPE_FLAG_NOP,
};
/*
* Individual Face Extrude.
*
* Extrudes faces individually.
*/
static BMOpDefine bmo_extrude_discrete_faces_def = {
"extrude_discrete_faces",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{{'\0'}},
},
/* slots_out */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}},
},
bmo_extrude_discrete_faces_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Extrude Only Edges.
*
* Extrudes Edges into faces, note that this is very simple, there's no fancy
* winged extrusion.
*/
static BMOpDefine bmo_extrude_edge_only_def = {
"extrude_edge_only",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input vertices */
{{'\0'}},
},
/* slots_out */
{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* output geometry */
{{'\0'}},
},
bmo_extrude_edge_only_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Individual Vertex Extrude.
*
* Extrudes wire edges from vertices.
*/
static BMOpDefine bmo_extrude_vert_indiv_def = {
"extrude_vert_indiv",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{{'\0'}},
},
/* slots_out */
{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output wire edges */
{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output vertices */
{{'\0'}},
},
bmo_extrude_vert_indiv_exec,
BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Connect Verts.
*
* Split faces by adding edges that connect **verts**.
*/
static BMOpDefine bmo_connect_verts_def = {
"connect_verts",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},
{{'\0'}},
},
/* slots_out */
{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
{{'\0'}},
},
bmo_connect_verts_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Connect Verts Across non Planer Faces.
*
* Split faces by connecting edges along non planer **faces**.
*/
static BMOpDefine bmo_connect_verts_nonplanar_def = {
"connect_verts_nonplanar",
/* slots_in */
{{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */
{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
{{'\0'}},
},
/* slots_out */
{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
{{'\0'}},
},
bmo_connect_verts_nonplanar_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Connect Verts.
*
* Split faces by adding edges that connect **verts**.
*/
static BMOpDefine bmo_connect_vert_pair_def = {
"connect_vert_pair",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},
{{'\0'}},
},
/* slots_out */
{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
{{'\0'}},
},
bmo_connect_vert_pair_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Extrude Faces.
*
* Extrude operator (does not transform)
*/
static BMOpDefine bmo_extrude_face_region_def = {
"extrude_face_region",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* edges and faces */
{"edges_exclude", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_EMPTY}},
{"use_keep_orig", BMO_OP_SLOT_BOOL}, /* keep original geometry */
{{'\0'}},
},
/* slots_out */
{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{{'\0'}},
},
bmo_extrude_face_region_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Dissolve Verts.
*/
static BMOpDefine bmo_dissolve_verts_def = {
"dissolve_verts",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},
{"use_face_split", BMO_OP_SLOT_BOOL},
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_dissolve_verts_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Dissolve Edges.
*/
static BMOpDefine bmo_dissolve_edges_def = {
"dissolve_edges",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
{"use_verts", BMO_OP_SLOT_BOOL}, /* dissolve verts left between only 2 edges. */
{"use_face_split", BMO_OP_SLOT_BOOL},
{{'\0'}},
},
/* slots_out */
{{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
{{'\0'}},
},
bmo_dissolve_edges_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Dissolve Faces.
*/
static BMOpDefine bmo_dissolve_faces_def = {
"dissolve_faces",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
{"use_verts", BMO_OP_SLOT_BOOL}, /* dissolve verts left between only 2 edges. */
{{'\0'}},
},
/* slots_out */
{{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
{{'\0'}},
},
bmo_dissolve_faces_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Limited Dissolve.
*
* Dissolve planar faces and co-linear edges.
*/
static BMOpDefine bmo_dissolve_limit_def = {
"dissolve_limit",
/* slots_in */
{{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */
{"use_dissolve_boundaries", BMO_OP_SLOT_BOOL},
{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},
{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
{"delimit", BMO_OP_SLOT_INT},
{{'\0'}},
},
/* slots_out */
{{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
{{'\0'}}},
bmo_dissolve_limit_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Degenerate Dissolve.
*
* Dissolve edges with no length, faces with no area.
*/
static BMOpDefine bmo_dissolve_degenerate_def = {
"dissolve_degenerate",
/* slots_in */
{{"dist", BMO_OP_SLOT_FLT}, /* minimum distance to consider degenerate */
{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
{{'\0'}},
},
/* slots_out */
{{{'\0'}}},
bmo_dissolve_degenerate_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Triangulate.
*/
static BMOpDefine bmo_triangulate_def = {
"triangulate",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
{"quad_method", BMO_OP_SLOT_INT},
{"ngon_method", BMO_OP_SLOT_INT},
{{'\0'}},
},
/* slots_out */
{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
{"face_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
{{'\0'}},
},
bmo_triangulate_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Un-Subdivide.
*
* Reduce detail in geometry containing grids.
*/
static BMOpDefine bmo_unsubdivide_def = {
"unsubdivide",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{"iterations", BMO_OP_SLOT_INT},
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_unsubdivide_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Subdivide Edges.
*
* Advanced operator for subdividing edges
* with options for face patterns, smoothing and randomization.
*/
static BMOpDefine bmo_subdivide_edges_def = {
"subdivide_edges",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
{"smooth", BMO_OP_SLOT_FLT},
{"smooth_falloff", BMO_OP_SLOT_INT}, /* SUBD_FALLOFF_ROOT and friends */
{"fractal", BMO_OP_SLOT_FLT},
{"along_normal", BMO_OP_SLOT_FLT},
{"cuts", BMO_OP_SLOT_INT},
{"seed", BMO_OP_SLOT_INT},
{"custom_patterns", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL}}, /* uses custom pointers */
{"edge_percents", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_FLT}},
{"quad_corner_type", BMO_OP_SLOT_INT}, /* quad corner type, see bmesh_operators.h */
{"use_grid_fill", BMO_OP_SLOT_BOOL}, /* fill in fully-selected faces with a grid */
{"use_single_edge", BMO_OP_SLOT_BOOL}, /* tessellate the case of one edge selected in a quad or triangle */
{"use_only_quads", BMO_OP_SLOT_BOOL}, /* only subdivide quads (for loopcut) */
{"use_sphere", BMO_OP_SLOT_BOOL}, /* for making new primitives only */
{"use_smooth_even", BMO_OP_SLOT_BOOL}, /* maintain even offset when smoothing */
{{'\0'}},
},
/* slots_out */
{/* these next three can have multiple types of elements in them */
{"geom_inner.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"geom_split.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* contains all output geometry */
{{'\0'}},
},
bmo_subdivide_edges_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Subdivide Edge-Ring.
*
* Take an edge-ring, and supdivide with interpolation options.
*/
static BMOpDefine bmo_subdivide_edgering_def = {
"subdivide_edgering",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input vertices */
{"interp_mode", BMO_OP_SLOT_INT},
{"smooth", BMO_OP_SLOT_FLT},
{"cuts", BMO_OP_SLOT_INT},
{"profile_shape", BMO_OP_SLOT_INT},
{"profile_shape_factor", BMO_OP_SLOT_FLT},
{{'\0'}},
},
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}}},
bmo_subdivide_edgering_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Bisect Plane.
*
* Bisects the mesh by a plane (cut the mesh in half).
*/
static BMOpDefine bmo_bisect_plane_def = {
"bisect_plane",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"dist", BMO_OP_SLOT_FLT}, /* minimum distance when testing if a vert is exactly on the plane */
{"plane_co", BMO_OP_SLOT_VEC}, /* point on the plane */
{"plane_no", BMO_OP_SLOT_VEC}, /* direction of the plane */
{"use_snap_center", BMO_OP_SLOT_BOOL}, /* snap axis aligned verts to the center */
{"clear_outer", BMO_OP_SLOT_BOOL}, /* when enabled. remove all geometry on the positive side of the plane */
{"clear_inner", BMO_OP_SLOT_BOOL}, /* when enabled. remove all geometry on the negative side of the plane */
{{'\0'}},
},
{{"geom_cut.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE}}, /* output new geometry from the cut */
{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input and output geometry (result of cut) */
{{'\0'}}},
bmo_bisect_plane_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Delete Geometry.
*
* Utility operator to delete geometry.
*/
static BMOpDefine bmo_delete_def = {
"delete",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"context", BMO_OP_SLOT_INT}, /* enum DEL_VERTS ... */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_delete_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Duplicate Geometry.
*
* Utility operator to duplicate geometry,
* optionally into a destination mesh.
*/
static BMOpDefine bmo_duplicate_def = {
"duplicate",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
/* destination bmesh, if NULL will use current on */
{"dest", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_BMESH}},
{{'\0'}},
},
/* slots_out */
{{"geom_orig.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
/* facemap maps from source faces to dupe
* faces, and from dupe faces to source faces */
{"vert_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
{"edge_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
{"face_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
{"boundary_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
{"isovert_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
{{'\0'}},
},
bmo_duplicate_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Split Off Geometry.
*
* Disconnect geometry from adjacent edges and faces,
* optionally into a destination mesh.
*/
static BMOpDefine bmo_split_def = {
"split",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
/* destination bmesh, if NULL will use current one */
{"dest", BMO_OP_SLOT_PTR, {BMO_OP_SLOT_SUBTYPE_PTR_BMESH}},
{"use_only_faces", BMO_OP_SLOT_BOOL}, /* when enabled. don't duplicate loose verts/edges */
{{'\0'}},
},
/* slots_out */
{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"boundary_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
{"isovert_map.out", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_ELEM}},
{{'\0'}},
},
bmo_split_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Spin.
*
* Extrude or duplicate geometry a number of times,
* rotating and possibly translating after each step
*/
static BMOpDefine bmo_spin_def = {
"spin",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"cent", BMO_OP_SLOT_VEC}, /* rotation center */
{"axis", BMO_OP_SLOT_VEC}, /* rotation axis */
{"dvec", BMO_OP_SLOT_VEC}, /* translation delta per step */
{"angle", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */
{"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */
{"steps", BMO_OP_SLOT_INT}, /* number of steps */
{"use_duplicate", BMO_OP_SLOT_BOOL}, /* duplicate or extrude? */
{{'\0'}},
},
/* slots_out */
{{"geom_last.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* result of last step */
{{'\0'}},
},
bmo_spin_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Similar Faces Search.
*
* Find similar faces (area/material/perimeter, ...).
*/
static BMOpDefine bmo_similar_faces_def = {
"similar_faces",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"type", BMO_OP_SLOT_INT}, /* type of selection */
{"thresh", BMO_OP_SLOT_FLT}, /* threshold of selection */
{"compare", BMO_OP_SLOT_INT}, /* comparison method */
{{'\0'}},
},
/* slots_out */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}},
},
bmo_similar_faces_exec,
BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Similar Edges Search.
*
* Find similar edges (length, direction, edge, seam, ...).
*/
static BMOpDefine bmo_similar_edges_def = {
"similar_edges",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
{"type", BMO_OP_SLOT_INT}, /* type of selection */
{"thresh", BMO_OP_SLOT_FLT}, /* threshold of selection */
{"compare", BMO_OP_SLOT_INT}, /* comparison method */
{{'\0'}},
},
/* slots_out */
{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* output edges */
{{'\0'}},
},
bmo_similar_edges_exec,
BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Similar Verts Search.
*
* Find similar vertices (normal, face, vertex group, ...).
*/
static BMOpDefine bmo_similar_verts_def = {
"similar_verts",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{"type", BMO_OP_SLOT_INT}, /* type of selection */
{"thresh", BMO_OP_SLOT_FLT}, /* threshold of selection */
{"compare", BMO_OP_SLOT_INT}, /* comparison method */
{{'\0'}},
},
/* slots_out */
{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output vertices */
{{'\0'}},
},
bmo_similar_verts_exec,
BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* UV Rotation.
*
* Cycle the loop UV's
*/
static BMOpDefine bmo_rotate_uvs_def = {
"rotate_uvs",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate counter-clockwise if true, otherwise clockwise */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_rotate_uvs_exec,
BMO_OPTYPE_FLAG_NOP,
};
/*
* UV Reverse.
*
* Reverse the UV's
*/
static BMOpDefine bmo_reverse_uvs_def = {
"reverse_uvs",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_reverse_uvs_exec,
BMO_OPTYPE_FLAG_NOP,
};
/*
* Color Rotation.
*
* Cycle the loop colors
*/
static BMOpDefine bmo_rotate_colors_def = {
"rotate_colors",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate counter-clockwise if true, otherwise clockwise */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_rotate_colors_exec,
BMO_OPTYPE_FLAG_NOP,
};
/*
* Color Reverse
*
* Reverse the loop colors.
*/
static BMOpDefine bmo_reverse_colors_def = {
"reverse_colors",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
bmo_reverse_colors_exec,
BMO_OPTYPE_FLAG_NOP,
};
/*
* Edge Split.
*
* Disconnects faces along input edges.
*/
static BMOpDefine bmo_split_edges_def = {
"split_edges",
/* slots_in */
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
/* needed for vertex rip so we can rip only half an edge at a boundary wich would otherwise split off */
{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* optional tag verts, use to have greater control of splits */
{"use_verts", BMO_OP_SLOT_BOOL}, /* use 'verts' for splitting, else just find verts to split from edges */
{{'\0'}},
},
/* slots_out */
{{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* old output disconnected edges */
{{'\0'}},
},
bmo_split_edges_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Create Grid.
*
* Creates a grid with a variable number of subdivisions
*/
static BMOpDefine bmo_create_grid_def = {
"create_grid",
/* slots_in */
{{"x_segments", BMO_OP_SLOT_INT}, /* number of x segments */
{"y_segments", BMO_OP_SLOT_INT}, /* number of y segments */
{"size", BMO_OP_SLOT_FLT}, /* size of the grid */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
{{'\0'}},
},
/* slots_out */
{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
{{'\0'}},
},
bmo_create_grid_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Create UV Sphere.
*
* Creates a grid with a variable number of subdivisions
*/
static BMOpDefine bmo_create_uvsphere_def = {
"create_uvsphere",
/* slots_in */
{{"u_segments", BMO_OP_SLOT_INT}, /* number of u segments */
{"v_segments", BMO_OP_SLOT_INT}, /* number of v segment */
{"diameter", BMO_OP_SLOT_FLT}, /* diameter */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
{{'\0'}},
},
/* slots_out */
{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
{{'\0'}},
},
bmo_create_uvsphere_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Create Ico-Sphere.
*
* Creates a grid with a variable number of subdivisions
*/
static BMOpDefine bmo_create_icosphere_def = {
"create_icosphere",
/* slots_in */
{{"subdivisions", BMO_OP_SLOT_INT}, /* how many times to recursively subdivide the sphere */
{"diameter", BMO_OP_SLOT_FLT}, /* diameter */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
{{'\0'}},
},
/* slots_out */
{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
{{'\0'}},
},
bmo_create_icosphere_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Create Suzanne.
*
* Creates a monkey (standard blender primitive).
*/
static BMOpDefine bmo_create_monkey_def = {
"create_monkey",
/* slots_in */
{{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
{{'\0'}},
},
/* slots_out */
{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
{{'\0'}},
},
bmo_create_monkey_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Create Cone.
*
* Creates a cone with variable depth at both ends
*/
static BMOpDefine bmo_create_cone_def = {
"create_cone",
/* slots_in */
{{"cap_ends", BMO_OP_SLOT_BOOL}, /* whether or not to fill in the ends with faces */
{"cap_tris", BMO_OP_SLOT_BOOL}, /* fill ends with triangles instead of ngons */
{"segments", BMO_OP_SLOT_INT},
{"diameter1", BMO_OP_SLOT_FLT}, /* diameter of one end */
{"diameter2", BMO_OP_SLOT_FLT}, /* diameter of the opposite */
{"depth", BMO_OP_SLOT_FLT}, /* distance between ends */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
{{'\0'}},
},
/* slots_out */
{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
{{'\0'}},
},
bmo_create_cone_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Creates a Circle.
*/
static BMOpDefine bmo_create_circle_def = {
"create_circle",
/* slots_in */
{{"cap_ends", BMO_OP_SLOT_BOOL}, /* whether or not to fill in the ends with faces */
{"cap_tris", BMO_OP_SLOT_BOOL}, /* fill ends with triangles instead of ngons */
{"segments", BMO_OP_SLOT_INT},
{"diameter", BMO_OP_SLOT_FLT}, /* diameter of one end */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
{{'\0'}},
},
/* slots_out */
{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
{{'\0'}},
},
bmo_create_circle_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Create Cube
*
* Creates a cube.
*/
static BMOpDefine bmo_create_cube_def = {
"create_cube",
/* slots_in */
{{"size", BMO_OP_SLOT_FLT}, /* size of the cube */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
{{'\0'}},
},
/* slots_out */
{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
{{'\0'}},
},
bmo_create_cube_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Bevel.
*
* Bevels edges and vertices
*/
static BMOpDefine bmo_bevel_def = {
"bevel",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input edges and vertices */
{"offset", BMO_OP_SLOT_FLT}, /* amount to offset beveled edge */
{"offset_type", BMO_OP_SLOT_INT}, /* how to measure offset (enum) */
{"segments", BMO_OP_SLOT_INT}, /* number of segments in bevel */
{"profile", BMO_OP_SLOT_FLT}, /* profile shape, 0->1 (.5=>round) */
{"vertex_only", BMO_OP_SLOT_BOOL}, /* only bevel vertices, not edges */
{{'\0'}},
},
/* slots_out */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}},
},
bmo_bevel_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Beautify Fill.
*
* Rotate edges to create more evenly spaced triangles.
*/
static BMOpDefine bmo_beautify_fill_def = {
"beautify_fill",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* edges that can be flipped */
{"use_restrict_tag", BMO_OP_SLOT_BOOL}, /* restrict edge rotation to mixed tagged vertices */
{"method", BMO_OP_SLOT_INT}, /* method to define what is beautiful */
{{'\0'}},
},
/* slots_out */
{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* new flipped faces and edges */
{{'\0'}},
},
bmo_beautify_fill_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Triangle Fill.
*
* Fill edges with triangles
*/
static BMOpDefine bmo_triangle_fill_def = {
"triangle_fill",
/* slots_in */
{{"use_beauty", BMO_OP_SLOT_BOOL},
{"use_dissolve", BMO_OP_SLOT_BOOL}, /* dissolve resulting faces */
{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
{"normal", BMO_OP_SLOT_VEC}, /* optionally pass the fill normal to use */
{{'\0'}},
},
/* slots_out */
{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* new faces and edges */
{{'\0'}},
},
bmo_triangle_fill_exec,
BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Solidify.
*
* Turns a mesh into a shell with thickness
*/
static BMOpDefine bmo_solidify_def = {
"solidify",
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"thickness", BMO_OP_SLOT_FLT},
{{'\0'}},
},
/* slots_out */
{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{{'\0'}},
},
bmo_solidify_face_region_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Face Inset (Individual).
*
* Insets individual faces.
*/
static BMOpDefine bmo_inset_individual_def = {
"inset_individual",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"thickness", BMO_OP_SLOT_FLT},
{"depth", BMO_OP_SLOT_FLT},
{"use_even_offset", BMO_OP_SLOT_BOOL},
{"use_interpolate", BMO_OP_SLOT_BOOL},
{"use_relative_offset", BMO_OP_SLOT_BOOL},
{{'\0'}},
},
/* slots_out */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}},
},
bmo_inset_individual_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC, /* caller needs to handle BMO_OPTYPE_FLAG_SELECT_FLUSH */
};
/*
* Face Inset (Regions).
*
* Inset or outset face regions.
*/
static BMOpDefine bmo_inset_region_def = {
"inset_region",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"use_boundary", BMO_OP_SLOT_BOOL},
{"use_even_offset", BMO_OP_SLOT_BOOL},
{"use_interpolate", BMO_OP_SLOT_BOOL},
{"use_relative_offset", BMO_OP_SLOT_BOOL},
{"use_edge_rail", BMO_OP_SLOT_BOOL},
{"thickness", BMO_OP_SLOT_FLT},
{"depth", BMO_OP_SLOT_FLT},
{"use_outset", BMO_OP_SLOT_BOOL},
{{'\0'}},
},
/* slots_out */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}},
},
bmo_inset_region_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Wire Frame.
*
* Makes a wire-frame copy of faces.
*/
static BMOpDefine bmo_wireframe_def = {
"wireframe",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"thickness", BMO_OP_SLOT_FLT},
{"offset", BMO_OP_SLOT_FLT},
{"use_replace", BMO_OP_SLOT_BOOL},
{"use_boundary", BMO_OP_SLOT_BOOL},
{"use_even_offset", BMO_OP_SLOT_BOOL},
{"use_crease", BMO_OP_SLOT_BOOL},
{"crease_weight", BMO_OP_SLOT_FLT},
{"thickness", BMO_OP_SLOT_FLT},
{"use_relative_offset", BMO_OP_SLOT_BOOL},
{"material_offset", BMO_OP_SLOT_INT},
{{'\0'}},
},
/* slots_out */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}},
},
bmo_wireframe_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
* Pokes a face.
*
* Splits a face into a triangle fan.
*/
static BMOpDefine bmo_poke_def = {
"poke",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"offset", BMO_OP_SLOT_FLT}, /* center vertex offset along normal */
{"center_mode", BMO_OP_SLOT_INT}, /* calculation mode for center vertex */
{"use_relative_offset", BMO_OP_SLOT_BOOL}, /* apply offset */
{{'\0'}},
},
/* slots_out */
{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}},
},
bmo_poke_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
#ifdef WITH_BULLET
/*
* Convex Hull
*
* Builds a convex hull from the vertices in 'input'.
*
* If 'use_existing_faces' is true, the hull will not output triangles
* that are covered by a pre-existing face.
*
* All hull vertices, faces, and edges are added to 'geom.out'. Any
* input elements that end up inside the hull (i.e. are not used by an
* output face) are added to the 'interior_geom' slot. The
* 'unused_geom' slot will contain all interior geometry that is
* completely unused. Lastly, 'holes_geom' contains edges and faces
* that were in the input and are part of the hull.
*/
static BMOpDefine bmo_convex_hull_def = {
"convex_hull",
/* slots_in */
{{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"use_existing_faces", BMO_OP_SLOT_BOOL},
{{'\0'}},
},
/* slots_out */
{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"geom_interior.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"geom_unused.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"geom_holes.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{{'\0'}},
},
bmo_convex_hull_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
#endif
/*
* Symmetrize.
*
* Makes the mesh elements in the "input" slot symmetrical. Unlike
* normal mirroring, it only copies in one direction, as specified by
* the "direction" slot. The edges and faces that cross the plane of
* symmetry are split as needed to enforce symmetry.
*
* All new vertices, edges, and faces are added to the "geom.out" slot.
*/
static BMOpDefine bmo_symmetrize_def = {
"symmetrize",
/* slots_in */
{{"input", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{"direction", BMO_OP_SLOT_INT},
{"dist", BMO_OP_SLOT_FLT}, /* minimum distance */
{{'\0'}},
},
/* slots_out */
{{"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}},
{{'\0'}},
},
bmo_symmetrize_exec,
BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
const BMOpDefine *bmo_opdefines[] = {
&bmo_automerge_def,
&bmo_average_vert_facedata_def,
&bmo_beautify_fill_def,
&bmo_bevel_def,
&bmo_bisect_edges_def,
&bmo_bmesh_to_mesh_def,
&bmo_bridge_loops_def,
&bmo_collapse_def,
&bmo_collapse_uvs_def,
&bmo_connect_verts_def,
&bmo_connect_verts_nonplanar_def,
&bmo_connect_vert_pair_def,
&bmo_contextual_create_def,
#ifdef WITH_BULLET
&bmo_convex_hull_def,
#endif
&bmo_create_circle_def,
&bmo_create_cone_def,
&bmo_create_cube_def,
&bmo_create_grid_def,
&bmo_create_icosphere_def,
&bmo_create_monkey_def,
&bmo_create_uvsphere_def,
&bmo_create_vert_def,
&bmo_delete_def,
&bmo_dissolve_edges_def,
&bmo_dissolve_faces_def,
&bmo_dissolve_verts_def,
&bmo_dissolve_limit_def,
&bmo_dissolve_degenerate_def,
&bmo_duplicate_def,
&bmo_holes_fill_def,
&bmo_face_attribute_fill_def,
&bmo_edgeloop_fill_def,
&bmo_edgenet_fill_def,
&bmo_edgenet_prepare_def,
&bmo_extrude_discrete_faces_def,
&bmo_extrude_edge_only_def,
&bmo_extrude_face_region_def,
&bmo_extrude_vert_indiv_def,
&bmo_find_doubles_def,
&bmo_grid_fill_def,
&bmo_inset_individual_def,
&bmo_inset_region_def,
&bmo_join_triangles_def,
&bmo_mesh_to_bmesh_def,
&bmo_mirror_def,
&bmo_object_load_bmesh_def,
&bmo_pointmerge_def,
&bmo_pointmerge_facedata_def,
&bmo_poke_def,
&bmo_recalc_face_normals_def,
&bmo_region_extend_def,
&bmo_remove_doubles_def,
&bmo_reverse_colors_def,
&bmo_reverse_faces_def,
&bmo_reverse_uvs_def,
&bmo_rotate_colors_def,
&bmo_rotate_def,
&bmo_rotate_edges_def,
&bmo_rotate_uvs_def,
&bmo_scale_def,
&bmo_similar_edges_def,
&bmo_similar_faces_def,
&bmo_similar_verts_def,
&bmo_smooth_vert_def,
&bmo_smooth_laplacian_vert_def,
&bmo_solidify_def,
&bmo_spin_def,
&bmo_split_def,
&bmo_split_edges_def,
&bmo_subdivide_edges_def,
&bmo_subdivide_edgering_def,
&bmo_bisect_plane_def,
&bmo_symmetrize_def,
&bmo_transform_def,
&bmo_translate_def,
&bmo_triangle_fill_def,
&bmo_triangulate_def,
&bmo_unsubdivide_def,
&bmo_weld_verts_def,
&bmo_wireframe_def,
};
const int bmo_opdefines_total = (sizeof(bmo_opdefines) / sizeof(void *));
|