diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-03-15 01:30:57 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-03-15 01:30:57 +0300 |
commit | 64078786cc2df63d9d8f1d10c48a5bda24639bcb (patch) | |
tree | 7b04b805df03708497bc21f973f1ddff7e58eb0d /source/blender/windowmanager | |
parent | 14c2fc3c12f2f5b43a8689f2a54c249a4325118c (diff) |
Fix #20486: blender hangs upon import attempt of an .obj with >40k polys.
Added automatic generation of lookup_int callbacks for collections, for
quicker lookup by index instead of looping over the whole thing. Import
is still quite slow, though now it only takes a few seconds.
The next bottleneck seems to be running update (depsgraph, notifiers, ..)
on setting every property. I fixed part of that by avoiding a notifier
to be added each time, now it checks for duplicates.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 9ef94b5e1ff..8cfd45662ac 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -108,6 +108,17 @@ void wm_event_free_all(wmWindow *win) /* ********************* notifiers, listeners *************** */ +static int wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, void *reference) +{ + wmNotifier *note; + + for(note=wm->queue.first; note; note=note->next) + if((note->category|note->data|note->subtype|note->action) == type && note->reference == reference) + return 1; + + return 0; +} + /* XXX: in future, which notifiers to send to other windows? */ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference) { @@ -134,7 +145,7 @@ void WM_main_add_notifier(unsigned int type, void *reference) Main *bmain= G.main; wmWindowManager *wm= bmain->wm.first; - if(wm) { + if(wm && !wm_test_duplicate_notifier(wm, type, reference)) { wmNotifier *note= MEM_callocN(sizeof(wmNotifier), "notifier"); note->wm= wm; |