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
|
/*
* 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.
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*/
/** \file
* \ingroup RNA
*/
#include <stdio.h>
#include <stdlib.h>
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "DNA_screen_types.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "UI_resources.h"
#include "rna_internal.h"
#define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""},
#define DEF_ICON_VECTOR(name) {ICON_##name, (#name), 0, (#name), ""},
#define DEF_ICON_COLOR(name) {ICON_##name, (#name), 0, (#name), ""},
#define DEF_ICON_BLANK(name)
const EnumPropertyItem rna_enum_icon_items[] = {
#include "UI_icons.h"
{0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
const char *rna_translate_ui_text(
const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, bool translate)
{
/* Also return text if UI labels translation is disabled. */
if (!text || !text[0] || !translate || !BLT_translate_iface()) {
return text;
}
/* If a text_ctxt is specified, use it! */
if (text_ctxt && text_ctxt[0]) {
return BLT_pgettext(text_ctxt, text);
}
/* Else, if an RNA type or property is specified, use its context. */
# if 0
/* XXX Disabled for now. Unfortunately, their is absolutely no way from py code to get the RNA
* struct corresponding to the 'data' (in functions like prop() & co),
* as this is pure runtime data. Hence, messages extraction script can't determine the
* correct context it should use for such 'text' messages...
* So for now, one have to explicitly specify the 'text_ctxt' when using prop() etc.
* functions, if default context is not suitable.
*/
if (prop) {
return BLT_pgettext(RNA_property_translation_context(prop), text);
}
# else
(void)prop;
# endif
if (type) {
return BLT_pgettext(RNA_struct_translation_context(type), text);
}
/* Else, default context! */
return BLT_pgettext(BLT_I18NCONTEXT_DEFAULT, text);
}
static void rna_uiItemR(uiLayout *layout,
PointerRNA *ptr,
const char *propname,
const char *name,
const char *text_ctxt,
bool translate,
int icon,
bool expand,
bool slider,
int toggle,
bool icon_only,
bool event,
bool full_event,
bool emboss,
int index,
int icon_value,
bool invert_checkbox)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
int flag = 0;
if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
if (icon_value && !icon) {
icon = icon_value;
}
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
flag |= (slider) ? UI_ITEM_R_SLIDER : 0;
flag |= (expand) ? UI_ITEM_R_EXPAND : 0;
if (toggle == 1) {
flag |= UI_ITEM_R_TOGGLE;
}
else if (toggle == 0) {
flag |= UI_ITEM_R_ICON_NEVER;
}
flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
flag |= (event) ? UI_ITEM_R_EVENT : 0;
flag |= (full_event) ? UI_ITEM_R_FULL_EVENT : 0;
flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG;
flag |= (invert_checkbox) ? UI_ITEM_R_CHECKBOX_INVERT : 0;
uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon);
}
static void rna_uiItemR_with_popover(uiLayout *layout,
struct PointerRNA *ptr,
const char *propname,
const char *name,
const char *text_ctxt,
bool translate,
int icon,
bool icon_only,
const char *panel_type)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
if ((RNA_property_type(prop) != PROP_ENUM) &&
!ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA)) {
RNA_warning(
"property is not an enum or color: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
int flag = 0;
flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
uiItemFullR_with_popover(layout, ptr, prop, -1, 0, flag, name, icon, panel_type);
}
static void rna_uiItemR_with_menu(uiLayout *layout,
struct PointerRNA *ptr,
const char *propname,
const char *name,
const char *text_ctxt,
bool translate,
int icon,
bool icon_only,
const char *menu_type)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
if (RNA_property_type(prop) != PROP_ENUM) {
RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
int flag = 0;
flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
uiItemFullR_with_menu(layout, ptr, prop, -1, 0, flag, name, icon, menu_type);
}
static void rna_uiItemMenuEnumR(uiLayout *layout,
struct PointerRNA *ptr,
const char *propname,
const char *name,
const char *text_ctxt,
bool translate,
int icon)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
uiItemMenuEnumR_prop(layout, ptr, prop, name, icon);
}
static void rna_uiItemTabsEnumR(uiLayout *layout,
bContext *C,
struct PointerRNA *ptr,
const char *propname,
struct PointerRNA *ptr_highlight,
const char *propname_highlight,
bool icon_only)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
if (RNA_property_type(prop) != PROP_ENUM) {
RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
/* Get the highlight property used to gray out some of the tabs. */
PropertyRNA *prop_highlight = NULL;
if (!RNA_pointer_is_null(ptr_highlight)) {
prop_highlight = RNA_struct_find_property(ptr_highlight, propname_highlight);
if (!prop_highlight) {
RNA_warning("property not found: %s.%s",
RNA_struct_identifier(ptr_highlight->type),
propname_highlight);
return;
}
if (RNA_property_type(prop_highlight) != PROP_BOOLEAN) {
RNA_warning("property is not a boolean: %s.%s",
RNA_struct_identifier(ptr_highlight->type),
propname_highlight);
return;
}
if (!RNA_property_array_check(prop_highlight)) {
RNA_warning("property is not an array: %s.%s",
RNA_struct_identifier(ptr_highlight->type),
propname_highlight);
return;
}
}
uiItemTabsEnumR_prop(layout, C, ptr, prop, ptr_highlight, prop_highlight, icon_only);
}
static void rna_uiItemEnumR_string(uiLayout *layout,
struct PointerRNA *ptr,
const char *propname,
const char *value,
const char *name,
const char *text_ctxt,
bool translate,
int icon)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
uiItemEnumR_string_prop(layout, ptr, prop, value, name, icon);
}
static void rna_uiItemPointerR(uiLayout *layout,
struct PointerRNA *ptr,
const char *propname,
struct PointerRNA *searchptr,
const char *searchpropname,
const char *name,
const char *text_ctxt,
bool translate,
int icon)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
PropertyRNA *searchprop = RNA_struct_find_property(searchptr, searchpropname);
if (!searchprop) {
RNA_warning(
"property not found: %s.%s", RNA_struct_identifier(searchptr->type), searchpropname);
return;
}
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
uiItemPointerR_prop(layout, ptr, prop, searchptr, searchprop, name, icon);
}
static PointerRNA rna_uiItemO(uiLayout *layout,
const char *opname,
const char *name,
const char *text_ctxt,
bool translate,
int icon,
bool emboss,
bool depress,
int icon_value)
{
wmOperatorType *ot;
ot = WM_operatortype_find(opname, 0); /* print error next */
if (!ot || !ot->srna) {
RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
return PointerRNA_NULL;
}
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
if (icon_value && !icon) {
icon = icon_value;
}
int flag = (emboss) ? 0 : UI_ITEM_R_NO_BG;
flag |= (depress) ? UI_ITEM_O_DEPRESS : 0;
PointerRNA opptr;
uiItemFullO_ptr(layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag, &opptr);
return opptr;
}
static PointerRNA rna_uiItemOMenuHold(uiLayout *layout,
const char *opname,
const char *name,
const char *text_ctxt,
bool translate,
int icon,
bool emboss,
bool depress,
int icon_value,
const char *menu)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
if (!ot || !ot->srna) {
RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
return PointerRNA_NULL;
}
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
if (icon_value && !icon) {
icon = icon_value;
}
int flag = (emboss) ? 0 : UI_ITEM_R_NO_BG;
flag |= (depress) ? UI_ITEM_O_DEPRESS : 0;
PointerRNA opptr;
uiItemFullOMenuHold_ptr(
layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag, menu, &opptr);
return opptr;
}
static void rna_uiItemsEnumO(uiLayout *layout,
const char *opname,
const char *propname,
const bool icon_only)
{
int flag = icon_only ? UI_ITEM_R_ICON_ONLY : 0;
uiItemsFullEnumO(layout, opname, propname, NULL, uiLayoutGetOperatorContext(layout), flag);
}
static void rna_uiItemMenuEnumO(uiLayout *layout,
bContext *C,
const char *opname,
const char *propname,
const char *name,
const char *text_ctxt,
bool translate,
int icon)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
if (!ot || !ot->srna) {
RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
return;
}
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
uiItemMenuEnumO_ptr(layout, C, ot, propname, name, icon);
}
static void rna_uiItemL(uiLayout *layout,
const char *name,
const char *text_ctxt,
bool translate,
int icon,
int icon_value)
{
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
if (icon_value && !icon) {
icon = icon_value;
}
uiItemL(layout, name, icon);
}
static void rna_uiItemM(uiLayout *layout,
const char *menuname,
const char *name,
const char *text_ctxt,
bool translate,
int icon,
int icon_value)
{
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
if (icon_value && !icon) {
icon = icon_value;
}
uiItemM(layout, menuname, name, icon);
}
static void rna_uiItemM_contents(uiLayout *layout, const char *menuname)
{
uiItemMContents(layout, menuname);
}
static void rna_uiItemPopoverPanel(uiLayout *layout,
bContext *C,
const char *panel_type,
const char *name,
const char *text_ctxt,
bool translate,
int icon,
int icon_value)
{
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
if (icon_value && !icon) {
icon = icon_value;
}
uiItemPopoverPanel(layout, C, panel_type, name, icon);
}
static void rna_uiItemPopoverPanelFromGroup(uiLayout *layout,
bContext *C,
int space_id,
int region_id,
const char *context,
const char *category)
{
uiItemPopoverPanelFromGroup(layout, C, space_id, region_id, context, category);
}
static void rna_uiTemplateID(uiLayout *layout,
bContext *C,
PointerRNA *ptr,
const char *propname,
const char *newop,
const char *openop,
const char *unlinkop,
int filter,
const bool live_icon,
const char *name,
const char *text_ctxt,
bool translate)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
uiTemplateID(layout, C, ptr, propname, newop, openop, unlinkop, filter, live_icon, name);
}
static void rna_uiTemplateAnyID(uiLayout *layout,
PointerRNA *ptr,
const char *propname,
const char *proptypename,
const char *name,
const char *text_ctxt,
bool translate)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
/* XXX This will search property again :( */
uiTemplateAnyID(layout, ptr, propname, proptypename, name);
}
static void rna_uiTemplateCacheFile(uiLayout *layout,
bContext *C,
PointerRNA *ptr,
const char *propname)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
uiTemplateCacheFile(layout, C, ptr, propname);
}
static void rna_uiTemplatePathBuilder(uiLayout *layout,
PointerRNA *ptr,
const char *propname,
PointerRNA *root_ptr,
const char *name,
const char *text_ctxt,
bool translate)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
/* XXX This will search property again :( */
uiTemplatePathBuilder(layout, ptr, propname, root_ptr, name);
}
static void rna_uiTemplateEventFromKeymapItem(
uiLayout *layout, wmKeyMapItem *kmi, const char *name, const char *text_ctxt, bool translate)
{
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
uiTemplateEventFromKeymapItem(layout, name, kmi, true);
}
static uiLayout *rna_uiLayoutRowWithHeading(
uiLayout *layout, bool align, const char *heading, const char *heading_ctxt, bool translate)
{
/* Get translated heading. */
heading = rna_translate_ui_text(heading, heading_ctxt, NULL, NULL, translate);
return uiLayoutRowWithHeading(layout, align, heading);
}
static uiLayout *rna_uiLayoutColumnWithHeading(
uiLayout *layout, bool align, const char *heading, const char *heading_ctxt, bool translate)
{
/* Get translated heading. */
heading = rna_translate_ui_text(heading, heading_ctxt, NULL, NULL, translate);
return uiLayoutColumnWithHeading(layout, align, heading);
}
static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon)
{
return UI_icon_from_rnaptr(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), false);
}
static const char *rna_ui_get_enum_name(bContext *C,
PointerRNA *ptr,
const char *propname,
const char *identifier)
{
PropertyRNA *prop = NULL;
const EnumPropertyItem *items = NULL;
bool free;
const char *name = "";
prop = RNA_struct_find_property(ptr, propname);
if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
RNA_warning(
"Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
return name;
}
RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
if (items) {
const int index = RNA_enum_from_identifier(items, identifier);
if (index != -1) {
name = items[index].name;
}
if (free) {
MEM_freeN((void *)items);
}
}
return name;
}
static const char *rna_ui_get_enum_description(bContext *C,
PointerRNA *ptr,
const char *propname,
const char *identifier)
{
PropertyRNA *prop = NULL;
const EnumPropertyItem *items = NULL;
bool free;
const char *desc = "";
prop = RNA_struct_find_property(ptr, propname);
if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
RNA_warning(
"Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
return desc;
}
RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
if (items) {
const int index = RNA_enum_from_identifier(items, identifier);
if (index != -1) {
desc = items[index].description;
}
if (free) {
MEM_freeN((void *)items);
}
}
return desc;
}
static int rna_ui_get_enum_icon(bContext *C,
PointerRNA *ptr,
const char *propname,
const char *identifier)
{
PropertyRNA *prop = NULL;
const EnumPropertyItem *items = NULL;
bool free;
int icon = ICON_NONE;
prop = RNA_struct_find_property(ptr, propname);
if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
RNA_warning(
"Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
return icon;
}
RNA_property_enum_items(C, ptr, prop, &items, NULL, &free);
if (items) {
const int index = RNA_enum_from_identifier(items, identifier);
if (index != -1) {
icon = items[index].icon;
}
if (free) {
MEM_freeN((void *)items);
}
}
return icon;
}
#else
static void api_ui_item_common_heading(FunctionRNA *func)
{
RNA_def_string(func,
"heading",
NULL,
UI_MAX_NAME_STR,
"Heading",
"Label to insert into the layout for this sub-layout");
RNA_def_string(func,
"heading_ctxt",
NULL,
0,
"",
"Override automatic translation context of the given heading");
RNA_def_boolean(
func, "translate", true, "", "Translate the given heading, when UI translation is enabled");
}
static void api_ui_item_common_text(FunctionRNA *func)
{
PropertyRNA *prop;
prop = RNA_def_string(func, "text", NULL, 0, "", "Override automatic text of the item");
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL);
prop = RNA_def_string(
func, "text_ctxt", NULL, 0, "", "Override automatic translation context of the given text");
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL);
RNA_def_boolean(
func, "translate", true, "", "Translate the given text, when UI translation is enabled");
}
static void api_ui_item_common(FunctionRNA *func)
{
PropertyRNA *prop;
api_ui_item_common_text(func);
prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_icon_items);
RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item");
}
static void api_ui_item_op(FunctionRNA *func)
{
PropertyRNA *parm;
parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void api_ui_item_op_common(FunctionRNA *func)
{
api_ui_item_op(func);
api_ui_item_common(func);
}
static void api_ui_item_rna_common(FunctionRNA *func)
{
PropertyRNA *parm;
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_api_ui_layout(StructRNA *srna)
{
FunctionRNA *func;
PropertyRNA *parm;
static const EnumPropertyItem curve_type_items[] = {
{0, "NONE", 0, "None", ""},
{'v', "VECTOR", 0, "Vector", ""},
{'c', "COLOR", 0, "Color", ""},
{'h', "HUE", 0, "Hue", ""},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem id_template_filter_items[] = {
{UI_TEMPLATE_ID_FILTER_ALL, "ALL", 0, "All", ""},
{UI_TEMPLATE_ID_FILTER_AVAILABLE, "AVAILABLE", 0, "Available", ""},
{0, NULL, 0, NULL, NULL},
};
static float node_socket_color_default[] = {0.0f, 0.0f, 0.0f, 1.0f};
/* simple layout specifiers */
func = RNA_def_function(srna, "row", "rna_uiLayoutRowWithHeading");
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
RNA_def_function_return(func, parm);
RNA_def_function_ui_description(
func,
"Sub-layout. Items placed in this sublayout are placed next to each other "
"in a row");
RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
api_ui_item_common_heading(func);
func = RNA_def_function(srna, "column", "rna_uiLayoutColumnWithHeading");
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
RNA_def_function_return(func, parm);
RNA_def_function_ui_description(
func,
"Sub-layout. Items placed in this sublayout are placed under each other "
"in a column");
RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
api_ui_item_common_heading(func);
func = RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow");
RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic", 0, INT_MAX);
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
RNA_def_function_return(func, parm);
RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
func = RNA_def_function(srna, "grid_flow", "uiLayoutGridFlow");
RNA_def_boolean(func, "row_major", false, "", "Fill row by row, instead of column by column");
RNA_def_int(
func,
"columns",
0,
INT_MIN,
INT_MAX,
"",
"Number of columns, positive are absolute fixed numbers, 0 is automatic, negative are "
"automatic multiple numbers along major axis (e.g. -2 will only produce 2, 4, 6 etc. "
"columns for row major layout, and 2, 4, 6 etc. rows for column major layout)",
INT_MIN,
INT_MAX);
RNA_def_boolean(func, "even_columns", false, "", "All columns will have the same width");
RNA_def_boolean(func, "even_rows", false, "", "All rows will have the same height");
RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
RNA_def_function_return(func, parm);
/* box layout */
func = RNA_def_function(srna, "box", "uiLayoutBox");
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
RNA_def_function_return(func, parm);
RNA_def_function_ui_description(func,
"Sublayout (items placed in this sublayout are placed "
"under each other in a column and are surrounded by a box)");
/* split layout */
func = RNA_def_function(srna, "split", "uiLayoutSplit");
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
RNA_def_function_return(func, parm);
RNA_def_float(func,
"factor",
0.0f,
0.0f,
1.0f,
"Percentage",
"Percentage of width to split at (leave unset for automatic calculation)",
0.0f,
1.0f);
RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
/* radial/pie layout */
func = RNA_def_function(srna, "menu_pie", "uiLayoutRadial");
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
RNA_def_function_return(func, parm);
RNA_def_function_ui_description(func,
"Sublayout. Items placed in this sublayout are placed "
"in a radial fashion around the menu center)");
/* Icon of a rna pointer */
func = RNA_def_function(srna, "icon", "rna_ui_get_rnaptr_icon");
parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
RNA_def_function_return(func, parm);
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take the icon");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_function_ui_description(func,
"Return the custom icon for this data, "
"use it e.g. to get materials or texture icons");
/* UI name, description and icon of an enum item */
func = RNA_def_function(srna, "enum_item_name", "rna_ui_get_enum_name");
parm = RNA_def_string(func, "name", NULL, 0, "", "UI name of the enum item");
RNA_def_function_return(func, parm);
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_function_ui_description(func, "Return the UI name for this enum item");
func = RNA_def_function(srna, "enum_item_description", "rna_ui_get_enum_description");
parm = RNA_def_string(func, "description", NULL, 0, "", "UI description of the enum item");
RNA_def_function_return(func, parm);
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_function_ui_description(func, "Return the UI description for this enum item");
func = RNA_def_function(srna, "enum_item_icon", "rna_ui_get_enum_icon");
parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
RNA_def_function_return(func, parm);
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_function_ui_description(func, "Return the icon for this enum item");
/* items */
func = RNA_def_function(srna, "prop", "rna_uiItemR");
RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout");
api_ui_item_rna_common(func);
api_ui_item_common(func);
RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");
RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values");
RNA_def_int(func,
"toggle",
-1,
-1,
1,
"",
"Use toggle widget for boolean values, "
"or a checkbox when disabled "
"(the default is -1 which uses toggle only when an icon is displayed)",
-1,
1);
RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text");
RNA_def_boolean(func, "event", false, "", "Use button to input key events");
RNA_def_boolean(
func, "full_event", false, "", "Use button to input full events including modifiers");
RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just the icon/text");
RNA_def_int(func,
"index",
/* RNA_NO_INDEX == -1 */
-1,
-2,
INT_MAX,
"",
"The index of this button, when set a single member of an array can be accessed, "
"when set to -1 all array members are used",
-2,
INT_MAX);
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
RNA_def_boolean(func, "invert_checkbox", false, "", "Draw checkbox value inverted");
func = RNA_def_function(srna, "props_enum", "uiItemsEnumR");
api_ui_item_rna_common(func);
func = RNA_def_function(srna, "prop_menu_enum", "rna_uiItemMenuEnumR");
api_ui_item_rna_common(func);
api_ui_item_common(func);
func = RNA_def_function(srna, "prop_with_popover", "rna_uiItemR_with_popover");
api_ui_item_rna_common(func);
api_ui_item_common(func);
RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
parm = RNA_def_string(func, "panel", NULL, 0, "", "Identifier of the panel");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "prop_with_menu", "rna_uiItemR_with_menu");
api_ui_item_rna_common(func);
api_ui_item_common(func);
RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "prop_tabs_enum", "rna_uiItemTabsEnumR");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
parm = RNA_def_pointer(
func, "data_highlight", "AnyType", "", "Data from which to take highlight property");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
parm = RNA_def_string(
func, "property_highlight", NULL, 0, "", "Identifier of highlight property in data");
RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
func = RNA_def_function(srna, "prop_enum", "rna_uiItemEnumR_string");
api_ui_item_rna_common(func);
parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
api_ui_item_common(func);
func = RNA_def_function(srna, "prop_search", "rna_uiItemPointerR");
api_ui_item_rna_common(func);
parm = RNA_def_pointer(
func, "search_data", "AnyType", "", "Data from which to take collection to search in");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(
func, "search_property", NULL, 0, "", "Identifier of search collection property");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
api_ui_item_common(func);
func = RNA_def_function(srna, "prop_decorator", "uiItemDecoratorR");
api_ui_item_rna_common(func);
RNA_def_int(func,
"index",
/* RNA_NO_INDEX == -1 */
-1,
-2,
INT_MAX,
"",
"The index of this button, when set a single member of an array can be accessed, "
"when set to -1 all array members are used",
-2,
INT_MAX);
for (int is_menu_hold = 0; is_menu_hold < 2; is_menu_hold++) {
func = (is_menu_hold) ? RNA_def_function(srna, "operator_menu_hold", "rna_uiItemOMenuHold") :
RNA_def_function(srna, "operator", "rna_uiItemO");
api_ui_item_op_common(func);
RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just the icon/text");
RNA_def_boolean(func, "depress", false, "", "Draw pressed in");
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
if (is_menu_hold) {
parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
parm = RNA_def_pointer(
func, "properties", "OperatorProperties", "", "Operator properties to fill in");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_function_return(func, parm);
RNA_def_function_ui_description(func,
"Item. Places a button into the layout to call an Operator");
}
func = RNA_def_function(srna, "operator_enum", "rna_uiItemsEnumO");
parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text");
func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
/* Can't use #api_ui_item_op_common because property must come right after. */
api_ui_item_op(func);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
api_ui_item_common(func);
/* useful in C but not in python */
# if 0
func = RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string");
api_ui_item_op_common(func);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "operator_boolean", "uiItemBooleanO");
api_ui_item_op_common(func);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_boolean(
func, "value", false, "", "Value of the property to call the operator with");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "operator_int", "uiItemIntO");
api_ui_item_op_common(func);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_int(func,
"value",
0,
INT_MIN,
INT_MAX,
"",
"Value of the property to call the operator with",
INT_MIN,
INT_MAX);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "operator_float", "uiItemFloatO");
api_ui_item_op_common(func);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_float(func,
"value",
0,
-FLT_MAX,
FLT_MAX,
"",
"Value of the property to call the operator with",
-FLT_MAX,
FLT_MAX);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "operator_string", "uiItemStringO");
api_ui_item_op_common(func);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_string(
func, "value", NULL, 0, "", "Value of the property to call the operator with");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
# endif
func = RNA_def_function(srna, "label", "rna_uiItemL");
RNA_def_function_ui_description(func, "Item. Displays text and/or icon in the layout");
api_ui_item_common(func);
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
func = RNA_def_function(srna, "menu", "rna_uiItemM");
parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
api_ui_item_common(func);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
func = RNA_def_function(srna, "menu_contents", "rna_uiItemM_contents");
parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "popover", "rna_uiItemPopoverPanel");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm = RNA_def_string(func, "panel", NULL, 0, "", "Identifier of the panel");
api_ui_item_common(func);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
func = RNA_def_function(srna, "popover_group", "rna_uiItemPopoverPanelFromGroup");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm = RNA_def_enum(func, "space_type", rna_enum_space_type_items, 0, "Space Type", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_enum(
func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_string(func, "context", NULL, 0, "", "panel type context");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_string(func, "category", NULL, 0, "", "panel type category");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "separator", "uiItemS_ex");
RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items");
RNA_def_float(func,
"factor",
1.0f,
0.0f,
FLT_MAX,
"Percentage",
"Percentage of width to space (leave unset for default space)",
0.0f,
FLT_MAX);
func = RNA_def_function(srna, "separator_spacer", "uiItemSpacer");
RNA_def_function_ui_description(
func, "Item. Inserts horizontal spacing empty space into the layout between items");
/* context */
func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
parm = RNA_def_string(func, "name", NULL, 0, "Name", "Name of entry in the context");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
/* templates */
func = RNA_def_function(srna, "template_header", "uiTemplateHeader");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Inserts common Space header UI (editor type selector)");
func = RNA_def_function(srna, "template_ID", "rna_uiTemplateID");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
RNA_def_string(
func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block");
RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
RNA_def_enum(func,
"filter",
id_template_filter_items,
UI_TEMPLATE_ID_FILTER_ALL,
"",
"Optionally limit the items which can be selected");
RNA_def_boolean(func, "live_icon", false, "", "Show preview instead of fixed icon");
api_ui_item_common_text(func);
func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
RNA_def_string(
func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block");
RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
RNA_def_int(
func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
RNA_def_int(func,
"cols",
0,
0,
INT_MAX,
"Number of thumbnail preview columns to display",
"",
0,
INT_MAX);
RNA_def_enum(func,
"filter",
id_template_filter_items,
UI_TEMPLATE_ID_FILTER_ALL,
"",
"Optionally limit the items which can be selected");
RNA_def_boolean(func, "hide_buttons", false, "", "Show only list, no buttons");
func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID");
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_string(func,
"type_property",
NULL,
0,
"",
"Identifier of property in data giving the type of the ID-blocks to use");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
api_ui_item_common_text(func);
func = RNA_def_function(srna, "template_ID_tabs", "uiTemplateIDTabs");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
RNA_def_string(func, "menu", NULL, 0, "", "Context menu identifier");
RNA_def_enum(func,
"filter",
id_template_filter_items,
UI_TEMPLATE_ID_FILTER_ALL,
"",
"Optionally limit the items which can be selected");
func = RNA_def_function(srna, "template_search", "uiTemplateSearch");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
parm = RNA_def_pointer(
func, "search_data", "AnyType", "", "Data from which to take collection to search in");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(
func, "search_property", NULL, 0, "", "Identifier of search collection property");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_string(
func, "new", NULL, 0, "", "Operator identifier to create a new item for the collection");
RNA_def_string(func,
"unlink",
NULL,
0,
"",
"Operator identifier to unlink or delete the active "
"item from the collection");
func = RNA_def_function(srna, "template_search_preview", "uiTemplateSearchPreview");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
parm = RNA_def_pointer(
func, "search_data", "AnyType", "", "Data from which to take collection to search in");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(
func, "search_property", NULL, 0, "", "Identifier of search collection property");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_string(
func, "new", NULL, 0, "", "Operator identifier to create a new item for the collection");
RNA_def_string(func,
"unlink",
NULL,
0,
"",
"Operator identifier to unlink or delete the active "
"item from the collection");
RNA_def_int(
func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
RNA_def_int(func,
"cols",
0,
0,
INT_MAX,
"Number of thumbnail preview columns to display",
"",
0,
INT_MAX);
func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder");
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
api_ui_item_common_text(func);
func = RNA_def_function(srna, "template_modifiers", "uiTemplateModifiers");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Generates the UI layout for the modifier stack");
func = RNA_def_function(srna, "template_constraints", "uiTemplateConstraints");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Generates the panels for the constraint stack");
RNA_def_boolean(func,
"use_bone_constraints",
true,
"",
"Add panels for bone constraints instead of object constraints");
func = RNA_def_function(srna, "template_grease_pencil_modifiers", "uiTemplateGpencilModifiers");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func,
"Generates the panels for the grease pencil modifier stack");
func = RNA_def_function(srna, "template_shaderfx", "uiTemplateShaderFx");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Generates the panels for the shader effect stack");
func = RNA_def_function(srna, "template_greasepencil_color", "uiTemplateGpencilColorPreview");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
RNA_def_int(
func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
RNA_def_int(func,
"cols",
0,
0,
INT_MAX,
"Number of thumbnail preview columns to display",
"",
0,
INT_MAX);
RNA_def_float(func, "scale", 1.0f, 0.1f, 1.5f, "Scale of the image thumbnails", "", 0.5f, 1.0f);
RNA_def_enum(func,
"filter",
id_template_filter_items,
UI_TEMPLATE_ID_FILTER_ALL,
"",
"Optionally limit the items which can be selected");
func = RNA_def_function(srna, "template_constraint_header", "uiTemplateConstraintHeader");
RNA_def_function_ui_description(func, "Generates the header for constraint panels");
parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
func = RNA_def_function(srna, "template_preview", "uiTemplatePreview");
RNA_def_function_ui_description(
func, "Item. A preview window for materials, textures, lights or worlds");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm = RNA_def_pointer(func, "id", "ID", "", "ID data-block");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_boolean(func, "show_buttons", true, "", "Show preview buttons?");
RNA_def_pointer(func, "parent", "ID", "", "ID data-block");
RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot");
RNA_def_string(
func,
"preview_id",
NULL,
0,
"",
"Identifier of this preview widget, if not set the ID type will be used "
"(i.e. all previews of materials without explicit ID will have the same size...)");
func = RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
RNA_def_function_ui_description(
func, "Item. A curve mapping widget used for e.g falloff curves for lights");
api_ui_item_rna_common(func);
RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display");
RNA_def_boolean(func, "levels", false, "", "Show black/white levels");
RNA_def_boolean(func, "brush", false, "", "Show brush options");
RNA_def_boolean(func, "use_negative_slope", false, "", "Use a negative slope by default");
RNA_def_boolean(func, "show_tone", false, "", "Show tone options");
func = RNA_def_function(srna, "template_curveprofile", "uiTemplateCurveProfile");
RNA_def_function_ui_description(func, "A profile path editor used for custom profiles");
api_ui_item_rna_common(func);
func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
RNA_def_function_ui_description(func, "Item. A color ramp widget");
api_ui_item_rna_common(func);
RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");
func = RNA_def_function(srna, "template_icon", "uiTemplateIcon");
RNA_def_function_ui_description(func, "Display a large icon");
parm = RNA_def_int(func, "icon_value", 0, 0, INT_MAX, "Icon to display", "", 0, INT_MAX);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_float(func,
"scale",
1.0f,
1.0f,
100.0f,
"Scale",
"Scale the icon size (by the button size)",
1.0f,
100.0f);
func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView");
RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews");
api_ui_item_rna_common(func);
RNA_def_boolean(func, "show_labels", false, "", "Show enum label in preview buttons");
RNA_def_float(func,
"scale",
6.0f,
1.0f,
100.0f,
"UI Units",
"Scale the button icon size (by the button size)",
1.0f,
100.0f);
RNA_def_float(func,
"scale_popup",
5.0f,
1.0f,
100.0f,
"Scale",
"Scale the popup icon size (by the button size)",
1.0f,
100.0f);
func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data");
api_ui_item_rna_common(func);
func = RNA_def_function(srna, "template_waveform", "uiTemplateWaveform");
RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data");
api_ui_item_rna_common(func);
func = RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope");
RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data");
api_ui_item_rna_common(func);
func = RNA_def_function(srna, "template_layers", "uiTemplateLayers");
api_ui_item_rna_common(func);
parm = RNA_def_pointer(
func, "used_layers_data", "AnyType", "", "Data from which to take property");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(
func, "used_layers_property", NULL, 0, "", "Identifier of property in data");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "template_color_picker", "uiTemplateColorPicker");
RNA_def_function_ui_description(func, "Item. A color wheel widget to pick colors");
api_ui_item_rna_common(func);
RNA_def_boolean(
func, "value_slider", false, "", "Display the value slider to the right of the color wheel");
RNA_def_boolean(func,
"lock",
false,
"",
"Lock the color wheel display to value 1.0 regardless of actual color");
RNA_def_boolean(
func, "lock_luminosity", false, "", "Keep the color at its original vector length");
RNA_def_boolean(func, "cubic", false, "", "Cubic saturation for picking values close to white");
func = RNA_def_function(srna, "template_palette", "uiTemplatePalette");
RNA_def_function_ui_description(func, "Item. A palette used to pick colors");
api_ui_item_rna_common(func);
RNA_def_boolean(func, "color", 0, "", "Display the colors as colors or values");
func = RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm = RNA_def_pointer(func, "image", "Image", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "template_image", "uiTemplateImage");
RNA_def_function_ui_description(
func, "Item(s). User interface for selecting images and their source paths");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
RNA_def_boolean(func, "multiview", false, "", "Expose Multi-View options");
func = RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings");
RNA_def_function_ui_description(func, "User interface for setting image format options");
parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_boolean(func, "color_management", false, "", "Show color management settings");
func = RNA_def_function(srna, "template_image_stereo_3d", "uiTemplateImageStereo3d");
RNA_def_function_ui_description(func, "User interface for setting image stereo 3d options");
parm = RNA_def_pointer(func, "stereo_3d_format", "Stereo3dFormat", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
func = RNA_def_function(srna, "template_image_views", "uiTemplateImageViews");
RNA_def_function_ui_description(func, "User interface for setting image views output options");
parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
RNA_def_function_ui_description(
func, "Item(s). User interface for selecting movie clips and their source paths");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
func = RNA_def_function(srna, "template_track", "uiTemplateTrack");
RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image.");
api_ui_item_rna_common(func);
func = RNA_def_function(srna, "template_marker", "uiTemplateMarker");
RNA_def_function_ui_description(func, "Item. A widget to control single marker settings.");
api_ui_item_rna_common(func);
parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
func = RNA_def_function(
srna, "template_movieclip_information", "uiTemplateMovieclipInformation");
RNA_def_function_ui_description(func, "Item. Movie clip information data.");
api_ui_item_rna_common(func);
parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
func = RNA_def_function(srna, "template_list", "uiTemplateList");
RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups.");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm = RNA_def_string(func, "listtype_name", NULL, 0, "", "Identifier of the list type to use");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_string(
func,
"list_id",
NULL,
0,
"",
"Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME
"\" class). "
"If this not an empty string, the uilist gets a custom ID, otherwise it takes the "
"name of the class used to define the uilist (for example, if the "
"class name is \"OBJECT_UL_vgroups\", and list_id is not set by the "
"script, then bl_idname = \"OBJECT_UL_vgroups\")");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(
func, "dataptr", "AnyType", "", "Data from which to take the Collection property");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(
func, "propname", NULL, 0, "", "Identifier of the Collection property in data");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(func,
"active_dataptr",
"AnyType",
"",
"Data from which to take the integer property, index of the active item");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(
func,
"active_propname",
NULL,
0,
"",
"Identifier of the integer property in active_data, index of the active item");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_string(func,
"item_dyntip_propname",
NULL,
0,
"",
"Identifier of a string property in items, to use as tooltip content");
RNA_def_int(func,
"rows",
5,
0,
INT_MAX,
"",
"Default and minimum number of rows to display",
0,
INT_MAX);
RNA_def_int(
func, "maxrows", 5, 0, INT_MAX, "", "Default maximum number of rows to display", 0, INT_MAX);
RNA_def_enum(func,
"type",
rna_enum_uilist_layout_type_items,
UILST_LAYOUT_DEFAULT,
"Type",
"Type of layout to use");
RNA_def_int(func,
"columns",
9,
0,
INT_MAX,
"",
"Number of items to display per row, for GRID layout",
0,
INT_MAX);
RNA_def_boolean(func, "sort_reverse", false, "", "Display items in reverse order by default");
RNA_def_boolean(func, "sort_lock", false, "", "Lock display order to default value");
func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch");
RNA_def_function(srna, "template_menu_search", "uiTemplateMenuSearch");
func = RNA_def_function(srna, "template_header_3D_mode", "uiTemplateHeader3D_mode");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "");
func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(
func, "Inserts common 3DView Edit modes header UI (selector for selection mode)");
func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
func = RNA_def_function(srna, "template_input_status", "uiTemplateInputStatus");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(func, "node", "Node", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "template_node_view", "uiTemplateNodeView");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(func, "node", "Node", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
func = RNA_def_function(
srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties");
parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
func = RNA_def_function(srna, "template_component_menu", "uiTemplateComponentMenu");
RNA_def_function_ui_description(func, "Item. Display expanded property in a popup menu");
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_string(func, "name", NULL, 0, "", "");
/* color management templates */
func = RNA_def_function(srna, "template_colorspace_settings", "uiTemplateColorspaceSettings");
RNA_def_function_ui_description(func, "Item. A widget to control input color space settings.");
api_ui_item_rna_common(func);
func = RNA_def_function(
srna, "template_colormanaged_view_settings", "uiTemplateColormanagedViewSettings");
RNA_def_function_ui_description(
func, "Item. A widget to control color managed view settings settings.");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
# if 0
RNA_def_boolean(func,
"show_global_settings",
false,
"",
"Show widgets to control global color management settings");
# endif
/* node socket icon */
func = RNA_def_function(srna, "template_node_socket", "uiTemplateNodeSocket");
RNA_def_function_ui_description(func, "Node Socket Icon");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_float_array(
func, "color", 4, node_socket_color_default, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
func = RNA_def_function(srna, "template_cache_file", "rna_uiTemplateCacheFile");
RNA_def_function_ui_description(
func, "Item(s). User interface for selecting cache files and their source paths");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
func = RNA_def_function(srna, "template_recent_files", "uiTemplateRecentFiles");
RNA_def_function_ui_description(func, "Show list of recently saved .blend files");
RNA_def_int(func, "rows", 5, 1, INT_MAX, "", "Maximum number of items to show", 1, INT_MAX);
parm = RNA_def_int(func, "found", 0, 0, INT_MAX, "", "Number of items drawn", 0, INT_MAX);
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "template_file_select_path", "uiTemplateFileSelectPath");
RNA_def_function_ui_description(func,
"Item. A text button to set the active file browser path.");
parm = RNA_def_pointer(func, "params", "FileSelectParams", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
func = RNA_def_function(
srna, "template_event_from_keymap_item", "rna_uiTemplateEventFromKeymapItem");
RNA_def_function_ui_description(func, "Display keymap item as icons/text");
parm = RNA_def_property(func, "item", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(parm, "KeyMapItem");
RNA_def_property_ui_text(parm, "Item", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
api_ui_item_common_text(func);
}
#endif
|