diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-11-30 14:38:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-01 02:31:10 +0300 |
commit | 9307202807e4ff52f2266b17597fa85ee6377293 (patch) | |
tree | 45f5f6b85b5854ed5ae2ad30dcfa3371eeee3749 /source/blender/editors | |
parent | b7978e984b4885495d0966d0c8652ff43ddf9fc9 (diff) |
RNA: de-duplciate rna-path create in tooltip code
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 3a24625c36c..5fe6fd119aa 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -534,33 +534,18 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if (but->rnapoin.id.data) { /* this could get its own 'BUT_GET_...' type */ - PointerRNA *ptr = &but->rnapoin; - PropertyRNA *prop = but->rnaprop; - ID *id = ptr->id.data; - - char *id_path; - char *data_path = NULL; /* never fails */ - id_path = RNA_path_full_ID_py(id); - - if (ptr->data && prop) { - data_path = RNA_path_from_ID_to_property(ptr, prop); - } + char *id_path; - if (data_path) { - const char *data_delim = (data_path[0] == '[') ? "" : "."; - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), - "%s%s%s", /* no need to translate */ - id_path, data_delim, data_path); - MEM_freeN(data_path); + if (but->rnaprop) { + id_path = RNA_path_full_property_py_ex(&but->rnapoin, but->rnaprop, but->rnaindex, true); } - else if (prop) { - /* can't find the path. be explicit in our ignorance "..." */ - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), - "%s ... %s", /* no need to translate */ - id_path, rna_prop.strinfo ? rna_prop.strinfo : RNA_property_identifier(prop)); + else { + id_path = RNA_path_full_struct_py(&but->rnapoin); } + + BLI_strncat_utf8(data->lines[data->totline], id_path, sizeof(data->lines[0])); MEM_freeN(id_path); data->format[data->totline].style = UI_TIP_STYLE_MONO; |