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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c445
1 files changed, 396 insertions, 49 deletions
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 548539e3395..b2f17bfed8b 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -32,17 +32,72 @@
#include <stdlib.h>
#include <stdio.h>
+#include "BLI_utildefines.h"
+
+#include "BLF_translation.h"
+
#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "DNA_screen_types.h"
#include "UI_resources.h"
+#include "UI_interface.h"
+#include "UI_interface_icons.h"
#include "rna_internal.h"
+#define DEF_ICON_BLANK_SKIP
+#define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""},
+#define DEF_VICO(name) {VICO_##name, (#name), 0, (#name), ""},
+EnumPropertyItem icon_items[] = {
+#include "UI_icons.h"
+ {0, NULL, 0, NULL, NULL}
+};
+#undef DEF_ICON_BLANK_SKIP
+#undef DEF_ICON
+#undef DEF_VICO
+
#ifdef RNA_RUNTIME
-static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, int icon,
- int expand, int slider, int toggle, int icon_only, int event, int full_event,
- int emboss, int index)
+static const char *rna_translate_ui_text(const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop,
+ int translate)
+{
+ /* Also return text if UI labels translation is disabled. */
+ if (!text || !text[0] || !translate || !BLF_translate_iface()) {
+ return text;
+ }
+
+ /* If a text_ctxt is specified, use it! */
+ if (text_ctxt && text_ctxt[0]) {
+ return BLF_pgettext(text_ctxt, text);
+ }
+
+ /* Else, if an RNA type or property is specified, use its context. */
+#if 0
+ /* XXX Disabled for now. Unfortunately, their is absolutely no way from py code to get the RNA struct corresponding
+ * to the 'data' (in functions like prop() & co), as this is pure runtime data. Hence, messages extraction
+ * script can't determine the correct context it should use for such 'text' messages...
+ * So for now, one have to explicitly specify the 'text_ctxt' when using prop() etc. functions,
+ * if default context is not suitable.
+ */
+ if (prop) {
+ return BLF_pgettext(RNA_property_translation_context(prop), text);
+ }
+#else
+ (void)prop;
+#endif
+ if (type) {
+ return BLF_pgettext(RNA_struct_translation_context(type), text);
+ }
+
+ /* Else, default context! */
+ return BLF_pgettext(BLF_I18NCONTEXT_DEFAULT, text);
+}
+
+static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt,
+ int translate, int icon, int expand, int slider, int toggle, int icon_only, int event,
+ int full_event, int emboss, int index)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
int flag = 0;
@@ -52,6 +107,9 @@ static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname,
return;
}
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
flag |= (slider) ? UI_ITEM_R_SLIDER : 0;
flag |= (expand) ? UI_ITEM_R_EXPAND : 0;
flag |= (toggle) ? UI_ITEM_R_TOGGLE : 0;
@@ -63,36 +121,266 @@ static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname,
uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon);
}
-static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char *name, int icon, int emboss)
+static void rna_uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name,
+ const char *text_ctxt, int translate, int icon)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ /* XXX This will search property again :( */
+ uiItemMenuEnumR(layout, ptr, propname, name, icon);
+}
+
+static void rna_uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value,
+ const char *name, const char *text_ctxt, int translate, int icon)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ /* XXX This will search property again :( */
+ uiItemEnumR_string(layout, ptr, propname, value, name, icon);
+}
+
+static void rna_uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
+ struct PointerRNA *searchptr, const char *searchpropname,
+ const char *name, const char *text_ctxt, int translate, int icon)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ /* XXX This will search property again :( */
+ uiItemPointerR(layout, ptr, propname, searchptr, searchpropname, name, icon);
+}
+
+static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char *name, const char *text_ctxt,
+ int translate, int icon, int emboss)
{
- int flag = UI_ITEM_O_RETURN_PROPS;
+ wmOperatorType *ot;
+ int flag;
+
+ ot = WM_operatortype_find(opname, 0); /* print error next */
+ if (!ot || !ot->srna) {
+ RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
+ return PointerRNA_NULL;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
+
+ flag = UI_ITEM_O_RETURN_PROPS;
flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG;
- return uiItemFullO(layout, opname, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag);
+
+ return uiItemFullO_ptr(layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag);
+}
+
+static void rna_uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname, const char *name,
+ const char *text_ctxt, int translate, int icon)
+{
+ wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
+
+ if (!ot || !ot->srna) {
+ RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
+
+ /* XXX This will search operator again :( */
+ uiItemMenuEnumO(layout, opname, propname, name, icon);
+}
+
+static void rna_uiItemL(uiLayout *layout, const char *name, const char *text_ctxt, 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;
+ }
+
+ uiItemL(layout, name, icon);
+}
+
+static void rna_uiItemM(uiLayout *layout, bContext *C, const char *menuname, const char *name, const char *text_ctxt,
+ int translate, int icon)
+{
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
+
+ uiItemM(layout, C, menuname, name, icon);
+}
+
+static void rna_uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename,
+ const char *name, const char *text_ctxt, int translate)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ /* XXX This will search property again :( */
+ uiTemplateAnyID(layout, ptr, propname, proptypename, name);
+}
+
+static void rna_uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *root_ptr,
+ const char *name, const char *text_ctxt, int translate)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ /* XXX This will search property again :( */
+ uiTemplatePathBuilder(layout, ptr, propname, root_ptr, name);
+}
+
+static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon)
+{
+ return UI_rnaptr_icon_get(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), FALSE);
+}
+
+static const char *rna_ui_get_enum_name(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier)
+{
+ PropertyRNA *prop = NULL;
+ EnumPropertyItem *items = NULL, *item;
+ int free;
+ const char *name = "";
+
+ prop = RNA_struct_find_property(ptr, propname);
+ if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
+ RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return name;
+ }
+
+ RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
+
+ if (items) {
+ for (item = items; item->identifier; item++) {
+ if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
+ name = item->name;
+ break;
+ }
+ }
+ if (free) {
+ MEM_freeN(items);
+ }
+ }
+
+ return name;
+}
+
+static const char *rna_ui_get_enum_description(bContext *C, PointerRNA *ptr, const char *propname,
+ const char *identifier)
+{
+ PropertyRNA *prop = NULL;
+ EnumPropertyItem *items = NULL, *item;
+ int free;
+ const char *desc = "";
+
+ prop = RNA_struct_find_property(ptr, propname);
+ if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
+ RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return desc;
+ }
+
+ RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
+
+ if (items) {
+ for (item = items; item->identifier; item++) {
+ if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
+ desc = item->description;
+ break;
+ }
+ }
+ if (free) {
+ MEM_freeN(items);
+ }
+ }
+
+ return desc;
+}
+
+static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier)
+{
+ PropertyRNA *prop = NULL;
+ EnumPropertyItem *items = NULL, *item;
+ int free;
+ int icon = ICON_NONE;
+
+ prop = RNA_struct_find_property(ptr, propname);
+ if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
+ RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return icon;
+ }
+
+ RNA_property_enum_items(C, ptr, prop, &items, NULL, &free);
+
+ if (items) {
+ for (item = items; item->identifier; item++) {
+ if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
+ icon = item->icon;
+ break;
+ }
+ }
+ if (free) {
+ MEM_freeN(items);
+ }
+ }
+
+ return icon;
}
#else
-#define DEF_ICON_BLANK_SKIP
-#define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""},
-#define DEF_VICO(name) {VICO_##name, (#name), 0, (#name), ""},
-static EnumPropertyItem icon_items[] = {
-#include "UI_icons.h"
- {0, NULL, 0, NULL, NULL}
-};
-#undef DEF_ICON_BLANK_SKIP
-#undef DEF_ICON
-#undef DEF_VICO
+static void api_ui_item_common_text(FunctionRNA *func)
+{
+ RNA_def_string(func, "text", "", 0, "", "Override automatic text of the item");
+ RNA_def_string(func, "text_ctxt", "", 0, "", "Override automatic translation context of the given text");
+ RNA_def_boolean(func, "translate", true, "", "Translate the given text, when UI translation is enabled");
+}
static void api_ui_item_common(FunctionRNA *func)
{
PropertyRNA *prop;
- RNA_def_string_translate(func, "text", "", 0, "", "Override automatic text of the item");
+ api_ui_item_common_text(func);
prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, icon_items);
RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item");
-
}
static void api_ui_item_op(FunctionRNA *func)
@@ -130,13 +418,8 @@ void RNA_api_ui_layout(StructRNA *srna)
{'h', "HUE", 0, "Hue", ""},
{0, NULL, 0, NULL, NULL}
};
-
- static EnumPropertyItem list_type_items[] = {
- {0, "DEFAULT", 0, "None", ""},
- {'c', "COMPACT", 0, "Compact", ""},
- {'i', "ICONS", 0, "Icons", ""},
- {0, NULL, 0, NULL, NULL}
- };
+
+ static float node_socket_color_default[] = { 0.0f, 0.0f, 0.0f, 1.0f };
/* simple layout specifiers */
func = RNA_def_function(srna, "row", "uiLayoutRow");
@@ -175,6 +458,44 @@ void RNA_api_ui_layout(StructRNA *srna)
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");
+ /* Icon of a rna pointer */
+ func = RNA_def_function(srna, "icon", "rna_ui_get_rnaptr_icon");
+ parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
+ RNA_def_function_return(func, parm);
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take the icon");
+ RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
+ RNA_def_function_ui_description(func, "Return the custom icon for this data, "
+ "use it e.g. to get materials or texture icons");
+
+ /* UI name, description and icon of an enum item */
+ func = RNA_def_function(srna, "enum_item_name", "rna_ui_get_enum_name");
+ parm = RNA_def_string(func, "name", "", 0, "", "UI name of the enum item");
+ RNA_def_function_return(func, parm);
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_function_ui_description(func, "Return the UI name for this enum item");
+
+ func = RNA_def_function(srna, "enum_item_description", "rna_ui_get_enum_description");
+ parm = RNA_def_string(func, "description", "", 0, "", "UI description of the enum item");
+ RNA_def_function_return(func, parm);
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_function_ui_description(func, "Return the UI description for this enum item");
+
+ func = RNA_def_function(srna, "enum_item_icon", "rna_ui_get_enum_icon");
+ parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
+ RNA_def_function_return(func, parm);
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_function_ui_description(func, "Return the icon for this enum item");
+
/* items */
func = RNA_def_function(srna, "prop", "rna_uiItemR");
RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout");
@@ -194,17 +515,17 @@ void RNA_api_ui_layout(StructRNA *srna)
func = RNA_def_function(srna, "props_enum", "uiItemsEnumR");
api_ui_item_rna_common(func);
- func = RNA_def_function(srna, "prop_menu_enum", "uiItemMenuEnumR");
+ func = RNA_def_function(srna, "prop_menu_enum", "rna_uiItemMenuEnumR");
api_ui_item_rna_common(func);
api_ui_item_common(func);
- func = RNA_def_function(srna, "prop_enum", "uiItemEnumR_string");
+ func = RNA_def_function(srna, "prop_enum", "rna_uiItemEnumR_string");
api_ui_item_rna_common(func);
parm = RNA_def_string(func, "value", "", 0, "", "Enum property value");
RNA_def_property_flag(parm, PROP_REQUIRED);
api_ui_item_common(func);
- func = RNA_def_function(srna, "prop_search", "uiItemPointerR");
+ func = RNA_def_function(srna, "prop_search", "rna_uiItemPointerR");
api_ui_item_rna_common(func);
parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
@@ -227,7 +548,7 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
RNA_def_property_flag(parm, PROP_REQUIRED);
- func = RNA_def_function(srna, "operator_menu_enum", "uiItemMenuEnumO");
+ func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO");
api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -274,11 +595,15 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED);
#endif
- func = RNA_def_function(srna, "label", "uiItemL");
- RNA_def_function_ui_description(func, "Item. Display text in the layout");
+ func = RNA_def_function(srna, "label", "rna_uiItemL");
+ 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()...)");
- func = RNA_def_function(srna, "menu", "uiItemM");
+ func = RNA_def_function(srna, "menu", "rna_uiItemM");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm = RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu");
api_ui_item_common(func);
@@ -315,7 +640,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);
- func = RNA_def_function(srna, "template_any_ID", "uiTemplateAnyID");
+ func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID");
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
@@ -323,16 +648,16 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_string(func, "type_property", "", 0, "",
"Identifier of property in data giving the type of the ID-blocks to use");
RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");
+ api_ui_item_common_text(func);
- func = RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder");
+ func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder");
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
- RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");
+ api_ui_item_common_text(func);
func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
@@ -369,6 +694,10 @@ void RNA_api_ui_layout(StructRNA *srna)
api_ui_item_rna_common(func);
RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail");
+ func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView");
+ RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews");
+ api_ui_item_rna_common(func);
+
func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data");
api_ui_item_rna_common(func);
@@ -439,26 +768,30 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
func = RNA_def_function(srna, "template_list", "uiTemplateList");
- RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups "
- "(WARNING: only one per panel allowed!).");
+ RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups.");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
+ parm = RNA_def_string(func, "listtype_name", "", 0, "", "Identifier of the list type to use");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm = RNA_def_string(func, "list_id", "", 0, "",
+ "Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME
+ "\" class). "
+ "If this is set, the uilist gets a custom ID, otherwise it takes the "
+ "name of the class used to define the uilist (for example, if the "
+ "class name is \"OBJECT_UL_vgroups\", and list_id is not set by the "
+ "script, then bl_idname = \"OBJECT_UL_vgroups\")");
+ parm = RNA_def_pointer(func, "dataptr", "AnyType", "", "Data from which to take the Collection property");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
- parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
+ parm = RNA_def_string(func, "propname", "", 0, "", "Identifier of the Collection property in data");
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm = RNA_def_pointer(func, "active_data", "AnyType", "",
- "Data from which to take property for the active element");
+ parm = RNA_def_pointer(func, "active_dataptr", "AnyType", "",
+ "Data from which to take the integer property, index of the active item");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
- parm = RNA_def_string(func, "active_property", "", 0, "",
- "Identifier of property in data, for the active element");
+ parm = RNA_def_string(func, "active_propname", "", 0, "",
+ "Identifier of the integer property in active_data, index of the active item");
RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_string(func, "prop_list", "", 0, "",
- "Identifier of a string property in each data member, specifying which "
- "of its properties should have a widget displayed in its row "
- "(format: \"propname1:propname2:propname3:...\")");
RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display", 0, INT_MAX);
RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display", 0, INT_MAX);
- RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use");
+ RNA_def_enum(func, "type", uilist_layout_type_items, UILST_LAYOUT_DEFAULT, "Type", "Type of layout to use");
func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
@@ -498,6 +831,14 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
+ func = RNA_def_function(srna, "template_component_menu", "uiTemplateComponentMenu");
+ RNA_def_function_ui_description(func, "Item. Display expanded property in a popup menu");
+ parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
+ RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
+ parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_string(func, "name", "", 0, "", "");
+
func = RNA_def_function(srna, "introspect", "uiLayoutIntrospect");
parm = RNA_def_string(func, "string", "", 1024 * 1024, "Descr", "DESCR");
RNA_def_function_return(func, parm);
@@ -512,6 +853,12 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
/* RNA_def_boolean(func, "show_global_settings", 0, "", "Show widgets to control global color management settings"); */
+
+ /* node socket icon */
+ func = RNA_def_function(srna, "template_node_socket", "uiTemplateNodeSocket");
+ RNA_def_function_ui_description(func, "Node Socket Icon");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_float_array(func, "color", 4, node_socket_color_default, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
}
#endif