diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 025c8691652..67383074497 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -37,18 +37,25 @@ #ifdef RNA_RUNTIME -static void rna_uiItemR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, char *propname, int expand, int slider, int toggle, int icon_only, int event, int full_event) +static void rna_uiItemR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, char *propname, int expand, int slider, int toggle, int icon_only, int event, int full_event, int no_bg, int index) { + PropertyRNA *prop= RNA_struct_find_property(ptr, propname); int flag= 0; + if(!prop) { + printf("rna_uiItemR: property not found: %s\n", propname); + return; + } + flag |= (slider)? UI_ITEM_R_SLIDER: 0; flag |= (expand)? UI_ITEM_R_EXPAND: 0; flag |= (toggle)? UI_ITEM_R_TOGGLE: 0; 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; - - uiItemR(layout, name, icon, ptr, propname, flag); + flag |= (no_bg)? UI_ITEM_R_NO_BG: 0; + + uiItemFullR(layout, name, icon, ptr, prop, index, 0, flag); } static PointerRNA rna_uiItemO(uiLayout *layout, char *name, int icon, char *opname) @@ -58,7 +65,7 @@ static PointerRNA rna_uiItemO(uiLayout *layout, char *name, int icon, char *opna #else -#define DEF_ICON(name) {name, #name, 0, #name, ""}, +#define DEF_ICON(name) {name, (#name)+5, 0, (#name)+5, ""}, static EnumPropertyItem icon_items[] = { #include "UI_icons.h" {0, NULL, 0, NULL, NULL}}; @@ -139,6 +146,7 @@ void RNA_api_ui_layout(StructRNA *srna) parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in."); RNA_def_function_return(func, parm); 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."); /* items */ func= RNA_def_function(srna, "prop", "rna_uiItemR"); @@ -150,6 +158,8 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_boolean(func, "icon_only", 0, "", "Draw only icons in buttons, no text."); RNA_def_boolean(func, "event", 0, "", "Use button to input key events."); RNA_def_boolean(func, "full_event", 0, "", "Use button to input full events including modifiers."); + RNA_def_boolean(func, "no_bg", 0, "", "Don't draw the button itself, just the icon/text."); + RNA_def_int(func, "index", -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); /* RNA_NO_INDEX == -1 */ func= RNA_def_function(srna, "props_enum", "uiItemsEnumR"); api_ui_item_rna_common(func); @@ -241,12 +251,17 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); - + /* templates */ func= RNA_def_function(srna, "template_header", "uiTemplateHeader"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_boolean(func, "menus", 1, "", "The header has menus, and should show menu expander."); + func= RNA_def_function(srna, "template_dopesheet_filter", "uiTemplateDopeSheetFilter"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + parm= RNA_def_pointer(func, "dopesheet", "DopeSheet", "", "DopeSheet settings holding filter options."); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); + func= RNA_def_function(srna, "template_ID", "uiTemplateID"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); @@ -303,6 +318,12 @@ void RNA_api_ui_layout(StructRNA *srna) 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_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); + parm= RNA_def_string(func, "used_layers_property", "", 0, "", "Identifier of property in data."); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX); + RNA_def_property_flag(parm, PROP_REQUIRED); func= RNA_def_function(srna, "template_triColorSet", "uiTemplateTriColorSet"); api_ui_item_rna_common(func); @@ -341,6 +362,12 @@ void RNA_api_ui_layout(StructRNA *srna) func= RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); + + + + func= RNA_def_function(srna, "introspect", "uiLayoutIntrospect"); + parm= RNA_def_string(func, "string", "", 1024*1024, "Descr", "DESCR"); + RNA_def_function_return(func, parm); } #endif |