Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/startup/bl_operators/wm.py4
-rw-r--r--source/blender/makesrna/intern/rna_rna.c13
2 files changed, 17 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 6c418902433..9a2328dcddc 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -505,6 +505,10 @@ class WM_MT_context_menu_enum(Menu):
return {'PASS_THROUGH'}
base_path, prop_string = data_path.rsplit(".", 1)
value_base = context_path_validate(context, base_path)
+ prop = value_base.bl_rna.properties[prop_string]
+
+ layout = self.layout
+ layout.label(prop.name, icon=prop.icon)
col = self.layout.column()
col.prop(value_base, prop_string, expand=True)
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);