From 96b58264ca7072e8549e89a4e7ae08f61e1bdc1a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 19 Feb 2010 16:31:03 +0000 Subject: [PATCH] faster function lookups, quick test through python cuts a quater the time off. was doing an extra lookup for the functions property, as well as using the property iterator. (every button & menu item draws does one of these for every redraw). --- source/blender/makesrna/intern/rna_access.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 8be14be78f4..3edab8ebc68 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -574,6 +574,19 @@ const struct ListBase *RNA_struct_defined_properties(StructRNA *srna) FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier) { +#if 1 + FunctionRNA *func; + StructRNA *type; + for(type= ptr->type; type; type= type->base) { + for(func= type->functions.first; func; func= func->cont.next) { + if(strcmp(func->identifier, identifier)==0) + return func; + } + } + return NULL; + + /* funcitonal but slow */ +#else PointerRNA tptr; PropertyRNA *iterprop; FunctionRNA *func; @@ -592,6 +605,7 @@ FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier) RNA_PROP_END; return func; +#endif } const struct ListBase *RNA_struct_defined_functions(StructRNA *srna)