Depsgraph: Object data separation, camera
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Jun 2018 08:52:50 +0000 (10:52 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Jun 2018 10:36:51 +0000 (12:36 +0200)
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_nodes.h
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.h

index b1a31ebf4a9a13624c20412922a2ffc8acb4d6d2..32c38f0d1f58ee351ba017d93fb23b7ce2234fc5 100644 (file)
@@ -572,7 +572,7 @@ void DepsgraphNodeBuilder::build_object_data(Object *object)
                        build_object_data_lamp(object);
                        break;
                case OB_CAMERA:
-                       build_camera(object);
+                       build_object_data_camera(object);
                        break;
                case OB_LIGHTPROBE:
                        build_object_data_lightprobe(object);
@@ -588,6 +588,12 @@ void DepsgraphNodeBuilder::build_object_data(Object *object)
        }
 }
 
+void DepsgraphNodeBuilder::build_object_data_camera(Object *object)
+{
+       Camera *camera = (Camera *)object->data;
+       build_camera(camera);
+}
+
 void DepsgraphNodeBuilder::build_object_data_lamp(Object *object)
 {
        Lamp *lamp = (Lamp *)object->data;
@@ -1166,12 +1172,8 @@ void DepsgraphNodeBuilder::build_obdata_geom(Object *object)
                           DEG_OPCODE_GEOMETRY_SELECT_UPDATE);
 }
 
-/* Cameras */
-void DepsgraphNodeBuilder::build_camera(Object *object)
+void DepsgraphNodeBuilder::build_camera(Camera *camera)
 {
-       /* Object data. */
-       /* TODO: Link scene-camera links in somehow... */
-       Camera *camera = (Camera *)object->data;
        if (built_map_.checkIsBuiltAndTag(camera)) {
                return;
        }
index 564d15781f2805c5b81925448ca812b3f89ba9cf..4f19a7a58f8fc0e65a086d1cc6b8c3117510f2af 100644 (file)
@@ -37,6 +37,7 @@
 
 struct Base;
 struct CacheFile;
+struct Camera;
 struct bGPdata;
 struct ListBase;
 struct GHash;
@@ -167,6 +168,7 @@ struct DepsgraphNodeBuilder {
                                Object *object,
                                eDepsNode_LinkedState_Type linked_state);
        void build_object_data(Object *object);
+       void build_object_data_camera(Object *object);
        void build_object_data_lamp(Object *object);
        void build_object_data_lightprobe(Object *object);
        void build_object_transform(Object *object);
@@ -190,7 +192,7 @@ struct DepsgraphNodeBuilder {
        void build_proxy_rig(Object *object);
        void build_shapekeys(Key *key);
        void build_obdata_geom(Object *object);
-       void build_camera(Object *object);
+       void build_camera(Camera *camera);
        void build_lamp(Lamp *lamp);
        void build_nodetree(bNodeTree *ntree);
        void build_material(Material *ma);
index 9d978aff9fb92f13036da7b01efd156d0f354c31..37f1023e134bb6f484fb6fabb52d4194c7c92cd4 100644 (file)
@@ -612,7 +612,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
                        build_object_data_lamp(object);
                        break;
                case OB_CAMERA:
-                       build_camera(object);
+                       build_object_data_camera(object);
                        break;
                case OB_LIGHTPROBE:
                        build_object_data_lightprobe(object);
@@ -627,6 +627,15 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
        }
 }
 
+void DepsgraphRelationBuilder::build_object_data_camera(Object *object)
+{
+       Camera *camera = (Camera *)object->data;
+       build_camera(camera);
+       ComponentKey object_parameters_key(&object->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");
+}
+
 void DepsgraphRelationBuilder::build_object_data_lamp(Object *object)
 {
        Lamp *lamp = (Lamp *)object->data;
@@ -1859,25 +1868,15 @@ void DepsgraphRelationBuilder::build_obdata_geom(Object *object)
        }
 }
 
-/* Cameras */
-// TODO: Link scene-camera links in somehow...
-void DepsgraphRelationBuilder::build_camera(Object *object)
+void DepsgraphRelationBuilder::build_camera(Camera *camera)
 {
-       Camera *camera = (Camera *)object->data;
        if (built_map_.checkIsBuiltAndTag(camera)) {
                return;
        }
-
-       ComponentKey object_parameters_key(&object->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");
-
-       /* DOF */
        if (camera->dof_ob != NULL) {
+               ComponentKey camera_parameters_key(&camera->id, DEG_NODE_TYPE_PARAMETERS);
                ComponentKey dof_ob_key(&camera->dof_ob->id, DEG_NODE_TYPE_TRANSFORM);
-               add_relation(dof_ob_key, object_parameters_key, "Camera DOF");
+               add_relation(dof_ob_key, camera_parameters_key, "Camera DOF");
        }
 }
 
index 5546d6fd32e5e9639d44ce83271cecf3dce0526a..b613b839b967d94fc48656da4dce0b8c20de8c5c 100644 (file)
@@ -51,6 +51,7 @@
 struct Base;
 struct bGPdata;
 struct CacheFile;
+struct Camera;
 struct ListBase;
 struct GHash;
 struct ID;
@@ -203,6 +204,7 @@ struct DepsgraphRelationBuilder
        void build_object(Base *base, Object *object);
        void build_object_flags(Base *base, Object *object);
        void build_object_data(Object *object);
+       void build_object_data_camera(Object *object);
        void build_object_data_lamp(Object *object);
        void build_object_data_lightprobe(Object *object);
        void build_object_parent(Object *object);
@@ -245,7 +247,7 @@ struct DepsgraphRelationBuilder
        void build_proxy_rig(Object *object);
        void build_shapekeys(ID *obdata, Key *key);
        void build_obdata_geom(Object *object);
-       void build_camera(Object *object);
+       void build_camera(Camera *camera);
        void build_lamp(Lamp *lamp);
        void build_nodetree(bNodeTree *ntree);
        void build_material(Material *ma);