[Bf-blender-cvs] [eec84cb] depsgraph_refactor: Depsgraph: Get rid of pose rebuild node

Sergey Sharybin noreply at git.blender.org
Mon Dec 8 11:25:32 CET 2014


Commit: eec84cb69c8b03eb6a9d73607ef1312796b1bfc6
Author: Sergey Sharybin
Date:   Mon Dec 8 13:38:47 2014 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rBeec84cb69c8b03eb6a9d73607ef1312796b1bfc6

Depsgraph: Get rid of pose rebuild node

This way we request pose to be valid at the time of depsgraph build
and evaluation. Otherwise there's no clear way to pass individual
pose channels to the update callbacks.

Pose is going to be missing mainly on exit from edit more and file
load and seems this two cases are handled correct. At least assert
failure doesn't happen for me.

There would be some issues with linked koro which i've been fixing
in the master branch, this is to be investigated still.

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

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/depsgraph_types.h
M	source/blender/depsgraph/intern/stubs.h

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 54ae0c4..7e490f5 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -541,7 +541,11 @@ void DepsgraphNodeBuilder::build_splineik_pose(Scene *scene, Object *ob, bPoseCh
 void DepsgraphNodeBuilder::build_rig(Scene *scene, Object *ob)
 {
 	bArmature *arm = (bArmature *)ob->data;
-	
+
+	/* We demand having proper pose. */
+	BLI_assert(ob->pose != NULL);
+	BLI_assert((ob->pose->flag & POSE_RECALC) == 0);
+
 	// TODO: bone names?
 	/* animation and/or drivers linking posebones to base-armature used to define them 
 	 * NOTE: AnimData here is really used to control animated deform properties, 
@@ -573,9 +577,6 @@ void DepsgraphNodeBuilder::build_rig(Scene *scene, Object *ob)
 	
 	/* pose eval context */
 	add_operation_node(&ob->id, DEPSNODE_TYPE_EVAL_POSE,
-	                   DEPSOP_TYPE_REBUILD, bind(BKE_pose_rebuild_op, _1, ob, ob->pose), deg_op_name_pose_rebuild);
-	
-	add_operation_node(&ob->id, DEPSNODE_TYPE_EVAL_POSE,
 	                   DEPSOP_TYPE_INIT, bind(BKE_pose_eval_init, _1, scene, ob, ob->pose), deg_op_name_pose_eval_init);
 	
 	add_operation_node(&ob->id, DEPSNODE_TYPE_EVAL_POSE,
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index e674efc..9371645 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -954,11 +954,9 @@ void DepsgraphRelationBuilder::build_rig(Scene *scene, Object *ob)
 	build_animdata(&arm->id);
 	
 	/* attach links between base operations */
-	OperationKey rebuild_key(&ob->id, DEPSNODE_TYPE_EVAL_POSE, deg_op_name_pose_rebuild);
 	OperationKey init_key(&ob->id, DEPSNODE_TYPE_EVAL_POSE, deg_op_name_pose_eval_init);
 	OperationKey flush_key(&ob->id, DEPSNODE_TYPE_EVAL_POSE, deg_op_name_pose_eval_flush);
 	
-	add_relation(rebuild_key, init_key, DEPSREL_TYPE_OPERATION, "[Pose Rebuild -> Pose Init] DepsRel");
 	add_relation(init_key, flush_key, DEPSREL_TYPE_OPERATION, "[Pose Init -> Pose Cleanup] DepsRel");
 
 	if (ob->adt != NULL) {
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cpp b/source/blender/depsgraph/intern/depsgraph_type_defines.cpp
index c0a9eb1..35cb174 100644
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cpp
@@ -124,16 +124,6 @@ void BKE_animsys_eval_driver(EvaluationContext *UNUSED(eval_ctx),
 	}
 }
 
-void BKE_pose_rebuild_op(EvaluationContext *eval_ctx, Object *ob, bPose *pose)
-{
-	bArmature *arm = (bArmature *)ob->data;
-	printf("%s on %s\n", __func__, ob->id.name);
-	BLI_assert(ob->type == OB_ARMATURE);
-	if ((ob->pose == NULL) || (ob->pose->flag & POSE_RECALC)) {
-		BKE_pose_rebuild(ob, arm);
-	}
-}
-
 void BKE_pose_eval_init(EvaluationContext *eval_ctx,
                         Scene *scene,
                         Object *ob,
@@ -142,6 +132,11 @@ void BKE_pose_eval_init(EvaluationContext *eval_ctx,
 	printf("%s on %s\n", __func__, ob->id.name);
 	BLI_assert(ob->type == OB_ARMATURE);
 	float ctime = BKE_scene_frame_get(scene); /* not accurate... */
+
+	/* We demand having proper pose. */
+	BLI_assert(ob->pose != NULL);
+	BLI_assert((ob->pose->flag & POSE_RECALC) == 0);
+
 	/* 1. clear flags */
 	for (bPoseChannel *pchan = (bPoseChannel *)ob->pose->chanbase.first;
 	     pchan != NULL;
@@ -274,7 +269,6 @@ const string deg_op_name_constraint_stack = "Constraint Stack";
 const string deg_op_name_rigidbody_world_rebuild = "Rigidbody World Rebuild";
 const string deg_op_name_rigidbody_world_simulate = "Rigidbody World Do Simulation";
 const string deg_op_name_rigidbody_object_sync = "RigidBodyObject Sync";
-const string deg_op_name_pose_rebuild = "Rebuild Pose";
 const string deg_op_name_pose_eval_init = "Init Pose Eval";
 const string deg_op_name_pose_eval_flush = "Flush Pose Eval";
 const string deg_op_name_ik_solver = "IK Solver";
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index 018557a..0f22e55 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -93,7 +93,6 @@ extern const string deg_op_name_constraint_stack;
 extern const string deg_op_name_rigidbody_world_rebuild;
 extern const string deg_op_name_rigidbody_world_simulate;
 extern const string deg_op_name_rigidbody_object_sync;
-extern const string deg_op_name_pose_rebuild;
 extern const string deg_op_name_pose_eval_init;
 extern const string deg_op_name_pose_eval_flush;
 extern const string deg_op_name_ik_solver;
diff --git a/source/blender/depsgraph/intern/stubs.h b/source/blender/depsgraph/intern/stubs.h
index 48c2486..d87db2b 100644
--- a/source/blender/depsgraph/intern/stubs.h
+++ b/source/blender/depsgraph/intern/stubs.h
@@ -40,7 +40,6 @@ void BKE_pose_eval_bone(struct EvaluationContext *eval_ctx,
                         Object *ob,
                         bPoseChannel *pchan);
 
-void BKE_pose_rebuild_op(struct EvaluationContext *eval_ctx, Object *ob, bPose *pose);
 void BKE_pose_eval_init(struct EvaluationContext *eval_ctx,
                         Scene *scene,
                         Object *ob,




More information about the Bf-blender-cvs mailing list