Fix T62768: Softbody cache still not updated correctly
There was missing flush from transform update to the point cache reset. Caused by the fact that when update happens in the "middle" of component all the component operations will be tagged for update (since the intermediate state is not stored), but that will not flush updates to other operations since that would cause too much of updates. This now we tag point cache for reset after evaluation operation but before final transform and before rigid body world.
This commit is contained in:
@@ -778,6 +778,11 @@ void DepsgraphNodeBuilder::build_object_transform(Object *object)
|
||||
function_bind(BKE_object_eval_uber_transform,
|
||||
_1,
|
||||
ob_cow));
|
||||
/* Operation to take of rigid body simulation. soft bodies and other firends
|
||||
* in the context of point cache invalidation. */
|
||||
add_operation_node(&object->id,
|
||||
NodeType::TRANSFORM,
|
||||
OperationCode::TRANSFORM_SIMULATION_INIT);
|
||||
/* Object transform is done. */
|
||||
op_node = add_operation_node(&object->id, NodeType::TRANSFORM,
|
||||
OperationCode::TRANSFORM_FINAL,
|
||||
@@ -1072,9 +1077,6 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene)
|
||||
if (object->type != OB_MESH) {
|
||||
continue;
|
||||
}
|
||||
add_operation_node(&object->id,
|
||||
NodeType::TRANSFORM,
|
||||
OperationCode::TRANSFORM_SIMULATION_INIT);
|
||||
/* Create operation for flushing results. */
|
||||
/* Object's transform component - where the rigidbody operation
|
||||
* lives. */
|
||||
|
||||
@@ -636,6 +636,10 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
|
||||
BKE_constraints_id_loop(&object->constraints, constraint_walk, &data);
|
||||
}
|
||||
/* Object constraints. */
|
||||
OperationKey object_transform_simulation_init_key(
|
||||
&object->id,
|
||||
NodeType::TRANSFORM,
|
||||
OperationCode::TRANSFORM_SIMULATION_INIT);
|
||||
if (object->constraints.first != NULL) {
|
||||
OperationKey constraint_key(&object->id,
|
||||
NodeType::TRANSFORM,
|
||||
@@ -649,12 +653,22 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
|
||||
/* operation order */
|
||||
add_relation(base_op_key, constraint_key, "ObBase-> Constraint Stack");
|
||||
add_relation(constraint_key, final_transform_key, "ObConstraints -> Done");
|
||||
add_relation(constraint_key, ob_eval_key, "Eval");
|
||||
add_relation(ob_eval_key, final_transform_key, "Eval");
|
||||
add_relation(constraint_key, ob_eval_key, "Constraint -> Transform Eval");
|
||||
add_relation(ob_eval_key,
|
||||
object_transform_simulation_init_key,
|
||||
"Transform Eval -> Simulation Init");
|
||||
add_relation(object_transform_simulation_init_key,
|
||||
final_transform_key,
|
||||
"Simulation -> Final Transform");
|
||||
}
|
||||
else {
|
||||
add_relation(base_op_key, ob_eval_key, "Eval");
|
||||
add_relation(ob_eval_key, final_transform_key, "Eval");
|
||||
add_relation(ob_eval_key,
|
||||
object_transform_simulation_init_key,
|
||||
"Transform Eval -> Simulation Init");
|
||||
add_relation(object_transform_simulation_init_key,
|
||||
final_transform_key,
|
||||
"Simulation -> Final Transform");
|
||||
}
|
||||
/* Animation data */
|
||||
build_animdata(&object->id);
|
||||
@@ -959,15 +973,16 @@ void DepsgraphRelationBuilder::build_object_pointcache(Object *object)
|
||||
}
|
||||
/* Manual edits to any dependency (or self) should reset the point cache. */
|
||||
if (!BLI_listbase_is_empty(&ptcache_id_list)) {
|
||||
OperationKey transform_init_key(&object->id,
|
||||
NodeType::TRANSFORM,
|
||||
OperationCode::TRANSFORM_INIT);
|
||||
OperationKey transform_simulation_init_key(
|
||||
&object->id,
|
||||
NodeType::TRANSFORM,
|
||||
OperationCode::TRANSFORM_SIMULATION_INIT);
|
||||
OperationKey geometry_init_key(&object->id,
|
||||
NodeType::GEOMETRY,
|
||||
OperationCode::GEOMETRY_EVAL_INIT);
|
||||
add_relation(transform_init_key,
|
||||
add_relation(transform_simulation_init_key,
|
||||
point_cache_key,
|
||||
"Transform Local -> Point Cache",
|
||||
"Transform Simulation -> Point Cache",
|
||||
RELATION_FLAG_FLUSH_USER_EDIT_ONLY);
|
||||
add_relation(geometry_init_key,
|
||||
point_cache_key,
|
||||
@@ -1740,10 +1755,6 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
|
||||
&object->id,
|
||||
NodeType::TRANSFORM,
|
||||
OperationCode::TRANSFORM_EVAL);
|
||||
|
||||
add_relation(object_transform_eval_key,
|
||||
object_transform_simulation_init_key,
|
||||
"Object Transform -> Simulation Init");
|
||||
add_relation(object_transform_simulation_init_key,
|
||||
rb_simulate_key,
|
||||
"Object Transform -> Rigidbody Sim Eval");
|
||||
|
||||
Reference in New Issue
Block a user