Depsgraph: Fix relation when lamp has driver on custom property

Was once again caused by an ambiguity of the entry/exit operations.

Only did for objects since those are the only one who needs this.
The rest types of IDs needs to be checked and only added extra
operations if needed (adding operations and relations causes some
overhead for evaluation, so need to be careful).
This commit is contained in:
Sergey Sharybin 2019-02-20 11:48:42 +01:00
parent e6bdc950d2
commit c985c60bdc
6 changed files with 43 additions and 4 deletions

View File

@ -602,14 +602,14 @@ void DepsgraphNodeBuilder::build_object(int base_index,
}
/* Object data. */
build_object_data(object, is_visible);
/* Paramaters, used by both drivers/animation and also to inform dependency
* from object's data. */
build_parameters(&object->id);
/* Build animation data,
*
* Do it now because it's possible object data will affect
* on object's level animation, for example in case of rebuilding
* pose for proxy. */
OperationNode *op_node = add_operation_node(
&object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL);
op_node->set_as_exit();
build_animdata(&object->id);
/* Particle systems. */
if (object->particlesystem.first != NULL) {
@ -983,6 +983,23 @@ void DepsgraphNodeBuilder::build_driver_id_property(ID *id,
prop_identifier);
}
void DepsgraphNodeBuilder::build_parameters(ID *id)
{
(void) add_id_node(id);
OperationNode *op_node;
/* Explicit entry. */
op_node = add_operation_node(
id, NodeType::PARAMETERS, OperationCode::PARAMETERS_ENTRY);
op_node->set_as_entry();
/* Generic evaluation node. */
add_operation_node(
id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL);
/* Explicit exit operation. */
op_node = add_operation_node(
id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT);
op_node->set_as_exit();
}
/* Recursively build graph for world */
void DepsgraphNodeBuilder::build_world(World *world)
{

View File

@ -192,6 +192,7 @@ struct DepsgraphNodeBuilder {
void build_driver(ID *id, FCurve *fcurve, int driver_index);
void build_driver_variables(ID *id, FCurve *fcurve);
void build_driver_id_property(ID *id, const char *rna_path);
void build_parameters(ID *id);
void build_ik_pose(Object *object,
bPoseChannel *pchan,
bConstraint *con);

View File

@ -710,6 +710,8 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
OperationCode::SYNCHRONIZE_TO_ORIGINAL);
add_relation(
final_transform_key, synchronize_key, "Synchronize to Original");
/* Parameters. */
build_parameters(&object->id);
}
void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object)
@ -806,8 +808,8 @@ void DepsgraphRelationBuilder::build_object_data_lamp(Object *object)
{
Lamp *lamp = (Lamp *)object->data;
build_lamp(lamp);
ComponentKey object_parameters_key(&object->id, NodeType::PARAMETERS);
ComponentKey lamp_parameters_key(&lamp->id, NodeType::PARAMETERS);
ComponentKey object_parameters_key(&object->id, NodeType::PARAMETERS);
add_relation(lamp_parameters_key, object_parameters_key, "Light -> Object");
}
@ -1625,6 +1627,20 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
}
}
void DepsgraphRelationBuilder::build_parameters(ID *id)
{
OperationKey parameters_entry_key(
id, NodeType::PARAMETERS, OperationCode::PARAMETERS_ENTRY);
OperationKey parameters_eval_key(
id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL);
OperationKey parameters_exit_key(
id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT);
add_relation(
parameters_entry_key, parameters_eval_key, "Entry -> Eval");
add_relation(
parameters_eval_key, parameters_exit_key, "Entry -> Exit");
}
void DepsgraphRelationBuilder::build_world(World *world)
{
if (built_map_.checkIsBuiltAndTag(world)) {

View File

@ -243,6 +243,7 @@ struct DepsgraphRelationBuilder
void build_driver(ID *id, FCurve *fcurve);
void build_driver_data(ID *id, FCurve *fcurve);
void build_driver_variables(ID *id, FCurve *fcurve);
void build_parameters(ID *id);
void build_world(World *world);
void build_rigidbody(Scene *scene);
void build_particle_systems(Object *object);

View File

@ -41,7 +41,9 @@ const char *operationCodeAsString(OperationCode opcode)
/* Generic Operations. */
case OperationCode::OPERATION: return "OPERATION";
case OperationCode::ID_PROPERTY: return "ID_PROPERTY";
case OperationCode::PARAMETERS_ENTRY: return "PARAMETERS_ENTRY";
case OperationCode::PARAMETERS_EVAL: return "PARAMETERS_EVAL";
case OperationCode::PARAMETERS_EXIT: return "PARAMETERS_EXIT";
/* Animation, Drivers, etc. */
case OperationCode::ANIMATION_ENTRY: return "ANIMATION_ENTRY";
case OperationCode::ANIMATION_EVAL: return "ANIMATION_EVAL";

View File

@ -47,7 +47,9 @@ enum class OperationCode {
/* Generic parameters evaluation. */
ID_PROPERTY,
PARAMETERS_ENTRY,
PARAMETERS_EVAL,
PARAMETERS_EXIT,
/* Animation, Drivers, etc. --------------------------------------------- */
/* NLA + Action */