Fix T63795: Display custom properties with brackets in info
When custom properties are changed, they are displayed with brackets in info. Ref D14380
This commit is contained in:
parent
4a5cd4e6c7
commit
9ec77d709c
Notes:
blender-bot
2023-02-14 11:21:40 +01:00
Referenced by issue #63795, data path for custom prop is wrong for info menu
|
@ -6012,13 +6012,29 @@ char *RNA_path_struct_property_py(PointerRNA *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;
|
||||
|
||||
if ((index == -1) || (RNA_property_array_check(prop) == false)) {
|
||||
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 {
|
||||
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;
|
||||
|
|
|
@ -588,7 +588,13 @@ char *WM_context_path_resolve_property_full(const bContext *C,
|
|||
if (data_path != NULL) {
|
||||
if (prop != NULL) {
|
||||
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);
|
||||
}
|
||||
else {
|
||||
member_id_data_path = BLI_string_join_by_sep_charN(
|
||||
'.', member_id, data_path, prop_str);
|
||||
}
|
||||
MEM_freeN(prop_str);
|
||||
}
|
||||
else {
|
||||
|
@ -600,7 +606,12 @@ char *WM_context_path_resolve_property_full(const bContext *C,
|
|||
else {
|
||||
if (prop != NULL) {
|
||||
char *prop_str = RNA_path_property_py(ptr, prop, index);
|
||||
member_id_data_path = BLI_string_join_by_sep_charN('.', member_id, prop_str);
|
||||
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);
|
||||
}
|
||||
MEM_freeN(prop_str);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue