Fix T41703: Blender crashes trying to load character file.

Core of the issue is that pointcache handling in depsgraph were (re-) tagging
for update some objects on hidden layers, when all their dependencies remained
untag.

Since we do not want to update objects on hidden layers, take this data into account
when flushing pointcache.

Investigations and org patch by self, reviews, advices and final patch by sergey, many thanks! :)
This commit is contained in:
Bastien Montagne 2014-09-08 11:49:55 +02:00
parent feba2d3edf
commit 9c19ad1f79
Notes: blender-bot 2023-05-29 09:17:12 +02:00
Referenced by issue #41703, Blender crashes trying to load character file
1 changed files with 13 additions and 7 deletions

View File

@ -1774,7 +1774,8 @@ static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime)
}
/* node was checked to have lasttime != curtime, and is of type ID_OB */
static void flush_pointcache_reset(Main *bmain, Scene *scene, DagNode *node, int curtime, int reset)
static void flush_pointcache_reset(Main *bmain, Scene *scene, DagNode *node,
int curtime, unsigned int lay, bool reset)
{
DagAdjList *itA;
Object *ob;
@ -1788,14 +1789,17 @@ static void flush_pointcache_reset(Main *bmain, Scene *scene, DagNode *node, int
if (reset || (ob->recalc & OB_RECALC_ALL)) {
if (BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH)) {
ob->recalc |= OB_RECALC_DATA;
lib_id_recalc_data_tag(bmain, &ob->id);
/* Don't tag nodes which are on invisible layer. */
if (itA->node->lay & lay) {
ob->recalc |= OB_RECALC_DATA;
lib_id_recalc_data_tag(bmain, &ob->id);
}
}
flush_pointcache_reset(bmain, scene, itA->node, curtime, 1);
flush_pointcache_reset(bmain, scene, itA->node, curtime, lay, true);
}
else
flush_pointcache_reset(bmain, scene, itA->node, curtime, 0);
flush_pointcache_reset(bmain, scene, itA->node, curtime, lay, false);
}
}
}
@ -1912,10 +1916,12 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
lib_id_recalc_data_tag(bmain, &ob->id);
}
flush_pointcache_reset(bmain, sce, itA->node, lasttime, 1);
flush_pointcache_reset(bmain, sce, itA->node, lasttime,
lay, true);
}
else
flush_pointcache_reset(bmain, sce, itA->node, lasttime, 0);
flush_pointcache_reset(bmain, sce, itA->node, lasttime,
lay, false);
}
}
}