Depsgraph: Make operation codes more obvious
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Oct 2017 08:58:33 +0000 (10:58 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Oct 2017 09:25:10 +0000 (11:25 +0200)
This synchronizes al lrelated changes from blender2.8 branch.

source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/depsgraph/intern/depsgraph_type_defines.cc
source/blender/depsgraph/intern/depsgraph_types.h

index 17f0c030bd0b1cc16f65e0ab667a4903063a62aa..744898896d9381505a81efcffb375b9701ff2c27 100644 (file)
@@ -465,7 +465,7 @@ void DepsgraphNodeBuilder::build_object_transform(Scene *scene, Object *ob)
         */
        add_operation_node(&ob->id, DEG_NODE_TYPE_TRANSFORM,
                           function_bind(BKE_object_eval_uber_transform, _1, scene, ob),
-                          DEG_OPCODE_OBJECT_UBEREVAL);
+                          DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL);
 
        /* object transform is done */
        op_node = add_operation_node(&ob->id, DEG_NODE_TYPE_TRANSFORM,
@@ -649,7 +649,7 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene)
                        /* object's transform component - where the rigidbody operation lives */
                        add_operation_node(&ob->id, DEG_NODE_TYPE_TRANSFORM,
                                           function_bind(BKE_rigidbody_object_sync_transforms, _1, scene, ob),
-                                          DEG_OPCODE_TRANSFORM_RIGIDBODY);
+                                          DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY);
                }
        }
 }
@@ -680,7 +680,7 @@ void DepsgraphNodeBuilder::build_particles(Scene *scene, Object *ob)
                                         _1,
                                         scene,
                                         ob),
-                          DEG_OPCODE_PSYS_EVAL_INIT);
+                          DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT);
 
        /* particle systems */
        LINKLIST_FOREACH (ParticleSystem *, psys, &ob->particlesystem) {
@@ -694,7 +694,7 @@ void DepsgraphNodeBuilder::build_particles(Scene *scene, Object *ob)
                // TODO: for now, this will just be a placeholder "ubereval" node
                add_operation_node(psys_comp,
                                   NULL,
-                                  DEG_OPCODE_PSYS_EVAL,
+                                  DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
                                   psys->name);
        }
 
index d42c404769111294ad735700d572f529ea68f71c..02fb9b65a630df413158cef34bb171ed42de513d 100644 (file)
@@ -342,7 +342,7 @@ void DepsgraphRelationBuilder::add_forcefield_relations(const OperationKey &key,
                                        add_relation(mod_key, key, name);
                                }
                                else if (eff->psys != psys) {
-                                       OperationKey eff_key(&eff->ob->id, DEG_NODE_TYPE_EVAL_PARTICLES, DEG_OPCODE_PSYS_EVAL, eff->psys->name);
+                                       OperationKey eff_key(&eff->ob->id, DEG_NODE_TYPE_EVAL_PARTICLES, DEG_OPCODE_PARTICLE_SYSTEM_EVAL, eff->psys->name);
                                        add_relation(eff_key, key, name);
                                }
                        }
@@ -422,7 +422,7 @@ void DepsgraphRelationBuilder::build_object(Main *bmain, Scene *scene, Object *o
        OperationKey parent_transform_key(&ob->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_PARENT);
        OperationKey final_transform_key(&ob->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_FINAL);
 
-       OperationKey ob_ubereval_key(&ob->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_OBJECT_UBEREVAL);
+       OperationKey ob_ubereval_key(&ob->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL);
 
        /* parenting */
        if (ob->parent != NULL) {
@@ -1262,7 +1262,7 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
                         *    XXX: there's probably a difference between passive and active
                         *         - passive don't change, so may need to know full transform...
                         */
-                       OperationKey rbo_key(&ob->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_RIGIDBODY);
+                       OperationKey rbo_key(&ob->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY);
 
                        eDepsOperation_Code trans_opcode = ob->parent ? DEG_OPCODE_TRANSFORM_PARENT : DEG_OPCODE_TRANSFORM_LOCAL;
                        OperationKey trans_op(&ob->id, DEG_NODE_TYPE_TRANSFORM, trans_opcode);
@@ -1291,7 +1291,7 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
                                 */
                                OperationKey uber_key(&ob->id,
                                                      DEG_NODE_TYPE_TRANSFORM,
-                                                     DEG_OPCODE_OBJECT_UBEREVAL);
+                                                     DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL);
                                add_relation(rbo_key, uber_key, "RBO Sync -> Uber (Temp)");
                        }
 
