Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_access.c
| Show First 20 Lines • Show All 6,006 Lines • ▼ Show 20 Lines | if (data_path) { | ||||
| MEM_freeN(data_path); | MEM_freeN(data_path); | ||||
| } | } | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| char *RNA_path_property_py(const PointerRNA *UNUSED(ptr), PropertyRNA *prop, int index) | char *RNA_path_property_py(const PointerRNA *UNUSED(ptr), PropertyRNA *prop, int index) | ||||
| { | { | ||||
| const bool is_rna = (prop->magic == RNA_MAGIC); | |||||
| const char *propname = RNA_property_identifier(prop); | |||||
| char *ret; | char *ret; | ||||
| if ((index == -1) || (RNA_property_array_check(prop) == false)) { | if ((index == -1) || (RNA_property_array_check(prop) == false)) { | ||||
campbellbarton: *picky* prefer to assign on declaration. | |||||
| ret = BLI_sprintfN("%s", RNA_property_identifier(prop)); | if (is_rna) { | ||||
| ret = BLI_strdup(propname); | |||||
| } | |||||
| else { | |||||
| char propname_esc[MAX_IDPROP_NAME * 2]; | |||||
| BLI_str_escape(propname_esc, propname, sizeof(propname_esc)); | |||||
| ret = BLI_sprintfN("[\"%s\"]", propname_esc); | |||||
| } | |||||
| } | } | ||||
| else { | else { | ||||
| ret = BLI_sprintfN("%s[%d]", RNA_property_identifier(prop), index); | if (is_rna) { | ||||
| ret = BLI_sprintfN("%s[%d]", propname, index); | |||||
| } | |||||
| else { | |||||
| char propname_esc[MAX_IDPROP_NAME * 2]; | |||||
| BLI_str_escape(propname_esc, propname, sizeof(propname_esc)); | |||||
| ret = BLI_sprintfN("[\"%s\"][%d]", propname_esc, index); | |||||
| } | |||||
| } | } | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| /* Quick name based property access */ | /* Quick name based property access */ | ||||
| bool RNA_boolean_get(PointerRNA *ptr, const char *name) | bool RNA_boolean_get(PointerRNA *ptr, const char *name) | ||||
| ▲ Show 20 Lines • Show All 1,951 Lines • Show Last 20 Lines | |||||
*picky* prefer to assign on declaration.