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/space_outliner | |
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/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 0250676c2dd..6d6c3429af2 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -66,6 +66,8 @@ #include "BKE_scene.h" #include "BKE_sequencer.h" +#include "BLI_ghash.h" + #include "ED_armature.h" #include "ED_object.h" #include "ED_screen.h" @@ -584,9 +586,10 @@ static void operator_call_cb(struct bContext *UNUSED(C), void *arg_kmi, void *ar static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(arg_kmi), 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->idname, str)) { char name[OP_MAX_TYPENAME]; @@ -598,6 +601,7 @@ static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(ar break; } } + BLI_ghashIterator_free(iter); } /* operator Search browse menu, open */ |