@@ -1314,8 +1314,8 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
                         * constraint affects the physics sim for these objects
                         */
                        ComponentKey trans_key(&ob->id, DEG_NODE_TYPE_TRANSFORM);
-                       OperationKey ob1_key(&rbc->ob1->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_RIGIDBODY);
-                       OperationKey ob2_key(&rbc->ob2->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_RIGIDBODY);
+                       OperationKey ob1_key(&rbc->ob1->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY);
+                       OperationKey ob2_key(&rbc->ob2->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY);
 
                        /* - constrained-objects sync depends on the constraint-holder */
                        add_relation(trans_key, ob1_key, "RigidBodyConstraint -> RBC.Object_1");
@@ -1335,7 +1335,7 @@ void DepsgraphRelationBuilder::build_particles(Scene *scene, Object *ob)
                                         DEG_OPCODE_GEOMETRY_UBEREVAL);
        OperationKey eval_init_key(&ob->id,
                                   DEG_NODE_TYPE_EVAL_PARTICLES,
-                                  DEG_OPCODE_PSYS_EVAL_INIT);
+                                  DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT);
        /* TODO(sergey): Are all particle systems depends on time?
         * Hair without dynamics i.e.
         */
@@ -1349,7 +1349,7 @@ void DepsgraphRelationBuilder::build_particles(Scene *scene, Object *ob)
                build_animdata(&part->id);
 
                /* this particle system */
-               OperationKey psys_key(&ob->id, DEG_NODE_TYPE_EVAL_PARTICLES, DEG_OPCODE_PSYS_EVAL, psys->name);
+               OperationKey psys_key(&ob->id, DEG_NODE_TYPE_EVAL_PARTICLES, DEG_OPCODE_PARTICLE_SYSTEM_EVAL, psys->name);
 
                /* XXX: if particle system is later re-enabled, we must do full rebuild? */
                if (!psys_check_enabled(ob, psys, G.is_rendering))
index e177c8c8ec06d871f0c55689e87f577b81fc7ab0..18074652f2dfeb890e97db99bf44540461bc00d1 100644 (file)
@@ -66,7 +66,9 @@ static GHash *_depsnode_typeinfo_registry = NULL;
 void deg_register_node_typeinfo(DepsNodeFactory *factory)
 {
        BLI_assert(factory != NULL);
-       BLI_ghash_insert(_depsnode_typeinfo_registry, SET_INT_IN_POINTER(factory->type()), factory);
+       BLI_ghash_insert(_depsnode_typeinfo_registry,
+                        SET_INT_IN_POINTER(factory->type()),
+                        factory);
 }
 
 /* Getters ------------------------------------------------- */
@@ -75,7 +77,8 @@ void deg_register_node_typeinfo(DepsNodeFactory *factory)
 DepsNodeFactory *deg_get_node_factory(const eDepsNode_Type type)
 {
        /* look up type - at worst, it doesn't exist in table yet, and we fail */
-       return (DepsNodeFactory *)BLI_ghash_lookup(_depsnode_typeinfo_registry, SET_INT_IN_POINTER(type));
+       return (DepsNodeFactory *)BLI_ghash_lookup(_depsnode_typeinfo_registry,
+                                                  SET_INT_IN_POINTER(type));
 }
 
 /* Get typeinfo for provided node */
