Commit: df045206021bdd448482f9d022f73029d28f7fc3
Author: Sergey Sharybin
Date:   Thu Feb 22 12:54:06 2018 +0100
Branches: master
https://developer.blender.org/rBdf045206021bdd448482f9d022f73029d28f7fc3

Depsgraph: Wrap all arguments foe modifiers relations update into a struct

Makes it easier to add or remove fields needed to update relations.

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

M       source/blender/blenkernel/BKE_modifier.h
M       source/blender/blenkernel/intern/depsgraph.c
M       source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M       source/blender/modifiers/intern/MOD_armature.c
M       source/blender/modifiers/intern/MOD_array.c
M       source/blender/modifiers/intern/MOD_boolean.c
M       source/blender/modifiers/intern/MOD_cast.c
M       source/blender/modifiers/intern/MOD_cloth.c
M       source/blender/modifiers/intern/MOD_curve.c
M       source/blender/modifiers/intern/MOD_datatransfer.c
M       source/blender/modifiers/intern/MOD_displace.c
M       source/blender/modifiers/intern/MOD_dynamicpaint.c
M       source/blender/modifiers/intern/MOD_fluidsim.c
M       source/blender/modifiers/intern/MOD_hook.c
M       source/blender/modifiers/intern/MOD_lattice.c
M       source/blender/modifiers/intern/MOD_mask.c
M       source/blender/modifiers/intern/MOD_meshdeform.c
M       source/blender/modifiers/intern/MOD_meshsequencecache.c
M       source/blender/modifiers/intern/MOD_mirror.c
M       source/blender/modifiers/intern/MOD_normal_edit.c
M       source/blender/modifiers/intern/MOD_particleinstance.c
M       source/blender/modifiers/intern/MOD_screw.c
M       source/blender/modifiers/intern/MOD_shrinkwrap.c
M       source/blender/modifiers/intern/MOD_simpledeform.c
M       source/blender/modifiers/intern/MOD_smoke.c
M       source/blender/modifiers/intern/MOD_softbody.c
M       source/blender/modifiers/intern/MOD_surfacedeform.c
M       source/blender/modifiers/intern/MOD_uvproject.c
M       source/blender/modifiers/intern/MOD_uvwarp.c
M       source/blender/modifiers/intern/MOD_warp.c
M       source/blender/modifiers/intern/MOD_wave.c
M       source/blender/modifiers/intern/MOD_weightvgedit.c
M       source/blender/modifiers/intern/MOD_weightvgmix.c
M       source/blender/modifiers/intern/MOD_weightvgproximity.c

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

diff --git a/source/blender/blenkernel/BKE_modifier.h 
b/source/blender/blenkernel/BKE_modifier.h
index 30c47a4b192..c4dc4998e35 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -127,6 +127,19 @@ typedef enum ModifierApplyFlag {
 } ModifierApplyFlag;
 
 
