Add missing particle system tagging on update to the new depsgraph

It's not ideal and mimics weak legacy code, but so close to bcon4 we'd better
not start re-considering the way how particle works..
This commit is contained in:
Sergey Sharybin
2015-05-28 13:49:23 +05:00
parent d9b6768521
commit f777983d5b

View File

@@ -62,6 +62,14 @@ extern "C" {
/* *********************** */
/* Update Tagging/Flushing */
/* Legacy depsgraph did some special trickery for things like particle systems
* when tagging ID for an update. Ideally that tagging needs to become obsolete
* in favor of havng dedicated node for that which gets tagged, but for until
* design of those areas is more clear we'll do the same legacy code here.
* - sergey -
*/
#define DEPSGRAPH_USE_LEGACY_TAGGING
/* Data-Based Tagging ------------------------------- */
static void lib_id_recalc_tag(Main *bmain, ID *id)
@@ -108,6 +116,33 @@ static void lib_id_recalc_tag_flag(Main *bmain, ID *id, int flag)
}
}
#ifdef DEPSGRAPH_USE_LEGACY_TAGGING
static void depsgraph_legacy_handle_update_tag(Main *bmain, ID *id, short flag)
{
if (flag) {
Object *object;
short idtype = GS(id->name);
if (idtype == ID_PA) {
ParticleSystem *psys;
for (object = (Object *)bmain->object.first;
object != NULL;
object = (Object *)object->id.next)
{
for (psys = (ParticleSystem *)object->particlesystem.first;
psys != NULL;
psys = (ParticleSystem *)psys->next)
{
if (&psys->part->id == id) {
DEG_id_tag_update_ex(bmain, &object->id, flag & OB_RECALC_ALL);
psys->recalc |= (flag & PSYS_RECALC);
}
}
}
}
}
}
#endif
/* Tag all nodes in ID-block for update.
* This is a crude measure, but is most convenient for old code.
*/
@@ -189,6 +224,14 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, short flag)
}
}
}
#ifdef DEPSGRAPH_USE_LEGACY_TAGGING
/* Special handling from the legacy depsgraph.
* TODO(sergey): Need to get rid of those once all the areas
* are re-formulated in terms of franular nodes.
*/
depsgraph_legacy_handle_update_tag(bmain, id, flag);
#endif
}
/* Tag given ID type for update. */