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:
authorCampbell Barton <ideasman42@gmail.com>2015-06-10 10:35:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-06-10 10:39:18 +0300
commitbc69eafa9838b12c6996b759b27df3445ed86e52 (patch)
treea210cb4ec6902ae7a184832bffa43a75ab85754e /source/blender/makesrna/intern/rna_ui_api.c
parent08687ee3804992652a3e4759c511db1dad8d8c80 (diff)
UI: option to pass "icon_value" to menus
D1336 by @lichtwerk Also remove verbose description, UI docs can explain use-case in more detail.
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index ce5f44a3989..cf387644d66 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -231,11 +231,15 @@ static void rna_uiItemL(uiLayout *layout, const char *name, const char *text_ctx
}
static void rna_uiItemM(uiLayout *layout, bContext *C, const char *menuname, const char *name, const char *text_ctxt,
- int translate, int icon)
+ int translate, int icon, int icon_value)
{
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
+ if (icon_value && !icon) {
+ icon = icon_value;
+ }
+
uiItemM(layout, C, menuname, name, icon);
}
@@ -525,9 +529,7 @@ void RNA_api_ui_layout(StructRNA *srna)
"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 */
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()...)");
+ RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
func = RNA_def_function(srna, "props_enum", "uiItemsEnumR");
api_ui_item_rna_common(func);
@@ -554,9 +556,7 @@ void RNA_api_ui_layout(StructRNA *srna)
api_ui_item_op_common(func);
RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, just the icon/text");
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()...)");
+ RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
parm = RNA_def_pointer(func, "properties", "OperatorProperties", "",
"Operator properties to fill in, return when 'properties' is set to true");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
@@ -621,15 +621,15 @@ void RNA_api_ui_layout(StructRNA *srna)
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()...)");
+ RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
func = RNA_def_function(srna, "menu", "rna_uiItemM");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
api_ui_item_common(func);
RNA_def_property_flag(parm, PROP_REQUIRED);
+ 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");
func = RNA_def_function(srna, "separator", "uiItemS");
RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items");