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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-03-15 01:30:57 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-03-15 01:30:57 +0300
commit64078786cc2df63d9d8f1d10c48a5bda24639bcb (patch)
tree7b04b805df03708497bc21f973f1ddff7e58eb0d /source/blender/windowmanager
parent14c2fc3c12f2f5b43a8689f2a54c249a4325118c (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.c13
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;