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).
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user