[Bf-blender-cvs] [48a0c931eea] master: Fix T80121: Forcefield F-curve modifier changes don't reset cache
Sybren A. Stüvel
noreply at git.blender.org
Mon Sep 28 17:25:44 CEST 2020
Commit: 48a0c931eea84fb072ce0b958090dda4b27cabff
Author: Sybren A. Stüvel
Date: Mon Sep 28 17:13:40 2020 +0200
Branches: master
https://developer.blender.org/rB48a0c931eea84fb072ce0b958090dda4b27cabff
Fix T80121: Forcefield F-curve modifier changes don't reset cache
Add a dependency graph relation Force Object Animation → Scene Rigid
Body World Rebuild. This ensures that the rigid body world is rebuilt
when a force object is re-tagged for animation updates.
The extra relation doesn't add any new calculations when the animation
is running, as the Time Source node already had a relation to the
scene's `RIGIDBODY_REBUILD` node.
The relation is created directly to the `RIGIDBODY_REBUILD` Operation. I
would have liked to target the containing Component instead. However,
that has the `RIGIDBODY_SIM` operation as entry node, which isn't enough
to actually fix T80121.
Reviewers: Sergey
Differential Revision: https://developer.blender.org/T80121
===================================================================
M source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M source/blender/depsgraph/intern/builder/deg_builder_relations.h
===================================================================
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 14f9db767a9..525f9e304cb 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1252,6 +1252,7 @@ void DepsgraphRelationBuilder::build_animdata(ID *id)
ComponentKey animation_key(id, NodeType::ANIMATION);
ComponentKey parameters_key(id, NodeType::PARAMETERS);
add_relation(animation_key, parameters_key, "Animation -> Parameters");
+ build_animdata_force(id);
}
}
@@ -1396,6 +1397,24 @@ void DepsgraphRelationBuilder::build_animation_images(ID *id)
}
}
+void DepsgraphRelationBuilder::build_animdata_force(ID *id)
+{
+ if (GS(id->name) != ID_OB) {
+ return;
+ }
+
+ const Object *object = (Object *)id;
+ if (object->pd == nullptr || object->pd->forcefield == PFIELD_NULL) {
+ return;
+ }
+
+ /* Updates to animation data (in the UI, for example by altering FCurve Modifier parameters
+ * animating force field strength) may need to rebuild the rigid body world. */
+ ComponentKey animation_key(id, NodeType::ANIMATION);
+ OperationKey rigidbody_key(&scene_->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_REBUILD);
+ add_relation(animation_key, rigidbody_key, "Animation -> Rigid Body");
+}
+
void DepsgraphRelationBuilder::build_action(bAction *action)
{
if (built_map_.checkIsBuiltAndTag(action)) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 39768b9fdb6..7f5e4cafeea 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -241,6 +241,7 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder {
OperationNode *operation_from,
ListBase *strips);
virtual void build_animdata_drivers(ID *id);
+ virtual void build_animdata_force(ID *id);
virtual void build_animation_images(ID *id);
virtual void build_action(bAction *action);
virtual void build_driver(ID *id, FCurve *fcurve);
More information about the Bf-blender-cvs
mailing list