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
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
|
/*
* 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.
*/
/** \file
* \ingroup RNA
*/
#include <stdlib.h>
#include <limits.h>
#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_sys_types.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "rna_internal.h"
#include "BKE_modifier.h"
#include "BKE_fluid.h"
#include "BKE_pointcache.h"
#include "DNA_modifier_types.h"
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_fluid_types.h"
#include "DNA_particle_types.h"
#include "WM_types.h"
#include "WM_api.h"
#ifdef RNA_RUNTIME
# include "BLI_math.h"
# include "BLI_threads.h"
# include "BKE_colorband.h"
# include "BKE_context.h"
# include "BKE_particle.h"
# include "DEG_depsgraph.h"
# include "DEG_depsgraph_build.h"
# include "manta_fluid_API.h"
static void rna_Fluid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY);
// Needed for liquid domain objects
Object *ob = (Object *)ptr->owner_id;
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
static void rna_Fluid_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
rna_Fluid_update(bmain, scene, ptr);
DEG_relations_tag_update(bmain);
}
static void rna_Fluid_resetCache(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
if (settings->mmd && settings->mmd->domain) {
settings->mmd->domain->cache_flag |= (FLUID_DOMAIN_OUTDATED_DATA |
FLUID_DOMAIN_OUTDATED_NOISE |
FLUID_DOMAIN_OUTDATED_MESH |
FLUID_DOMAIN_OUTDATED_PARTICLES);
scene->r.cfra = settings->cache_frame_start;
}
DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY);
}
static void rna_Fluid_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
{
# ifdef WITH_FLUID
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
BKE_fluid_modifier_reset(settings->mmd);
}
# endif
rna_Fluid_resetCache(bmain, scene, ptr);
rna_Fluid_update(bmain, scene, ptr);
}
static void rna_Fluid_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
# ifdef WITH_FLUID
BKE_fluid_modifier_reset(settings->mmd);
# endif
if (settings->mmd && settings->mmd->domain) {
settings->mmd->domain->point_cache[0]->flag |= PTCACHE_OUTDATED;
}
rna_Fluid_dependency_update(bmain, scene, ptr);
}
static void rna_Fluid_parts_create(Main *bmain,
PointerRNA *ptr,
const char *pset_name,
const char *parts_name,
const char *psys_name,
int psys_type)
{
# ifndef WITH_FLUID
UNUSED_VARS(bmain, ptr, pset_name, parts_name, psys_name, psys_type);
# else
Object *ob = (Object *)ptr->owner_id;
BKE_fluid_particle_system_create(bmain, ob, pset_name, parts_name, psys_name, psys_type);
# endif
}
static void rna_Fluid_parts_delete(PointerRNA *ptr, int ptype)
{
# ifndef WITH_FLUID
UNUSED_VARS(ptr, ptype);
# else
Object *ob = (Object *)ptr->owner_id;
BKE_fluid_particle_system_destroy(ob, ptype);
# endif
}
static bool rna_Fluid_parts_exists(PointerRNA *ptr, int ptype)
{
Object *ob = (Object *)ptr->owner_id;
ParticleSystem *psys;
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
if (psys->part->type == ptype) {
return true;
}
}
return false;
}
static void rna_Fluid_draw_type_update(Main *UNUSED(bmain),
Scene *UNUSED(scene),
struct PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
/* Wireframe mode more convenient when particles present */
if (settings->particle_type == 0) {
ob->dt = OB_SOLID;
}
else {
ob->dt = OB_WIRE;
}
}
static void rna_Fluid_flip_parts_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
FluidModifierData *mmd;
mmd = (FluidModifierData *)modifiers_findByType(ob, eModifierType_Fluid);
bool exists = rna_Fluid_parts_exists(ptr, PART_FLUID_FLIP);
/* Only create a particle system in liquid domain mode. */
if (mmd->domain->type != FLUID_DOMAIN_TYPE_LIQUID) {
rna_Fluid_reset(bmain, scene, ptr);
return;
}
if (ob->type == OB_MESH && !exists) {
rna_Fluid_parts_create(bmain,
ptr,
"FlipParticleSettings",
"FLIP Particles",
"FLIP Particle System",
PART_FLUID_FLIP);
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_FLIP;
}
else {
rna_Fluid_parts_delete(ptr, PART_FLUID_FLIP);
rna_Fluid_resetCache(bmain, scene, ptr);
mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_FLIP;
}
rna_Fluid_draw_type_update(NULL, NULL, ptr);
rna_Fluid_reset(bmain, scene, ptr);
}
static void rna_Fluid_spray_parts_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
FluidModifierData *mmd;
mmd = (FluidModifierData *)modifiers_findByType(ob, eModifierType_Fluid);
bool exists = rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAY);
if (ob->type == OB_MESH && !exists) {
rna_Fluid_parts_create(bmain,
ptr,
"SprayParticleSettings",
"Spray Particles",
"Spray Particle System",
PART_FLUID_SPRAY);
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_SPRAY;
}
else {
rna_Fluid_parts_delete(ptr, PART_FLUID_SPRAY);
rna_Fluid_resetCache(bmain, scene, ptr);
mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_SPRAY;
}
rna_Fluid_draw_type_update(NULL, NULL, ptr);
rna_Fluid_reset(bmain, scene, ptr);
}
static void rna_Fluid_bubble_parts_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
FluidModifierData *mmd;
mmd = (FluidModifierData *)modifiers_findByType(ob, eModifierType_Fluid);
bool exists = rna_Fluid_parts_exists(ptr, PART_FLUID_BUBBLE);
if (ob->type == OB_MESH && !exists) {
rna_Fluid_parts_create(bmain,
ptr,
"BubbleParticleSettings",
"Bubble Particles",
"Bubble Particle System",
PART_FLUID_BUBBLE);
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_BUBBLE;
}
else {
rna_Fluid_parts_delete(ptr, PART_FLUID_BUBBLE);
rna_Fluid_resetCache(bmain, scene, ptr);
mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_BUBBLE;
}
rna_Fluid_draw_type_update(NULL, NULL, ptr);
rna_Fluid_reset(bmain, scene, ptr);
}
static void rna_Fluid_foam_parts_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
FluidModifierData *mmd;
mmd = (FluidModifierData *)modifiers_findByType(ob, eModifierType_Fluid);
bool exists = rna_Fluid_parts_exists(ptr, PART_FLUID_FOAM);
if (ob->type == OB_MESH && !exists) {
rna_Fluid_parts_create(bmain,
ptr,
"FoamParticleSettings",
"Foam Particles",
"Foam Particle System",
PART_FLUID_FOAM);
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_FOAM;
}
else {
rna_Fluid_parts_delete(ptr, PART_FLUID_FOAM);
rna_Fluid_resetCache(bmain, scene, ptr);
mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_FOAM;
}
rna_Fluid_draw_type_update(NULL, NULL, ptr);
rna_Fluid_reset(bmain, scene, ptr);
}
static void rna_Fluid_tracer_parts_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
FluidModifierData *mmd;
mmd = (FluidModifierData *)modifiers_findByType(ob, eModifierType_Fluid);
bool exists = rna_Fluid_parts_exists(ptr, PART_FLUID_TRACER);
if (ob->type == OB_MESH && !exists) {
rna_Fluid_parts_create(bmain,
ptr,
"TracerParticleSettings",
"Tracer Particles",
"Tracer Particle System",
PART_FLUID_TRACER);
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_TRACER;
}
else {
rna_Fluid_parts_delete(ptr, PART_FLUID_TRACER);
rna_Fluid_resetCache(bmain, scene, ptr);
mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_TRACER;
}
rna_Fluid_draw_type_update(NULL, NULL, ptr);
rna_Fluid_reset(bmain, scene, ptr);
}
static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
FluidModifierData *mmd;
mmd = (FluidModifierData *)modifiers_findByType(ob, eModifierType_Fluid);
if (mmd->domain->sndparticle_combined_export == SNDPARTICLE_COMBINED_EXPORT_OFF) {
rna_Fluid_parts_delete(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM | PART_FLUID_BUBBLE));
// re-add each particle type if enabled
if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) != 0) {
rna_Fluid_spray_parts_update(bmain, scene, ptr);
}
if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FOAM) != 0) {
rna_Fluid_foam_parts_update(bmain, scene, ptr);
}
if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE) != 0) {
rna_Fluid_bubble_parts_update(bmain, scene, ptr);
}
}
else if (mmd->domain->sndparticle_combined_export == SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM) {
if (ob->type == OB_MESH &&
!rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM))) {
rna_Fluid_parts_delete(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM));
}
rna_Fluid_parts_create(bmain,
ptr,
"SprayFoamParticleSettings",
"Spray + Foam Particles",
"Spray + Foam Particle System",
(PART_FLUID_SPRAY | PART_FLUID_FOAM));
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_SPRAY;
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_FOAM;
// re-add bubbles if enabled
if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE) != 0) {
rna_Fluid_bubble_parts_update(bmain, scene, ptr);
}
}
else if (mmd->domain->sndparticle_combined_export == SNDPARTICLE_COMBINED_EXPORT_SPRAY_BUBBLE) {
if (ob->type == OB_MESH &&
!rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_BUBBLE))) {
rna_Fluid_parts_delete(ptr, (PART_FLUID_SPRAY | PART_FLUID_BUBBLE));
}
rna_Fluid_parts_create(bmain,
ptr,
"SprayBubbleParticleSettings",
"Spray + Bubble Particles",
"Spray + Bubble Particle System",
(PART_FLUID_SPRAY | PART_FLUID_BUBBLE));
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_SPRAY;
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_BUBBLE;
// re-add foam if enabled
if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FOAM) != 0) {
rna_Fluid_foam_parts_update(bmain, scene, ptr);
}
}
else if (mmd->domain->sndparticle_combined_export == SNDPARTICLE_COMBINED_EXPORT_FOAM_BUBBLE) {
if (ob->type == OB_MESH &&
!rna_Fluid_parts_exists(ptr, (PART_FLUID_FOAM | PART_FLUID_BUBBLE))) {
rna_Fluid_parts_delete(ptr, (PART_FLUID_FOAM | PART_FLUID_BUBBLE));
}
rna_Fluid_parts_create(bmain,
ptr,
"FoamBubbleParticleSettings",
"Foam + Bubble Particles",
"Foam + Bubble Particle System",
(PART_FLUID_FOAM | PART_FLUID_BUBBLE));
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_FOAM;
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_BUBBLE;
// re-add spray if enabled
if ((mmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) != 0) {
rna_Fluid_spray_parts_update(bmain, scene, ptr);
}
}
else if (mmd->domain->sndparticle_combined_export ==
SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM_BUBBLE) {
if (ob->type == OB_MESH &&
!rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM | PART_FLUID_BUBBLE))) {
rna_Fluid_parts_delete(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM | PART_FLUID_BUBBLE));
}
rna_Fluid_parts_create(bmain,
ptr,
"SprayFoamBubbleParticleSettings",
"Spray + Foam + Bubble Particles",
"Spray + Foam + Bubble Particle System",
(PART_FLUID_SPRAY | PART_FLUID_FOAM | PART_FLUID_BUBBLE));
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_SPRAY;
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_FOAM;
mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_BUBBLE;
}
else {
// sanity check, should not occur
printf("ERROR: Unexpected combined export setting encountered!");
}
rna_Fluid_resetCache(bmain, scene, ptr);
rna_Fluid_draw_type_update(NULL, NULL, ptr);
}
static void rna_Fluid_cachetype_mesh_set(struct PointerRNA *ptr, int value)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
BKE_fluid_cachetype_mesh_set(settings, value);
}
static void rna_Fluid_cachetype_data_set(struct PointerRNA *ptr, int value)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
BKE_fluid_cachetype_data_set(settings, value);
}
static void rna_Fluid_cachetype_particle_set(struct PointerRNA *ptr, int value)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
BKE_fluid_cachetype_particle_set(settings, value);
}
static void rna_Fluid_cachetype_noise_set(struct PointerRNA *ptr, int value)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
BKE_fluid_cachetype_noise_set(settings, value);
}
static void rna_Fluid_cachetype_set(struct PointerRNA *ptr, int value)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
if (value != settings->cache_type) {
settings->cache_type = value;
settings->cache_flag = 0;
}
}
static void rna_Fluid_guide_parent_set(struct PointerRNA *ptr,
struct PointerRNA value,
struct ReportList *UNUSED(reports))
{
FluidDomainSettings *mds = (FluidDomainSettings *)ptr->data;
Object *par = (Object *)value.data;
FluidModifierData *mmd_par = NULL;
if (par != NULL) {
mmd_par = (FluidModifierData *)modifiers_findByType(par, eModifierType_Fluid);
if (mmd_par && mmd_par->domain) {
mds->guide_parent = value.data;
copy_v3_v3_int(mds->guide_res, mmd_par->domain->res);
}
}
else {
mds->guide_parent = NULL;
}
}
static const EnumPropertyItem *rna_Fluid_cachetype_mesh_itemf(bContext *UNUSED(C),
PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
EnumPropertyItem *item = NULL;
EnumPropertyItem tmp = {0, "", 0, "", ""};
int totitem = 0;
tmp.value = FLUID_DOMAIN_FILE_BIN_OBJECT;
tmp.identifier = "BOBJECT";
tmp.name = "Binary Object files";
tmp.description = "Binary object file format";
RNA_enum_item_add(&item, &totitem, &tmp);
tmp.value = FLUID_DOMAIN_FILE_OBJECT;
tmp.identifier = "OBJECT";
tmp.name = "Object files";
tmp.description = "Object file format";
RNA_enum_item_add(&item, &totitem, &tmp);
RNA_enum_item_end(&item, &totitem);
*r_free = true;
return item;
}
static const EnumPropertyItem *rna_Fluid_cachetype_volume_itemf(bContext *UNUSED(C),
PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
EnumPropertyItem *item = NULL;
EnumPropertyItem tmp = {0, "", 0, "", ""};
int totitem = 0;
tmp.value = FLUID_DOMAIN_FILE_UNI;
tmp.identifier = "UNI";
tmp.name = "Uni Cache";
tmp.description = "Uni file format";
RNA_enum_item_add(&item, &totitem, &tmp);
# ifdef WITH_OPENVDB
tmp.value = FLUID_DOMAIN_FILE_OPENVDB;
tmp.identifier = "OPENVDB";
tmp.name = "OpenVDB";
tmp.description = "OpenVDB file format";
RNA_enum_item_add(&item, &totitem, &tmp);
# endif
tmp.value = FLUID_DOMAIN_FILE_RAW;
tmp.identifier = "RAW";
tmp.name = "Raw Cache";
tmp.description = "Raw file format";
RNA_enum_item_add(&item, &totitem, &tmp);
RNA_enum_item_end(&item, &totitem);
*r_free = true;
return item;
}
static const EnumPropertyItem *rna_Fluid_cachetype_particle_itemf(bContext *UNUSED(C),
PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
EnumPropertyItem *item = NULL;
EnumPropertyItem tmp = {0, "", 0, "", ""};
int totitem = 0;
tmp.value = FLUID_DOMAIN_FILE_UNI;
tmp.identifier = "UNI";
tmp.name = "Uni Cache";
tmp.description = "Uni file format";
RNA_enum_item_add(&item, &totitem, &tmp);
RNA_enum_item_end(&item, &totitem);
*r_free = true;
return item;
}
static void rna_Fluid_cache_directory_set(struct PointerRNA *ptr, const char *value)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
if (STREQ(settings->cache_directory, value)) {
return;
}
BLI_strncpy(settings->cache_directory, value, sizeof(settings->cache_directory));
/* TODO (sebbas): Read cache state in order to set cache bake flags and cache pause frames
* correctly */
// settings->cache_flag = 0;
}
static void rna_Fluid_domaintype_set(struct PointerRNA *ptr, int value)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
Object *ob = (Object *)ptr->owner_id;
BKE_fluid_domain_type_set(ob, settings, value);
}
static char *rna_FluidDomainSettings_path(PointerRNA *ptr)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
ModifierData *md = (ModifierData *)settings->mmd;
char name_esc[sizeof(md->name) * 2];
BLI_strescape(name_esc, md->name, sizeof(name_esc));
return BLI_sprintfN("modifiers[\"%s\"].domain_settings", name_esc);
}
static char *rna_FluidFlowSettings_path(PointerRNA *ptr)
{
FluidFlowSettings *settings = (FluidFlowSettings *)ptr->data;
ModifierData *md = (ModifierData *)settings->mmd;
char name_esc[sizeof(md->name) * 2];
BLI_strescape(name_esc, md->name, sizeof(name_esc));
return BLI_sprintfN("modifiers[\"%s\"].flow_settings", name_esc);
}
static char *rna_FluidEffectorSettings_path(PointerRNA *ptr)
{
FluidEffectorSettings *settings = (FluidEffectorSettings *)ptr->data;
ModifierData *md = (ModifierData *)settings->mmd;
char name_esc[sizeof(md->name) * 2];
BLI_strescape(name_esc, md->name, sizeof(name_esc));
return BLI_sprintfN("modifiers[\"%s\"].effector_settings", name_esc);
}
/* -------------------------------------------------------------------- */
/** \name Grid Accessors
* \{ */
# ifdef WITH_FLUID
static int rna_FluidModifier_grid_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
FluidDomainSettings *mds = (FluidDomainSettings *)ptr->data;
float *density = NULL;
int size = 0;
if (mds->flags & FLUID_DOMAIN_USE_NOISE && mds->fluid) {
/* high resolution smoke */
int res[3];
manta_smoke_turbulence_get_res(mds->fluid, res);
size = res[0] * res[1] * res[2];
density = manta_smoke_turbulence_get_density(mds->fluid);
}
else if (mds->fluid) {
/* regular resolution */
size = mds->res[0] * mds->res[1] * mds->res[2];
density = manta_smoke_get_density(mds->fluid);
}
length[0] = (density) ? size : 0;
return length[0];
}
static int rna_FluidModifier_color_grid_get_length(PointerRNA *ptr,
int length[RNA_MAX_ARRAY_DIMENSION])
{
rna_FluidModifier_grid_get_length(ptr, length);
length[0] *= 4;
return length[0];
}
static int rna_FluidModifier_velocity_grid_get_length(PointerRNA *ptr,
int length[RNA_MAX_ARRAY_DIMENSION])
{
FluidDomainSettings *mds = (FluidDomainSettings *)ptr->data;
float *vx = NULL;
float *vy = NULL;
float *vz = NULL;
int size = 0;
/* Velocity data is always low-resolution. */
if (mds->fluid) {
size = 3 * mds->res[0] * mds->res[1] * mds->res[2];
vx = manta_get_velocity_x(mds->fluid);
vy = manta_get_velocity_y(mds->fluid);
vz = manta_get_velocity_z(mds->fluid);
}
length[0] = (vx && vy && vz) ? size : 0;
return length[0];
}
static int rna_FluidModifier_heat_grid_get_length(PointerRNA *ptr,
int length[RNA_MAX_ARRAY_DIMENSION])
{
FluidDomainSettings *mds = (FluidDomainSettings *)ptr->data;
float *heat = NULL;
int size = 0;
/* Heat data is always low-resolution. */
if (mds->fluid) {
size = mds->res[0] * mds->res[1] * mds->res[2];
heat = manta_smoke_get_heat(mds->fluid);
}
length[0] = (heat) ? size : 0;
return length[0];
}
static void rna_FluidModifier_density_grid_get(PointerRNA *ptr, float *values)
{
FluidDomainSettings *mds = (FluidDomainSettings *)ptr->data;
int length[RNA_MAX_ARRAY_DIMENSION];
int size = rna_FluidModifier_grid_get_length(ptr, length);
float *density;
BLI_rw_mutex_lock(mds->fluid_mutex, THREAD_LOCK_READ);
if (mds->flags & FLUID_DOMAIN_USE_NOISE && mds->fluid) {
density = manta_smoke_turbulence_get_density(mds->fluid);
}
else {
density = manta_smoke_get_density(mds->fluid);
}
memcpy(values, density, size * sizeof(float));
BLI_rw_mutex_unlock(mds->fluid_mutex);
}
static void rna_FluidModifier_velocity_grid_get(PointerRNA *ptr, float *values)
{
FluidDomainSettings *mds = (FluidDomainSettings *)ptr->data;
int length[RNA_MAX_ARRAY_DIMENSION];
int size = rna_FluidModifier_velocity_grid_get_length(ptr, length);
float *vx, *vy, *vz;
int i;
BLI_rw_mutex_lock(mds->fluid_mutex, THREAD_LOCK_READ);
vx = manta_get_velocity_x(mds->fluid);
vy = manta_get_velocity_y(mds->fluid);
vz = manta_get_velocity_z(mds->fluid);
for (i = 0; i < size; i += 3) {
*(values++) = *(vx++);
*(values++) = *(vy++);
*(values++) = *(vz++);
}
BLI_rw_mutex_unlock(mds->fluid_mutex);
}
static void rna_FluidModifier_color_grid_get(PointerRNA *ptr, float *values)
{
FluidDomainSettings *mds = (FluidDomainSettings *)ptr->data;
int length[RNA_MAX_ARRAY_DIMENSION];
int size = rna_FluidModifier_grid_get_length(ptr, length);
BLI_rw_mutex_lock(mds->fluid_mutex, THREAD_LOCK_READ);
if (!mds->fluid) {
memset(values, 0, size * sizeof(float));
}
else {
if (mds->flags & FLUID_DOMAIN_USE_NOISE) {
if (manta_smoke_turbulence_has_colors(mds->fluid)) {
manta_smoke_turbulence_get_rgba(mds->fluid, values, 0);
}
else {
manta_smoke_turbulence_get_rgba_from_density(mds->fluid, mds->active_color, values, 0);
}
}
else {
if (manta_smoke_has_colors(mds->fluid)) {
manta_smoke_get_rgba(mds->fluid, values, 0);
}
else {
manta_smoke_get_rgba_from_density(mds->fluid, mds->active_color, values, 0);
}
}
}
BLI_rw_mutex_unlock(mds->fluid_mutex);
}
static void rna_FluidModifier_flame_grid_get(PointerRNA *ptr, float *values)
{
FluidDomainSettings *mds = (FluidDomainSettings *)ptr->data;
int length[RNA_MAX_ARRAY_DIMENSION];
int size = rna_FluidModifier_grid_get_length(ptr, length);
float *flame;
BLI_rw_mutex_lock(mds->fluid_mutex, THREAD_LOCK_READ);
if (mds->flags & FLUID_DOMAIN_USE_NOISE && mds->fluid) {
flame = manta_smoke_turbulence_get_flame(mds->fluid);
}
else {
flame = manta_smoke_get_flame(mds->fluid);
}
if (flame) {
memcpy(values, flame, size * sizeof(float));
}
else {
memset(values, 0, size * sizeof(float));
}
BLI_rw_mutex_unlock(mds->fluid_mutex);
}
static void rna_FluidModifier_heat_grid_get(PointerRNA *ptr, float *values)
{
FluidDomainSettings *mds = (FluidDomainSettings *)ptr->data;
int length[RNA_MAX_ARRAY_DIMENSION];
int size = rna_FluidModifier_heat_grid_get_length(ptr, length);
float *heat;
BLI_rw_mutex_lock(mds->fluid_mutex, THREAD_LOCK_READ);
heat = manta_smoke_get_heat(mds->fluid);
if (heat != NULL) {
/* scale heat values from -2.0-2.0 to -1.0-1.0. */
for (int i = 0; i < size; i++) {
values[i] = heat[i] * 0.5f;
}
}
else {
memset(values, 0, size * sizeof(float));
}
BLI_rw_mutex_unlock(mds->fluid_mutex);
}
static void rna_FluidModifier_temperature_grid_get(PointerRNA *ptr, float *values)
{
FluidDomainSettings *mds = (FluidDomainSettings *)ptr->data;
int length[RNA_MAX_ARRAY_DIMENSION];
int size = rna_FluidModifier_grid_get_length(ptr, length);
float *flame;
BLI_rw_mutex_lock(mds->fluid_mutex, THREAD_LOCK_READ);
if (mds->flags & FLUID_DOMAIN_USE_NOISE && mds->fluid) {
flame = manta_smoke_turbulence_get_flame(mds->fluid);
}
else {
flame = manta_smoke_get_flame(mds->fluid);
}
if (flame) {
/* Output is such that 0..1 maps to 0..1000K */
float offset = mds->flame_ignition;
float scale = mds->flame_max_temp - mds->flame_ignition;
for (int i = 0; i < size; i++) {
values[i] = (flame[i] > 0.01f) ? offset + flame[i] * scale : 0.0f;
}
}
else {
memset(values, 0, size * sizeof(float));
}
BLI_rw_mutex_unlock(mds->fluid_mutex);
}
# endif /* WITH_FLUID */
/** \} */
static void rna_FluidFlow_density_vgroup_get(PointerRNA *ptr, char *value)
{
FluidFlowSettings *flow = (FluidFlowSettings *)ptr->data;
rna_object_vgroup_name_index_get(ptr, value, flow->vgroup_density);
}
static int rna_FluidFlow_density_vgroup_length(PointerRNA *ptr)
{
FluidFlowSettings *flow = (FluidFlowSettings *)ptr->data;
return rna_object_vgroup_name_index_length(ptr, flow->vgroup_density);
}
static void rna_FluidFlow_density_vgroup_set(struct PointerRNA *ptr, const char *value)
{
FluidFlowSettings *flow = (FluidFlowSettings *)ptr->data;
rna_object_vgroup_name_index_set(ptr, value, &flow->vgroup_density);
}
static void rna_FluidFlow_uvlayer_set(struct PointerRNA *ptr, const char *value)
{
FluidFlowSettings *flow = (FluidFlowSettings *)ptr->data;
rna_object_uvlayer_name_set(ptr, value, flow->uvlayer_name, sizeof(flow->uvlayer_name));
}
static void rna_Fluid_use_color_ramp_set(struct PointerRNA *ptr, bool value)
{
FluidDomainSettings *mds = (FluidDomainSettings *)ptr->data;
mds->use_coba = value;
if (value && mds->coba == NULL) {
mds->coba = BKE_colorband_add(false);
}
}
static void rna_Fluid_flowsource_set(struct PointerRNA *ptr, int value)
{
FluidFlowSettings *settings = (FluidFlowSettings *)ptr->data;
if (value != settings->source) {
settings->source = value;
}
}
static const EnumPropertyItem *rna_Fluid_flowsource_itemf(bContext *UNUSED(C),
PointerRNA *ptr,
PropertyRNA *UNUSED(prop),
bool *r_free)
{
FluidFlowSettings *settings = (FluidFlowSettings *)ptr->data;
EnumPropertyItem *item = NULL;
EnumPropertyItem tmp = {0, "", 0, "", ""};
int totitem = 0;
tmp.value = FLUID_FLOW_SOURCE_MESH;
tmp.identifier = "MESH";
tmp.icon = ICON_META_CUBE;
tmp.name = "Mesh";
tmp.description = "Emit fluid from mesh surface or volume";
RNA_enum_item_add(&item, &totitem, &tmp);
if (settings->type != FLUID_FLOW_TYPE_LIQUID) {
tmp.value = FLUID_FLOW_SOURCE_PARTICLES;
tmp.identifier = "PARTICLES";
tmp.icon = ICON_PARTICLES;
tmp.name = "Particle System";
tmp.description = "Emit smoke from particles";
RNA_enum_item_add(&item, &totitem, &tmp);
}
RNA_enum_item_end(&item, &totitem);
*r_free = true;
return item;
}
static void rna_Fluid_flowtype_set(struct PointerRNA *ptr, int value)
{
FluidFlowSettings *settings = (FluidFlowSettings *)ptr->data;
if (value != settings->type) {
settings->type = value;
/* Force flow source to mesh */
if (value == FLUID_FLOW_TYPE_LIQUID) {
rna_Fluid_flowsource_set(ptr, FLUID_FLOW_SOURCE_MESH);
settings->surface_distance = 0.0f;
}
else {
settings->surface_distance = 1.5f;
}
}
}
#else
static void rna_def_fluid_mesh_vertices(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "FluidDomainVertexVelocity", NULL);
RNA_def_struct_ui_text(srna, "Fluid Mesh Velocity", "Velocity of a simulated fluid mesh");
RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL);
prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
RNA_def_property_array(prop, 3);
RNA_def_property_float_sdna(prop, NULL, "vel");
RNA_def_property_ui_text(prop, "Velocity", "");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
static void rna_def_fluid_domain_settings(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem domain_types[] = {
{FLUID_DOMAIN_TYPE_GAS, "GAS", 0, "Gas", "Create domain for gases"},
{FLUID_DOMAIN_TYPE_LIQUID, "LIQUID", 0, "Liquid", "Create domain for liquids"},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem prop_noise_type_items[] = {
{FLUID_NOISE_TYPE_WAVELET, "NOISEWAVE", 0, "Wavelet", ""},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_compression_items[] = {
{VDB_COMPRESSION_ZIP, "ZIP", 0, "Zip", "Effective but slow compression"},
# ifdef WITH_OPENVDB_BLOSC
{VDB_COMPRESSION_BLOSC,
"BLOSC",
0,
"Blosc",
"Multithreaded compression, similar in size and quality as 'Zip'"},
# endif
{VDB_COMPRESSION_NONE, "NONE", 0, "None", "Do not use any compression"},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem cache_comp_items[] = {
{SM_CACHE_LIGHT, "CACHELIGHT", 0, "Lite", "Fast but not so effective compression"},
{SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Effective but slow compression"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem smoke_highres_sampling_items[] = {
{SM_HRES_FULLSAMPLE, "FULLSAMPLE", 0, "Full Sample", ""},
{SM_HRES_LINEAR, "LINEAR", 0, "Linear", ""},
{SM_HRES_NEAREST, "NEAREST", 0, "Nearest", ""},
{0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem cache_types[] = {
{FLUID_DOMAIN_CACHE_REPLAY,
"REPLAY",
0,
"Replay",
"Use the timeline to bake the scene. Pausing and resuming possible."},
{FLUID_DOMAIN_CACHE_MODULAR,
"MODULAR",
0,
"Modular",
"Bake every stage of the simulation on its own. Can pause and resume bake jobs."},
{FLUID_DOMAIN_CACHE_FINAL, "FINAL", 0, "Final", "Bake the entire simulation at once."},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem smoke_data_depth_items[] = {
{16, "16", 0, "Float (Half)", "Half float (16 bit data)"},
{0, "32", 0, "Float (Full)", "Full float (32 bit data)"}, /* default */
{0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem fluid_mesh_quality_items[] = {
{FLUID_DOMAIN_MESH_IMPROVED,
"IMPROVED",
0,
"Final",
"Use improved particle levelset (slower but more precise and with mesh smoothening "
"options)"},
{FLUID_DOMAIN_MESH_UNION,
"UNION",
0,
"Preview",
"Use union particle levelset (faster but lower quality)"},
{0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem fluid_guide_source_items[] = {
{FLUID_DOMAIN_GUIDE_SRC_DOMAIN,
"DOMAIN",
0,
"Domain",
"Use a fluid domain for guiding (domain needs to be baked already so that velocities can "
"be extracted but can be of any type)"},
{FLUID_DOMAIN_GUIDE_SRC_EFFECTOR,
"EFFECTOR",
0,
"Effector",
"Use guiding (effector) objects to create fluid guiding (guiding objects should be "
"animated and baked once set up completely)"},
{0, NULL, 0, NULL, NULL},
};
/* Cache type - generated dynamically based on domain type */
static EnumPropertyItem cache_file_type_items[] = {
{0, "NONE", 0, "", ""},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem view_items[] = {
{FLUID_DOMAIN_SLICE_VIEW_ALIGNED,
"VIEW_ALIGNED",
0,
"View",
"Slice volume parallel to the view plane"},
{FLUID_DOMAIN_SLICE_AXIS_ALIGNED,
"AXIS_ALIGNED",
0,
"Axis",
"Slice volume parallel to the major axis"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem axis_slice_method_items[] = {
{AXIS_SLICE_FULL, "FULL", 0, "Full", "Slice the whole domain object"},
{AXIS_SLICE_SINGLE, "SINGLE", 0, "Single", "Perform a single slice of the domain object"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem interp_method_item[] = {
{VOLUME_INTERP_LINEAR, "LINEAR", 0, "Linear", "Good smoothness and speed"},
{VOLUME_INTERP_CUBIC,
"CUBIC",
0,
"Cubic",
"Smoothed high quality interpolation, but slower"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem axis_slice_position_items[] = {
{SLICE_AXIS_AUTO,
"AUTO",
0,
"Auto",
"Adjust slice direction according to the view direction"},
{SLICE_AXIS_X, "X", 0, "X", "Slice along the X axis"},
{SLICE_AXIS_Y, "Y", 0, "Y", "Slice along the Y axis"},
{SLICE_AXIS_Z, "Z", 0, "Z", "Slice along the Z axis"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem vector_draw_items[] = {
{VECTOR_DRAW_NEEDLE, "NEEDLE", 0, "Needle", "Display vectors as needles"},
{VECTOR_DRAW_STREAMLINE, "STREAMLINE", 0, "Streamlines", "Display vectors as streamlines"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem sndparticle_boundary_items[] = {
{SNDPARTICLE_BOUNDARY_DELETE,
"DELETE",
0,
"Delete",
"Delete secondary particles that are inside obstacles or left the domain"},
{SNDPARTICLE_BOUNDARY_PUSHOUT,
"PUSHOUT",
0,
"Push Out",
"Push secondary particles that left the domain back into the domain"},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem sndparticle_combined_export_items[] = {
{SNDPARTICLE_COMBINED_EXPORT_OFF,
"OFF",
0,
"Off",
"Create a seperate particle system for every secondary particle type"},
{SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM,
"SPRAY_FOAM",
0,
"Spray + Foam",
"Spray and foam particles are saved in the same particle system"},
{SNDPARTICLE_COMBINED_EXPORT_SPRAY_BUBBLE,
"SPRAY_BUBBLES",
0,
"Spray + Bubbles",
"Spray and bubble particles are saved in the same particle system"},
{SNDPARTICLE_COMBINED_EXPORT_FOAM_BUBBLE,
"FOAM_BUBBLES",
0,
"Foam + Bubbles",
"Foam and bubbles particles are saved in the same particle system"},
{SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM_BUBBLE,
"SPRAY_FOAM_BUBBLES",
0,
"Spray + Foam + Bubbles",
"Create one particle system that contains all three secondary particle types"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem simulation_methods[] = {
{FLUID_DOMAIN_METHOD_FLIP, "FLIP", 0, "FLIP", "Use FLIP as the simulation method"},
/*{FLUID_DOMAIN_METHOD_APIC, "APIC", 0, "APIC", "Use APIC as the simulation method"},*/
{0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FluidDomainSettings", NULL);
RNA_def_struct_ui_text(srna, "Domain Settings", "Fluid domain settings");
RNA_def_struct_sdna(srna, "FluidDomainSettings");
RNA_def_struct_path_func(srna, "rna_FluidDomainSettings_path");
prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "EffectorWeights");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Effector Weights", "");
/* object collections */
prop = RNA_def_property(srna, "effector_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "effector_group");
RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Effector Collection", "Limit effectors to this collection");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset_dependency");
prop = RNA_def_property(srna, "fluid_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "fluid_group");
RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Fluid Collection", "Limit fluid objects to this collection");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset_dependency");
prop = RNA_def_property(srna, "force_collection", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "force_group");
RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Force Collection", "Limit forces to this collection");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset_dependency");
/* grid access */
# ifdef WITH_FLUID
prop = RNA_def_property(srna, "density_grid", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(prop, 32);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_grid_get_length");
RNA_def_property_float_funcs(prop, "rna_FluidModifier_density_grid_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Density Grid", "Smoke density grid");
prop = RNA_def_property(srna, "velocity_grid", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(prop, 32);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_velocity_grid_get_length");
RNA_def_property_float_funcs(prop, "rna_FluidModifier_velocity_grid_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Velocity Grid", "Smoke velocity grid");
prop = RNA_def_property(srna, "flame_grid", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(prop, 32);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_grid_get_length");
RNA_def_property_float_funcs(prop, "rna_FluidModifier_flame_grid_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Flame Grid", "Smoke flame grid");
prop = RNA_def_property(srna, "color_grid", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(prop, 32);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_color_grid_get_length");
RNA_def_property_float_funcs(prop, "rna_FluidModifier_color_grid_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Color Grid", "Smoke color grid");
prop = RNA_def_property(srna, "heat_grid", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(prop, 32);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_heat_grid_get_length");
RNA_def_property_float_funcs(prop, "rna_FluidModifier_heat_grid_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Heat Grid", "Smoke heat grid");
prop = RNA_def_property(srna, "temperature_grid", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(prop, 32);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_grid_get_length");
RNA_def_property_float_funcs(prop, "rna_FluidModifier_temperature_grid_get", NULL, NULL);
RNA_def_property_ui_text(
prop, "Temperature Grid", "Smoke temperature grid, range 0..1 represents 0..1000K");
# endif /* WITH_FLUID */
/* domain object data */
prop = RNA_def_property(srna,
"start_point",
PROP_FLOAT,
PROP_XYZ); /* can change each frame when using adaptive domain */
RNA_def_property_float_sdna(prop, NULL, "p0");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "p0", "Start point");
prop = RNA_def_property(srna,
"cell_size",
PROP_FLOAT,
PROP_XYZ); /* can change each frame when using adaptive domain */
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "cell_size", "Cell Size");
prop = RNA_def_property(srna,
"domain_resolution",
PROP_INT,
PROP_XYZ); /* can change each frame when using adaptive domain */
RNA_def_property_int_sdna(prop, NULL, "res");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "res", "Smoke Grid Resolution");
/* adaptive domain options */
prop = RNA_def_property(srna, "additional_res", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "adapt_res");
RNA_def_property_range(prop, 0, 512);
RNA_def_property_ui_text(prop, "Additional", "Maximum number of additional cells");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "adapt_margin", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "adapt_margin");
RNA_def_property_range(prop, 2, 24);
RNA_def_property_ui_text(
prop, "Margin", "Margin added around fluid to minimize boundary interference");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "adapt_threshold", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.01, 0.5);
RNA_def_property_ui_text(
prop, "Threshold", "Maximum amount of fluid cell can contain before it is considered empty");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "use_adaptive_domain", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_ADAPTIVE_DOMAIN);
RNA_def_property_ui_text(
prop, "Adaptive Domain", "Adapt simulation resolution and size to fluid");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
/* fluid domain options */
prop = RNA_def_property(srna, "resolution_max", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "maxres");
RNA_def_property_range(prop, 6, 10000);
RNA_def_property_ui_range(prop, 24, 10000, 2, -1);
RNA_def_property_ui_text(prop, "Max Res", "Resolution used for the fluid domain");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_collision_border_front", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "border_collisions", FLUID_DOMAIN_BORDER_FRONT);
RNA_def_property_ui_text(prop, "Front", "Enable collisons with front domain border");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_collision_border_back", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "border_collisions", FLUID_DOMAIN_BORDER_BACK);
RNA_def_property_ui_text(prop, "Back", "Enable collisons with back domain border");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_collision_border_right", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "border_collisions", FLUID_DOMAIN_BORDER_RIGHT);
RNA_def_property_ui_text(prop, "Right", "Enable collisons with right domain border");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_collision_border_left", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "border_collisions", FLUID_DOMAIN_BORDER_LEFT);
RNA_def_property_ui_text(prop, "Left", "Enable collisons with left domain border");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_collision_border_top", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "border_collisions", FLUID_DOMAIN_BORDER_TOP);
RNA_def_property_ui_text(prop, "Top", "Enable collisons with top domain border");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_collision_border_bottom", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "border_collisions", FLUID_DOMAIN_BORDER_BOTTOM);
RNA_def_property_ui_text(prop, "Bottom", "Enable collisons with bottom domain border");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
RNA_def_property_float_sdna(prop, NULL, "gravity");
RNA_def_property_array(prop, 3);
RNA_def_property_range(prop, -1000.1, 1000.1);
RNA_def_property_ui_text(prop, "Gravity", "Gravity in X, Y and Z direction");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "domain_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, domain_types);
RNA_def_property_enum_funcs(prop, NULL, "rna_Fluid_domaintype_set", NULL);
RNA_def_property_ui_text(prop, "Domain Type", "Change domain type of the simulation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_flip_parts_update");
/* smoke domain options */
prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "alpha");
RNA_def_property_range(prop, -5.0, 5.0);
RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
RNA_def_property_ui_text(
prop,
"Density",
"How much density affects smoke motion (higher value results in faster rising smoke)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "beta");
RNA_def_property_range(prop, -5.0, 5.0);
RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
RNA_def_property_ui_text(
prop,
"Heat",
"How much heat affects smoke motion (higher value results in faster rising smoke)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "diss_speed");
RNA_def_property_range(prop, 1.0, 10000.0);
RNA_def_property_ui_range(prop, 1.0, 10000.0, 1, -1);
RNA_def_property_ui_text(prop, "Dissolve Speed", "Dissolve Speed");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "vorticity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vorticity");
RNA_def_property_range(prop, 0.0, 4.0);
RNA_def_property_ui_text(prop, "Vorticity", "Amount of turbulence/rotation in fluid");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "highres_sampling", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, smoke_highres_sampling_items);
RNA_def_property_ui_text(prop, "Emitter", "Method for sampling the high resolution flow");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "use_dissolve_smoke", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_DISSOLVE);
RNA_def_property_ui_text(prop, "Dissolve Smoke", "Enable smoke to disappear over time");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "use_dissolve_smoke_log", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_DISSOLVE_LOG);
RNA_def_property_ui_text(prop, "Logarithmic dissolve", "Using 1/x ");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
/* flame options */
prop = RNA_def_property(srna, "burning_rate", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.01, 4.0);
RNA_def_property_ui_range(prop, 0.01, 2.0, 1.0, 5);
RNA_def_property_ui_text(
prop, "Speed", "Speed of the burning reaction (use larger values for smaller flame)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "flame_smoke", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 8.0);
RNA_def_property_ui_range(prop, 0.0, 4.0, 1.0, 5);
RNA_def_property_ui_text(prop, "Smoke", "Amount of smoke created by burning fuel");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "flame_vorticity", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 2.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 5);
RNA_def_property_ui_text(prop, "Vorticity", "Additional vorticity for the flames");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "flame_ignition", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.5, 5.0);
RNA_def_property_ui_range(prop, 0.5, 2.5, 1.0, 5);
RNA_def_property_ui_text(prop, "Ignition", "Minimum temperature of flames");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "flame_max_temp", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 1.0, 10.0);
RNA_def_property_ui_range(prop, 1.0, 5.0, 1.0, 5);
RNA_def_property_ui_text(prop, "Maximum", "Maximum temperature of flames");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "flame_smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke emitted from burning fuel");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
/* noise options */
prop = RNA_def_property(srna, "noise_strength", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "noise_strength");
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 2);
RNA_def_property_ui_text(prop, "Strength", "Strength of noise");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "noise_pos_scale", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "noise_pos_scale");
RNA_def_property_range(prop, 0.0001, 10.0);
RNA_def_property_ui_text(
prop, "Scale", "Scale of noise (higher value results in larger vortices)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "noise_time_anim", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "noise_time_anim");
RNA_def_property_range(prop, 0.0001, 10.0);
RNA_def_property_ui_text(prop, "Time", "Animation time of noise");
prop = RNA_def_property(srna, "noise_scale", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "noise_scale");
RNA_def_property_range(prop, 1, 100);
RNA_def_property_ui_range(prop, 1, 10, 1, -1);
RNA_def_property_ui_text(prop,
"Noise Scale",
"Scale underlying noise grids by this factor. Noise grids have size "
"factor times base resolution");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "noise_type");
RNA_def_property_enum_items(prop, prop_noise_type_items);
RNA_def_property_ui_text(
prop, "Noise Method", "Noise method which is used for creating the high resolution");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_noise", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_NOISE);
RNA_def_property_ui_text(prop, "Use Noise", "Enable fluid noise (using amplification)");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_update");
/* liquid domain options */
prop = RNA_def_property(srna, "simulation_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "simulation_method");
RNA_def_property_enum_items(prop, simulation_methods);
RNA_def_property_ui_text(prop, "Simulation Method", "Change the underlying simulation method");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "flip_ratio", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_text(
prop,
"FLIP Ratio",
"PIC/FLIP Ratio. A value of 1.0 will result in a completely FLIP based simulation. Use a "
"lower value for simulations which should produce smaller splashes");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "particle_randomness", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_text(prop, "Randomness", "Randomness factor for particle sampling");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "particle_number", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 1, 5);
RNA_def_property_ui_text(
prop, "Number", "Particle number factor (higher value results in more particles)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "particle_min", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "particle_minimum");
RNA_def_property_range(prop, 0, 1000);
RNA_def_property_ui_text(prop,
"Minimum",
"Minimum number of particles per cell (ensures that each cell has at "
"least this amount of particles)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "particle_max", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "particle_maximum");
RNA_def_property_range(prop, 0, 1000);
RNA_def_property_ui_text(prop,
"Maximum",
"Maximum number of particles per cell (ensures that each cell has at "
"most this amount of particles)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "particle_radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_text(
prop,
"Radius",
"Particle radius factor. Use this parameter when the simulation appears to leak volume");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "particle_band_width", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1000.0);
RNA_def_property_ui_text(
prop,
"Width",
"Particle (narrow) band width (higher value results in thicker band and more particles)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "use_flip_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "particle_type", FLUID_DOMAIN_PARTICLE_FLIP);
RNA_def_property_ui_text(prop, "FLIP", "Create FLIP particle system");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Fluid_flip_parts_update");
prop = RNA_def_property(srna, "use_fractions", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_FRACTIONS);
RNA_def_property_ui_text(
prop,
"Fractional Obstacles",
"Fractional obstacles improve and smoothen the fluid-obstacle boundary");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "fractions_threshold", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.001, 1.0);
RNA_def_property_ui_range(prop, 0.01, 1.0, 0.05, -1);
RNA_def_property_ui_text(prop,
"Obstacle-Fluid Threshold ",
"Determines how much fluid is allowed in an obstacle cell "
"(higher values will tag a boundary cell as an obstacle easier "
"and reduce the boundary smoothening effect)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
/* diffusion options */
prop = RNA_def_property(srna, "surface_tension", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 100.0);
RNA_def_property_ui_text(
prop,
"Tension",
"Surface tension of liquid (higher value results in greater hydrophobic behaviour)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "viscosity_base", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "viscosity_base");
RNA_def_property_range(prop, 0, 10);
RNA_def_property_ui_text(
prop,
"Viscosity Base",
"Viscosity setting: value that is multiplied by 10 to the power of (exponent*-1)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "viscosity_exponent", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "viscosity_exponent");
RNA_def_property_range(prop, 0, 10);
RNA_def_property_ui_text(
prop,
"Viscosity Exponent",
"Negative exponent for the viscosity value (to simplify entering small values "
"e.g. 5*10^-6)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "domain_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.001, 10000.0);
RNA_def_property_ui_text(prop, "Meters", "Domain size in meters (longest domain side)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
/* mesh options options */
prop = RNA_def_property(srna, "mesh_concave_upper", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_text(
prop,
"Upper Concavity",
"Upper mesh concavity bound (high values tend to smoothen and fill out concave regions)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "mesh_concave_lower", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_text(
prop,
"Lower Concavity",
"Lower mesh concavity bound (high values tend to smoothen and fill out concave regions)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "mesh_smoothen_pos", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 100);
RNA_def_property_ui_text(prop, "Smoothen Pos", "Positive mesh smoothening");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "mesh_smoothen_neg", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 100);
RNA_def_property_ui_text(prop, "Smoothen Neg", "Negative mesh smoothening");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "mesh_scale", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "mesh_scale");
RNA_def_property_range(prop, 1, 100);
RNA_def_property_ui_range(prop, 1, 10, 1, -1);
RNA_def_property_ui_text(prop,
"Mesh scale",
"Scale underlying mesh grids by this factor. Mesh grids have size "
"factor times base resolution");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "mesh_generator", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mesh_generator");
RNA_def_property_enum_items(prop, fluid_mesh_quality_items);
RNA_def_property_ui_text(prop, "Mesh generator", "Which particle levelset generator to use");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_update");
prop = RNA_def_property(srna, "mesh_vertices", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "mesh_velocities", "totvert");
RNA_def_property_struct_type(prop, "FluidDomainVertexVelocity");
RNA_def_property_ui_text(
prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation");
rna_def_fluid_mesh_vertices(brna);
prop = RNA_def_property(srna, "use_mesh", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_MESH);
RNA_def_property_ui_text(prop, "Use Mesh", "Enable fluid mesh (using amplification)");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_update");
prop = RNA_def_property(srna, "use_speed_vectors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_SPEED_VECTORS);
RNA_def_property_ui_text(
prop,
"Speed Vectors",
"Generate speed vectors (will be loaded automatically during render for motion blur)");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "mesh_particle_radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_text(
prop,
"Radius",
"Particle radius factor (higher value results in larger (meshed) particles)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
/* secondary particles options */
prop = RNA_def_property(srna, "sndparticle_tau_min_wc", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1000.0);
RNA_def_property_ui_range(prop, 0.0, 1000.0, 100.0, 3);
RNA_def_property_ui_text(prop,
"tauMin_wc",
"Lower clamping threshold for marking fluid cells as wave crests "
"(lower values result in more marked cells)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_tau_max_wc", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1000.0);
RNA_def_property_ui_range(prop, 0.0, 1000.0, 100.0, 3);
RNA_def_property_ui_text(prop,
"tauMax_wc",
"Upper clamping threshold for marking fluid cells as wave crests "
"(higher values result in less marked cells)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_tau_min_ta", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1000.0);
RNA_def_property_ui_range(prop, 0.0, 10000.0, 100.0, 3);
RNA_def_property_ui_text(prop,
"tauMin_ta",
"Lower clamping threshold for marking fluid cells where air is trapped "
"(lower values result in more marked cells)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_tau_max_ta", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1000.0);
RNA_def_property_ui_range(prop, 0.0, 1000.0, 100.0, 3);
RNA_def_property_ui_text(prop,
"tauMax_ta",
"Upper clamping threshold for marking fluid cells where air is trapped "
"(higher values result in less marked cells)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_tau_min_k", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1000.0);
RNA_def_property_ui_range(prop, 0.0, 1000.0, 100.0, 3);
RNA_def_property_ui_text(
prop,
"tauMin_k",
"Lower clamping threshold that indicates the fluid speed where cells start to emit "
"particles (lower values result in generally more particles)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_tau_max_k", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1000.0);
RNA_def_property_ui_range(prop, 0.0, 1000.0, 100.0, 3);
RNA_def_property_ui_text(
prop,
"tauMax_k",
"Upper clamping threshold that indicates the fluid speed where cells no longer emit more "
"particles (higher values result in generally less particles)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_k_wc", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 10000);
RNA_def_property_ui_range(prop, 0, 10000, 1.0, -1);
RNA_def_property_ui_text(prop,
"Wave Crest Sampling",
"Maximum number of particles generated per wave crest cell per frame");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_k_ta", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 10000);
RNA_def_property_ui_range(prop, 0, 10000, 1.0, -1);
RNA_def_property_ui_text(prop,
"Trapped Air Sampling",
"Maximum number of particles generated per trapped air cell per frame");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_k_b", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 100.0);
RNA_def_property_ui_range(prop, 0.0, 100.0, 10.0, 2);
RNA_def_property_ui_text(prop,
"Buoyancy",
"Amount of buoyancy force that rises bubbles (high values result in "
"bubble movement mainly upwards)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_k_d", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 100.0);
RNA_def_property_ui_range(prop, 0.0, 100.0, 10.0, 2);
RNA_def_property_ui_text(prop,
"Drag",
"Amount of drag force that moves bubbles along with the fluid (high "
"values result in bubble movement mainly along with the fluid)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_l_min", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10000.0);
RNA_def_property_ui_range(prop, 0.0, 10000.0, 100.0, 1);
RNA_def_property_ui_text(prop, "Lifetime(min)", "Lowest possible particle lifetime");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_l_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10000.0);
RNA_def_property_ui_range(prop, 0.0, 10000.0, 100.0, 1);
RNA_def_property_ui_text(prop, "Lifetime(max)", "Highest possible particle lifetime");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_boundary", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "sndparticle_boundary");
RNA_def_property_enum_items(prop, sndparticle_boundary_items);
RNA_def_property_ui_text(
prop, "Particles in Boundary", "How particles that left the domain are treated");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "sndparticle_combined_export", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "sndparticle_combined_export");
RNA_def_property_enum_items(prop, sndparticle_combined_export_items);
RNA_def_property_ui_text(
prop,
"Combined Export",
"Determines which particle systems are created from secondary particles");
RNA_def_property_update(prop, 0, "rna_Fluid_combined_export_update");
prop = RNA_def_property(srna, "sndparticle_potential_radius", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "sndparticle_potential_radius");
RNA_def_property_range(prop, 1, 4);
RNA_def_property_ui_range(prop, 1, 4, 1, -1);
RNA_def_property_ui_text(prop,
"Potential Radius",
"Radius to compute potential for each cell (higher values are slower "
"but create smoother potential grids)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "sndparticle_update_radius", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "sndparticle_update_radius");
RNA_def_property_range(prop, 1, 4);
RNA_def_property_ui_range(prop, 1, 4, 1, -1);
RNA_def_property_ui_text(prop,
"Update Radius",
"Radius to compute position update for each particle (higher values "
"are slower but particles move less chaotic)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "particle_scale", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "particle_scale");
RNA_def_property_range(prop, 1, 100);
RNA_def_property_ui_range(prop, 1, 10, 1, -1);
RNA_def_property_ui_text(prop,
"Mesh scale",
"Scale underlying particle grids by this factor. Particle grids have "
"size factor times base resolution");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_spray_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "particle_type", FLUID_DOMAIN_PARTICLE_SPRAY);
RNA_def_property_ui_text(prop, "Spray", "Create spray particle system");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Fluid_spray_parts_update");
prop = RNA_def_property(srna, "use_bubble_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "particle_type", FLUID_DOMAIN_PARTICLE_BUBBLE);
RNA_def_property_ui_text(prop, "Bubble", "Create bubble particle system");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Fluid_bubble_parts_update");
prop = RNA_def_property(srna, "use_foam_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "particle_type", FLUID_DOMAIN_PARTICLE_FOAM);
RNA_def_property_ui_text(prop, "Foam", "Create foam particle system");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Fluid_foam_parts_update");
prop = RNA_def_property(srna, "use_tracer_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "particle_type", FLUID_DOMAIN_PARTICLE_TRACER);
RNA_def_property_ui_text(prop, "Tracer", "Create tracer particle system");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Fluid_tracer_parts_update");
/* fluid guiding options */
prop = RNA_def_property(srna, "guide_alpha", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "guide_alpha");
RNA_def_property_range(prop, 1.0, 100.0);
RNA_def_property_ui_text(prop, "Weight", "Guiding weight (higher value results in greater lag)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "guide_beta", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "guide_beta");
RNA_def_property_range(prop, 1, 50);
RNA_def_property_ui_text(prop, "Size", "Guiding size (higher value results in larger vortices)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "guide_vel_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "guide_vel_factor");
RNA_def_property_range(prop, 0.0, 100.0);
RNA_def_property_ui_text(
prop,
"Weight",
"Guiding velocity factor (higher value results in bigger guiding velocities)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "guide_source", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "guide_source");
RNA_def_property_enum_items(prop, fluid_guide_source_items);
RNA_def_property_ui_text(prop, "Guiding source", "Choose where to get guiding velocities from");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_update");
prop = RNA_def_property(srna, "guide_parent", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "guide_parent");
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_pointer_funcs(prop, NULL, "rna_Fluid_guide_parent_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop,
"",
"Use velocities from this object for the guiding effect (object needs "
"to have fluid modifier and be of type domain))");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_update");
prop = RNA_def_property(srna, "use_guide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_GUIDE);
RNA_def_property_ui_text(prop, "Use Guiding", "Enable fluid guiding");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
/* cache options */
prop = RNA_def_property(srna, "cache_frame_start", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "cache_frame_start");
RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1);
RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts");
prop = RNA_def_property(srna, "cache_frame_end", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "cache_frame_end");
RNA_def_property_range(prop, 1, MAXFRAME);
RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops");
prop = RNA_def_property(srna, "cache_frame_pause_data", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "cache_frame_pause_data");
prop = RNA_def_property(srna, "cache_frame_pause_noise", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "cache_frame_pause_noise");
prop = RNA_def_property(srna, "cache_frame_pause_mesh", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "cache_frame_pause_mesh");
prop = RNA_def_property(srna, "cache_frame_pause_particles", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "cache_frame_pause_particles");
prop = RNA_def_property(srna, "cache_frame_pause_guide", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "cache_frame_pause_guide");
prop = RNA_def_property(srna, "cache_mesh_format", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "cache_mesh_format");
RNA_def_property_enum_items(prop, cache_file_type_items);
RNA_def_property_enum_funcs(
prop, NULL, "rna_Fluid_cachetype_mesh_set", "rna_Fluid_cachetype_mesh_itemf");
RNA_def_property_ui_text(
prop, "File Format", "Select the file format to be used for caching surface data");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "cache_data_format", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "cache_data_format");
RNA_def_property_enum_items(prop, cache_file_type_items);
RNA_def_property_enum_funcs(
prop, NULL, "rna_Fluid_cachetype_data_set", "rna_Fluid_cachetype_volume_itemf");
RNA_def_property_ui_text(
prop, "File Format", "Select the file format to be used for caching volumetric data");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "cache_particle_format", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "cache_particle_format");
RNA_def_property_enum_items(prop, cache_file_type_items);
RNA_def_property_enum_funcs(
prop, NULL, "rna_Fluid_cachetype_particle_set", "rna_Fluid_cachetype_particle_itemf");
RNA_def_property_ui_text(
prop, "File Format", "Select the file format to be used for caching particle data");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "cache_noise_format", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "cache_noise_format");
RNA_def_property_enum_items(prop, cache_file_type_items);
RNA_def_property_enum_funcs(
prop, NULL, "rna_Fluid_cachetype_noise_set", "rna_Fluid_cachetype_volume_itemf");
RNA_def_property_ui_text(
prop, "File Format", "Select the file format to be used for caching noise data");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "cache_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "cache_type");
RNA_def_property_enum_items(prop, cache_types);
RNA_def_property_enum_funcs(prop, NULL, "rna_Fluid_cachetype_set", NULL);
RNA_def_property_ui_text(prop, "Type", "Change the cache type of the simulation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_reset");
prop = RNA_def_property(srna, "cache_directory", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_maxlength(prop, FILE_MAX);
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Fluid_cache_directory_set");
RNA_def_property_string_sdna(prop, NULL, "cache_directory");
RNA_def_property_ui_text(prop, "Cache directory", "Directory that contains fluid cache files");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_property(srna, "is_cache_baking_data", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKING_DATA);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_property(srna, "has_cache_baked_data", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKED_DATA);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_property(srna, "is_cache_baking_noise", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKING_NOISE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_property(srna, "has_cache_baked_noise", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKED_NOISE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_property(srna, "is_cache_baking_mesh", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKING_MESH);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_property(srna, "has_cache_baked_mesh", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKED_MESH);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_property(srna, "is_cache_baking_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKING_PARTICLES);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_property(srna, "has_cache_baked_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKED_PARTICLES);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_property(srna, "is_cache_baking_guide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKING_GUIDE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_property(srna, "has_cache_baked_guide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKED_GUIDE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
/* Read only checks, avoids individually accessing flags above. */
prop = RNA_def_property(srna, "is_cache_baking_any", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKING_ALL);
RNA_def_property_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "has_cache_baked_any", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", FLUID_DOMAIN_BAKED_ALL);
RNA_def_property_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "export_manta_script", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_EXPORT_MANTA_SCRIPT);
RNA_def_property_ui_text(
prop,
"Export Fluidflow Script",
"Generate and export Fluidflow script from current domain settings during bake. This is "
"only needed if you plan to analyse the cache (e.g. view grids, velocity vectors, "
"particles) in Fluidflow directly (outside of Blender) after baking the simulation");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
/* time options */
prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "time_scale");
RNA_def_property_range(prop, 0.0001, 10.0);
RNA_def_property_ui_text(prop, "Time Scale", "Adjust simulation speed");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "cfl_condition", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "cfl_condition");
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_text(
prop, "CFL", "Maximal velocity per cell (higher value results in larger timesteps)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "use_adaptive_timesteps", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_ADAPTIVE_TIME);
RNA_def_property_ui_text(prop, "Use Adaptive Time Steps", "");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache");
prop = RNA_def_property(srna, "timesteps_min", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "timesteps_minimum");
RNA_def_property_range(prop, 1, 100);
RNA_def_property_ui_range(prop, 0, 100, 1, -1);
RNA_def_property_ui_text(
prop, "Minimum", "Minimum number of simulation steps to perform for one frame");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "timesteps_max", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "timesteps_maximum");
RNA_def_property_range(prop, 1, 100);
RNA_def_property_ui_range(prop, 0, 100, 1, -1);
RNA_def_property_ui_text(
prop, "Maximum", "Maximum number of simulation steps to perform for one frame");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
/* display settings */
prop = RNA_def_property(srna, "slice_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "slice_method");
RNA_def_property_enum_items(prop, view_items);
RNA_def_property_ui_text(prop, "View Method", "How to slice the volume for viewport rendering");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "axis_slice_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "axis_slice_method");
RNA_def_property_enum_items(prop, axis_slice_method_items);
RNA_def_property_ui_text(prop, "Method", "");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "slice_axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "slice_axis");
RNA_def_property_enum_items(prop, axis_slice_position_items);
RNA_def_property_ui_text(prop, "Axis", "");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "slice_per_voxel", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "slice_per_voxel");
RNA_def_property_range(prop, 0.0, 100.0);
RNA_def_property_ui_range(prop, 0.0, 5.0, 0.1, 1);
RNA_def_property_ui_text(
prop, "Slice Per Voxel", "How many slices per voxel should be generated");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "slice_depth", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "slice_depth");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
RNA_def_property_ui_text(prop, "Position", "Position of the slice");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "display_thickness", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "display_thickness");
RNA_def_property_range(prop, 0.001, 1000.0);
RNA_def_property_ui_range(prop, 0.1, 100.0, 0.1, 3);
RNA_def_property_ui_text(prop, "Thickness", "Thickness of smoke drawing in the viewport");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_property(srna, "display_interpolation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "interp_method");
RNA_def_property_enum_items(prop, interp_method_item);
RNA_def_property_ui_text(
prop, "Interpolation", "Interpolation method to use for smoke/fire volumes in solid mode");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw_velocity", 0);
RNA_def_property_ui_text(
prop, "Display Velocity", "Toggle visualization of the velocity field as needles");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "vector_display_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "vector_draw_type");
RNA_def_property_enum_items(prop, vector_draw_items);
RNA_def_property_ui_text(prop, "Display Type", "");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "vector_scale", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vector_scale");
RNA_def_property_range(prop, 0.0, 1000.0);
RNA_def_property_ui_range(prop, 0.0, 100.0, 0.1, 3);
RNA_def_property_ui_text(prop, "Scale", "Multiplier for scaling the vectors");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
/* --------- Color mapping. --------- */
prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "use_coba", 0);
RNA_def_property_boolean_funcs(prop, NULL, "rna_Fluid_use_color_ramp_set");
RNA_def_property_ui_text(
prop,
"Use Color Ramp",
"Render a simulation field while mapping its voxels values to the colors of a ramp");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
static const EnumPropertyItem coba_field_items[] = {
{FLUID_DOMAIN_FIELD_COLOR_R, "COLOR_R", 0, "Red", "Red component of the color field"},
{FLUID_DOMAIN_FIELD_COLOR_G, "COLOR_G", 0, "Green", "Green component of the color field"},
{FLUID_DOMAIN_FIELD_COLOR_B, "COLOR_B", 0, "Blue", "Blue component of the color field"},
{FLUID_DOMAIN_FIELD_DENSITY, "DENSITY", 0, "Density", "Quantity of soot in the fluid"},
{FLUID_DOMAIN_FIELD_FLAME, "FLAME", 0, "Flame", "Flame field"},
{FLUID_DOMAIN_FIELD_FUEL, "FUEL", 0, "Fuel", "Fuel field"},
{FLUID_DOMAIN_FIELD_HEAT, "HEAT", 0, "Heat", "Temperature of the fluid"},
{FLUID_DOMAIN_FIELD_VELOCITY_X,
"VELOCITY_X",
0,
"X Velocity",
"X component of the velocity field"},
{FLUID_DOMAIN_FIELD_VELOCITY_Y,
"VELOCITY_Y",
0,
"Y Velocity",
"Y component of the velocity field"},
{FLUID_DOMAIN_FIELD_VELOCITY_Z,
"VELOCITY_Z",
0,
"Z Velocity",
"Z component of the velocity field"},
{0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "coba_field", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "coba_field");
RNA_def_property_enum_items(prop, coba_field_items);
RNA_def_property_ui_text(prop, "Field", "Simulation field to color map");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "coba");
RNA_def_property_struct_type(prop, "ColorRamp");
RNA_def_property_ui_text(prop, "Color Ramp", "");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "clipping", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "clipping");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
RNA_def_property_ui_text(
prop,
"Clipping",
"Value under which voxels are considered empty space to optimize caching and rendering");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
/* -- Deprecated / unsed options (below)-- */
/* pointcache options */
prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "point_cache[0]");
RNA_def_property_struct_type(prop, "PointCache");
RNA_def_property_ui_text(prop, "Point Cache", "");
prop = RNA_def_property(srna, "point_cache_compress_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "cache_comp");
RNA_def_property_enum_items(prop, cache_comp_items);
RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
/* OpenVDB options */
prop = RNA_def_property(srna, "openvdb_cache_compress_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "openvdb_comp");
RNA_def_property_enum_items(prop, prop_compression_items);
RNA_def_property_ui_text(prop, "Compression", "Compression method to be used");
prop = RNA_def_property(srna, "data_depth", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "data_depth");
RNA_def_property_enum_items(prop, smoke_data_depth_items);
RNA_def_property_ui_text(prop,
"Data Depth",
"Bit depth for writing all scalar (including vector) "
"lower values reduce file size");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
}
static void rna_def_fluid_flow_settings(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static const EnumPropertyItem flow_types[] = {
{FLUID_FLOW_TYPE_SMOKE, "SMOKE", 0, "Smoke", "Add smoke"},
{FLUID_FLOW_TYPE_SMOKEFIRE, "BOTH", 0, "Fire + Smoke", "Add fire and smoke"},
{FLUID_FLOW_TYPE_FIRE, "FIRE", 0, "Fire", "Add fire"},
{FLUID_FLOW_TYPE_LIQUID, "LIQUID", 0, "Liquid", "Add liquid"},
{0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem flow_behaviors[] = {
{FLUID_FLOW_BEHAVIOR_INFLOW, "INFLOW", 0, "Inflow", "Add fluid to simulation"},
{FLUID_FLOW_BEHAVIOR_OUTFLOW, "OUTFLOW", 0, "Outflow", "Delete fluid from simulation"},
{FLUID_FLOW_BEHAVIOR_GEOMETRY,
"GEOMETRY",
0,
"Geometry",
"Only use given geometry for fluid"},
{0, NULL, 0, NULL, NULL},
};
/* Flow source - generated dynamically based on flow type */
static EnumPropertyItem flow_sources[] = {
{0, "NONE", 0, "", ""},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem flow_texture_types[] = {
{FLUID_FLOW_TEXTURE_MAP_AUTO,
"AUTO",
0,
"Generated",
"Generated coordinates centered to flow object"},
{FLUID_FLOW_TEXTURE_MAP_UV, "UV", 0, "UV", "Use UV layer for texture coordinates"},
{0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FluidFlowSettings", NULL);
RNA_def_struct_ui_text(srna, "Flow Settings", "Fluid flow settings");
RNA_def_struct_sdna(srna, "FluidFlowSettings");
RNA_def_struct_path_func(srna, "rna_FluidFlowSettings_path");
prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "density");
RNA_def_property_range(prop, 0.0, 1);
RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 4);
RNA_def_property_ui_text(prop, "Density", "");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "color");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "fuel_amount", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10);
RNA_def_property_ui_range(prop, 0.0, 5.0, 1.0, 4);
RNA_def_property_ui_text(prop, "Flame Rate", "");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "temperature");
RNA_def_property_range(prop, -10, 10);
RNA_def_property_ui_range(prop, -10, 10, 1, 1);
RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "psys");
RNA_def_property_struct_type(prop, "ParticleSystem");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
RNA_def_property_update(prop, 0, "rna_Fluid_reset_dependency");
prop = RNA_def_property(srna, "flow_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, flow_types);
RNA_def_property_enum_funcs(prop, NULL, "rna_Fluid_flowtype_set", NULL);
RNA_def_property_ui_text(prop, "Flow Type", "Change type of fluid in the simulation");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "flow_behavior", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "behavior");
RNA_def_property_enum_items(prop, flow_behaviors);
RNA_def_property_ui_text(prop, "Flow Behavior", "Change flow behavior in the simulation");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "flow_source", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "source");
RNA_def_property_enum_items(prop, flow_sources);
RNA_def_property_enum_funcs(
prop, NULL, "rna_Fluid_flowsource_set", "rna_Fluid_flowsource_itemf");
RNA_def_property_ui_text(prop, "Source", "Change how fluid is emitted");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_FLOW_ABSOLUTE);
RNA_def_property_ui_text(prop,
"Absolute Density",
"Only allow given density value in emitter area and will not add up");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_initial_velocity", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_FLOW_INITVELOCITY);
RNA_def_property_ui_text(
prop, "Initial Velocity", "Fluid has some initial velocity when it is emitted");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vel_multi");
RNA_def_property_range(prop, -100.0, 100.0);
RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
RNA_def_property_ui_text(prop,
"Source",
"Multiplier of source velocity passed to fluid (source velocity is "
"non-zero only if object is moving)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "velocity_normal", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vel_normal");
RNA_def_property_range(prop, -100.0, 100.0);
RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
RNA_def_property_ui_text(prop, "Normal", "Amount of normal directional velocity");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "velocity_random", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vel_random");
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_range(prop, 0.0, 2.0, 0.05, 5);
RNA_def_property_ui_text(prop, "Random", "Amount of random velocity");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "velocity_coord", PROP_FLOAT, PROP_XYZ);
RNA_def_property_float_sdna(prop, NULL, "vel_coord");
RNA_def_property_array(prop, 3);
RNA_def_property_range(prop, -1000.1, 1000.1);
RNA_def_property_ui_text(prop, "Initial", "Initial velocity in X, Y and Z direction");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "volume_density", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.05, 5);
RNA_def_property_ui_text(prop, "Volume", "Factor for smoke emitted from inside the mesh volume");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_range(prop, 0.0, 10.0, 0.05, 5);
RNA_def_property_ui_text(prop, "Surface", "Maximum distance from mesh surface to emit fluid");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_plane_init", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_FLOW_USE_PLANE_INIT);
RNA_def_property_ui_text(prop, "Is Planar", "Treat this object as a planar, unclosed mesh");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.1, 20.0);
RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5);
RNA_def_property_ui_text(prop, "Size", "Particle size in simulation cells");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_particle_size", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_FLOW_USE_PART_SIZE);
RNA_def_property_ui_text(
prop, "Set Size", "Set particle size in simulation cells or use nearest cell");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_inflow", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_FLOW_USE_INFLOW);
RNA_def_property_ui_text(prop, "Enabled", "Control when to apply inflow");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 200);
RNA_def_property_ui_range(prop, 0, 10, 1, -1);
RNA_def_property_ui_text(prop,
"Subframes",
"Number of additional samples to take between frames to improve "
"quality of fast moving flows");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "density_vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop,
"rna_FluidFlow_density_vgroup_get",
"rna_FluidFlow_density_vgroup_length",
"rna_FluidFlow_density_vgroup_set");
RNA_def_property_ui_text(
prop, "Vertex Group", "Name of vertex group which determines surface emission rate");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_FLOW_TEXTUREEMIT);
RNA_def_property_ui_text(prop, "Use Texture", "Use a texture to control emission strength");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "texture_map_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "texture_type");
RNA_def_property_enum_items(prop, flow_texture_types);
RNA_def_property_ui_text(prop, "Mapping", "Texture mapping type");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
RNA_def_property_ui_text(prop, "UV Map", "UV map name");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_FluidFlow_uvlayer_set");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "noise_texture", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Texture", "Texture that controls emission strength");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "texture_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.01, 10.0);
RNA_def_property_ui_range(prop, 0.1, 5.0, 0.05, 5);
RNA_def_property_ui_text(prop, "Size", "Size of texture mapping");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 200.0);
RNA_def_property_ui_range(prop, 0.0, 100.0, 0.05, 5);
RNA_def_property_ui_text(prop, "Offset", "Z-offset of texture mapping");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
}
static void rna_def_fluid_effector_settings(BlenderRNA *brna)
{
static EnumPropertyItem effector_type_items[] = {
{FLUID_EFFECTOR_TYPE_COLLISION, "COLLISION", 0, "Collision", "Create collision object"},
{FLUID_EFFECTOR_TYPE_GUIDE, "GUIDE", 0, "Guide", "Create guide object"},
{0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem fluid_guide_mode_items[] = {
{FLUID_EFFECTOR_GUIDE_MAX,
"MAXIMUM",
0,
"Maximize",
"Compare velocities from previous frame with new velocities from current frame and keep "
"the maximum"},
{FLUID_EFFECTOR_GUIDE_MIN,
"MINIMUM",
0,
"Minimize",
"Compare velocities from previous frame with new velocities from current frame and keep "
"the minimum"},
{FLUID_EFFECTOR_GUIDE_OVERRIDE,
"OVERRIDE",
0,
"Override",
"Always write new guide velocities for every frame (each frame only contains current "
"velocities from guiding objects)"},
{FLUID_EFFECTOR_GUIDE_AVERAGED,
"AVERAGED",
0,
"Averaged",
"Take average of velocities from previous frame and new velocities from current frame"},
{0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "FluidEffectorSettings", NULL);
RNA_def_struct_ui_text(srna, "Effector Settings", "Smoke collision settings");
RNA_def_struct_sdna(srna, "FluidEffectorSettings");
RNA_def_struct_path_func(srna, "rna_FluidEffectorSettings_path");
prop = RNA_def_property(srna, "effector_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, effector_type_items);
RNA_def_property_ui_text(prop, "Effector Type", "Change type of effector in the simulation");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_range(prop, 0.0, 10.0, 0.05, 5);
RNA_def_property_ui_text(
prop, "Surface", "Distance around mesh surface to consider as effector");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "use_plane_init", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_FLOW_USE_PLANE_INIT);
RNA_def_property_ui_text(prop, "Is Planar", "Treat this object as a planar, unclosed mesh");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vel_multi");
RNA_def_property_range(prop, -100.0, 100.0);
RNA_def_property_ui_text(prop, "Source", "Multiplier of obstacle velocity");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
prop = RNA_def_property(srna, "guide_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "guide_mode");
RNA_def_property_enum_items(prop, fluid_guide_mode_items);
RNA_def_property_ui_text(prop, "Guiding mode", "How to create guiding velocities");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_update");
}
void RNA_def_fluid(BlenderRNA *brna)
{
rna_def_fluid_domain_settings(brna);
rna_def_fluid_flow_settings(brna);
rna_def_fluid_effector_settings(brna);
}
#endif
|