[Bf-blender-cvs] [60857cdb79e] blender2.8: Depsgraph: Cleanup, line wrapping

Sergey Sharybin noreply at git.blender.org
Thu Nov 22 16:17:28 CET 2018


Commit: 60857cdb79ed7ecb636a60092ffd1a0887d63c5c
Author: Sergey Sharybin
Date:   Thu Nov 22 15:50:42 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB60857cdb79ed7ecb636a60092ffd1a0887d63c5c

Depsgraph: Cleanup, line wrapping

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

M	source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
index f95060ee6ec..2b4d8d394ab 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
@@ -78,88 +78,93 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
                                              RootPChanMap *root_map)
 {
 	bKinematicConstraint *data = (bKinematicConstraint *)con->data;
-
-	/* attach owner to IK Solver too
-	 * - assume that owner is always part of chain
-	 * - see notes on direction of rel below...
-	 */
+	/* Attach owner to IK Solver to. */
 	bPoseChannel *rootchan = BKE_armature_ik_solver_find_root(pchan, data);
 	if (rootchan == NULL) {
 		return;
 	}
-	OperationKey pchan_local_key(&object->id, DEG_NODE_TYPE_BONE,
-	                             pchan->name, DEG_OPCODE_BONE_LOCAL);
-	OperationKey init_ik_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT_IK);
-	OperationKey solver_key(&object->id, DEG_NODE_TYPE_EVAL_POSE,
+	OperationKey pchan_local_key(&object->id,
+	                             DEG_NODE_TYPE_BONE,
+	                             pchan->name,
+	                             DEG_OPCODE_BONE_LOCAL);
+	OperationKey init_ik_key(
+	        &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT_IK);
+	OperationKey solver_key(&object->id,
+	                        DEG_NODE_TYPE_EVAL_POSE,
 	                        rootchan->name,
 	                        DEG_OPCODE_POSE_IK_SOLVER);
-
 	add_relation(pchan_local_key, init_ik_key, "IK Constraint -> Init IK Tree");
 	add_relation(init_ik_key, solver_key, "Init IK -> IK Solver");
-
 	/* IK target */
-	// XXX: this should get handled as part of the constraint code
+	/* TODO(sergey): This should get handled as part of the constraint code. */
 	if (data->tar != NULL) {
-		/* TODO(sergey): For until we'll store partial matricies in the depsgraph,
-		 * we create dependency between target object and pose eval component.
+		/* TODO(sergey): For until we'll store partial matricies in the
+		 * depsgraph, we create dependency between target object and pose eval
+		 * component.
 		 *
-		 * This way we ensuring the whole subtree is updated from scratch without
-		 * need of intermediate matricies. This is an overkill, but good enough for
-		 * testing IK solver.
-		 */
-		// FIXME: geometry targets...
+		 * This way we ensuring the whole subtree is updated from scratch
+		 * without need of intermediate matricies. This is an overkill, but good
+		 * enough for testing IK solver. */
 		ComponentKey pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE);
 		if ((data->tar->type == OB_ARMATURE) && (data->subtarget[0])) {
-			/* TODO(sergey): This is only for until granular update stores intermediate result. */
+			/* TODO(sergey): This is only for until granular update stores
+			 * intermediate result. */
 			if (data->tar != object) {
-				/* different armature - can just read the results */
-				ComponentKey target_key(&data->tar->id, DEG_NODE_TYPE_BONE, data->subtarget);
+				/* Different armature - can just read the results. */
+				ComponentKey target_key(
+				        &data->tar->id, DEG_NODE_TYPE_BONE, data->subtarget);
 				add_relation(target_key, pose_key, con->name);
 			}
 			else {
-				/* same armature - we'll use the ready state only, just in case this bone is in the chain we're solving */
-				OperationKey target_key(&data->tar->id, DEG_NODE_TYPE_BONE, data->subtarget, DEG_OPCODE_BONE_DONE);
+				/* Same armature - we'll use the ready state only, just in case
+				 * this bone is in the chain we're solving. */
+				OperationKey target_key(&data->tar->id,
+				                        DEG_NODE_TYPE_BONE,
+				                        data->subtarget,
+				                        DEG_OPCODE_BONE_DONE);
 				add_relation(target_key, solver_key, con->name);
 			}
 		}
-		else if (ELEM(data->tar->type, OB_MESH, OB_LATTICE) && (data->subtarget[0])) {
-			/* vertex group target */
-			/* NOTE: for now, we don't need to represent vertex groups separately... */
+		else if (data->subtarget[0] &&
+		         ELEM(data->tar->type, OB_MESH, OB_LATTICE))
+		{
+			/* Vertex group target. */
+			/* NOTE: for now, we don't need to represent vertex groups
+			 * separately. */
 			ComponentKey target_key(&data->tar->id, DEG_NODE_TYPE_GEOMETRY);
 			add_relation(target_key, solver_key, con->name);
-
 			if (data->tar->type == OB_MESH) {
 				add_customdata_mask(target_key, CD_MASK_MDEFORMVERT);
 			}
 		}
 		else {
-			/* Standard Object Target */
+			/* Standard Object Target. */
 			ComponentKey target_key(&data->tar->id, DEG_NODE_TYPE_TRANSFORM);
 			add_relation(target_key, pose_key, con->name);
 		}
-
-		if ((data->tar == object) && (data->subtarget[0])) {
+		if (data->tar == object && data->subtarget[0]) {
 			/* Prevent target's constraints from linking to anything from same
-			 * chain that it controls.
-			 */
+			 * chain that it controls. */
 			root_map->add_bone(data->subtarget, rootchan->name);
 		}
 	}
-
-	/* Pole Target */
-	// XXX: this should get handled as part of the constraint code
+	/* Pole Target. */
+	/* TODO(sergey): This should get handled as part of the constraint code. */
 	if (data->poletar != NULL) {
 		if ((data->poletar->type == OB_ARMATURE) && (data->polesubtarget[0])) {
-			// XXX: same armature issues - ready vs done?
-			ComponentKey target_key(&data->poletar->id, DEG_NODE_TYPE_BONE, data->polesubtarget);
+			ComponentKey target_key(&data->poletar->id,
+			                        DEG_NODE_TYPE_BONE,
+			                        data->polesubtarget);
 			add_relation(target_key, solver_key, con->name);
 		}
-		else if (ELEM(data->poletar->type, OB_MESH, OB_LATTICE) && (data->polesubtarget[0])) {
-			/* vertex group target */
-			/* NOTE: for now, we don't need to represent vertex groups separately... */
+		else if (data->polesubtarget[0] &&
+		         ELEM(data->poletar->type, OB_MESH, OB_LATTICE))
+		{
+			/* Vertex group target. */
+			/* NOTE: for now, we don't need to represent vertex groups
+			 * separately. */
 			ComponentKey target_key(&data->poletar->id, DEG_NODE_TYPE_GEOMETRY);
 			add_relation(target_key, solver_key, con->name);
-
 			if (data->poletar->type == OB_MESH) {
 				add_customdata_mask(target_key, CD_MASK_MDEFORMVERT);
 			}
@@ -169,60 +174,65 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
 			add_relation(target_key, solver_key, con->name);
 		}
 	}
-
-	DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
-	                 BUILD, "\nStarting IK Build: pchan = %s, target = (%s, %s), segcount = %d\n",
-	                 pchan->name, data->tar->id.name, data->subtarget, data->rootbone);
-
+	DEG_DEBUG_PRINTF(
+	        (::Depsgraph *)graph_,
+	        BUILD,
+	        "\nStarting IK Build: pchan = %s, target = (%s, %s), "
+	        "segcount = %d\n",
+	        pchan->name, data->tar->id.name, data->subtarget, data->rootbone);
 	bPoseChannel *parchan = pchan;
-	/* exclude tip from chain? */
+	/* Exclude tip from chain if needed. */
 	if (!(data->flag & CONSTRAINT_IK_TIP)) {
 		parchan = pchan->parent;
 	}
-
 	root_map->add_bone(parchan->name, rootchan->name);
-
 	OperationKey parchan_transforms_key(&object->id, DEG_NODE_TYPE_BONE,
 	                                    parchan->name, DEG_OPCODE_BONE_READY);
 	add_relation(parchan_transforms_key, solver_key, "IK Solver Owner");
-
-	/* Walk to the chain's root */
-	//size_t segcount = 0;
+	/* Walk to the chain's root. */
 	int segcount = 0;
-
-	while (parchan) {
-		/* Make IK-solver dependent on this bone's result,
-		 * since it can only run after the standard results
-		 * of the bone are know. Validate links step on the
-		 * bone will ensure that users of this bone only
-		 * grab the result with IK solver results...
-		 */
+	while (parchan != NULL) {
+		/* Make IK-solver dependent on this bone's result, since it can only run
+		 * after the standard results of the bone are know. Validate links step
+		 * on the bone will ensure that users of this bone only grab the result
+		 * with IK solver results. */
 		if (parchan != pchan) {
-			OperationKey parent_key(&object->id, DEG_NODE_TYPE_BONE, parchan->name, DEG_OPCODE_BONE_READY);
+			OperationKey parent_key(&object->id,
+			                        DEG_NODE_TYPE_BONE,
+			                        parchan->name,
+			                        DEG_OPCODE_BONE_READY);
 			add_relation(parent_key, solver_key, "IK Chain Parent");
-
-			OperationKey done_key(&object->id, DEG_NODE_TYPE_BONE, parchan->name, DEG_OPCODE_BONE_DONE);
-			add_relation(solver_key, done_key, "IK Chain Result");
+			OperationKey bone_done_key(&object->id,
+			                           DEG_NODE_TYPE_BONE,
+			                           parchan->name,
+			                           DEG_OPCODE_BONE_DONE);
+			add_relation(solver_key, bone_done_key, "IK Chain Result");
 		}
 		else {
-			OperationKey final_transforms_key(&object->id, DEG_NODE_TYPE_BONE, parchan->name, DEG_OPCODE_BONE_DONE);
+			OperationKey final_transforms_key(&object->id,
+			                                  DEG_NODE_TYPE_BONE,
+			                                  parchan->name,
+			                                  DEG_OPCODE_BONE_DONE);
 			add_relation(solver_key, final_transforms_key, "IK Solver Result");
 		}
 		parchan->flag |= POSE_DONE;
-
-
 		root_map->add_bone(parchan->name, rootchan->name);
-
-		/* continue up chain, until we reach target number of items... */
-		DEG_DEBUG_PRINTF((::Depsgraph *)graph_, BUILD, "  %d = %s\n", segcount, parchan->name);
+		/* continue up chain, until we reach target number of items. */
+		DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
+		                 BUILD,
+		                 "  %d = %s\n",
+		                 segcount, parchan->name);
+		/* TODO(sergey): This is an arbitrary value, which was just following
+		 * old code convention. */
 		segcount++;
-		if ((segcount == data->rootbone) || (segcount > 255)) break;  /* 255 is weak */
-
+		if ((segcount == data->rootbone) || (segcount > 255)) {
+			break;
+		}
 		parchan  = parchan->parent;
 	}
-
-	OperationKey done_key(&object->id, D

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list