[Bf-blender-cvs] [cda141c] depsgraph_refactor: Depsgraph: Add depsgraph update function to the hook modifier

Sergey Sharybin noreply at git.blender.org
Fri Nov 7 14:57:04 CET 2014


Commit: cda141c8e528c76ad85a6d99c2d0354071c8be3e
Author: Sergey Sharybin
Date:   Fri Nov 7 14:56:38 2014 +0100
Branches: depsgraph_refactor
https://developer.blender.org/rBcda141c8e528c76ad85a6d99c2d0354071c8be3e

Depsgraph: Add depsgraph update function to the hook modifier

This is mainly to test how this is expected to work and it seems
to be rather straightforward. Now new depsgraph can use hook :)

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

M	source/blender/depsgraph/intern/depsgraph_build_relations.cpp
M	source/blender/modifiers/intern/MOD_hook.c

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index e777423..3f6b7a2 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -925,7 +925,11 @@ void DepsgraphRelationBuilder::build_obdata_geom(Scene *scene, Object *ob)
 				add_relation(prev_mod_key, mod_key, DEPSREL_TYPE_GEOMETRY_EVAL, "Modifier Stack");
 			
 			if (mti->updateDepsgraph) {
-				DepsNodeHandle handle = create_node_handle(mod_key);
+				/* TODO(sergey): Currently we hook the relation to the uberupdate node,
+				 * om the future we'll hook it up to the particular modifier node.
+				 */
+				OperationKey eval_key(&ob->id, DEPSNODE_TYPE_GEOMETRY, "Object Eval");
+				DepsNodeHandle handle = create_node_handle(eval_key);
 				mti->updateDepsgraph(md, scene, ob, &handle);
 			}
 			
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index c144033..ec5652f 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -120,6 +120,19 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 	}
 }
 
+static void updateDepsgraph(ModifierData *md,
+                            struct Scene *UNUSED(scene),
+                            Object *UNUSED(ob),
+                            struct DepsNodeHandle *node)
+{
+	HookModifierData *hmd = (HookModifierData *) md;
+
+	if (hmd->object) {
+		/* TODO(sergey): Different relation type depending on subtarget? */
+		DEG_add_object_relation(node, hmd->object, DEG_OB_COMP_GEOMETRY, "Hook Modifier");
+	}
+}
+
 static float hook_falloff(const float co_1[3], const float co_2[3], const float falloff_squared, float fac)
 {
 	if (falloff_squared) {
@@ -286,7 +299,7 @@ ModifierTypeInfo modifierType_Hook = {
 	/* freeData */          freeData,
 	/* isDisabled */        isDisabled,
 	/* updateDepgraph */    updateDepgraph,
-	/* updateDepsgraph */   NULL,
+	/* updateDepsgraph */   updateDepsgraph,
 	/* dependsOnTime */     NULL,
 	/* dependsOnNormals */	NULL,
 	/* foreachObjectLink */ foreachObjectLink,




More information about the Bf-blender-cvs mailing list