diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-12-28 13:20:16 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-12-28 13:20:16 +0400 |
commit | 7504cf34b470bec3b3fc7239d655738a09ed7624 (patch) | |
tree | b811d07dc2b708163b2944bb7b3c4cc99aa588ed /source/blender/makesrna/intern | |
parent | 7730ddb3d6211a9c03e4b2eebedefcfb6f709891 (diff) |
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_dynamicpaint.c | 22 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 164 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 194 |
3 files changed, 356 insertions, 24 deletions
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 4f9f2009a14..030325494ff 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -32,6 +32,8 @@ #include "rna_internal.h" +#include "BLI_math_base.h" + #include "BKE_modifier.h" #include "BKE_dynamicpaint.h" @@ -219,6 +221,14 @@ static int rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr) return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ? 1 : 0; } +/* is some 3D view preview available */ +static int rna_DynamicPaint_use_color_preview_get(PointerRNA *ptr) +{ + DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data; + + return dynamicPaint_surfaceHasColorPreview(surface); +} + /* does output layer exist*/ static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index) { @@ -239,6 +249,7 @@ static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, Pointe tmp.value = MOD_DPAINT_SURFACE_T_PAINT; tmp.identifier = "PAINT"; tmp.name = "Paint"; + tmp.icon = ICON_TPAINT_HLT; RNA_enum_item_add(&item, &totitem, &tmp); /* Displace */ @@ -248,6 +259,7 @@ static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, Pointe tmp.value = MOD_DPAINT_SURFACE_T_DISPLACE; tmp.identifier = "DISPLACE"; tmp.name = "Displace"; + tmp.icon = ICON_MOD_DISPLACE; RNA_enum_item_add(&item, &totitem, &tmp); } @@ -256,6 +268,7 @@ static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, Pointe tmp.value = MOD_DPAINT_SURFACE_T_WEIGHT; tmp.identifier = "WEIGHT"; tmp.name = "Weight"; + tmp.icon = ICON_MOD_VERTEX_WEIGHT; RNA_enum_item_add(&item, &totitem, &tmp); } @@ -264,6 +277,7 @@ static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, Pointe tmp.value = MOD_DPAINT_SURFACE_T_WAVE; tmp.identifier = "WAVE"; tmp.name = "Waves"; + tmp.icon = ICON_MOD_WAVE; RNA_enum_item_add(&item, &totitem, &tmp); } @@ -705,6 +719,14 @@ static void rna_def_canvas_surface(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL); RNA_def_property_ui_text(prop, "Use Cache", ""); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); + + /* whether this surface has preview data for 3D view */ + RNA_define_verify_sdna(FALSE); + prop = RNA_def_property(srna, "use_color_preview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_use_color_preview_get", NULL); + RNA_def_property_ui_text(prop, "Use Corlor Preview", "Whether this surface has some color preview for 3D view"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); + RNA_define_verify_sdna(TRUE); } static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index de359fd6413..e6e953c412b 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -55,6 +55,16 @@ EnumPropertyItem operator_context_items[] = { {0, NULL, 0, NULL, NULL} }; +EnumPropertyItem uilist_layout_type_items[] = { + {UILST_LAYOUT_DEFAULT, "DEFAULT", 0, "Default Layout", + "Use the default, multi-rows layout"}, + {UILST_LAYOUT_COMPACT, "COMPACT", 0, "Compact Layout", + "Use the compact, single-row layout"}, + {UILST_LAYOUT_GRID, "GRID", 0, "Grid Layout", + "Use the grid-based layout"}, + {0, NULL, 0, NULL, NULL} +}; + #ifdef RNA_RUNTIME #include <assert.h> @@ -252,6 +262,105 @@ static StructRNA *rna_Panel_refine(PointerRNA *ptr) return (hdr->type && hdr->type->ext.srna) ? hdr->type->ext.srna : &RNA_Panel; } +/* UIList */ +static void uilist_draw_item(uiList *uilst, bContext *C, uiLayout *layout, PointerRNA *dataptr, PointerRNA *itemptr, + int icon, PointerRNA *active_dataptr, const char *active_propname, int index) +{ + extern FunctionRNA rna_UIList_draw_item_func; + + PointerRNA ultr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(&CTX_wm_screen(C)->id, uilst->type->ext.srna, uilst, &ultr); + func = &rna_UIList_draw_item_func; /* RNA_struct_find_function(&ultr, "draw_item"); */ + + RNA_parameter_list_create(&list, &ultr, func); + RNA_parameter_set_lookup(&list, "context", &C); + RNA_parameter_set_lookup(&list, "layout", &layout); + RNA_parameter_set_lookup(&list, "data", dataptr); + RNA_parameter_set_lookup(&list, "item", itemptr); + RNA_parameter_set_lookup(&list, "icon", &icon); + RNA_parameter_set_lookup(&list, "active_data", active_dataptr); + RNA_parameter_set_lookup(&list, "active_property", &active_propname); + RNA_parameter_set_lookup(&list, "index", &index); + uilst->type->ext.call((bContext *)C, &ultr, func, &list); + + RNA_parameter_list_free(&list); +} + +static void rna_UIList_unregister(Main *UNUSED(bmain), StructRNA *type) +{ + uiListType *ult = RNA_struct_blender_type_get(type); + + if (!ult) + return; + + RNA_struct_free_extension(type, &ult->ext); + + WM_uilisttype_freelink(ult); + + RNA_struct_free(&BLENDER_RNA, type); + + /* update while blender is running */ + WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); +} + +static StructRNA *rna_UIList_register(Main *bmain, ReportList *reports, void *data, const char *identifier, + StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +{ + uiListType *ult, dummyult = {NULL}; + uiList dummyuilist = {NULL}; + PointerRNA dummyultr; + int have_function[1]; + size_t over_alloc = 0; /* warning, if this becomes a bess, we better do another alloc */ + + /* setup dummy menu & menu type to store static properties in */ + dummyuilist.type = &dummyult; + RNA_pointer_create(NULL, &RNA_UIList, &dummyuilist, &dummyultr); + + /* validate the python class */ + if (validate(&dummyultr, data, have_function) != 0) + return NULL; + + if (strlen(identifier) >= sizeof(dummyult.idname)) { + BKE_reportf(reports, RPT_ERROR, "Registering uilist class: '%s' is too long, maximum length is %d", + identifier, (int)sizeof(dummyult.idname)); + return NULL; + } + + /* check if we have registered this uilist type before, and remove it */ + ult = WM_uilisttype_find(dummyult.idname, TRUE); + if (ult && ult->ext.srna) + rna_UIList_unregister(bmain, ult->ext.srna); + + /* create a new menu type */ + ult = MEM_callocN(sizeof(uiListType) + over_alloc, "python uilist"); + memcpy(ult, &dummyult, sizeof(dummyult)); + + ult->ext.srna = RNA_def_struct(&BLENDER_RNA, ult->idname, "UIList"); + ult->ext.data = data; + ult->ext.call = call; + ult->ext.free = free; + RNA_struct_blender_type_set(ult->ext.srna, ult); + RNA_def_struct_flag(ult->ext.srna, STRUCT_NO_IDPROPERTIES); + + ult->draw_item = (have_function[0]) ? uilist_draw_item : NULL; + + WM_uilisttype_add(ult); + + /* update while blender is running */ + WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + + return ult->ext.srna; +} + +static StructRNA *rna_UIList_refine(PointerRNA *ptr) +{ + uiList *uilst = (uiList *)ptr->data; + return (uilst->type && uilst->type->ext.srna) ? uilst->type->ext.srna : &RNA_UIList; +} + /* Header */ static void header_draw(const bContext *C, Header *hdr) @@ -495,6 +604,8 @@ static void rna_Menu_bl_description_set(PointerRNA *ptr, const char *value) else assert(!"setting the bl_description on a non-builtin menu"); } +/* UILayout */ + static int rna_UILayout_active_get(PointerRNA *ptr) { return uiLayoutGetActive(ptr->data); @@ -738,6 +849,58 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Options", "Options for this panel type"); } +static void rna_def_uilist(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + PropertyRNA *parm; + FunctionRNA *func; + + srna = RNA_def_struct(brna, "UIList", NULL); + RNA_def_struct_ui_text(srna, "UIList", "UI list containing the elements of a collection"); + RNA_def_struct_sdna(srna, "uiList"); + RNA_def_struct_refine_func(srna, "rna_UIList_refine"); + RNA_def_struct_register_funcs(srna, "rna_UIList_register", "rna_UIList_unregister", NULL); + + /* draw */ + func = RNA_def_function(srna, "draw_item", NULL); + RNA_def_function_ui_description(func, "Draw an item in the list (NOTE: when you define your own draw_item " + "function, you may want to check given 'item' is of the right type...)"); + RNA_def_function_flag(func, FUNC_REGISTER); + parm = RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); + parm = RNA_def_pointer(func, "item", "AnyType", "", "Item of the collection property"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); + parm = RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "Icon of the item in the collection", 0, INT_MAX); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_pointer(func, "active_data", "AnyType", "", + "Data from which to take property for the active element"); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); + parm = RNA_def_string(func, "active_property", "", 0, "", + "Identifier of property in active_data, for the active element"); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the item in the collection", 0, INT_MAX); + RNA_def_property_flag(parm, PROP_REQUIRED); + + prop = RNA_def_property(srna, "layout_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, uilist_layout_type_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + /* registration */ + prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "type->idname"); + RNA_def_property_flag(prop, PROP_REGISTER | PROP_NEVER_CLAMP); + RNA_def_property_ui_text(prop, "ID Name", + "If this is set, 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 bl_idname is not set by the " + "script, then bl_idname = \"OBJECT_UL_vgroups\")"); +} + static void rna_def_header(BlenderRNA *brna) { StructRNA *srna; @@ -852,6 +1015,7 @@ void RNA_def_ui(BlenderRNA *brna) { rna_def_ui_layout(brna); rna_def_panel(brna); + rna_def_uilist(brna); rna_def_header(brna); rna_def_menu(brna); } diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 548539e3395..366d0dc1fd9 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -33,8 +33,12 @@ #include <stdio.h> #include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "DNA_screen_types.h" #include "UI_resources.h" +#include "UI_interface_icons.h" #include "rna_internal.h" @@ -70,12 +74,117 @@ static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char * return uiItemFullO(layout, opname, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag); } +static void rna_uiItemL(uiLayout *layout, const char *name, int icon, int icon_value) +{ + if (icon_value && !icon) { + icon = icon_value; + } + + uiItemL(layout, name, icon); +} + +static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon) +{ + return UI_rnaptr_icon_get(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; + EnumPropertyItem *items = NULL, *item; + int 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) { + for (item = items; item->identifier; item++) { + if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) { + name = item->name; + break; + } + } + if (free) { + MEM_freeN(items); + } + } + + return name; +} + +static const char *rna_ui_get_enum_description(bContext *C, PointerRNA *ptr, const char *propname, + const char *identifier) +{ + PropertyRNA *prop = NULL; + EnumPropertyItem *items = NULL, *item; + int 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) { + for (item = items; item->identifier; item++) { + if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) { + desc = item->description; + break; + } + } + if (free) { + MEM_freeN(items); + } + } + + return desc; +} + +static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier) +{ + PropertyRNA *prop = NULL; + EnumPropertyItem *items = NULL, *item; + int 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) { + for (item = items; item->identifier; item++) { + if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) { + icon = item->icon; + break; + } + } + if (free) { + MEM_freeN(items); + } + } + + return icon; +} + #else #define DEF_ICON_BLANK_SKIP #define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""}, #define DEF_VICO(name) {VICO_##name, (#name), 0, (#name), ""}, -static EnumPropertyItem icon_items[] = { +EnumPropertyItem icon_items[] = { #include "UI_icons.h" {0, NULL, 0, NULL, NULL} }; @@ -92,7 +201,6 @@ static void api_ui_item_common(FunctionRNA *func) prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, icon_items); RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item"); - } static void api_ui_item_op(FunctionRNA *func) @@ -130,13 +238,6 @@ void RNA_api_ui_layout(StructRNA *srna) {'h', "HUE", 0, "Hue", ""}, {0, NULL, 0, NULL, NULL} }; - - static EnumPropertyItem list_type_items[] = { - {0, "DEFAULT", 0, "None", ""}, - {'c', "COMPACT", 0, "Compact", ""}, - {'i', "ICONS", 0, "Icons", ""}, - {0, NULL, 0, NULL, NULL} - }; /* simple layout specifiers */ func = RNA_def_function(srna, "row", "uiLayoutRow"); @@ -175,6 +276,44 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at", 0.0f, 1.0f); RNA_def_boolean(func, "align", 0, "", "Align buttons to each other"); + /* 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_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); + 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", "", 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", "", 0, "", "Identifier of the enum item"); + RNA_def_property_flag(parm, PROP_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", "", 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", "", 0, "", "Identifier of the enum item"); + RNA_def_property_flag(parm, PROP_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", "", 0, "", "Identifier of the enum item"); + RNA_def_property_flag(parm, PROP_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"); @@ -274,9 +413,13 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED); #endif - func = RNA_def_function(srna, "label", "uiItemL"); - RNA_def_function_ui_description(func, "Item. Display text in the layout"); + func = RNA_def_function(srna, "label", "rna_uiItemL"); + RNA_def_function_ui_description(func, "Item. Display 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 " + "(use it e.g. with custom material icons returned by icon()...)"); func = RNA_def_function(srna, "menu", "uiItemM"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); @@ -439,26 +582,29 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_boolean(func, "compact", 0, "", "Use more compact layout"); func = RNA_def_function(srna, "template_list", "uiTemplateList"); - RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups " - "(WARNING: only one per panel allowed!)."); + 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_pointer(func, "data", "AnyType", "", "Data from which to take property"); + parm = RNA_def_string(func, "listtype_name", "", 0, "", "Identifier of the list type to use"); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_string(func, "list_id", "", 0, "", + "Identifier of this list widget. " + "If this is set, 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\")"); + parm = RNA_def_pointer(func, "dataptr", "AnyType", "", "Data from which to take the Collection property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); - parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data"); + parm = RNA_def_string(func, "propname", "", 0, "", "Identifier of the Collection property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); - parm = RNA_def_pointer(func, "active_data", "AnyType", "", - "Data from which to take property for the active element"); + parm = RNA_def_pointer(func, "active_dataptr", "AnyType", "", + "Data from which to take the integer property, index of the active item"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); - parm = RNA_def_string(func, "active_property", "", 0, "", - "Identifier of property in data, for the active element"); + parm = RNA_def_string(func, "active_propname", "", 0, "", + "Identifier of the integer property in active_data, index of the active item"); RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_string(func, "prop_list", "", 0, "", - "Identifier of a string property in each data member, specifying which " - "of its properties should have a widget displayed in its row " - "(format: \"propname1:propname2:propname3:...\")"); RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display", 0, INT_MAX); RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display", 0, INT_MAX); - RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use"); + RNA_def_enum(func, "type", uilist_layout_type_items, UILST_LAYOUT_DEFAULT, "Type", "Type of layout to use"); func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); |