Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-02-19 19:31:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-19 19:31:03 +0300
commit96b58264ca7072e8549e89a4e7ae08f61e1bdc1a (patch)
treebca346064fe31cb5b09ba1798e347ea2e3da9350 /source/blender
parent3bf2715039eecee409d3b6c3639e853b6750e77c (diff)
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).
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/makesrna/intern/rna_access.c14
1 files changed, 14 insertions, 0 deletions
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)