Commit: 89de2ec1ada1a9e05ff284ee681f04368f7e18ab
Author: Sergey Sharybin
Date:   Mon Mar 16 15:10:40 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB89de2ec1ada1a9e05ff284ee681f04368f7e18ab

Depsgraph: Fix add parameters component to camera datablock

Fixes drivers using camera properties as an input.

TODO: Add CACamera -> OBCamera relation.

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

M       source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
M       source/blender/depsgraph/intern/depsgraph_build_relations.cpp

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp 
b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 6e7d6f3..2ce285e 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -867,6 +867,13 @@ void DepsgraphNodeBuilder::build_camera(Object *ob)
 {
        /* TODO: Link scene-camera links in somehow... */
        Camera *cam = (Camera *)ob->data;
+       ID *camera_id = &cam->id;
+       if (camera_id->flag & LIB_DOIT) {
+               return;
+       }
+
+       add_operation_node(camera_id, DEPSNODE_TYPE_PARAMETERS, 
DEPSOP_TYPE_EXEC, NULL,
+                          DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
 
        if (cam->dof_ob != NULL) {
                /* TODO(sergey): For now parametrs are on object level. */
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp 
b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index 3c02dfb..f80ca87 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -1557,12 +1557,25 @@ void DepsgraphRelationBuilder::build_obdata_geom(Scene 
*scene, Object *ob)
 void DepsgraphRelationBuilder::build_camera(Object *ob)
 {
        Camera *cam = (Camera *)ob->data;
-       ComponentKey param_key(&ob->id, DEPSNODE_TYPE_PARAMETERS);
+       ID *camera_id = &cam->id;
+       if (camera_id->flag & LIB_DOIT) {
+               return;
+       }
+       camera_id->flag |= LIB_DOIT;
+
+       ComponentKey parameters_key(camera_id, DEPSNODE_TYPE_PARAMETERS);
+
+       if (BKE_animdata_from_id(camera_id) != NULL) {
+               ComponentKey animation_key(camera_id, DEPSNODE_TYPE_ANIMATION);
+               add_relation(animation_key, parameters_key,
+                            DEPSREL_TYPE_COMPONENT_ORDER, "Camera Parameters");
+       }
 
        /* DOF */
        if (cam->dof_ob) {
+               ComponentKey ob_param_key(&ob->id, DEPSNODE_TYPE_PARAMETERS);
                ComponentKey dof_ob_key(&cam->dof_ob->id, 
DEPSNODE_TYPE_TRANSFORM);
-               add_relation(dof_ob_key, param_key, DEPSREL_TYPE_TRANSFORM, 
"Camera DOF");
+               add_relation(dof_ob_key, ob_param_key, DEPSREL_TYPE_TRANSFORM, 
"Camera DOF");
        }
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to