Commit: 5a14af62d023e7bf173aca2b6d1022a754306478
Author: Sergey Sharybin
Date:   Wed Jun 6 11:22:20 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB5a14af62d023e7bf173aca2b6d1022a754306478

Depsgraph: Object data separation, geometry

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

M       source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M       source/blender/depsgraph/intern/builder/deg_builder_nodes.h
M       source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M       source/blender/depsgraph/intern/builder/deg_builder_relations.h

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 32c38f0d1f5..02e5c3cdbab 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -549,7 +549,7 @@ void DepsgraphNodeBuilder::build_object_data(Object *object)
                case OB_SURF:
                case OB_MBALL:
                case OB_LATTICE:
-                       build_obdata_geom(object);
+                       build_object_data_geometry(object);
                        /* TODO(sergey): Only for until we support granular
                         * update of curves.
                         */
@@ -999,12 +999,11 @@ void DepsgraphNodeBuilder::build_shapekeys(Key *key)
 
 /* ObData Geometry Evaluation */
 // XXX: what happens if the datablock is shared!
-void DepsgraphNodeBuilder::build_obdata_geom(Object *object)
+void DepsgraphNodeBuilder::build_object_data_geometry(Object *object)
 {
        OperationDepsNode *op_node;
        Scene *scene_cow = get_cow_datablock(scene_);
        Object *object_cow = get_cow_datablock(object);
-
        /* Temporary uber-update node, which does everything.
         * It is for the being we're porting old dependencies into the new 
system.
         * We'll get rid of this node as soon as all the granular update 
functions
@@ -1027,17 +1026,14 @@ void DepsgraphNodeBuilder::build_obdata_geom(Object 
*object)
                                     DEG_OPCODE_PLACEHOLDER,
                                     "Eval Init");
        op_node->set_as_entry();
-
        // TODO: "Done" operation
-
        /* Cloth modifier. */
        LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
                if (md->type == eModifierType_Cloth) {
                        build_cloth(object);
                }
        }
-
-       /* materials */
+       /* Materials. */
        if (object->totcol != 0) {
                if (object->type == OB_MESH) {
                        add_operation_node(&object->id,
@@ -1055,37 +1051,36 @@ void DepsgraphNodeBuilder::build_obdata_geom(Object 
*object)
                        }
                }
        }
-
-       /* geometry collision */
+       /* Geometry collision. */
        if (ELEM(object->type, OB_MESH, OB_CURVE, OB_LATTICE)) {
                // add geometry collider relations
        }
+       build_object_data_geometry_datablock((ID *)object->data);
+}
 
