diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-17 04:29:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-17 04:29:39 +0400 |
commit | c8df3db370bcd827d13181fd69a6ff99b7b2412b (patch) | |
tree | dfe8cd0c11486dc9f411ad396f19cc16b71e4af4 /source/blender/makesrna/intern/rna_rna.c | |
parent | 6891c57e4c4b2389bd496b9b2af4404447cc840f (diff) |
show a title in menus triggered by WM_OT_context_menu_enum, also show an icon when available.
Diffstat (limited to 'source/blender/makesrna/intern/rna_rna.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index c47718c681e..f86f6010e27 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -523,6 +523,13 @@ static int rna_Property_unit_get(PointerRNA *ptr) return RNA_SUBTYPE_UNIT(prop->subtype); } +static int rna_Property_icon_get(PointerRNA *ptr) +{ + PropertyRNA *prop = (PropertyRNA *)ptr->data; + rna_idproperty_check(&prop, ptr); + return prop->icon; +} + static int rna_Property_readonly_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; @@ -1137,6 +1144,12 @@ static void rna_def_property(BlenderRNA *brna) RNA_def_property_enum_funcs(prop, "rna_Property_unit_get", NULL, NULL); RNA_def_property_ui_text(prop, "Unit", "Type of units for this property"); + prop = RNA_def_property(srna, "icon", PROP_ENUM, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_enum_items(prop, icon_items); + RNA_def_property_enum_funcs(prop, "rna_Property_icon_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Icon", "Icon of the item"); + prop = RNA_def_property(srna, "is_readonly", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Property_readonly_get", NULL); |