From b8a71efeba70d6c3ebc579f5043daa4162da86e8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Mar 2012 07:52:14 +0000 Subject: style cleanup: follow style guide for/with/if spacing --- source/blender/ikplugin/intern/itasc_plugin.cpp | 60 ++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'source/blender/ikplugin') diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 0f178366b39..a5e7150328b 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -198,7 +198,7 @@ struct IK_Scene // delete scene first if (scene) delete scene; - for(std::vector::iterator it = targets.begin(); it != targets.end(); ++it) + for (std::vector::iterator it = targets.begin(); it != targets.end(); ++it) delete (*it); targets.clear(); if (channels) @@ -245,7 +245,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co data=(bKinematicConstraint*)con->data; /* exclude tip from chain? */ - if(!(data->flag & CONSTRAINT_IK_TIP)) + if (!(data->flag & CONSTRAINT_IK_TIP)) pchan_tip= pchan_tip->parent; rootbone = data->rootbone; @@ -256,7 +256,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co if (++segcount > 255) // 255 is weak break; - if(segcount==rootbone){ + if (segcount==rootbone){ // reached this end of the chain but if the chain is overlapping with a // previous one, we must go back up to the root of the other chain if ((curchan->flag & POSE_CHAIN) && curchan->iktree.first == NULL){ @@ -289,7 +289,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co // by contruction there can be only one tree per channel and each channel can be part of at most one tree. tree = (PoseTree*)pchan_root->iktree.first; - if(tree==NULL) { + if (tree==NULL) { /* make new tree */ tree= (PoseTree*)MEM_callocN(sizeof(PoseTree), "posetree"); @@ -299,7 +299,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co tree->pchan= (bPoseChannel**)MEM_callocN(segcount*sizeof(void*), "ik tree pchan"); tree->parent= (int*)MEM_callocN(segcount*sizeof(int), "ik tree parent"); - for(a=0; apchan[a]= chanlist[segcount-a-1]; tree->parent[a]= a-1; } @@ -322,19 +322,19 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co for (;ttotchannel && tree->pchan[t]!=chanlist[segcount-a-1];t++); if (t>=tree->totchannel) break; - for(; atotchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++); + for (; atotchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++); } segcount= segcount-a; target->tip= tree->totchannel + segcount - 1; if (segcount > 0) { - for(parent = a - 1; parent < tree->totchannel; parent++) - if(tree->pchan[parent] == chanlist[segcount-1]->parent) + for (parent = a - 1; parent < tree->totchannel; parent++) + if (tree->pchan[parent] == chanlist[segcount-1]->parent) break; /* shouldn't happen, but could with dependency cycles */ - if(parent == tree->totchannel) + if (parent == tree->totchannel) parent = a - 1; /* resize array */ @@ -350,7 +350,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co MEM_freeN(oldparent); /* add new pose channels at the end, in reverse order */ - for(a=0; apchan[tree->totchannel+a]= chanlist[segcount-a-1]; tree->parent[tree->totchannel+a]= tree->totchannel+a-1; } @@ -401,8 +401,8 @@ int initialize_scene(Object *ob, bPoseChannel *pchan_tip) /* find all IK constraints and validate them */ treecount = 0; - for(con= (bConstraint *)pchan_tip->constraints.first; con; con= (bConstraint *)con->next) { - if(con->type==CONSTRAINT_TYPE_KINEMATIC) { + for (con= (bConstraint *)pchan_tip->constraints.first; con; con= (bConstraint *)con->next) { + if (con->type==CONSTRAINT_TYPE_KINEMATIC) { if (constraint_valid(con)) treecount += initialize_chain(ob, pchan_tip, con); } @@ -428,12 +428,12 @@ static double EulerAngleFromMatrix(const KDL::Rotation& R, int axis) if (t > 16.0*KDL::epsilon) { if (axis == 0) return -KDL::atan2(R(1,2), R(2,2)); - else if(axis == 1) return KDL::atan2(-R(0,2), t); + else if (axis == 1) return KDL::atan2(-R(0,2), t); else return -KDL::atan2(R(0,1), R(0,0)); } else { if (axis == 0) return -KDL::atan2(-R(2,1), R(1,1)); - else if(axis == 1) return KDL::atan2(-R(0,2), t); + else if (axis == 1) return KDL::atan2(-R(0,2), t); else return 0.0f; } } @@ -873,7 +873,7 @@ static int convert_channels(IK_Scene *ikscene, PoseTree *tree) int a, flag, njoint; njoint = 0; - for(a=0, ikchan = ikscene->channels; anumchan; ++a, ++ikchan) { + for (a=0, ikchan = ikscene->channels; anumchan; ++a, ++ikchan) { pchan= tree->pchan[a]; ikchan->pchan = pchan; ikchan->parent = (a>0) ? tree->parent[a] : -1; @@ -881,17 +881,17 @@ static int convert_channels(IK_Scene *ikscene, PoseTree *tree) /* set DoF flag */ flag = 0; - if(!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP) && + if (!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP) && (!(pchan->ikflag & BONE_IK_XLIMIT) || pchan->limitmin[0]<0.f || pchan->limitmax[0]>0.f)) flag |= IK_XDOF; - if(!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP) && + if (!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP) && (!(pchan->ikflag & BONE_IK_YLIMIT) || pchan->limitmin[1]<0.f || pchan->limitmax[1]>0.f)) flag |= IK_YDOF; - if(!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP) && + if (!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP) && (!(pchan->ikflag & BONE_IK_ZLIMIT) || pchan->limitmin[2]<0.f || pchan->limitmax[2]>0.f)) flag |= IK_ZDOF; - if(tree->stretch && (pchan->ikstretch > 0.0)) { + if (tree->stretch && (pchan->ikstretch > 0.0)) { flag |= IK_TRANSY; } /* @@ -994,7 +994,7 @@ static void convert_pose(IK_Scene *ikscene) // assume uniform scaling and take Y scale as general scale for the armature scale = len_v3(ikscene->blArmature->obmat[1]); rot = &ikscene->jointArray(0); - for(joint=a=0, ikchan = ikscene->channels; anumchan && jointnumjoint; ++a, ++ikchan) { + for (joint=a=0, ikchan = ikscene->channels; anumchan && jointnumjoint; ++a, ++ikchan) { pchan= ikchan->pchan; bone= pchan->bone; @@ -1035,7 +1035,7 @@ static void rest_pose(IK_Scene *ikscene) SetToZero(ikscene->jointArray); // except for transY joints rot = &ikscene->jointArray(0); - for(joint=a=0, ikchan = ikscene->channels; anumchan && jointnumjoint; ++a, ++ikchan) { + for (joint=a=0, ikchan = ikscene->channels; anumchan && jointnumjoint; ++a, ++ikchan) { pchan= ikchan->pchan; bone= pchan->bone; @@ -1133,7 +1133,7 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan) rest_pose(ikscene); } rot = &ikscene->jointArray(0); - for(a=0, ikchan = ikscene->channels; atotchannel; ++a, ++ikchan) { + for (a=0, ikchan = ikscene->channels; atotchannel; ++a, ++ikchan) { pchan= ikchan->pchan; bone= pchan->bone; @@ -1500,7 +1500,7 @@ static void create_scene(Scene *scene, Object *ob) bPoseChannel *pchan; // create the IK scene - for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { + for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { // by construction there is only one tree PoseTree *tree = (PoseTree*)pchan->iktree.first; if (tree) { @@ -1515,9 +1515,9 @@ static void create_scene(Scene *scene, Object *ob) while(tree) { BLI_remlink(&pchan->iktree, tree); BLI_freelistN(&tree->targets); - if(tree->pchan) MEM_freeN(tree->pchan); - if(tree->parent) MEM_freeN(tree->parent); - if(tree->basis_change) MEM_freeN(tree->basis_change); + if (tree->pchan) MEM_freeN(tree->pchan); + if (tree->parent) MEM_freeN(tree->parent); + if (tree->basis_change) MEM_freeN(tree->basis_change); MEM_freeN(tree); tree = (PoseTree*)pchan->iktree.first; } @@ -1528,7 +1528,7 @@ static void create_scene(Scene *scene, Object *ob) static void init_scene(Object *ob) { if (ob->pose->ikdata) { - for(IK_Scene* scene = ((IK_Data*)ob->pose->ikdata)->first; + for (IK_Scene* scene = ((IK_Data*)ob->pose->ikdata)->first; scene != NULL; scene = scene->next) { scene->channels[0].pchan->flag |= POSE_IKTREE; @@ -1550,7 +1550,7 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl } else { // in animation mode, we must get the bone position from action and constraints - for(i=0, ikchan=ikscene->channels; inumchan; i++, ++ikchan) { + for (i=0, ikchan=ikscene->channels; inumchan; i++, ++ikchan) { if (!(ikchan->pchan->flag & POSE_DONE)) where_is_pose_bone(blscene, ikscene->blArmature, ikchan->pchan, ctime, 1); // tell blender that this channel was controlled by IK, it's cleared on each where_is_pose() @@ -1711,8 +1711,8 @@ void itasc_initialize_tree(struct Scene *scene, Object *ob, float ctime) itasc_clear_data(ob->pose); // we should handle all the constraint and mark them all disabled // for blender but we'll start with the IK constraint alone - for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { - if(pchan->constflag & PCHAN_HAS_IK) + for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { + if (pchan->constflag & PCHAN_HAS_IK) count += initialize_scene(ob, pchan); } // if at least one tree, create the scenes from the PoseTree stored in the channels -- cgit v1.2.3