diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-08-24 04:44:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-08-24 04:44:28 +0300 |
commit | 7ec1a56a41953eac23e252fad9a3bf1605471abc (patch) | |
tree | 34d707f3d434a39bc08c34cbc64abfce61c9da9c /source/blender/makesrna/intern/rna_ui_api.c | |
parent | c5206e5d2f880adf9cff8ed295be5ec160d18e0d (diff) |
RNA: avoid redundant property lookups in UI API
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 7b08380cabe..d647876796a 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -156,8 +156,7 @@ static void rna_uiItemEnumR_string( /* Get translated name (label). */ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate); - /* XXX This will search property again :( */ - uiItemEnumR_string(layout, ptr, propname, value, name, icon); + uiItemEnumR_string_prop(layout, ptr, prop, value, name, icon); } static void rna_uiItemPointerR( @@ -166,17 +165,20 @@ static void rna_uiItemPointerR( const char *name, const char *text_ctxt, bool translate, int icon) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); - if (!prop) { RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } + PropertyRNA *searchprop = RNA_struct_find_property(searchptr, searchpropname); + if (!searchprop) { + RNA_warning("property not found: %s.%s", RNA_struct_identifier(searchptr->type), searchpropname); + return; + } /* Get translated name (label). */ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate); - /* XXX This will search property again :( */ - uiItemPointerR(layout, ptr, propname, searchptr, searchpropname, name, icon); + uiItemPointerR_prop(layout, ptr, prop, searchptr, searchprop, name, icon); } static PointerRNA rna_uiItemO( |