From 0a08d8c892d595eab9aaec46739ef697bcee5cef Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 17 Nov 2016 15:11:55 +0100 Subject: Depsgraph: Use utility macro to iterate over linked list This will be compiled into same exact code, just saves us from doing annoying type casts all over the place. --- .../depsgraph/intern/builder/deg_builder_relations_rig.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to '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 3edb2b7acb7..0fa7a5b1830 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -335,8 +335,8 @@ void DepsgraphRelationBuilder::build_rig(Scene *scene, Object *ob) */ RootPChanMap root_map; bool pose_depends_on_local_transform = false; - for (bPoseChannel *pchan = (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan = pchan->next) { - for (bConstraint *con = (bConstraint *)pchan->constraints.first; con; con = con->next) { + LINKLIST_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) { + LINKLIST_FOREACH (bConstraint *, con, &pchan->constraints) { switch (con->type) { case CONSTRAINT_TYPE_KINEMATIC: build_ik_pose(ob, pchan, con, &root_map); @@ -377,7 +377,7 @@ void DepsgraphRelationBuilder::build_rig(Scene *scene, Object *ob) /* links between operations for each bone */ - for (bPoseChannel *pchan = (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan = pchan->next) { + LINKLIST_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) { OperationKey bone_local_key(&ob->id, DEPSNODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_LOCAL); OperationKey bone_pose_key(&ob->id, DEPSNODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_POSE_PARENT); OperationKey bone_ready_key(&ob->id, DEPSNODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_READY); @@ -441,10 +441,7 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *ob) { OperationKey pose_init_key(&ob->id, DEPSNODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT); OperationKey pose_done_key(&ob->id, DEPSNODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE); - for (bPoseChannel *pchan = (bPoseChannel *)ob->pose->chanbase.first; - pchan != NULL; - pchan = pchan->next) - { + LINKLIST_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) { OperationKey bone_local_key(&ob->id, DEPSNODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_LOCAL); OperationKey bone_ready_key(&ob->id, DEPSNODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_READY); OperationKey bone_done_key(&ob->id, DEPSNODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_DONE); -- cgit v1.2.3