[Bf-blender-cvs] [ca0c6f1] depsgraph_refactor: Depsgraph: Bunch of node relation fixes, some other changes as well

Sergey Sharybin noreply at git.blender.org
Mon Nov 10 16:20:37 CET 2014


Commit: ca0c6f17924c7c2facc316102599074264888f35
Author: Sergey Sharybin
Date:   Mon Nov 10 15:44:37 2014 +0100
Branches: depsgraph_refactor
https://developer.blender.org/rBca0c6f17924c7c2facc316102599074264888f35

Depsgraph: Bunch of node relation fixes, some other changes as well

This commit mainly ensures that relations between operations are more or less
correct (well, they're correct for the tests files i've got here), Namely:

- Added component relation between transform and geometry components.
  This is a temporary workaround just to play around a bit, because it solves
  some missing updates but also introduces unwanted updates.

  For example, such relation solves missing updates of boolean modifier, but
  introduces extra data updates when dragging default cube.

  Think proper way to deal with this would be to make it so in the example above
  boolean modifier adds a relation between modifier node and transform component.

- Added an uber object transform update, which is the last in the transform
  component.

  This way we can have proper object transform update without introducing storage
  of the intermediate matricies for now.

  This is a temporary solution for until we've got proper granularity.

- Made it so firts modifier depends on the object geometry.

- Made it so local constraints depends on local transform operation.

- Seems pose flush should depend on all the pose channels, otherwise what it is
  gonna to flush?

- Fixed target key of constraint targeted to a bone.

This commit also gets rid of few temp hacks, and now the have working Victor rig.

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

M	source/blender/blenkernel/BKE_object.h
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/object_update.c
M	source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
M	source/blender/depsgraph/intern/depsgraph_build_relations.cpp
M	source/blender/depsgraph/intern/depsgraph_type_defines.cpp
M	source/blender/depsgraph/intern/stubs.h
M	source/blender/modifiers/intern/MOD_hook.c

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

diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index e4f1d3c..c7e18e1 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -50,6 +50,7 @@ struct MovieClip;
 struct Main;
 struct RigidBodyWorld;
 struct HookModifierData;
+struct ModifierData;
 
 void BKE_object_workob_clear(struct Object *workob);
 void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
@@ -120,8 +121,7 @@ void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob);
 void BKE_object_where_is_calc_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob, float r_originmat[3][3]);
 void BKE_object_where_is_calc_time(struct Scene *scene, struct Object *ob, float ctime);
 void BKE_object_where_is_calc_time_ex(struct Scene *scene, struct Object *ob, float ctime,
-                                      struct RigidBodyWorld *rbw, float r_originmat[3][3],
-                                      bool do_constraints);
+                                      struct RigidBodyWorld *rbw, float r_originmat[3][3]);
 void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]);
 
 /* possibly belong in own moduke? */
@@ -171,15 +171,27 @@ void BKE_object_tfm_protected_restore(struct Object *ob,
                                       const ObjectTfmProtectedChannels *obtfm,
                                       const short protectflag);
 
+/* Dependency graph evaluation callbacks. */
 void BKE_object_eval_local_transform(struct EvaluationContext *eval_ctx,
                                      struct Scene *scene,
                                      struct Object *ob);