+typedef struct ModifierUpdateDepsgraphContext {
+       struct Main *bmain;
+       struct Scene *scene;
+       struct Object *object;
+
+       /* Old depsgraph node handle. */
+       struct DagForest *forest;
+       struct DagNode *obNode;
+
+       /* new depsgraph node handle. */
+       struct DepsNodeHandle *node;
+} ModifierUpdateDepsgraphContext;
+
 typedef struct ModifierTypeInfo {
        /* The user visible name for this modifier */
        char name[32];
@@ -265,9 +278,8 @@ typedef struct ModifierTypeInfo {
         *
         * This function is optional.
         */
-       void (*updateDepgraph)(struct ModifierData *md, struct DagForest 
*forest,
-                              struct Main *bmain, struct Scene *scene,
-                              struct Object *ob, struct DagNode *obNode);
+       void (*updateDepgraph)(struct ModifierData *md,
+                              const ModifierUpdateDepsgraphContext* ctx);
 
        /* Add the appropriate relations to the dependency graph.
         *
@@ -275,10 +287,7 @@ typedef struct ModifierTypeInfo {
         */
        /* TODO(sergey): Remove once we finally switched to the new depsgraph. 
*/
        void (*updateDepsgraph)(struct ModifierData *md,
-                               struct Main *bmain,
-                               struct Scene *scene,
-                               struct Object *ob,
-                               struct DepsNodeHandle *node);
+                               const ModifierUpdateDepsgraphContext* ctx);
 
        /* Should return true if the modifier needs to be recalculated on time
         * changes.
diff --git a/source/blender/blenkernel/intern/depsgraph.c 
b/source/blender/blenkernel/intern/depsgraph.c
index 0fb9c4408d6..99e4a3ab9da 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -645,11 +645,18 @@ static void build_dag_object(DagForest *dag, DagNode 
*scenenode, Main *bmain, Sc
 
        if (ob->modifiers.first) {
                ModifierData *md;
-               
+               ModifierUpdateDepsgraphContext ctx = {
+                       .bmain = bmain,
+                       .scene = scene,
+                       .object = ob,
+
+                       .forest = dag,
+                       .obNode = node,
+               };
                for (md = ob->modifiers.first; md; md = md->next) {
                        const ModifierTypeInfo *mti = 
modifierType_getInfo(md->type);
                        
-                       if (mti->updateDepgraph) mti->updateDepgraph(md, dag, 
bmain, scene, ob, node);
+                       if (mti->updateDepgraph) mti->updateDepgraph(md, &ctx);
                }
        }
        if (ob->parent) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index c47006a7895..abb1e3674a7 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1539,17 +1539,17 @@ void DepsgraphRelationBuilder::build_obdata_geom(Object 
*object)
                OperationKey obdata_ubereval_key(&object->id,
                                                 DEG_NODE_TYPE_GEOMETRY,
                                                 DEG_OPCODE_GEOMETRY_UBEREVAL);
+               ModifierUpdateDepsgraphContext ctx = {};
+               ctx.bmain = bmain_;
+               ctx.scene = scene_;
+               ctx.object = object;
 
                LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
                        const ModifierTypeInfo *mti = 
modifierType_getInfo((ModifierType)md->type);
                        if (mti->updateDepsgraph) {
                                DepsNodeHandle handle = 
create_node_handle(obdata_ubereval_key);
-                               mti->updateDepsgraph(
-                                       md,
-                                       bmain_,
-                                       scene_,
-                                       object,
-                                       reinterpret_cast< ::DepsNodeHandle* 
>(&handle));
+                               ctx.node = reinterpret_cast< ::DepsNodeHandle* 
>(&handle);
+                               mti->updateDepsgraph(md, &ctx);
                        }
                        if (BKE_object_modifier_use_time(object, md)) {
                                TimeSourceKey time_src_key;
diff --git a/source/blender/modifiers/intern/MOD_armature.c 
b/source/blender/modifiers/intern/MOD_armature.c
index f2f76f13883..22ec13cd0a0 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -99,32 +99,24 @@ static void foreachObjectLink(
        walk(userData, ob, &amd->object, IDWALK_CB_NOP);
 }
 
-static void updateDepgraph(ModifierData *md, DagForest *forest,
-                           struct Main *UNUSED(bmain),
-                           struct Scene *UNUSED(scene),
-                           Object *UNUSED(ob),
-                           DagNode *obNode)
+static void updateDepgraph(ModifierData *md, const 
ModifierUpdateDepsgraphContext *ctx)
 {
        ArmatureModifierData *amd = (ArmatureModifierData *) md;
 
        if (amd->object) {
-               DagNode *curNode = dag_get_node(forest, amd->object);
+               DagNode *curNode = dag_get_node(ctx->forest, amd->object);
 
-               dag_add_relation(forest, curNode, obNode,
+               dag_add_relation(ctx->forest, curNode, ctx->obNode,
                                 DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Armature 
Modifier");
        }
 }
 
-static void updateDepsgraph(ModifierData *md,
-                            struct Main *UNUSED(bmain),
-                            struct Scene *UNUSED(scene),
-                            Object *UNUSED(ob),
-                            struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const 
ModifierUpdateDepsgraphContext *ctx)
 {
        ArmatureModifierData *amd = (ArmatureModifierData *)md;
        if (amd->object != NULL) {
-               DEG_add_object_relation(node, amd->object, 
DEG_OB_COMP_EVAL_POSE, "Armature Modifier");
-               DEG_add_object_relation(node, amd->object, 
DEG_OB_COMP_TRANSFORM, "Armature Modifier");
+               DEG_add_object_relation(ctx->node, amd->object, 
DEG_OB_COMP_EVAL_POSE, "Armature Modifier");
+               DEG_add_object_relation(ctx->node, amd->object, 
DEG_OB_COMP_TRANSFORM, "Armature Modifier");
        }
 }
 
diff --git a/source/blender/modifiers/intern/MOD_array.c 
b/source/blender/modifiers/intern/MOD_array.c
index 8eda1653956..053957d89e2 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -102,60 +102,53 @@ static void foreachObjectLink(
        walk(userData, ob, &amd->offset_ob, IDWALK_CB_NOP);
 }
 
-static void updateDepgraph(ModifierData *md, DagForest *forest,
-                           struct Main *UNUSED(bmain),
-                           struct Scene *UNUSED(scene),
-                           Object *UNUSED(ob), DagNode *obNode)
+static void updateDepgraph(ModifierData *md, const 
ModifierUpdateDepsgraphContext *ctx)
 {
        ArrayModifierData *amd = (ArrayModifierData *) md;
 
        if (amd->start_cap) {
-               DagNode *curNode = dag_get_node(forest, amd->start_cap);
+               DagNode *curNode = dag_get_node(ctx->forest, amd->start_cap);
 
-               dag_add_relation(forest, curNode, obNode,
+               dag_add_relation(ctx->forest, curNode, ctx->obNode,
                                 DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array 
Modifier");
        }
        if (amd->end_cap) {
-               DagNode *curNode = dag_get_node(forest, amd->end_cap);
+               DagNode *curNode = dag_get_node(ctx->forest, amd->end_cap);
 
-               dag_add_relation(forest, curNode, obNode,
+               dag_add_relation(ctx->forest, curNode, ctx->obNode,
                                 DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array 
Modifier");
        }
        if (amd->curve_ob) {
-               DagNode *curNode = dag_get_node(forest, amd->curve_ob);
+               DagNode *curNode = dag_get_node(ctx->forest, amd->curve_ob);
                curNode->eval_flags |= DAG_EVAL_NEED_CURVE_PATH;
 
-               dag_add_relation(forest, curNode, obNode,
+               dag_add_relation(ctx->forest, curNode, ctx->obNode,
                                 DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array 
Modifier");
        }
        if (amd->offset_ob) {
-               DagNode *curNode = dag_get_node(forest, amd->offset_ob);
+               DagNode *curNode = dag_get_node(ctx->forest, amd->offset_ob);
 
-               dag_add_relation(forest, curNode, obNode,
+               dag_add_relation(ctx->forest, curNode, ctx->obNode,
                                 DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Array 
Modifier");
        }
 }
 
-static void updateDepsgraph(ModifierData *md,
-                            struct Main *UNUSED(bmain),
-                            struct Scene *UNUSED(scene),
-                            Object *UNUSED(ob),
-                            struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const 
ModifierUpdateDepsgraphContext *ctx)
 {
        ArrayModifierData *amd = (ArrayModifierData *)md;
        if (amd->start_cap != NULL) {
-               DEG_add_object_relation(node, amd->start_cap, 
DEG_OB_COMP_TRANSFORM, "Array Modifier Start Cap");
+               DEG_add_object_relation(ctx->node, amd->start_cap, 
DEG_OB_COMP_TRANSFORM, "Array Modifier Start Cap");
        }
        if (amd->end_cap != NULL) {
-               DEG_add_object_relation(node, amd->end_cap, 
DEG_OB_COMP_TRANSFORM, "Array Modifier End Cap");
+               DEG_add_object_relation(ctx->node, amd->end_cap, 
DEG_OB_COMP_TRANSFORM, "Array Modifier End Cap");
        }
        if (amd->curve_ob) {
-               struct Depsgraph *depsgraph = DEG_get_graph_from_handle(node);
-               DEG_add_object_relation(node, amd->curve_ob, 
DEG_OB_COMP_GEOMETRY, "Array Modifier Curve");
+               struct Depsgraph *depsgraph = 
DEG_get_graph_from_handle(ctx->node);
+               DEG_add_object_relation(ctx->node, amd->curve_ob, 
DEG_OB_COMP_GEOMETRY, "Array Modifier Curve");
                DEG_add_special_eval_flag(depsgraph, &amd->curve_ob->id, 
DAG_EVAL_NEED_CURVE_PATH);
        }
        if (amd->offset_ob != NULL) {
-               DEG_add_object_relation(node, amd->offset_ob, 
DEG_OB_COMP_TRANSFORM, "Array Modifier Offset");
+               DEG_add_object_relation(ctx->node, amd->offset_ob, 
DEG_OB_COMP_TRANSFORM, "Array Modifier Offset");
        }
 }
 
diff --git a/source/blender/modifiers/intern/MOD_boolean.c 
b/source/blender/modifiers/intern/MOD_boolean.c
index 2a6bf108f25..93c4d83870a 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -97,35 +97,27 @@ static void foreachObjectLink(
        walk(userData, ob, &bmd->object, IDWALK_CB_NOP);
 }
 
-static void updateDepgraph(ModifierData *md, DagForest *forest,
-                           struct Main *UNUSED(bmain),
-                           struct Scene *UNUSED(scene),
-                           Object *UNUSED(ob),
-                           DagNode *obNode)
+static void updateDepgraph(ModifierData *md, const ModifierUpda

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to