Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_ui_api.c
| Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
| static void rna_uiItemR(uiLayout *layout, | static void rna_uiItemR(uiLayout *layout, | ||||
| PointerRNA *ptr, | PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| const char *name, | const char *name, | ||||
| const char *text_ctxt, | const char *text_ctxt, | ||||
| bool translate, | bool translate, | ||||
| int icon, | int icon, | ||||
| bool expand, | bool expand, | ||||
| bool split_row, | |||||
| bool slider, | bool slider, | ||||
| bool toggle, | bool toggle, | ||||
| bool icon_only, | bool icon_only, | ||||
| bool event, | bool event, | ||||
| bool full_event, | bool full_event, | ||||
| bool emboss, | bool emboss, | ||||
| int index, | int index, | ||||
| int icon_value) | int icon_value) | ||||
| Show All 10 Lines | if (icon_value && !icon) { | ||||
| icon = icon_value; | icon = icon_value; | ||||
| } | } | ||||
| /* Get translated name (label). */ | /* Get translated name (label). */ | ||||
| name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate); | name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate); | ||||
| flag |= (slider) ? UI_ITEM_R_SLIDER : 0; | flag |= (slider) ? UI_ITEM_R_SLIDER : 0; | ||||
| flag |= (expand) ? UI_ITEM_R_EXPAND : 0; | flag |= (expand) ? UI_ITEM_R_EXPAND : 0; | ||||
| flag |= (split_row) ? UI_ITEM_R_SPLIT_ROW : 0; | |||||
| flag |= (toggle) ? UI_ITEM_R_TOGGLE : 0; | flag |= (toggle) ? UI_ITEM_R_TOGGLE : 0; | ||||
| flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0; | flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0; | ||||
| flag |= (event) ? UI_ITEM_R_EVENT : 0; | flag |= (event) ? UI_ITEM_R_EVENT : 0; | ||||
| flag |= (full_event) ? UI_ITEM_R_FULL_EVENT : 0; | flag |= (full_event) ? UI_ITEM_R_FULL_EVENT : 0; | ||||
| flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG; | flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG; | ||||
| uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon); | uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 494 Lines • ▼ Show 20 Lines | static void api_ui_item_rna_common(FunctionRNA *func) | ||||
| parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); | parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data"); | parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data"); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| } | } | ||||
| void RNA_api_ui_layout(StructRNA *srna) | void RNA_api_ui_layout(StructRNA *srna) | ||||
| { | { | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
jbakker: Update text: "Use separator to expand to next row" | |||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| static const EnumPropertyItem curve_type_items[] = { | static const EnumPropertyItem curve_type_items[] = { | ||||
| {0, "NONE", 0, "None", ""}, | {0, "NONE", 0, "None", ""}, | ||||
| {'v', "VECTOR", 0, "Vector", ""}, | {'v', "VECTOR", 0, "Vector", ""}, | ||||
| {'c', "COLOR", 0, "Color", ""}, | {'c', "COLOR", 0, "Color", ""}, | ||||
| {'h', "HUE", 0, "Hue", ""}, | {'h', "HUE", 0, "Hue", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| ▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | void RNA_api_ui_layout(StructRNA *srna) | ||||
| RNA_def_function_ui_description(func, "Return the icon for this enum item"); | RNA_def_function_ui_description(func, "Return the icon for this enum item"); | ||||
| /* items */ | /* items */ | ||||
| func = RNA_def_function(srna, "prop", "rna_uiItemR"); | 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"); | RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout"); | ||||
| api_ui_item_rna_common(func); | api_ui_item_rna_common(func); | ||||
| api_ui_item_common(func); | api_ui_item_common(func); | ||||
| RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail"); | RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail"); | ||||
| RNA_def_boolean(func, "split_row", false, "", "Separator will expand to a new row"); | |||||
| RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values"); | RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values"); | ||||
| RNA_def_boolean(func, "toggle", false, "", "Use toggle widget for boolean values"); | RNA_def_boolean(func, "toggle", false, "", "Use toggle widget for boolean values"); | ||||
| RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text"); | RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text"); | ||||
| RNA_def_boolean(func, "event", false, "", "Use button to input key events"); | RNA_def_boolean(func, "event", false, "", "Use button to input key events"); | ||||
| RNA_def_boolean( | RNA_def_boolean( | ||||
| func, "full_event", false, "", "Use button to input full events including modifiers"); | func, "full_event", false, "", "Use button to input full events including modifiers"); | ||||
| RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just the icon/text"); | RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just the icon/text"); | ||||
| RNA_def_int(func, | RNA_def_int(func, | ||||
| ▲ Show 20 Lines • Show All 722 Lines • Show Last 20 Lines | |||||
Update text: "Use separator to expand to next row"