@@ -95,33 +98,45 @@ static const char *stringify_opcode(eDepsOperation_Code opcode)
 {
        switch (opcode) {
 #define STRINGIFY_OPCODE(name) case DEG_OPCODE_##name: return #name
+               /* Generic Operations. */
                STRINGIFY_OPCODE(OPERATION);
+               STRINGIFY_OPCODE(PARAMETERS_EVAL);
                STRINGIFY_OPCODE(PLACEHOLDER);
+               /* Animation, Drivers, etc. */
                STRINGIFY_OPCODE(ANIMATION);
                STRINGIFY_OPCODE(DRIVER);
+               /* Transform. */
                STRINGIFY_OPCODE(TRANSFORM_LOCAL);
                STRINGIFY_OPCODE(TRANSFORM_PARENT);
                STRINGIFY_OPCODE(TRANSFORM_CONSTRAINTS);
+               STRINGIFY_OPCODE(TRANSFORM_FINAL);
+               STRINGIFY_OPCODE(TRANSFORM_OBJECT_UBEREVAL);
+               /* Rigid body. */
                STRINGIFY_OPCODE(RIGIDBODY_REBUILD);
                STRINGIFY_OPCODE(RIGIDBODY_SIM);
-               STRINGIFY_OPCODE(TRANSFORM_RIGIDBODY);
-               STRINGIFY_OPCODE(TRANSFORM_FINAL);
-               STRINGIFY_OPCODE(OBJECT_UBEREVAL);
+               STRINGIFY_OPCODE(RIGIDBODY_TRANSFORM_COPY);
+               /* Geometry. */
                STRINGIFY_OPCODE(GEOMETRY_UBEREVAL);
+               /* Pose. */
                STRINGIFY_OPCODE(POSE_INIT);
                STRINGIFY_OPCODE(POSE_INIT_IK);
                STRINGIFY_OPCODE(POSE_DONE);
                STRINGIFY_OPCODE(POSE_IK_SOLVER);
                STRINGIFY_OPCODE(POSE_SPLINE_IK_SOLVER);
+               /* Bone. */
                STRINGIFY_OPCODE(BONE_LOCAL);
                STRINGIFY_OPCODE(BONE_POSE_PARENT);
                STRINGIFY_OPCODE(BONE_CONSTRAINTS);
                STRINGIFY_OPCODE(BONE_READY);
                STRINGIFY_OPCODE(BONE_DONE);
-               STRINGIFY_OPCODE(PSYS_EVAL);
-               STRINGIFY_OPCODE(PSYS_EVAL_INIT);
+               /* Particles. */
+               STRINGIFY_OPCODE(PARTICLE_SYSTEM_EVAL_INIT);
+               STRINGIFY_OPCODE(PARTICLE_SYSTEM_EVAL);
+               /* Masks. */
                STRINGIFY_OPCODE(MASK_ANIMATION);
                STRINGIFY_OPCODE(MASK_EVAL);
+               /* Shading. */
+               STRINGIFY_OPCODE(SHADING);
 
                case DEG_NUM_OPCODES: return "SpecialCase";
 #undef STRINGIFY_OPCODE
index ef7b32a8d8338321a3b1fe027dbcf8a6a6423a44..c6a44902a86a825a3b457855b0fd88de810adf24 100644 (file)
@@ -103,10 +103,7 @@ typedef enum eDepsNode_Type {
        DEG_NODE_TYPE_PARAMETERS,
        /* Generic "Proxy-Inherit" Component. */
        DEG_NODE_TYPE_PROXY,
-       /* Animation Component
-        *
-        * XXX: merge in with parameters?
-        */
+       /* Animation Component */
        DEG_NODE_TYPE_ANIMATION,
        /* Transform Component (Parenting/Constraints) */
        DEG_NODE_TYPE_TRANSFORM,
@@ -131,77 +128,64 @@ typedef enum eDepsNode_Type {
 
 /* Identifiers for common operations (as an enum). */
 typedef enum eDepsOperation_Code {
-       /* Generic Operations ------------------------------ */
+       /* Generic Operations. ------------------------------ */
 
        /* Placeholder for operations which don't need special mention */
        DEG_OPCODE_OPERATION = 0,
 
+       /* Generic parameters evaluation. */
+       DEG_OPCODE_PARAMETERS_EVAL,
+
        // XXX: Placeholder while porting depsgraph code
        DEG_OPCODE_PLACEHOLDER,
 
        /* Animation, Drivers, etc. ------------------------ */
-
        /* NLA + Action */
        DEG_OPCODE_ANIMATION,
-
        /* Driver */
        DEG_OPCODE_DRIVER,
 
-       /* Transform --------------------------------------- */
-
+       /* Transform. -------------------------------------- */
        /* Transform entry point - local transforms only */
        DEG_OPCODE_TRANSFORM_LOCAL,
-
        /* Parenting */
        DEG_OPCODE_TRANSFORM_PARENT,
-
        /* Constraints */
        DEG_OPCODE_TRANSFORM_CONSTRAINTS,
+       /* Transform exit point */
+       DEG_OPCODE_TRANSFORM_FINAL,
+       /* Handle object-level updates, mainly proxies hacks and recalc flags.  */
+       DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL,
 
-       /* Rigidbody Sim - Perform Sim */
+       /* Rigid body. -------------------------------------- */
+       /* Perform Simulation */
        DEG_OPCODE_RIGIDBODY_REBUILD,
        DEG_OPCODE_RIGIDBODY_SIM,
+       /* Copy results to object */
+       DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY,
 
-       /* Rigidbody Sim - Copy Results to Object */
-       DEG_OPCODE_TRANSFORM_RIGIDBODY,
-
-       /* Transform exitpoint */
-       DEG_OPCODE_TRANSFORM_FINAL,
-
-       /* XXX: ubereval is for temporary porting purposes only */
-       DEG_OPCODE_OBJECT_UBEREVAL,
-
-       /* Geometry ---------------------------------------- */
-
-       /* XXX: Placeholder - UberEval */
+       /* Geometry. ---------------------------------------- */
+       /* Evaluate the whole geometry, including modifiers. */
        DEG_OPCODE_GEOMETRY_UBEREVAL,
 
-       /* Pose -------------------------------------------- */
-
+       /* Pose. -------------------------------------------- */
        /* Init pose, clear flags, etc. */
        DEG_OPCODE_POSE_INIT,
-
        /* Initialize IK solver related pose stuff. */
        DEG_OPCODE_POSE_INIT_IK,
-
        /* Free IK Trees + Compute Deform Matrices */
        DEG_OPCODE_POSE_DONE,
-
        /* IK/Spline Solvers */
        DEG_OPCODE_POSE_IK_SOLVER,
        DEG_OPCODE_POSE_SPLINE_IK_SOLVER,
 
-       /* Bone -------------------------------------------- */
-
-       /* Bone local transforms - Entrypoint */
+       /* Bone. -------------------------------------------- */
+       /* Bone local transforms - entry point */
        DEG_OPCODE_BONE_LOCAL,
-
        /* Pose-space conversion (includes parent + restpose, */
        DEG_OPCODE_BONE_POSE_PARENT,
-
        /* Constraints */
        DEG_OPCODE_BONE_CONSTRAINTS,
-
        /* Bone transforms are ready
         *
         * - "READY"  This (internal, noop is used to signal that all pre-IK
@@ -216,11 +200,13 @@ typedef enum eDepsOperation_Code {
        DEG_OPCODE_BONE_READY,
        DEG_OPCODE_BONE_DONE,
 
-       /* Particles --------------------------------------- */
+       /* Particles. --------------------------------------- */
+       /* Particle System evaluation. */
+       DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT,
+       DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
 
-       /* XXX: placeholder - Particle System eval */
-       DEG_OPCODE_PSYS_EVAL_INIT,
-       DEG_OPCODE_PSYS_EVAL,
+       /* Shading. ------------------------------------------- */
+       DEG_OPCODE_SHADING,
 
        /* Masks ------------------------------------------- */
        DEG_OPCODE_MASK_ANIMATION,