Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_access.c
| Show First 20 Lines • Show All 1,209 Lines • ▼ Show 20 Lines | |||||
| }; | }; | ||||
| /* Reuse for dynamic types with default value */ | /* Reuse for dynamic types with default value */ | ||||
| EnumPropertyItem DummyRNA_DEFAULT_items[] = { | EnumPropertyItem DummyRNA_DEFAULT_items[] = { | ||||
| {0, "DEFAULT", 0, "Default", ""}, | {0, "DEFAULT", 0, "Default", ""}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **r_item, | void RNA_property_enum_items_ex( | ||||
| int *r_totitem, bool *r_free) | bContext *C, PointerRNA *ptr, PropertyRNA *prop, const bool use_static, | ||||
| EnumPropertyItem **r_item, int *r_totitem, bool *r_free) | |||||
| { | { | ||||
| EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop); | EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop); | ||||
| *r_free = false; | *r_free = false; | ||||
| if (eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) { | if (!use_static && eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) { | ||||
| EnumPropertyItem *item; | EnumPropertyItem *item; | ||||
| if (prop->flag & PROP_ENUM_NO_CONTEXT) | if (prop->flag & PROP_ENUM_NO_CONTEXT) | ||||
| item = eprop->itemf(NULL, ptr, prop, r_free); | item = eprop->itemf(NULL, ptr, prop, r_free); | ||||
| else | else | ||||
| item = eprop->itemf(C, ptr, prop, r_free); | item = eprop->itemf(C, ptr, prop, r_free); | ||||
| /* any callbacks returning NULL should be fixed */ | /* any callbacks returning NULL should be fixed */ | ||||
| Show All 11 Lines | void RNA_property_enum_items_ex( | ||||
| } | } | ||||
| else { | else { | ||||
| *r_item = eprop->item; | *r_item = eprop->item; | ||||
| if (r_totitem) | if (r_totitem) | ||||
| *r_totitem = eprop->totitem; | *r_totitem = eprop->totitem; | ||||
| } | } | ||||
| } | } | ||||
| void RNA_property_enum_items( | |||||
| bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **r_item, int *r_totitem, bool *r_free) | |||||
| { | |||||
| RNA_property_enum_items_ex(C, ptr, prop, false, r_item, r_totitem, r_free); | |||||
| } | |||||
| #ifdef WITH_INTERNATIONAL | #ifdef WITH_INTERNATIONAL | ||||
| static void property_enum_translate(PropertyRNA *prop, EnumPropertyItem **r_item, int *r_totitem, bool *r_free) | static void property_enum_translate(PropertyRNA *prop, EnumPropertyItem **r_item, int *r_totitem, bool *r_free) | ||||
| { | { | ||||
| if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) { | if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) { | ||||
| int i; | int i; | ||||
| /* Note: Only do those tests once, and then use BLT_pgettext. */ | /* Note: Only do those tests once, and then use BLT_pgettext. */ | ||||
| bool do_iface = BLT_translate_iface(); | bool do_iface = BLT_translate_iface(); | ||||
| ▲ Show 20 Lines • Show All 5,592 Lines • Show Last 20 Lines | |||||