-       ID *obdata = (ID *)object->data;
+void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata)
+{
        if (built_map_.checkIsBuiltAndTag(obdata)) {
                return;
        }
+       OperationDepsNode *op_node;
        /* Make sure we've got an ID node before requesting CoW pointer. */
        (void) add_id_node((ID *)obdata);
        ID *obdata_cow = get_cow_id(obdata);
-
+       /* Animation. */
+       build_animdata(obdata);
        /* ShapeKeys */
-       Key *key = BKE_key_from_object(object);
+       Key *key = BKE_key_from_id(obdata);
        if (key) {
                build_shapekeys(key);
        }
-
-       build_animdata(obdata);
-
        /* Nodes for result of obdata's evaluation, and geometry
         * evaluation on object.
         */
-       switch (object->type) {
-               case OB_MESH:
+       const ID_Type id_type = GS(obdata->name);
+       switch (id_type) {
+               case ID_ME:
                {
-                       //Mesh *me = (Mesh *)object->data;
-
-                       /* evaluation operations */
                        op_node = add_operation_node(obdata,
                                                     DEG_NODE_TYPE_GEOMETRY,
                                                     
function_bind(BKE_mesh_eval_geometry,
@@ -1096,8 +1091,7 @@ void DepsgraphNodeBuilder::build_obdata_geom(Object 
*object)
                        op_node->set_as_entry();
                        break;
                }
-
-               case OB_MBALL:
+               case ID_MB:
                {
                        op_node = add_operation_node(obdata,
                                                     DEG_NODE_TYPE_GEOMETRY,
@@ -1107,13 +1101,8 @@ void DepsgraphNodeBuilder::build_obdata_geom(Object 
*object)
                        op_node->set_as_entry();
                        break;
                }
-
-               case OB_CURVE:
-               case OB_SURF:
-               case OB_FONT:
+               case ID_CU:
                {
-                       /* Curve/nurms evaluation operations. */
-                       /* - calculate curve geometry (including path) */
                        op_node = add_operation_node(obdata,
                                                     DEG_NODE_TYPE_GEOMETRY,
                                                     
function_bind(BKE_curve_eval_geometry,
@@ -1132,15 +1121,13 @@ void DepsgraphNodeBuilder::build_obdata_geom(Object 
*object)
                        if (cu->taperobj != NULL) {
                                build_object(-1, cu->taperobj, 
DEG_ID_LINKED_INDIRECTLY);
                        }
-                       if (object->type == OB_FONT && cu->textoncurve != NULL) 
{
+                       if (cu->textoncurve != NULL) {
                                build_object(-1, cu->textoncurve, 
DEG_ID_LINKED_INDIRECTLY);
                        }
                        break;
                }
-
-               case OB_LATTICE:
+               case ID_LT:
                {
-                       /* Lattice evaluation operations. */
                        op_node = add_operation_node(obdata,
                                                     DEG_NODE_TYPE_GEOMETRY,
                                                     
function_bind(BKE_lattice_eval_geometry,
@@ -1151,18 +1138,18 @@ void DepsgraphNodeBuilder::build_obdata_geom(Object 
*object)
                        op_node->set_as_entry();
                        break;
                }
+               default:
+                       BLI_assert(!"Should not happen");
+                       break;
        }
-
        op_node = add_operation_node(obdata, DEG_NODE_TYPE_GEOMETRY, NULL,
                                     DEG_OPCODE_PLACEHOLDER, "Eval Done");
        op_node->set_as_exit();
-
        /* Parameters for driver sources. */
        add_operation_node(obdata,
                           DEG_NODE_TYPE_PARAMETERS,
                           NULL,
                           DEG_OPCODE_PARAMETERS_EVAL);
-
        /* Batch cache. */
        add_operation_node(obdata,
                           DEG_NODE_TYPE_BATCH_CACHE,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index 4f19a7a58f8..b265ed09f1e 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -169,6 +169,8 @@ struct DepsgraphNodeBuilder {
                                eDepsNode_LinkedState_Type linked_state);
        void build_object_data(Object *object);
        void build_object_data_camera(Object *object);
+       void build_object_data_geometry(Object *object);
+       void build_object_data_geometry_datablock(ID *obdata);
        void build_object_data_lamp(Object *object);
        void build_object_data_lightprobe(Object *object);
        void build_object_transform(Object *object);
@@ -191,7 +193,6 @@ struct DepsgraphNodeBuilder {
        void build_rig(Object *object);
        void build_proxy_rig(Object *object);
        void build_shapekeys(Key *key);
-       void build_obdata_geom(Object *object);
        void build_camera(Camera *camera);
        void build_lamp(Lamp *lamp);
        void build_nodetree(bNodeTree *ntree);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 37f1023e134..830d811c4c1 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -161,6 +161,9 @@ static bool particle_system_depends_on_time(ParticleSystem 
*psys)
 
 static bool object_particles_depends_on_time(Object *object)
 {
+       if (object->type != OB_MESH) {
+               return false;
+       }
        LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
                if (particle_system_depends_on_time(psys)) {
                        return true;
@@ -597,7 +600,7 @@ void DepsgraphRelationBuilder::build_object_data(Object 
*object)
                case OB_MBALL:
                case OB_LATTICE:
                {
-                       build_obdata_geom(object);
+                       build_object_data_geometry(object);
                        break;
                }
                case OB_ARMATURE:
@@ -1671,42 +1674,42 @@ void DepsgraphRelationBuilder::build_shapekeys(ID 
*obdata, Key *key)
  * ==========================
  *
  * The evaluation of geometry on objects is as follows:
- * - The actual evaluated of the derived geometry (e.g. DerivedMesh, DispList, 
etc.)
- *   occurs in the Geometry component of the object which references this. 
This includes
- *   modifiers, and the temporary "ubereval" for geometry.
- * - Therefore, each user of a piece of shared geometry data ends up 
evaluating its own
- *   version of the stuff, complete with whatever modifiers it may use.
+ * - The actual evaluated of the derived geometry (e.g. DerivedMesh, DispList)
+ *   occurs in the Geometry component of the object which references this.
+ *   This includes modifiers, and the temporary "ubereval" for geometry.
+ *   Therefore, each user of a piece of shared geometry data ends up evaluating
+ *   its own version of the stuff, complete with whatever modifiers it may use.
  *
- * - The datablocks for the geometry data - "obdata" (e.g. ID_ME, ID_CU, 
ID_LT, etc.) are used for
+ * - The datablocks for the geometry data - "obdata" (e.g. ID_ME, ID_CU, 
ID_LT.)
+ *   are used for
  *     1) calculating the bounding boxes of the geometry data,
- *     2) aggregating inward links from other objects (e.g. for text on curve, 
etc.)
+ *     2) aggregating inward links from other objects (e.g. for text on curve)
  *        and also for the links coming from the shapekey datablocks
- * - Animation/Drivers affecting the parameters of the geometry are made to 
trigger
- *   updates on the obdata geometry component, which then trigger downstream
- *   re-evaluation of the individual instances of this geometry.
+ * - Animation/Drivers affecting the parameters of the geometry are made to
+ *   trigger updates on the obdata geometry component, which then trigger
+ *   downstream re-evaluation of the individual instances of this geometry.
  */
-// TODO: Materials and lighting should probably get their own component, 
instead of being lumped under geometry?
-void DepsgraphRelationBuilder::build_obdata_geom(Object *object)
+void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
 {
        ID *obdata = (ID *)object->data;
-
        /* Init operation of object-level geometry evaluation. */
-       OperationKey geom_init_key(&object->id, DEG_NODE_TYPE_GEOMETRY, 
DEG_OPCODE_PLACEHOLDER, "Eval Init");
-
-       /* get nodes for result of obdata's evaluation, and geometry evaluation 
on object */
+       OperationKey geom_init_key(&object->id,
+                                  DEG_NODE_TYPE_GEOMETRY,
+                                                          
DEG_OPCODE_PLACEHOLDER,
+                                                          "Eval Init");
+       /* Get nodes for result of obdata's evaluation, and geometry evaluation
+        * on object.
+        */
        ComponentKey obdata_geom_key(obdata, DEG_NODE_TYPE_GEOMETRY);
        ComponentKey geom_key(&object->id, DEG_NODE_TYPE_GEOMETRY);
-
-       /* link components to each other */
+       /* Link components to each other. */
        add_relation(obdata_geom_key, geom_key, "Object Geometry Base Data");
-
        OperationKey obdata_ubereval_key(&object->id,
                                    

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to