diff options
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 5228f00d0de..8ce6ab957b8 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -405,6 +405,21 @@ static StructRNA *rna_Panel_refine(PointerRNA *ptr) return (menu->type && menu->type->rna_ext.srna) ? menu->type->rna_ext.srna : &RNA_Panel; } +static StructRNA *rna_Panel_custom_data_typef(PointerRNA *ptr) +{ + Panel *panel = (Panel *)ptr->data; + + return UI_panel_custom_data_get(panel)->type; +} + +static PointerRNA rna_Panel_custom_data_get(PointerRNA *ptr) +{ + Panel *panel = (Panel *)ptr->data; + + /* Because the panel custom data is general we can't refine the pointer type here. */ + return *UI_panel_custom_data_get(panel); +} + /* UIList */ static unsigned int rna_UIList_filter_const_FILTER_ITEM_get(PointerRNA *UNUSED(ptr)) { @@ -1347,9 +1362,12 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "drawname"); RNA_def_property_ui_text(prop, "Text", "XXX todo"); - prop = RNA_def_int( - srna, "list_panel_index", 0, 0, INT_MAX, "Instanced Panel Data Index", "", 0, INT_MAX); - RNA_def_property_int_sdna(prop, NULL, "runtime.list_index"); + prop = RNA_def_property(srna, "custom_data", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Constraint"); + RNA_def_property_pointer_sdna(prop, NULL, "runtime.custom_data_ptr"); + RNA_def_property_pointer_funcs( + prop, "rna_Panel_custom_data_get", NULL, "rna_Panel_custom_data_typef", NULL); + RNA_def_property_ui_text(prop, "Custom Data", "Panel Data"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* registration */ |