Depsgraph: Remove modifiers operation code
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 7 Jun 2017 12:08:11 +0000 (14:08 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 7 Jun 2017 12:08:11 +0000 (14:08 +0200)
Was internally a no-op operation, which only caused extra work
to be done during depsgrpah traversal and evaluation, without
making any measurable improvement.

source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/intern/object_update.c
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 b6633ea6198923de8d19203da253178de8588213..2f5d0b3f1b0fec23a60ec61e5c2d26413b5be875 100644 (file)
@@ -189,10 +189,6 @@ void BKE_object_eval_constraints(struct EvaluationContext *eval_ctx,
                                  struct Object *ob);
 void BKE_object_eval_done(struct EvaluationContext *eval_ctx, struct Object *ob);
 
-void BKE_object_eval_modifier(struct EvaluationContext *eval_ctx,
-                              struct Scene *scene,
-                              struct Object *ob,
-                              struct ModifierData *md);
 void BKE_object_eval_uber_transform(struct EvaluationContext *eval_ctx,
                                     struct Scene *scene,
                                     struct Object *ob);
index a531466294e01dd23df8ca457ee3520ef050a9d7..e03af585cf2fe94ee5ac2afa4ebb1ca4b0600714 100644 (file)
@@ -145,18 +145,6 @@ void BKE_object_eval_done(EvaluationContext *UNUSED(eval_ctx), Object *ob)
        else ob->transflag &= ~OB_NEG_SCALE;
 }
 
-void BKE_object_eval_modifier(struct EvaluationContext *eval_ctx,
-                              struct Scene *scene,
-                              struct Object *ob,
-                              struct ModifierData *md)
-{
-       DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
-       (void) eval_ctx;  /* Ignored. */
-       (void) scene;  /* Ignored. */
-       (void) ob;  /* Ignored. */
-       (void) md;  /* Ignored. */
-}
-
 void BKE_object_handle_data_update(EvaluationContext *eval_ctx,
                                    Scene *scene,
                                    Object *ob)
index f0165bdcb8f7ecc84da19db05641973d5074559f..99d8834da1bbd843446b357fcf58946dcd642685 100644 (file)
@@ -768,17 +768,8 @@ void DepsgraphNodeBuilder::build_obdata_geom(Scene *scene, Object *ob)
 
        // TODO: "Done" operation
 
