diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-02-09 15:58:24 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-02-09 15:58:24 +0300 |
commit | 5186062d582dee0ce4ef6c461e45d1654aff3e16 (patch) | |
tree | 1c2361b1852445b60985369e93c6dfd27ef14f03 /source | |
parent | 017e2fb28469595d4302ee8facc72ad1b216e253 (diff) |
Integration of particle shapekeys with the depsgraph and driver eval.
It's a bit messy, but that is to be expected: all of the areas involved
(particles, shapekeys, depsgraph, drivers) are badly designed and
supposed to get major refactoring ...
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 30 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 7 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 7 |
3 files changed, 38 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 566aa6657b9..00efc28988b 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -761,6 +761,10 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O if (!psys_check_enabled(ob, psys)) continue; + key = psys->key; + if (key && key->adt) + dag_add_driver_relation(key->adt, dag, node, 1); + if (ELEM(part->phystype, PART_PHYS_KEYED, PART_PHYS_BOIDS)) { ParticleTarget *pt = psys->targets.first; @@ -2496,12 +2500,26 @@ static void dag_id_flush_update(Main *bmain, Scene *sce, ID *id) /* set flags based on ShapeKey */ if (idtype == ID_KE) { for (obt = bmain->object.first; obt; obt = obt->id.next) { - Key *key = BKE_key_from_object(obt); - if (!(ob && obt == ob) && ((ID *)key == id)) { - obt->flag |= (OB_RECALC_OB | OB_RECALC_DATA); - lib_id_recalc_tag(bmain, &obt->id); - lib_id_recalc_data_tag(bmain, &obt->id); - BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH); + if (!(ob && obt == ob)) { + Key *key = BKE_key_from_object(obt); + ParticleSystem *psys; + + if ((ID *)key == id) { + obt->flag |= (OB_RECALC_OB | OB_RECALC_DATA); + lib_id_recalc_tag(bmain, &obt->id); + lib_id_recalc_data_tag(bmain, &obt->id); + BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH); + } + + for (psys = obt->particlesystem.first; psys; psys = psys->next) { + key = psys->key; + if ((ID *)key == id) { + obt->flag |= (OB_RECALC_OB | OB_RECALC_DATA); + lib_id_recalc_tag(bmain, &obt->id); + lib_id_recalc_data_tag(bmain, &obt->id); + BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH); + } + } } } } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index f290ddd98ff..8695867a80d 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3025,6 +3025,7 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx, ID *data_id = (ID *)ob->data; AnimData *adt = BKE_animdata_from_id(data_id); Key *key; + ParticleSystem *psys; float ctime = BKE_scene_frame_get(scene); if (G.debug & G_DEBUG_DEPSGRAPH) @@ -3041,6 +3042,12 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx, if (!(ob->shapeflag & OB_SHAPE_LOCK)) BKE_animsys_evaluate_animdata(scene, &key->id, key->adt, ctime, ADT_RECALC_DRIVERS); } + for (psys = ob->particlesystem.first; psys; psys = psys->next) { + key = psys->key; + if (key && key->block.first) { + BKE_animsys_evaluate_animdata(scene, &key->id, key->adt, ctime, ADT_RECALC_DRIVERS); + } + } /* includes all keys and modifiers */ switch (ob->type) { diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index d6daa64a9f2..09c8af8c1b4 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -90,6 +90,7 @@ #include "BKE_modifier.h" #include "BKE_node.h" #include "BKE_mask.h" +#include "BKE_particle.h" #include "BKE_sequencer.h" #include "ED_anim_api.h" @@ -2260,6 +2261,7 @@ static size_t animdata_filter_dopesheet_ob(bAnimContext *ac, ListBase *anim_data BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_OBJC(ob)) { Key *key = BKE_key_from_object(ob); + ParticleSystem *psys; /* object-level animation */ if ((ob->adt) && !(ads->filterflag & ADS_FILTER_NOOBJ)) { @@ -2270,6 +2272,11 @@ static size_t animdata_filter_dopesheet_ob(bAnimContext *ac, ListBase *anim_data if ((key && key->adt) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)) { tmp_items += animdata_filter_ds_keyanim(ac, &tmp_data, ads, ob, key, filter_mode); } + for (psys = ob->particlesystem.first; psys; psys = psys->next) { + if ((psys->key && psys->key->adt) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)) { + tmp_items += animdata_filter_ds_keyanim(ac, &tmp_data, ads, ob, psys->key, filter_mode); + } + } /* modifiers */ if ((ob->modifiers.first) && !(ads->filterflag & ADS_FILTER_NOMODIFIERS)) { |