Fix T52705: Lamps shadows are not refreshed when tweaking lamps parameters
Lamp and camera datablocks updates should flush some updates to corresponding objects. Currently it's done as Parameters -> Parameters relations.
This commit is contained in:
@@ -1043,7 +1043,15 @@ void DepsgraphNodeBuilder::build_obdata_geom(Scene *scene, Object *ob)
|
|||||||
/* Cameras */
|
/* Cameras */
|
||||||
void DepsgraphNodeBuilder::build_camera(Object *ob)
|
void DepsgraphNodeBuilder::build_camera(Object *ob)
|
||||||
{
|
{
|
||||||
/* TODO: Link scene-camera links in somehow... */
|
/* Object itself. */
|
||||||
|
add_operation_node(&ob->id,
|
||||||
|
DEG_NODE_TYPE_PARAMETERS,
|
||||||
|
NULL,
|
||||||
|
DEG_OPCODE_PARAMETERS_EVAL,
|
||||||
|
"Camera Parameters");
|
||||||
|
|
||||||
|
/* Object data. */
|
||||||
|
/* TODO: Link scene-camera links in somehow. */
|
||||||
Camera *cam = (Camera *)ob->data;
|
Camera *cam = (Camera *)ob->data;
|
||||||
ID *camera_id = &cam->id;
|
ID *camera_id = &cam->id;
|
||||||
if (camera_id->tag & LIB_TAG_DOIT) {
|
if (camera_id->tag & LIB_TAG_DOIT) {
|
||||||
@@ -1056,17 +1064,19 @@ void DepsgraphNodeBuilder::build_camera(Object *ob)
|
|||||||
DEG_NODE_TYPE_PARAMETERS,
|
DEG_NODE_TYPE_PARAMETERS,
|
||||||
NULL,
|
NULL,
|
||||||
DEG_OPCODE_PARAMETERS_EVAL);
|
DEG_OPCODE_PARAMETERS_EVAL);
|
||||||
|
|
||||||
if (cam->dof_ob != NULL) {
|
|
||||||
/* TODO(sergey): For now parametrs are on object level. */
|
|
||||||
add_operation_node(&ob->id, DEG_NODE_TYPE_PARAMETERS, NULL,
|
|
||||||
DEG_OPCODE_PLACEHOLDER, "Camera DOF");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lamps */
|
/* Lamps */
|
||||||
void DepsgraphNodeBuilder::build_lamp(Object *ob)
|
void DepsgraphNodeBuilder::build_lamp(Object *ob)
|
||||||
{
|
{
|
||||||
|
/* Object itself. */
|
||||||
|
add_operation_node(&ob->id,
|
||||||
|
DEG_NODE_TYPE_PARAMETERS,
|
||||||
|
NULL,
|
||||||
|
DEG_OPCODE_PARAMETERS_EVAL,
|
||||||
|
"Lamp Parameters");
|
||||||
|
|
||||||
|
/* Object data. */
|
||||||
Lamp *la = (Lamp *)ob->data;
|
Lamp *la = (Lamp *)ob->data;
|
||||||
ID *lamp_id = &la->id;
|
ID *lamp_id = &la->id;
|
||||||
if (lamp_id->tag & LIB_TAG_DOIT) {
|
if (lamp_id->tag & LIB_TAG_DOIT) {
|
||||||
@@ -1076,9 +1086,6 @@ void DepsgraphNodeBuilder::build_lamp(Object *ob)
|
|||||||
build_animdata(&la->id);
|
build_animdata(&la->id);
|
||||||
|
|
||||||
/* node for obdata */
|
/* node for obdata */
|
||||||
add_component_node(lamp_id, DEG_NODE_TYPE_PARAMETERS);
|
|
||||||
|
|
||||||
/* TODO(sergey): Is it really how we're supposed to work with drivers? */
|
|
||||||
add_operation_node(lamp_id,
|
add_operation_node(lamp_id,
|
||||||
DEG_NODE_TYPE_PARAMETERS,
|
DEG_NODE_TYPE_PARAMETERS,
|
||||||
NULL,
|
NULL,
|
||||||
|
|||||||
@@ -1749,18 +1749,21 @@ void DepsgraphRelationBuilder::build_camera(Object *ob)
|
|||||||
}
|
}
|
||||||
camera_id->tag |= LIB_TAG_DOIT;
|
camera_id->tag |= LIB_TAG_DOIT;
|
||||||
|
|
||||||
ComponentKey parameters_key(camera_id, DEG_NODE_TYPE_PARAMETERS);
|
ComponentKey object_parameters_key(&ob->id, DEG_NODE_TYPE_PARAMETERS);
|
||||||
|
ComponentKey camera_parameters_key(camera_id, DEG_NODE_TYPE_PARAMETERS);
|
||||||
|
|
||||||
|
add_relation(camera_parameters_key, object_parameters_key,
|
||||||
|
"Camera -> Object");
|
||||||
|
|
||||||
if (needs_animdata_node(camera_id)) {
|
if (needs_animdata_node(camera_id)) {
|
||||||
ComponentKey animation_key(camera_id, DEG_NODE_TYPE_ANIMATION);
|
ComponentKey animation_key(camera_id, DEG_NODE_TYPE_ANIMATION);
|
||||||
add_relation(animation_key, parameters_key, "Camera Parameters");
|
add_relation(animation_key, camera_parameters_key, "Camera Parameters");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DOF */
|
/* DOF */
|
||||||
if (cam->dof_ob) {
|
if (cam->dof_ob != NULL) {
|
||||||
ComponentKey ob_param_key(&ob->id, DEG_NODE_TYPE_PARAMETERS);
|
|
||||||
ComponentKey dof_ob_key(&cam->dof_ob->id, DEG_NODE_TYPE_TRANSFORM);
|
ComponentKey dof_ob_key(&cam->dof_ob->id, DEG_NODE_TYPE_TRANSFORM);
|
||||||
add_relation(dof_ob_key, ob_param_key, "Camera DOF");
|
add_relation(dof_ob_key, object_parameters_key, "Camera DOF");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1774,18 +1777,22 @@ void DepsgraphRelationBuilder::build_lamp(Object *ob)
|
|||||||
}
|
}
|
||||||
lamp_id->tag |= LIB_TAG_DOIT;
|
lamp_id->tag |= LIB_TAG_DOIT;
|
||||||
|
|
||||||
ComponentKey parameters_key(lamp_id, DEG_NODE_TYPE_PARAMETERS);
|
ComponentKey object_parameters_key(&ob->id, DEG_NODE_TYPE_PARAMETERS);
|
||||||
|
ComponentKey lamp_parameters_key(lamp_id, DEG_NODE_TYPE_PARAMETERS);
|
||||||
|
|
||||||
|
add_relation(lamp_parameters_key, object_parameters_key,
|
||||||
|
"Lamp -> Object");
|
||||||
|
|
||||||
if (needs_animdata_node(lamp_id)) {
|
if (needs_animdata_node(lamp_id)) {
|
||||||
ComponentKey animation_key(lamp_id, DEG_NODE_TYPE_ANIMATION);
|
ComponentKey animation_key(lamp_id, DEG_NODE_TYPE_ANIMATION);
|
||||||
add_relation(animation_key, parameters_key, "Lamp Parameters");
|
add_relation(animation_key, lamp_parameters_key, "Lamp Parameters");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lamp's nodetree */
|
/* lamp's nodetree */
|
||||||
if (la->nodetree) {
|
if (la->nodetree) {
|
||||||
build_nodetree(la->nodetree);
|
build_nodetree(la->nodetree);
|
||||||
ComponentKey nodetree_key(&la->nodetree->id, DEG_NODE_TYPE_SHADING);
|
ComponentKey nodetree_key(&la->nodetree->id, DEG_NODE_TYPE_SHADING);
|
||||||
add_relation(nodetree_key, parameters_key, "NTree->Lamp Parameters");
|
add_relation(nodetree_key, lamp_parameters_key, "NTree->Lamp Parameters");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* textures */
|
/* textures */
|
||||||
@@ -1801,9 +1808,7 @@ void DepsgraphRelationBuilder::build_lamp(Object *ob)
|
|||||||
OperationKey lamp_copy_on_write_key(lamp_id,
|
OperationKey lamp_copy_on_write_key(lamp_id,
|
||||||
DEG_NODE_TYPE_COPY_ON_WRITE,
|
DEG_NODE_TYPE_COPY_ON_WRITE,
|
||||||
DEG_OPCODE_COPY_ON_WRITE);
|
DEG_OPCODE_COPY_ON_WRITE);
|
||||||
add_relation(lamp_copy_on_write_key,
|
add_relation(lamp_copy_on_write_key, ob_copy_on_write_key, "Eval Order");
|
||||||
ob_copy_on_write_key,
|
|
||||||
"Evaluation Order");
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user