-       /* Modifiers */
+       /* Cloyth modifier. */
        LINKLIST_FOREACH (ModifierData *, md, &ob->modifiers) {
-               add_operation_node(&ob->id,
-                                  DEG_NODE_TYPE_GEOMETRY,
-                                  function_bind(BKE_object_eval_modifier,
-                                                _1,
-                                                scene,
-                                                ob,
-                                                md),
-                                  DEG_OPCODE_GEOMETRY_MODIFIER,
-                                  md->name);
                if (md->type == eModifierType_Cloth) {
                        build_cloth(scene, ob);
                }
index b449a8f9caf89850276311ea0fee0279eee3dd73..72a7d04f627d3e55f4a1f0d20cce9dc6119a0e27 100644 (file)
@@ -995,21 +995,12 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
                }
        }
        else if (GS(id->name) == ID_OB && strstr(rna_path, "modifiers[")) {
-               /* modifier driver - connect directly to the modifier */
-               char *modifier_name = BLI_str_quoted_substrN(rna_path, "modifiers[");
-               if (modifier_name) {
-                       OperationKey modifier_key(id,
-                                                 DEG_NODE_TYPE_GEOMETRY,
-                                                 DEG_OPCODE_GEOMETRY_MODIFIER,
-                                                 modifier_name);
-                       if (has_node(modifier_key)) {
-                               add_relation(driver_key, modifier_key, "[Driver -> Modifier]");
-                       }
-                       else {
-                               printf("Unexisting driver RNA path: %s\n", rna_path);
-                       }
-
-                       MEM_freeN(modifier_name);
+               OperationKey modifier_key(id, DEG_NODE_TYPE_GEOMETRY, DEG_OPCODE_GEOMETRY_UBEREVAL);
+               if (has_node(modifier_key)) {
+                       add_relation(driver_key, modifier_key, "[Driver -> Modifier]");
+               }
+               else {
+                       printf("Unexisting driver RNA path: %s\n", rna_path);
                }
        }
        else if (GS(id->name) == ID_KE && strstr(rna_path, "key_blocks[")) {
@@ -1326,7 +1317,7 @@ void DepsgraphRelationBuilder::build_particles(Scene *scene, Object *ob)
 
 void DepsgraphRelationBuilder::build_cloth(Scene * /*scene*/,
                                            Object *object,
-                                           ModifierData *md)
+                                           ModifierData * /*md*/)
 {
        OperationKey cache_key(&object->id,
                               DEG_NODE_TYPE_CACHE,
@@ -1335,8 +1326,7 @@ void DepsgraphRelationBuilder::build_cloth(Scene * /*scene*/,
        /* Cache component affects on modifier. */
        OperationKey modifier_key(&object->id,
                                  DEG_NODE_TYPE_GEOMETRY,
-                                 DEG_OPCODE_GEOMETRY_MODIFIER,
-                                 md->name);
+                                 DEG_OPCODE_GEOMETRY_UBEREVAL);
        add_relation(cache_key, modifier_key, "Cloth Cache -> Cloth");
 }
 
@@ -1399,24 +1389,16 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje
        add_relation(obdata_geom_key, geom_key, "Object Geometry Base Data");
 
        /* Modifiers */
-       if (ob->modifiers.first) {
-               OperationKey prev_mod_key;
+       if (ob->modifiers.first != NULL) {
+               OperationKey obdata_ubereval_key(&ob->id,
+                                                DEG_NODE_TYPE_GEOMETRY,
+                                                DEG_OPCODE_GEOMETRY_UBEREVAL);
 
                LINKLIST_FOREACH (ModifierData *, md, &ob->modifiers) {
                        const ModifierTypeInfo *mti = modifierType_getInfo((ModifierType)md->type);
-                       OperationKey mod_key(&ob->id, DEG_NODE_TYPE_GEOMETRY, DEG_OPCODE_GEOMETRY_MODIFIER, md->name);
-
-                       if (md->prev) {
-                               /* Stack relation: modifier depends on previous modifier in the stack */
-                               add_relation(prev_mod_key, mod_key, "Modifier Stack");
-                       }
-                       else {
-                               /* Stack relation: first modifier depends on the geometry. */
-                               add_relation(geom_init_key, mod_key, "Modifier Stack");
-                       }
 
                        if (mti->updateDepsgraph) {
-                               DepsNodeHandle handle = create_node_handle(mod_key);
+                               DepsNodeHandle handle = create_node_handle(obdata_ubereval_key);
                                mti->updateDepsgraph(
                                        md,
                                        bmain,
@@ -1427,7 +1409,7 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje
 
                        if (BKE_object_modifier_use_time(ob, md)) {
                                TimeSourceKey time_src_key;
-                               add_relation(time_src_key, mod_key, "Time Source");
+                               add_relation(time_src_key, obdata_ubereval_key, "Time Source");
 
                                /* Hacky fix for T45633 (Animated modifiers aren't updated)
                                 *
@@ -1437,15 +1419,13 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje
                                /* XXX: Remove this hack when these links are added as part of build_animdata() instead */
                                if (modifier_dependsOnTime(md) == false && needs_animdata_node(&ob->id)) {
                                        ComponentKey animation_key(&ob->id, DEG_NODE_TYPE_ANIMATION);
-                                       add_relation(animation_key, mod_key, "Modifier Animation");
+                                       add_relation(animation_key, obdata_ubereval_key, "Modifier Animation");
                                }
                        }
 
                        if (md->type == eModifierType_Cloth) {
                                build_cloth(scene, ob, md);
                        }
-
-                       prev_mod_key = mod_key;
                }
        }
 
@@ -1471,14 +1451,7 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje
        if (ob->type != OB_ARMATURE) {
                /* Armatures does no longer require uber node. */
                OperationKey obdata_ubereval_key(&ob->id, DEG_NODE_TYPE_GEOMETRY, DEG_OPCODE_GEOMETRY_UBEREVAL);
-               if (ob->modifiers.last) {
-                       ModifierData *md = (ModifierData *)ob->modifiers.last;
-                       OperationKey mod_key(&ob->id, DEG_NODE_TYPE_GEOMETRY, DEG_OPCODE_GEOMETRY_MODIFIER, md->name);
-                       add_relation(mod_key, obdata_ubereval_key, "Object Geometry UberEval");
-               }
-               else {
-                       add_relation(geom_init_key, obdata_ubereval_key, "Object Geometry UberEval");
-               }
+               add_relation(geom_init_key, obdata_ubereval_key, "Object Geometry UberEval");
        }
 
        if (obdata->tag & LIB_TAG_DOIT) {
index d688387f862d45c49490d87d8d71d1cef5368485..77454cd85ec3b455cc757a733c794969810b2c4b 100644 (file)
@@ -108,7 +108,6 @@ static const char *stringify_opcode(eDepsOperation_Code opcode)
                STRINGIFY_OPCODE(TRANSFORM_FINAL);
                STRINGIFY_OPCODE(OBJECT_UBEREVAL);
                STRINGIFY_OPCODE(GEOMETRY_UBEREVAL);
-               STRINGIFY_OPCODE(GEOMETRY_MODIFIER);
                STRINGIFY_OPCODE(GEOMETRY_PATH);
                STRINGIFY_OPCODE(POSE_INIT);
                STRINGIFY_OPCODE(POSE_DONE);
index 392ba672e9370f0dc1595b9204535f1d22294525..0d857a8dc52654fe5535618edd5c997cc482a280 100644 (file)
@@ -178,9 +178,6 @@ typedef enum eDepsOperation_Code {
        /* XXX: Placeholder - UberEval */
        DEG_OPCODE_GEOMETRY_UBEREVAL,
 
-       /* Modifier */
-       DEG_OPCODE_GEOMETRY_MODIFIER,
-
        /* Curve Objects - Path Calculation (used for path-following tools, */
        DEG_OPCODE_GEOMETRY_PATH,