[Bf-blender-cvs] [8dc2fbd7b66] master: Fix T79117: dependency cycle with passive rigid body objects

Jacques Lucke noreply at git.blender.org
Thu Jul 30 18:26:04 CEST 2020


Commit: 8dc2fbd7b666b6cf0477627249f1a2b6a4924e9e
Author: Jacques Lucke
Date:   Thu Jul 30 18:22:29 2020 +0200
Branches: master
https://developer.blender.org/rB8dc2fbd7b666b6cf0477627249f1a2b6a4924e9e

Fix T79117: dependency cycle with passive rigid body objects

Reviewers: zeddb

Differential Revision: D8431

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

M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 57bc673a521..390e996b63f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -1126,6 +1126,12 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene)
       if (object->type != OB_MESH) {
         continue;
       }
+      if (object->rigidbody_object == nullptr) {
+        continue;
+      }
+      if (object->rigidbody_object->type == RBO_TYPE_PASSIVE) {
+        continue;
+      }
       /* Create operation for flushing results. */
       /* Object's transform component - where the rigidbody operation
        * lives. */
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index d0e8246caa9..8932d875776 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1698,6 +1698,12 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
       if (object->type != OB_MESH) {
         continue;
       }
+      if (object->rigidbody_object == nullptr) {
+        continue;
+      }
+      if (object->rigidbody_object->type == RBO_TYPE_PASSIVE) {
+        continue;
+      }
       OperationKey rb_transform_copy_key(
           &object->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY);
       /* Rigid body synchronization depends on the actual simulation. */
@@ -1747,13 +1753,18 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
       /* final result of the constraint object's transform controls how
        * the constraint affects the physics sim for these objects. */
       ComponentKey trans_key(&object->id, NodeType::TRANSFORM);
-      OperationKey ob1_key(
-          &rbc->ob1->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY);
-      OperationKey ob2_key(
-          &rbc->ob2->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY);
-      /* Constrained-objects sync depends on the constraint-holder. */
-      add_relation(trans_key, ob1_key, "RigidBodyConstraint -> RBC.Object_1");
-      add_relation(trans_key, ob2_key, "RigidBodyConstraint -> RBC.Object_2");
+      if (rbc->ob1->rigidbody_object->type == RBO_TYPE_ACTIVE) {
+        OperationKey ob1_key(
+            &rbc->ob1->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY);
+        /* Constrained-objects sync depends on the constraint-holder. */
+        add_relation(trans_key, ob1_key, "RigidBodyConstraint -> RBC.Object_1");
+      }
+      if (rbc->ob2->rigidbody_object->type == RBO_TYPE_ACTIVE) {
+        OperationKey ob2_key(
+            &rbc->ob2->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY);
+        /* Constrained-objects sync depends on the constraint-holder. */
+        add_relation(trans_key, ob2_key, "RigidBodyConstraint -> RBC.Object_2");
+      }
       /* Ensure that sim depends on this constraint's transform. */
       add_relation(trans_key, rb_simulate_key, "RigidBodyConstraint Transform -> RB Simulation");
     }



More information about the Bf-blender-cvs mailing list