[Bf-blender-cvs] [c334be74924] temp-angavrilov: Depsgraph: connect up drivers on various physics properties.
Alexander Gavrilov
noreply at git.blender.org
Sat Dec 11 16:25:28 CET 2021
Commit: c334be74924dae120d0323d72335cd3367226a6b
Author: Alexander Gavrilov
Date: Sat Jan 9 21:19:37 2021 +0300
Branches: temp-angavrilov
https://developer.blender.org/rBc334be74924dae120d0323d72335cd3367226a6b
Depsgraph: connect up drivers on various physics properties.
It seems drivers for physics properties weren't being linked to
evaluation nodes. This connects settings used by modifiers
to Geometry; particle settings and rigid body data to Transform
which seems to contain rigid body evaluation; and force fields
to object Transform, since fields can exist on empties.
Differential Revision: https://developer.blender.org/D10088
===================================================================
M source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M source/blender/depsgraph/intern/builder/deg_builder_rna.cc
M source/blender/makesrna/RNA_access.h
===================================================================
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index b195b2d9e11..d7744df7ccb 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1872,6 +1872,27 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
}
+ /* Constraints. */
+ if (rbw->constraints != nullptr) {
+ build_collection(nullptr, nullptr, rbw->constraints);
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->constraints, object) {
+ if (object->rigidbody_constraint == nullptr) {
+ continue;
+ }
+ if (object->rigidbody_object != nullptr) {
+ /* Avoid duplicate relations for constraints attached to objects. */
+ continue;
+ }
+
+ /* Simulation uses object transformation after parenting and solving constraints. */
+ OperationKey object_transform_simulation_init_key(
+ &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_SIMULATION_INIT);
+ add_relation(object_transform_simulation_init_key,
+ rb_simulate_key,
+ "Object Transform -> Rigidbody Sim Eval");
+ }
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
+ }
}
void DepsgraphRelationBuilder::build_particle_systems(Object *object)
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
index 40e59875832..1f70ae1f1f6 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
@@ -278,7 +278,16 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
RNA_struct_is_a(ptr->type, &RNA_LatticePoint) ||
RNA_struct_is_a(ptr->type, &RNA_MeshUVLoop) ||
RNA_struct_is_a(ptr->type, &RNA_MeshLoopColor) ||
- RNA_struct_is_a(ptr->type, &RNA_VertexGroupElement)) {
+ RNA_struct_is_a(ptr->type, &RNA_VertexGroupElement) ||
+ ELEM(ptr->type,
+ &RNA_CollisionSettings,
+ &RNA_SoftBodySettings,
+ &RNA_ClothSettings,
+ &RNA_ClothCollisionSettings,
+ &RNA_DynamicPaintSurface,
+ &RNA_DynamicPaintCanvasSettings,
+ &RNA_DynamicPaintBrushSettings) ||
+ (ELEM(ptr->type, &RNA_EffectorWeights) && GS(node_identifier.id->name) == ID_OB)) {
/* When modifier is used as FROM operation this is likely referencing to
* the property (for example, modifier's influence).
* But when it's used as TO operation, this is geometry component. */
@@ -379,6 +388,20 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
node_identifier.type = NodeType::GEOMETRY;
return node_identifier;
}
+ else if (GS(node_identifier.id->name) == ID_PA &&
+ ELEM(ptr->type, &RNA_EffectorWeights, &RNA_FieldSettings, &RNA_ParticleSettings)) {
+ node_identifier.type = NodeType::PARTICLE_SETTINGS;
+ return node_identifier;
+ }
+ else if (ELEM(ptr->type,
+ &RNA_EffectorWeights,
+ &RNA_RigidBodyWorld,
+ &RNA_FieldSettings,
+ &RNA_RigidBodyObject,
+ &RNA_RigidBodyConstraint)) {
+ node_identifier.type = NodeType::TRANSFORM;
+ return node_identifier;
+ }
if (prop != nullptr) {
/* All unknown data effectively falls under "parameter evaluation". */
node_identifier.type = NodeType::PARAMETERS;
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 7fa7405add1..aa8f4188da3 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -519,7 +519,7 @@ extern StructRNA RNA_RenderLayer;
extern StructRNA RNA_RenderPass;
extern StructRNA RNA_RenderResult;
extern StructRNA RNA_RenderSettings;
-extern StructRNA RNA_RigidBodyJointConstraint;
+extern StructRNA RNA_RigidBodyConstraint;
extern StructRNA RNA_RigidBodyObject;
extern StructRNA RNA_RigidBodyWorld;
extern StructRNA RNA_SPHFluidSettings;
More information about the Bf-blender-cvs
mailing list