32
32
#include <stdlib.h>
35
#include "BLI_utildefines.h"
37
#include "BLF_translation.h"
35
39
#include "RNA_define.h"
40
#include "RNA_enum_types.h"
42
#include "DNA_screen_types.h"
37
44
#include "UI_resources.h"
41
static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, int icon,
42
int expand, int slider, int toggle, int icon_only, int event, int full_event,
43
int emboss, int index)
45
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
49
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
53
flag |= (slider)? UI_ITEM_R_SLIDER: 0;
54
flag |= (expand)? UI_ITEM_R_EXPAND: 0;
55
flag |= (toggle)? UI_ITEM_R_TOGGLE: 0;
56
flag |= (icon_only)? UI_ITEM_R_ICON_ONLY: 0;
57
flag |= (event)? UI_ITEM_R_EVENT: 0;
58
flag |= (full_event)? UI_ITEM_R_FULL_EVENT: 0;
59
flag |= (emboss)? 0: UI_ITEM_R_NO_BG;
61
uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon);
64
static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char *name, int icon, int emboss)
66
int flag = UI_ITEM_O_RETURN_PROPS;
67
flag |= (emboss)? 0: UI_ITEM_R_NO_BG;
68
return uiItemFullO(layout, opname, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag);
45
#include "UI_interface.h"
46
#include "UI_interface_icons.h"
48
#include "rna_internal.h"
73
50
#define DEF_ICON_BLANK_SKIP
74
51
#define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""},
75
52
#define DEF_VICO(name) {VICO_##name, (#name), 0, (#name), ""},
76
static EnumPropertyItem icon_items[] = {
53
EnumPropertyItem icon_items[] = {
77
54
#include "UI_icons.h"
78
{0, NULL, 0, NULL, NULL}};
55
{0, NULL, 0, NULL, NULL}
79
57
#undef DEF_ICON_BLANK_SKIP
63
static const char *rna_translate_ui_text(const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop,
66
/* Also return text if UI labels translation is disabled. */
67
if (!text || !text[0] || !translate || !BLF_translate_iface()) {
71
/* If a text_ctxt is specified, use it! */
72
if (text_ctxt && text_ctxt[0]) {
73
return BLF_pgettext(text_ctxt, text);
76
/* Else, if an RNA type or property is specified, use its context. */
78
/* XXX Disabled for now. Unfortunately, their is absolutely no way from py code to get the RNA struct corresponding
79
* to the 'data' (in functions like prop() & co), as this is pure runtime data. Hence, messages extraction
80
* script can't determine the correct context it should use for such 'text' messages...
81
* So for now, one have to explicitly specify the 'text_ctxt' when using prop() etc. functions,
82
* if default context is not suitable.
85
return BLF_pgettext(RNA_property_translation_context(prop), text);
91
return BLF_pgettext(RNA_struct_translation_context(type), text);
94
/* Else, default context! */
95
return BLF_pgettext(BLF_I18NCONTEXT_DEFAULT, text);
98
static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt,
99
int translate, int icon, int expand, int slider, int toggle, int icon_only, int event,
100
int full_event, int emboss, int index)
102
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
106
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
110
/* Get translated name (label). */
111
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
113
flag |= (slider) ? UI_ITEM_R_SLIDER : 0;
114
flag |= (expand) ? UI_ITEM_R_EXPAND : 0;
115
flag |= (toggle) ? UI_ITEM_R_TOGGLE : 0;
116
flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
117
flag |= (event) ? UI_ITEM_R_EVENT : 0;
118
flag |= (full_event) ? UI_ITEM_R_FULL_EVENT : 0;
119
flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG;
121
uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon);
124
static void rna_uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name,
125
const char *text_ctxt, int translate, int icon)
127
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
130
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
134
/* Get translated name (label). */
135
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
137
/* XXX This will search property again :( */
138
uiItemMenuEnumR(layout, ptr, propname, name, icon);
141
static void rna_uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value,
142
const char *name, const char *text_ctxt, int translate, int icon)
144
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
147
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
151
/* Get translated name (label). */
152
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
154
/* XXX This will search property again :( */
155
uiItemEnumR_string(layout, ptr, propname, value, name, icon);
158
static void rna_uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
159
struct PointerRNA *searchptr, const char *searchpropname,
160
const char *name, const char *text_ctxt, int translate, int icon)
162
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
165
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
169
/* Get translated name (label). */
170
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
172
/* XXX This will search property again :( */
173
uiItemPointerR(layout, ptr, propname, searchptr, searchpropname, name, icon);
176
static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char *name, const char *text_ctxt,
177
int translate, int icon, int emboss)
182
ot = WM_operatortype_find(opname, 0); /* print error next */
183
if (!ot || !ot->srna) {
184
RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
185
return PointerRNA_NULL;
188
/* Get translated name (label). */
189
name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
191
flag = UI_ITEM_O_RETURN_PROPS;
192
flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG;
194
return uiItemFullO_ptr(layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag);
197
static void rna_uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname, const char *name,
198
const char *text_ctxt, int translate, int icon)
200
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
202
if (!ot || !ot->srna) {
203
RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
207
/* Get translated name (label). */
208
name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
210
/* XXX This will search operator again :( */
211
uiItemMenuEnumO(layout, opname, propname, name, icon);
214
static void rna_uiItemL(uiLayout *layout, const char *name, const char *text_ctxt, int translate,
215
int icon, int icon_value)
217
/* Get translated name (label). */
218
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
220
if (icon_value && !icon) {
224
uiItemL(layout, name, icon);
227
static void rna_uiItemM(uiLayout *layout, bContext *C, const char *menuname, const char *name, const char *text_ctxt,
228
int translate, int icon)
230
/* Get translated name (label). */
231
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
233
uiItemM(layout, C, menuname, name, icon);
236
static void rna_uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename,
237
const char *name, const char *text_ctxt, int translate)
239
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
242
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
246
/* Get translated name (label). */
247
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
249
/* XXX This will search property again :( */
250
uiTemplateAnyID(layout, ptr, propname, proptypename, name);
253
static void rna_uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *root_ptr,
254
const char *name, const char *text_ctxt, int translate)
256
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
259
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
263
/* Get translated name (label). */
264
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
266
/* XXX This will search property again :( */
267
uiTemplatePathBuilder(layout, ptr, propname, root_ptr, name);
270
static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon)
272
return UI_rnaptr_icon_get(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), FALSE);
275
static const char *rna_ui_get_enum_name(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier)
277
PropertyRNA *prop = NULL;
278
EnumPropertyItem *items = NULL, *item;
280
const char *name = "";
282
prop = RNA_struct_find_property(ptr, propname);
283
if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
284
RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
288
RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
291
for (item = items; item->identifier; item++) {
292
if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
305
static const char *rna_ui_get_enum_description(bContext *C, PointerRNA *ptr, const char *propname,
306
const char *identifier)
308
PropertyRNA *prop = NULL;
309
EnumPropertyItem *items = NULL, *item;
311
const char *desc = "";
313
prop = RNA_struct_find_property(ptr, propname);
314
if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
315
RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
319
RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
322
for (item = items; item->identifier; item++) {
323
if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
324
desc = item->description;
336
static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier)
338
PropertyRNA *prop = NULL;
339
EnumPropertyItem *items = NULL, *item;
341
int icon = ICON_NONE;
343
prop = RNA_struct_find_property(ptr, propname);
344
if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
345
RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
349
RNA_property_enum_items(C, ptr, prop, &items, NULL, &free);
352
for (item = items; item->identifier; item++) {
353
if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
368
static void api_ui_item_common_text(FunctionRNA *func)
370
RNA_def_string(func, "text", "", 0, "", "Override automatic text of the item");
371
RNA_def_string(func, "text_ctxt", "", 0, "", "Override automatic translation context of the given text");
372
RNA_def_boolean(func, "translate", true, "", "Translate the given text, when UI translation is enabled");
83
375
static void api_ui_item_common(FunctionRNA *func)
85
377
PropertyRNA *prop;
87
RNA_def_string_translate(func, "text", "", 0, "", "Override automatic text of the item");
379
api_ui_item_common_text(func);
89
381
prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
90
382
RNA_def_property_enum_items(prop, icon_items);
91
383
RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item");
95
386
static void api_ui_item_op(FunctionRNA *func)
169
456
RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at", 0.0f, 1.0f);
170
457
RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");
459
/* Icon of a rna pointer */
460
func = RNA_def_function(srna, "icon", "rna_ui_get_rnaptr_icon");
461
parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
462
RNA_def_function_return(func, parm);
463
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
464
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take the icon");
465
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
466
RNA_def_function_ui_description(func, "Return the custom icon for this data, "
467
"use it e.g. to get materials or texture icons");
469
/* UI name, description and icon of an enum item */
470
func = RNA_def_function(srna, "enum_item_name", "rna_ui_get_enum_name");
471
parm = RNA_def_string(func, "name", "", 0, "", "UI name of the enum item");
472
RNA_def_function_return(func, parm);
473
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
474
api_ui_item_rna_common(func);
475
parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item");
476
RNA_def_property_flag(parm, PROP_REQUIRED);
477
RNA_def_function_ui_description(func, "Return the UI name for this enum item");
479
func = RNA_def_function(srna, "enum_item_description", "rna_ui_get_enum_description");
480
parm = RNA_def_string(func, "description", "", 0, "", "UI description of the enum item");
481
RNA_def_function_return(func, parm);
482
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
483
api_ui_item_rna_common(func);
484
parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item");
485
RNA_def_property_flag(parm, PROP_REQUIRED);
486
RNA_def_function_ui_description(func, "Return the UI description for this enum item");
488
func = RNA_def_function(srna, "enum_item_icon", "rna_ui_get_enum_icon");
489
parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
490
RNA_def_function_return(func, parm);
491
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
492
api_ui_item_rna_common(func);
493
parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item");
494
RNA_def_property_flag(parm, PROP_REQUIRED);
495
RNA_def_function_ui_description(func, "Return the icon for this enum item");
173
498
func = RNA_def_function(srna, "prop", "rna_uiItemR");
174
499
RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout");
210
535
api_ui_item_op_common(func);
211
536
RNA_def_boolean(func, "emboss", 1, "", "Draw the button itself, just the icon/text");
212
537
parm = RNA_def_pointer(func, "properties", "OperatorProperties", "",
213
"Operator properties to fill in, return when 'properties' is set to true");
214
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
538
"Operator properties to fill in, return when 'properties' is set to true");
539
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
215
540
RNA_def_function_return(func, parm);
216
541
RNA_def_function_ui_description(func, "Item. Places a button into the layout to call an Operator");
218
/* func= RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string");
219
api_ui_item_op_common(func);
220
parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
221
RNA_def_property_flag(parm, PROP_REQUIRED);
222
parm= RNA_def_string(func, "value", "", 0, "", "Enum property value");
223
RNA_def_property_flag(parm, PROP_REQUIRED); */
225
543
func = RNA_def_function(srna, "operator_enum", "uiItemsEnumO");
226
544
parm = RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator");
227
545
RNA_def_property_flag(parm, PROP_REQUIRED);
228
546
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
229
547
RNA_def_property_flag(parm, PROP_REQUIRED);
231
func = RNA_def_function(srna, "operator_menu_enum", "uiItemMenuEnumO");
549
func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO");
232
550
api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */
233
551
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
234
552
RNA_def_property_flag(parm, PROP_REQUIRED);
235
553
api_ui_item_common(func);
237
/* func= RNA_def_function(srna, "operator_boolean", "uiItemBooleanO");
238
api_ui_item_op_common(func);
239
parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
240
RNA_def_property_flag(parm, PROP_REQUIRED);
241
parm= RNA_def_boolean(func, "value", 0, "", "Value of the property to call the operator with");
555
/* useful in C but not in python */
558
func = RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string");
559
api_ui_item_op_common(func);
560
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
561
RNA_def_property_flag(parm, PROP_REQUIRED);
562
parm = RNA_def_string(func, "value", "", 0, "", "Enum property value");
563
RNA_def_property_flag(parm, PROP_REQUIRED);
565
func = RNA_def_function(srna, "operator_boolean", "uiItemBooleanO");
566
api_ui_item_op_common(func);
567
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
568
RNA_def_property_flag(parm, PROP_REQUIRED);
569
parm = RNA_def_boolean(func, "value", 0, "", "Value of the property to call the operator with");
242
570
RNA_def_property_flag(parm, PROP_REQUIRED); */
244
/* func= RNA_def_function(srna, "operator_int", "uiItemIntO");
572
func = RNA_def_function(srna, "operator_int", "uiItemIntO");
245
573
api_ui_item_op_common(func);
246
parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
574
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
247
575
RNA_def_property_flag(parm, PROP_REQUIRED);
248
parm= RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "",
576
parm = RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "",
249
577
"Value of the property to call the operator with", INT_MIN, INT_MAX);
250
578
RNA_def_property_flag(parm, PROP_REQUIRED); */
252
/* func= RNA_def_function(srna, "operator_float", "uiItemFloatO");
580
func = RNA_def_function(srna, "operator_float", "uiItemFloatO");
253
581
api_ui_item_op_common(func);
254
parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
582
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
255
583
RNA_def_property_flag(parm, PROP_REQUIRED);
256
parm= RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "",
584
parm = RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "",
257
585
"Value of the property to call the operator with", -FLT_MAX, FLT_MAX);
258
586
RNA_def_property_flag(parm, PROP_REQUIRED); */
260
/* func= RNA_def_function(srna, "operator_string", "uiItemStringO");
588
func = RNA_def_function(srna, "operator_string", "uiItemStringO");
261
589
api_ui_item_op_common(func);
262
parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
263
RNA_def_property_flag(parm, PROP_REQUIRED);
264
parm= RNA_def_string(func, "value", "", 0, "", "Value of the property to call the operator with");
265
RNA_def_property_flag(parm, PROP_REQUIRED); */
267
func = RNA_def_function(srna, "label", "uiItemL");
268
RNA_def_function_ui_description(func, "Item. Display text in the layout");
269
api_ui_item_common(func);
271
func = RNA_def_function(srna, "menu", "uiItemM");
590
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
591
RNA_def_property_flag(parm, PROP_REQUIRED);
592
parm = RNA_def_string(func, "value", "", 0, "", "Value of the property to call the operator with");
593
RNA_def_property_flag(parm, PROP_REQUIRED);
596
func = RNA_def_function(srna, "label", "rna_uiItemL");
597
RNA_def_function_ui_description(func, "Item. Display text and/or icon in the layout");
598
api_ui_item_common(func);
599
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
600
RNA_def_property_ui_text(parm, "Icon Value",
601
"Override automatic icon of the item "
602
"(use it e.g. with custom material icons returned by icon()...)");
604
func = RNA_def_function(srna, "menu", "rna_uiItemM");
272
605
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
273
606
parm = RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu");
274
607
api_ui_item_common(func);
305
638
RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
306
639
RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);
308
func = RNA_def_function(srna, "template_any_ID", "uiTemplateAnyID");
641
func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID");
309
642
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
310
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
643
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
311
644
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
312
645
RNA_def_property_flag(parm, PROP_REQUIRED);
313
646
parm = RNA_def_string(func, "type_property", "", 0, "",
314
"Identifier of property in data giving the type of the ID-blocks to use");
647
"Identifier of property in data giving the type of the ID-blocks to use");
315
648
RNA_def_property_flag(parm, PROP_REQUIRED);
316
RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");
649
api_ui_item_common_text(func);
318
func = RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder");
651
func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder");
319
652
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
320
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
653
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
321
654
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
322
655
RNA_def_property_flag(parm, PROP_REQUIRED);
323
656
parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
324
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
325
RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");
657
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
658
api_ui_item_common_text(func);
327
660
func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
328
661
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
329
662
RNA_def_function_ui_description(func, "Layout . Generates the UI layout for modifiers");
330
663
parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data");
331
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
664
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
332
665
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
333
666
RNA_def_function_return(func, parm);
335
668
func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
336
669
RNA_def_function_ui_description(func, "Layout . Generates the UI layout for constraints");
337
670
parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
338
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
671
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
339
672
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
340
673
RNA_def_function_return(func, parm);
422
760
RNA_def_function_ui_description(func, "Item. A widget to control single marker settings.");
423
761
api_ui_item_rna_common(func);
424
762
parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
425
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
763
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
426
764
parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
427
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
765
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
428
766
RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
430
768
func = RNA_def_function(srna, "template_list", "uiTemplateList");
431
RNA_def_function_ui_description(func, "Item. A list widget to display data. e.g. vertexgroups");
769
RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups.");
432
770
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
433
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
434
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
435
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
436
RNA_def_property_flag(parm, PROP_REQUIRED);
437
parm = RNA_def_pointer(func, "active_data", "AnyType", "",
438
"Data from which to take property for the active element");
439
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
440
parm = RNA_def_string(func, "active_property", "", 0, "",
441
"Identifier of property in data, for the active element");
442
RNA_def_property_flag(parm, PROP_REQUIRED);
443
RNA_def_string(func, "prop_list", "", 0, "",
444
"Identifier of a string property in each data member, specifying which "
445
"of its properties should have a widget displayed in its row "
446
"(format: \"propname1:propname2:propname3:...\")");
771
parm = RNA_def_string(func, "listtype_name", "", 0, "", "Identifier of the list type to use");
772
RNA_def_property_flag(parm, PROP_REQUIRED);
773
parm = RNA_def_string(func, "list_id", "", 0, "",
774
"Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME
776
"If this is set, the uilist gets a custom ID, otherwise it takes the "
777
"name of the class used to define the uilist (for example, if the "
778
"class name is \"OBJECT_UL_vgroups\", and list_id is not set by the "
779
"script, then bl_idname = \"OBJECT_UL_vgroups\")");
780
parm = RNA_def_pointer(func, "dataptr", "AnyType", "", "Data from which to take the Collection property");
781
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
782
parm = RNA_def_string(func, "propname", "", 0, "", "Identifier of the Collection property in data");
783
RNA_def_property_flag(parm, PROP_REQUIRED);
784
parm = RNA_def_pointer(func, "active_dataptr", "AnyType", "",
785
"Data from which to take the integer property, index of the active item");
786
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
787
parm = RNA_def_string(func, "active_propname", "", 0, "",
788
"Identifier of the integer property in active_data, index of the active item");
789
RNA_def_property_flag(parm, PROP_REQUIRED);
447
790
RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display", 0, INT_MAX);
448
791
RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display", 0, INT_MAX);
449
RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use");
792
RNA_def_enum(func, "type", uilist_layout_type_items, UILST_LAYOUT_DEFAULT, "Type", "Type of layout to use");
451
794
func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
452
795
RNA_def_function_flag(func, FUNC_USE_CONTEXT);