Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
| Show First 20 Lines • Show All 1,692 Lines • ▼ Show 20 Lines | void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) | ||||
| } | } | ||||
| /* Objects. */ | /* Objects. */ | ||||
| if (rbw->group != nullptr) { | if (rbw->group != nullptr) { | ||||
| build_collection(nullptr, nullptr, rbw->group); | build_collection(nullptr, nullptr, rbw->group); | ||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->group, object) { | FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->group, object) { | ||||
| if (object->type != OB_MESH) { | if (object->type != OB_MESH) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (object->rigidbody_object == nullptr) { | |||||
| continue; | |||||
| } | |||||
| if (object->rigidbody_object->type == RBO_TYPE_PASSIVE) { | |||||
| continue; | |||||
| } | |||||
| OperationKey rb_transform_copy_key( | OperationKey rb_transform_copy_key( | ||||
| &object->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY); | &object->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY); | ||||
| /* Rigid body synchronization depends on the actual simulation. */ | /* Rigid body synchronization depends on the actual simulation. */ | ||||
| add_relation(rb_simulate_key, rb_transform_copy_key, "Rigidbody Sim Eval -> RBO Sync"); | add_relation(rb_simulate_key, rb_transform_copy_key, "Rigidbody Sim Eval -> RBO Sync"); | ||||
| /* Simulation uses object transformation after parenting and solving constraints. */ | /* Simulation uses object transformation after parenting and solving constraints. */ | ||||
| OperationKey object_transform_simulation_init_key( | OperationKey object_transform_simulation_init_key( | ||||
| &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_SIMULATION_INIT); | &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_SIMULATION_INIT); | ||||
| OperationKey object_transform_eval_key( | OperationKey object_transform_eval_key( | ||||
| Show All 33 Lines | FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->constraints, object) { | ||||
| } | } | ||||
| /* Make sure indirectly linked objects are fully built. */ | /* Make sure indirectly linked objects are fully built. */ | ||||
| build_object(object); | build_object(object); | ||||
| build_object(rbc->ob1); | build_object(rbc->ob1); | ||||
| build_object(rbc->ob2); | build_object(rbc->ob2); | ||||
| /* final result of the constraint object's transform controls how | /* final result of the constraint object's transform controls how | ||||
| * the constraint affects the physics sim for these objects. */ | * the constraint affects the physics sim for these objects. */ | ||||
| ComponentKey trans_key(&object->id, NodeType::TRANSFORM); | ComponentKey trans_key(&object->id, NodeType::TRANSFORM); | ||||
| if (rbc->ob1->rigidbody_object->type == RBO_TYPE_ACTIVE) { | |||||
| OperationKey ob1_key( | OperationKey ob1_key( | ||||
| &rbc->ob1->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY); | &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( | OperationKey ob2_key( | ||||
| &rbc->ob2->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY); | &rbc->ob2->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_TRANSFORM_COPY); | ||||
| /* Constrained-objects sync depends on the constraint-holder. */ | /* 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"); | add_relation(trans_key, ob2_key, "RigidBodyConstraint -> RBC.Object_2"); | ||||
| } | |||||
| /* Ensure that sim depends on this constraint's transform. */ | /* Ensure that sim depends on this constraint's transform. */ | ||||
| add_relation(trans_key, rb_simulate_key, "RigidBodyConstraint Transform -> RB Simulation"); | add_relation(trans_key, rb_simulate_key, "RigidBodyConstraint Transform -> RB Simulation"); | ||||
| } | } | ||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_END; | FOREACH_COLLECTION_OBJECT_RECURSIVE_END; | ||||
| } | } | ||||
| } | } | ||||
| void DepsgraphRelationBuilder::build_particle_systems(Object *object) | void DepsgraphRelationBuilder::build_particle_systems(Object *object) | ||||
| ▲ Show 20 Lines • Show All 1,156 Lines • Show Last 20 Lines | |||||