Revision: 44333 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44333 Author: mont29 Date: 2012-02-22 16:21:17 +0000 (Wed, 22 Feb 2012) Log Message: ----------- More style edits (adding a space between statements and parenthesis, if (foo) blah;), to follow http://wiki.blender.org/index.php/User:Nazg-gul/CodeStyle proposition.
Modified Paths: -------------- trunk/blender/source/blender/blenkernel/intern/armature.c Modified: trunk/blender/source/blender/blenkernel/intern/armature.c =================================================================== --- trunk/blender/source/blender/blenkernel/intern/armature.c 2012-02-22 16:08:30 UTC (rev 44332) +++ trunk/blender/source/blender/blenkernel/intern/armature.c 2012-02-22 16:21:17 UTC (rev 44333) @@ -88,7 +88,7 @@ bArmature *get_armature(Object *ob) { - if(ob->type == OB_ARMATURE) + if (ob->type == OB_ARMATURE) return (bArmature *)ob->data; return NULL; } @@ -97,8 +97,8 @@ { Bone *bone; - for(bone = lb->first; bone; bone = bone->next) { - if(bone->prop) { + for (bone = lb->first; bone; bone = bone->next) { + if (bone->prop) { IDP_FreeProperty(bone->prop); MEM_freeN(bone->prop); } @@ -110,11 +110,11 @@ void free_armature(bArmature *arm) { - if(arm) { + if (arm) { free_bonelist(&arm->bonebase); /* free editmode data */ - if(arm->edbo) { + if (arm->edbo) { BLI_freelistN(arm->edbo); MEM_freeN(arm->edbo); @@ -122,13 +122,13 @@ } /* free sketch */ - if(arm->sketch) { + if (arm->sketch) { freeSketch(arm->sketch); arm->sketch = NULL; } /* free animation data */ - if(arm->adt) { + if (arm->adt) { BKE_free_animdata(&arm->id); arm->adt = NULL; } @@ -141,35 +141,35 @@ int is_local = FALSE, is_lib = FALSE; Object *ob; - if(arm->id.lib == NULL) + if (arm->id.lib == NULL) return; - if(arm->id.us == 1) { + if (arm->id.us == 1) { id_clear_lib_data(bmain, &arm->id); return; } - for(ob = bmain->object.first; ob && ELEM(0, is_lib, is_local); ob = ob->id.next) { - if(ob->data == arm) { - if(ob->id.lib) + for (ob = bmain->object.first; ob && ELEM(0, is_lib, is_local); ob = ob->id.next) { + if (ob->data == arm) { + if (ob->id.lib) is_lib = TRUE; else is_local = TRUE; } } - if(is_local && is_lib == FALSE) { + if (is_local && is_lib == FALSE) { id_clear_lib_data(bmain, &arm->id); } - else if(is_local && is_lib) { + else if (is_local && is_lib) { bArmature *arm_new = copy_armature(arm); arm_new->id.us = 0; /* Remap paths of new ID using old library as base. */ BKE_id_lib_local_paths(bmain, arm->id.lib, &arm_new->id); - for(ob = bmain->object.first; ob; ob = ob->id.next) { - if(ob->data == arm) { - if(ob->id.lib == NULL) { + for (ob = bmain->object.first; ob; ob = ob->id.next) { + if (ob->data == arm) { + if (ob->id.lib == NULL) { ob->data = arm_new; arm_new->id.us++; arm->id.us--; @@ -183,10 +183,10 @@ { Bone *curBone, *newChildBone; - if(oldBone == actBone) + if (oldBone == actBone) *newActBone = newBone; - if(oldBone->prop) + if (oldBone->prop) newBone->prop = IDP_CopyProperty(oldBone->prop); /* Copy this bone's list */ @@ -194,7 +194,7 @@ /* For each child in the list, update it's children */ newChildBone = newBone->childbase.first; - for(curBone = oldBone->childbase.first; curBone; curBone = curBone->next){ + for (curBone = oldBone->childbase.first; curBone; curBone = curBone->next){ newChildBone->parent = newBone; copy_bonechildren(newChildBone, curBone, actBone, newActBone); newChildBone = newChildBone->next; @@ -212,7 +212,7 @@ /* Duplicate the childrens' lists*/ newBone = newArm->bonebase.first; - for(oldBone = arm->bonebase.first; oldBone; oldBone = oldBone->next) { + for (oldBone = arm->bonebase.first; oldBone; oldBone = oldBone->next) { newBone->parent = NULL; copy_bonechildren(newBone, oldBone, arm->act_bone, &newActBone); newBone = newBone->next; @@ -231,12 +231,12 @@ { Bone *curBone, *rbone; - if(!strcmp(bone->name, name)) + if (!strcmp(bone->name, name)) return bone; - for(curBone = bone->childbase.first; curBone; curBone = curBone->next) { + for (curBone = bone->childbase.first; curBone; curBone = curBone->next) { rbone = get_named_bone_bonechildren(curBone, name); - if(rbone) + if (rbone) return rbone; } @@ -249,12 +249,12 @@ { Bone *bone = NULL, *curBone; - if(!arm) + if (!arm) return NULL; - for(curBone = arm->bonebase.first; curBone; curBone = curBone->next) { + for (curBone = arm->bonebase.first; curBone; curBone = curBone->next) { bone = get_named_bone_bonechildren(curBone, name); - if(bone) + if (bone) return bone; } @@ -272,7 +272,7 @@ char extension[5] = ""; len = strlen(name); - if(len == 0) + if (len == 0) return 0; BLI_strncpy(basename, name, sizeof(basename)); @@ -284,31 +284,31 @@ * -> Otherwise, extension is added from perspective of object based on which side tail goes to * - If head is non-zero, extension is added from perspective of object based on side head is on */ - if(axis == 2) { + if (axis == 2) { /* z-axis - vertical (top/bottom) */ - if(IS_EQ(head, 0)) { - if(tail < 0) + if (IS_EQ(head, 0)) { + if (tail < 0) strcpy(extension, "Bot"); - else if(tail > 0) + else if (tail > 0) strcpy(extension, "Top"); } else { - if(head < 0) + if (head < 0) strcpy(extension, "Bot"); else strcpy(extension, "Top"); } } - else if(axis == 1) { + else if (axis == 1) { /* y-axis - depth (front/back) */ - if(IS_EQ(head, 0)) { - if(tail < 0) + if (IS_EQ(head, 0)) { + if (tail < 0) strcpy(extension, "Fr"); - else if(tail > 0) + else if (tail > 0) strcpy(extension, "Bk"); } else { - if(head < 0) + if (head < 0) strcpy(extension, "Fr"); else strcpy(extension, "Bk"); @@ -316,17 +316,17 @@ } else { /* x-axis - horizontal (left/right) */ - if(IS_EQ(head, 0)) { - if(tail < 0) + if (IS_EQ(head, 0)) { + if (tail < 0) strcpy(extension, "R"); - else if(tail > 0) + else if (tail > 0) strcpy(extension, "L"); } else { - if(head < 0) + if (head < 0) strcpy(extension, "R"); /* XXX Shouldn't this be simple else, as for z and y axes? */ - else if(head > 0) + else if (head > 0) strcpy(extension, "L"); } } @@ -335,20 +335,20 @@ * - truncate if there is an extension and it wouldn't be able to fit * - otherwise, just append to end */ - if(extension[0]) { + if (extension[0]) { int change = 1; - while(change) { /* remove extensions */ + while (change) { /* remove extensions */ change = 0; - if(len > 2 && basename[len-2] == '.') { - if(basename[len-1] == 'L' || basename[len-1] == 'R') { /* L R */ + if (len > 2 && basename[len-2] == '.') { + if (basename[len-1] == 'L' || basename[len-1] == 'R') { /* L R */ basename[len-2] = '\0'; len -= 2; change = 1; } } - else if(len > 3 && basename[len-3] == '.') { - if((basename[len-2] == 'F' && basename[len-1] == 'r') || /* Fr */ + else if (len > 3 && basename[len-3] == '.') { + if ((basename[len-2] == 'F' && basename[len-1] == 'r') || /* Fr */ (basename[len-2] == 'B' && basename[len-1] == 'k')) /* Bk */ { basename[len-3] = '\0'; @@ -356,8 +356,8 @@ change = 1; } } - else if(len > 4 && basename[len-4] == '.') { - if((basename[len-3] == 'T' && basename[len-2] == 'o' && basename[len-1] == 'p') || /* Top */ + else if (len > 4 && basename[len-4] == '.') { + if ((basename[len-3] == 'T' && basename[len-2] == 'o' && basename[len-1] == 'p') || /* Top */ (basename[len-3] == 'B' && basename[len-2] == 'o' && basename[len-1] == 't')) /* Bot */ { basename[len-4] = '\0'; @@ -367,7 +367,7 @@ } } - if((MAXBONENAME - len) < strlen(extension) + 1) { /* add 1 for the '.' */ + if ((MAXBONENAME - len) < strlen(extension) + 1) { /* add 1 for the '.' */ strncpy(name, basename, len-strlen(extension)); } @@ -393,7 +393,7 @@ int a, nr; pdist[0] = 0.0f; - for(a = 0, fp = data; a < MAX_BBONE_SUBDIV; a++, fp += 4) { + for (a = 0, fp = data; a < MAX_BBONE_SUBDIV; a++, fp += 4) { copy_qt_qt(temp[a], fp); pdist[a+1] = pdist[a] + len_v3v3(fp, fp+4); } @@ -404,11 +404,11 @@ /* go over distances and calculate new points */ ddist = totdist/((float)desired); nr = 1; - for(a = 1, fp = data+4; a < desired; a++, fp += 4) { + for (a = 1, fp = data+4; a < desired; a++, fp += 4) { dist = ((float)a)*ddist; /* we're looking for location (distance) 'dist' in the array */ - while((dist >= pdist[nr]) && nr < MAX_BBONE_SUBDIV) + while ((dist >= pdist[nr]) && nr < MAX_BBONE_SUBDIV) nr++; fac1 = pdist[nr] - pdist[nr-1]; @@ -441,13 +441,13 @@ length = bone->length; - if(!rest) { + if (!rest) { /* check if we need to take non-uniform bone scaling into account */ scale[0] = len_v3(pchan->pose_mat[0]); scale[1] = len_v3(pchan->pose_mat[1]); scale[2] = len_v3(pchan->pose_mat[2]); - if(fabsf(scale[0] - scale[1]) > 1e-6f || fabsf(scale[1] - scale[2]) > 1e-6f) { + if (fabsf(scale[0] - scale[1]) > 1e-6f || fabsf(scale[1] - scale[2]) > 1e-6f) { unit_m4(scalemat); scalemat[0][0] = scale[0]; scalemat[1][1] = scale[1]; @@ -463,7 +463,7 @@ hlength2 = bone->ease2*length*0.390464f; /* evaluate next and prev bones */ - if(bone->flag & BONE_CONNECTED) + if (bone->flag & BONE_CONNECTED) prev = pchan->parent; else prev = NULL; @@ -473,10 +473,10 @@ /* find the handle points, since this is inside bone space, the * first point = (0,0,0) * last point = (0, length, 0) */ - if(rest) { + if (rest) { invert_m4_m4(imat, pchan->bone->arm_mat); } - else if(doscale) { + else if (doscale) { copy_m4_m4(posemat, pchan->pose_mat); normalize_m4(posemat); invert_m4_m4(imat, posemat); @@ -484,17 +484,17 @@ else invert_m4_m4(imat, pchan->pose_mat); - if(prev) { + if (prev) { float difmat[4][4], result[3][3], imat3[3][3]; /* transform previous point inside this bone space */ - if(rest) + if (rest) copy_v3_v3(h1, prev->bone->arm_head); else copy_v3_v3(h1, prev->pose_head); mul_m4_v3(imat, h1); - if(prev->bone->segments>1) { + if (prev->bone->segments>1) { /* if previous bone is B-bone too, use average handle direction */ h1[1] -= length; roll1 = 0.0f; @@ -503,9 +503,9 @@ normalize_v3(h1); mul_v3_fl(h1, -hlength1); - if(prev->bone->segments == 1) { + if (prev->bone->segments == 1) { /* find the previous roll to interpolate */ - if(rest) + if (rest) mult_m4_m4m4(difmat, imat, prev->bone->arm_mat); else mult_m4_m4m4(difmat, imat, prev->pose_mat); @@ -523,25 +523,25 @@ h1[0] = 0.0f; h1[1] = hlength1; h1[2] = 0.0f; roll1 = 0.0f; } - if(next) { + if (next) { float difmat[4][4], result[3][3], imat3[3][3]; /* transform next point inside this bone space */ - if(rest) + if (rest) @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs