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