Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_operators.c
| Show First 20 Lines • Show All 582 Lines • ▼ Show 20 Lines | char *WM_context_path_resolve_property_full(const bContext *C, | ||||
| const char *member_id = wm_context_member_from_ptr(C, ptr, &is_id); | const char *member_id = wm_context_member_from_ptr(C, ptr, &is_id); | ||||
| char *member_id_data_path = NULL; | char *member_id_data_path = NULL; | ||||
| if (member_id != NULL) { | if (member_id != NULL) { | ||||
| if (is_id && !RNA_struct_is_ID(ptr->type)) { | if (is_id && !RNA_struct_is_ID(ptr->type)) { | ||||
| char *data_path = RNA_path_from_ID_to_struct(ptr); | char *data_path = RNA_path_from_ID_to_struct(ptr); | ||||
| if (data_path != NULL) { | if (data_path != NULL) { | ||||
| if (prop != NULL) { | if (prop != NULL) { | ||||
| char *prop_str = RNA_path_property_py(ptr, prop, index); | char *prop_str = RNA_path_property_py(ptr, prop, index); | ||||
| member_id_data_path = BLI_string_join_by_sep_charN('.', member_id, data_path, prop_str); | if (prop_str[0] == '[') { | ||||
| member_id_data_path = BLI_string_joinN(member_id, ".", data_path, prop_str); | |||||
campbellbarton: This passes a character as `'.'` as a string.
instead of many string formatting characters… | |||||
| } | |||||
| else { | |||||
| member_id_data_path = BLI_string_join_by_sep_charN( | |||||
| '.', member_id, data_path, prop_str); | |||||
| } | |||||
| MEM_freeN(prop_str); | MEM_freeN(prop_str); | ||||
| } | } | ||||
| else { | else { | ||||
| member_id_data_path = BLI_string_join_by_sep_charN('.', member_id, data_path); | member_id_data_path = BLI_string_join_by_sep_charN('.', member_id, data_path); | ||||
| } | } | ||||
| MEM_freeN(data_path); | MEM_freeN(data_path); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| if (prop != NULL) { | if (prop != NULL) { | ||||
| char *prop_str = RNA_path_property_py(ptr, prop, index); | char *prop_str = RNA_path_property_py(ptr, prop, index); | ||||
| if (prop_str[0] == '[') { | |||||
| member_id_data_path = BLI_string_joinN(member_id, prop_str); | |||||
| } | |||||
| else { | |||||
| member_id_data_path = BLI_string_join_by_sep_charN('.', member_id, prop_str); | member_id_data_path = BLI_string_join_by_sep_charN('.', member_id, prop_str); | ||||
| } | |||||
| MEM_freeN(prop_str); | MEM_freeN(prop_str); | ||||
| } | } | ||||
| else { | else { | ||||
| member_id_data_path = BLI_strdup(member_id); | member_id_data_path = BLI_strdup(member_id); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return member_id_data_path; | return member_id_data_path; | ||||
| ▲ Show 20 Lines • Show All 3,492 Lines • Show Last 20 Lines | |||||
This passes a character as '.' as a string.
instead of many string formatting characters, prefer:
BLI_string_join(member_id, ".", data_path, prop_str) since nothing is gained from using string formatting and join is used elsewhere in this function.
Same goes for BLI_sprintfN use below.