diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-08-11 10:06:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-08-11 10:06:17 +0400 |
commit | a7663cc37753abd97744b51739358fb6b8026883 (patch) | |
tree | 5fe4e6bd695d42f47027c40c630f918bdec33294 /source/blender/editors/interface | |
parent | 0fac849d44d5bf8f2d3add9e10c03adbe5ffe331 (diff) |
use ghash for operator and menu types, was doing string lookup in the operator list (containing over 1000 items) for each button draw.
gives small speedup for UI drawing and overall startup time.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 6384d91955f..2faac24fd78 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -39,6 +39,7 @@ #include "BLI_string.h" #include "BLI_utildefines.h" +#include "BLI_ghash.h" #include "BKE_animsys.h" #include "BKE_colortools.h" @@ -2322,10 +2323,11 @@ static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2) static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items) { - wmOperatorType *ot = WM_operatortype_first(); - - for(; ot; ot= ot->next) { - + GHashIterator *iter= WM_operatortype_iter(); + + for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) { + wmOperatorType *ot= BLI_ghashIterator_getValue(iter); + if(BLI_strcasestr(ot->name, str)) { if(WM_operator_poll((bContext*)C, ot)) { char name[256]; @@ -2345,6 +2347,7 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char } } } + BLI_ghashIterator_free(iter); } void uiTemplateOperatorSearch(uiLayout *layout) |