-void BKE_object_constraints_evaluate(struct EvaluationContext *eval_ctx,
-                                     struct Scene *scene,
-                                     struct Object *ob);
-void BKE_object_eval_geometry(struct EvaluationContext *eval_ctx,
+void BKE_object_eval_constraints(struct EvaluationContext *eval_ctx,
+                                 struct Scene *scene,
+                                 struct Object *ob);
+void BKE_object_eval_modifier(struct EvaluationContext *eval_ctx,
                               struct Scene *scene,
-                              struct Object *ob);
+                              struct Object *ob,
+                              struct ModifierData *md);
+void BKE_object_eval_uber_transform(struct EvaluationContext *eval_ctx,
+                                    struct Scene *scene,
+                                    struct Object *ob);
+void BKE_object_eval_uber_data(struct EvaluationContext *eval_ctx,
+                               struct Scene *scene,
+                               struct Object *ob);
+
+void BKE_object_handle_data_update(struct EvaluationContext *eval_ctx,
+                                   struct Scene *scene,
+                                   struct Object *ob);
 void BKE_object_handle_update(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob);
 void BKE_object_handle_update_ex(struct EvaluationContext *eval_ctx,
                                  struct Scene *scene, struct Object *ob,
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 97133ae..627f975 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2417,8 +2417,7 @@ static bool where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat
  * the time being we don't kick old depsgraph out.
  */
 void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
-                                      RigidBodyWorld *rbw, float r_originmat[3][3],
-                                      bool do_constraints)
+                                      RigidBodyWorld *rbw, float r_originmat[3][3])
 {
 	if (ob == NULL) return;
 	
@@ -2450,7 +2449,7 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
 	BKE_rigidbody_sync_transforms(rbw, ob, ctime);
 	
 	/* solve constraints */
-	if (do_constraints && ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) {
+	if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) {
 		bConstraintOb *cob;
 		cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
 		BKE_constraints_solve(&ob->constraints, cob, ctime);
@@ -2464,7 +2463,7 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
 
 void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
 {
-	BKE_object_where_is_calc_time_ex(scene, ob, ctime, NULL, NULL, true);
+	BKE_object_where_is_calc_time_ex(scene, ob, ctime, NULL, NULL);
 }
 
 /* get object transformation matrix without recalculating dependencies and
@@ -2491,11 +2490,11 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4])
 
 void BKE_object_where_is_calc_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3])
 {
-	BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), rbw, r_originmat, true);
+	BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), rbw, r_originmat);
 }
 void BKE_object_where_is_calc(Scene *scene, Object *ob)
 {
-	BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), NULL, NULL, true);
+	BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), NULL, NULL);
 }
 
 /* for calculation of the inverse parent transform, only used for editor */
@@ -3009,7 +3008,7 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx,
 		}
 		
 		if (ob->recalc & OB_RECALC_DATA) {
-			BKE_object_eval_geometry(eval_ctx, scene, ob);
+			BKE_object_handle_data_update(eval_ctx, scene, ob);
 		}
 
 		ob->recalc &= ~OB_RECALC_ALL;
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index 43899f7..708a901 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -61,49 +61,47 @@
 
 #define PRINT if (DEG_get_eval_mode() == DEG_EVAL_MODE_NEW) printf
 
-void BKE_object_eval_local_transform(EvaluationContext *UNUSED(eval_ctx),
+void BKE_object_eval_local_transform(EvaluationContext *eval_ctx,
                                      Scene *scene,
                                      Object *ob)
 {
-	float ctime = BKE_scene_frame_get(scene);
 	PRINT("%s on %s\n", __func__, ob->id.name);
-	BKE_object_where_is_calc_time_ex(scene, ob, ctime, scene->rigidbody_world, NULL, false);
+
+	(void) eval_ctx;  /* Ignored. */
+	(void) scene;  /* Ignored. */
 }
 
-void BKE_object_constraints_evaluate(EvaluationContext *eval_ctx,
-                                     Scene *scene,
-                                     Object *ob)
+void BKE_object_eval_constraints(EvaluationContext *eval_ctx,
+                                 Scene *scene,
+                                 Object *ob)
 {
-	float ctime = BKE_scene_frame_get(scene);
+	PRINT("%s on %s\n", __func__, ob->id.name);
 	(void) eval_ctx;  /* Ignored. */
+	(void) scene;  /* Ignored. */
+	(void) ob;  /* Ignored. */
+}
 
+void BKE_object_eval_modifier(struct EvaluationContext *eval_ctx,
+                              struct Scene *scene,
+                              struct Object *ob,
+                              struct ModifierData *md)
+{
 	PRINT("%s on %s\n", __func__, ob->id.name);
-
-	/* solve constraints */
-	if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) {
-		bConstraintOb *cob;
-		cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
-		BKE_constraints_solve(&ob->constraints, cob, ctime);
-		BKE_constraints_clear_evalob(cob);
-
-		/* TODO(sergey): This is kind of retarded.. */
-		/* set negative scale flag in object */
-		if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE;
-		else ob->transflag &= ~OB_NEG_SCALE;
-	}
+	(void) eval_ctx;  /* Ignored. */
+	(void) scene;  /* Ignored. */
+	(void) ob;  /* Ignored. */
+	(void) md;  /* Ignored. */
 }
 
-void BKE_object_eval_geometry(EvaluationContext *eval_ctx,
-                              Scene *scene,
-                              Object *ob)
+void BKE_object_handle_data_update(EvaluationContext *eval_ctx,
+                                   Scene *scene,
+                                   Object *ob)
 {
 	ID *data_id = (ID *)ob->data;
 	AnimData *adt = BKE_animdata_from_id(data_id);
 	Key *key;
 	float ctime = BKE_scene_frame_get(scene);
 
-	PRINT("%s on %s\n", __func__, ob->id.name);
-
 	if (G.debug & G_DEBUG_DEPSGRAPH)
 		printf("recalcdata %s\n", ob->id.name + 2);
 
@@ -238,3 +236,37 @@ void BKE_object_eval_geometry(EvaluationContext *eval_ctx,
 
 	/* quick cache removed */
 }
+
+void BKE_object_eval_uber_transform(EvaluationContext *eval_ctx,
+                                    Scene *scene,
+                                    Object *ob)
+{
+	(void) eval_ctx;  /* Ignored. */
+	(void) scene;  /* Ignored. */
+	/* TODO(sergey): Currently it's a duplicate of logic in BKE_object_handle_update_ex(). */
+	/* Handle proxy copy for target, */
+	if (ob->id.lib && ob->proxy_from) {
+		if (ob->proxy_from->proxy_group) {
+			/* Transform proxy into group space. */
+			Object *obg = ob->proxy_from->proxy_group;
+			invert_m4_m4(obg->imat, obg->obmat);
+			mul_m4_m4m4(ob->obmat, obg->imat, ob->proxy_from->obmat);
+			/* Should always be true. */
+			if (obg->dup_group) {
+				add_v3_v3(ob->obmat[3], obg->dup_group->dupli_ofs);
+			}
+		}
+		else
+			copy_m4_m4(ob->obmat, ob->proxy_from->obmat);
+	}
+	else
+		BKE_object_where_is_calc_ex(scene, scene->rigidbody_world, ob, NULL);
+}
+
+void BKE_object_eval_uber_data(EvaluationContext *eval_ctx,
+                               Scene *scene,
+                               Object *ob)
+{
+	PRINT("%s on %s\n", __func__, ob->id.name);
+	BKE_object_handle_data_update(eval_ctx, scene, ob);
+}
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index ff0b9b3..79306c8 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list