[Bf-blender-cvs] [5186062] gooseberry: Integration of particle shapekeys with the depsgraph and driver eval.

Lukas Tönne noreply at git.blender.org
Mon Feb 9 14:00:13 CET 2015


Commit: 5186062d582dee0ce4ef6c461e45d1654aff3e16
Author: Lukas Tönne
Date:   Mon Feb 9 13:58:24 2015 +0100
Branches: gooseberry
https://developer.blender.org/rB5186062d582dee0ce4ef6c461e45d1654aff3e16

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 ...

===================================================================

M	source/blender/blenkernel/intern/depsgraph.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/editors/animation/anim_filter.c

===================================================================

diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 566aa66..00efc28 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 f290ddd..8695867 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 d6daa64..09c8af8 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)) {




More information about the Bf-blender-cvs mailing list