From ab4a2aaf4a4b2b4e416aa1f113b30362cbe0dec3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Mar 2012 06:38:07 +0000 Subject: style cleanup: follow style guide for formatting of if/for/while loops, and else if's --- source/blender/editors/util/crazyspace.c | 102 +++++++++++++++---------------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'source/blender/editors/util/crazyspace.c') diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c index 544a1c77d50..cef440668e6 100644 --- a/source/blender/editors/util/crazyspace.c +++ b/source/blender/editors/util/crazyspace.c @@ -78,7 +78,7 @@ static void make_vertexcos__mapFunc(void *userData, int index, float *co, float float *vec = mappedData->vertexcos; vec+= 3*index; - if(!mappedData->flags[index]) { + if (!mappedData->flags[index]) { /* we need coord from prototype vertex, not it clones or images, * suppose they stored in the beginning of vertex array stored in DM */ copy_v3_v3(vec, co); @@ -91,9 +91,9 @@ static int modifiers_disable_subsurf_temporary(Object *ob) ModifierData *md; int disabled = 0; - for(md=ob->modifiers.first; md; md=md->next) - if(md->type==eModifierType_Subsurf) - if(md->mode & eModifierMode_OnCage) { + for (md=ob->modifiers.first; md; md=md->next) + if (md->type==eModifierType_Subsurf) + if (md->mode & eModifierMode_OnCage) { md->mode ^= eModifierMode_DisableTemporary; disabled= 1; } @@ -112,7 +112,7 @@ float *crazyspace_get_mapped_editverts(Scene *scene, Object *obedit) MappedUserData userData; /* disable subsurf temporal, get mapped cos, and enable it */ - if(modifiers_disable_subsurf_temporary(obedit)) { + if (modifiers_disable_subsurf_temporary(obedit)) { /* need to make new derivemesh */ makeDerivedMesh(scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH, 0); } @@ -194,13 +194,13 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped intptr_t index= 0; /* two abused locations in vertices */ - for(eve= em->verts.first; eve; eve= eve->next, index++) { + for (eve= em->verts.first; eve; eve= eve->next, index++) { eve->tmp.p = NULL; eve->prev= (EditVert *)index; } /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */ - for(efa= em->faces.first; efa; efa= efa->next) { + for (efa= em->faces.first; efa; efa= efa->next) { /* retrieve mapped coordinates */ v1= mappedcos + 3*(intptr_t)(efa->v1->prev); @@ -211,39 +211,39 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped co2= (origcos)? origcos + 3*(intptr_t)(efa->v2->prev): efa->v2->co; co3= (origcos)? origcos + 3*(intptr_t)(efa->v3->prev): efa->v3->co; - if(efa->v2->tmp.p==NULL && efa->v2->f1) { + if (efa->v2->tmp.p==NULL && efa->v2->f1) { set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1); efa->v2->tmp.p= (void*)quats; quats+= 4; } - if(efa->v4) { + if (efa->v4) { v4= mappedcos + 3*(intptr_t)(efa->v4->prev); co4= (origcos)? origcos + 3*(intptr_t)(efa->v4->prev): efa->v4->co; - if(efa->v1->tmp.p==NULL && efa->v1->f1) { + if (efa->v1->tmp.p==NULL && efa->v1->f1) { set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4); efa->v1->tmp.p= (void*)quats; quats+= 4; } - if(efa->v3->tmp.p==NULL && efa->v3->f1) { + if (efa->v3->tmp.p==NULL && efa->v3->f1) { set_crazy_vertex_quat(quats, co3, co4, co2, v3, v4, v2); efa->v3->tmp.p= (void*)quats; quats+= 4; } - if(efa->v4->tmp.p==NULL && efa->v4->f1) { + if (efa->v4->tmp.p==NULL && efa->v4->f1) { set_crazy_vertex_quat(quats, co4, co1, co3, v4, v1, v3); efa->v4->tmp.p= (void*)quats; quats+= 4; } } else { - if(efa->v1->tmp.p==NULL && efa->v1->f1) { + if (efa->v1->tmp.p==NULL && efa->v1->f1) { set_crazy_vertex_quat(quats, co1, co2, co3, v1, v2, v3); efa->v1->tmp.p= (void*)quats; quats+= 4; } - if(efa->v3->tmp.p==NULL && efa->v3->f1) { + if (efa->v3->tmp.p==NULL && efa->v3->f1) { set_crazy_vertex_quat(quats, co3, co1, co2, v3, v1, v2); efa->v3->tmp.p= (void*)quats; quats+= 4; @@ -252,7 +252,7 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped } /* restore abused prev pointer */ - for(prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next) + for (prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next) eve->prev= prev; #endif } @@ -267,13 +267,13 @@ void crazyspace_set_quats_mesh(Mesh *me, float *origcos, float *mappedcos, float float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4; mvert= me->mvert; - for(i=0; itotvert; i++, mvert++) + for (i=0; itotvert; i++, mvert++) mvert->flag&= ~ME_VERT_TMP_TAG; /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */ mvert= me->mvert; mface= me->mface; - for(i=0; itotface; i++, mface++) { + for (i=0; itotface; i++, mface++) { /* retrieve mapped coordinates */ v1= mappedcos + 3*mface->v1; @@ -284,34 +284,34 @@ void crazyspace_set_quats_mesh(Mesh *me, float *origcos, float *mappedcos, float co2= (origcos)? origcos + 3*mface->v2: mvert[mface->v2].co; co3= (origcos)? origcos + 3*mface->v3: mvert[mface->v3].co; - if((mvert[mface->v2].flag&ME_VERT_TMP_TAG)==0) { + if ((mvert[mface->v2].flag&ME_VERT_TMP_TAG)==0) { set_crazy_vertex_quat(&quats[mface->v2*4], co2, co3, co1, v2, v3, v1); mvert[mface->v2].flag|= ME_VERT_TMP_TAG; } - if(mface->v4) { + if (mface->v4) { v4= mappedcos + 3*mface->v4; co4= (origcos)? origcos + 3*mface->v4: mvert[mface->v4].co; - if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) { + if ((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) { set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co4, v1, v2, v4); mvert[mface->v1].flag|= ME_VERT_TMP_TAG; } - if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) { + if ((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) { set_crazy_vertex_quat(&quats[mface->v3*4], co3, co4, co2, v3, v4, v2); mvert[mface->v3].flag|= ME_VERT_TMP_TAG; } - if((mvert[mface->v4].flag&ME_VERT_TMP_TAG)==0) { + if ((mvert[mface->v4].flag&ME_VERT_TMP_TAG)==0) { set_crazy_vertex_quat(&quats[mface->v4*4], co4, co1, co3, v4, v1, v3); mvert[mface->v4].flag|= ME_VERT_TMP_TAG; } } else { - if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) { + if ((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) { set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co3, v1, v2, v3); mvert[mface->v1].flag|= ME_VERT_TMP_TAG; } - if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) { + if ((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) { set_crazy_vertex_quat(&quats[mface->v3*4], co3, co1, co2, v3, v1, v2); mvert[mface->v3].flag|= ME_VERT_TMP_TAG; } @@ -336,19 +336,19 @@ int editbmesh_get_first_deform_matrices(Scene *scene, Object *ob, BMEditMesh *em /* compute the deformation matrices and coordinates for the first * modifiers with on cage editing that are enabled and support computing * deform matrices */ - for(i = 0; md && i <= cageIndex; i++, md = md->next) { + for (i = 0; md && i <= cageIndex; i++, md = md->next) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); - if(!editbmesh_modifier_is_enabled(scene, md, dm)) + if (!editbmesh_modifier_is_enabled(scene, md, dm)) continue; - if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) { - if(!defmats) { + if (mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) { + if (!defmats) { dm= getEditDerivedBMesh(em, ob, NULL); deformedVerts= editbmesh_get_vertex_cos(em, &numVerts); defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats"); - for(a=0; anext, i++) - if(editbmesh_modifier_is_enabled(scene, md, dm) && modifier_isCorrectableDeformed(md)) + for (; md && i <= cageIndex; md = md->next, i++) + if (editbmesh_modifier_is_enabled(scene, md, dm) && modifier_isCorrectableDeformed(md)) numleft++; - if(dm) + if (dm) dm->release(dm); *deformmats= defmats; @@ -382,7 +382,7 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma int has_multires = mmd != NULL && mmd->sculptlvl > 0; int numleft= 0; - if(has_multires) { + if (has_multires) { *deformmats= NULL; *deformcos= NULL; return numleft; @@ -391,37 +391,37 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma dm= NULL; md= modifiers_getVirtualModifierList(ob); - for(; md; md= md->next) { + for (; md; md= md->next) { ModifierTypeInfo *mti= modifierType_getInfo(md->type); - if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; + if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; - if(mti->type==eModifierTypeType_OnlyDeform) { - if(!defmats) { + if (mti->type==eModifierTypeType_OnlyDeform) { + if (!defmats) { Mesh *me= (Mesh*)ob->data; dm= mesh_create_derived(me, ob, NULL); deformedVerts= mesh_getVertexCos(me, &numVerts); defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats"); - for(a=0; adeformMatrices) mti->deformMatrices(md, ob, dm, deformedVerts, defmats, numVerts); + if (mti->deformMatrices) mti->deformMatrices(md, ob, dm, deformedVerts, defmats, numVerts); else break; } } - for(; md; md= md->next) { + for (; md; md= md->next) { ModifierTypeInfo *mti= modifierType_getInfo(md->type); - if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; + if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; - if(mti->type==eModifierTypeType_OnlyDeform) + if (mti->type==eModifierTypeType_OnlyDeform) numleft++; } - if(dm) + if (dm) dm->release(dm); *deformmats= defmats; @@ -434,7 +434,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3 { int totleft= sculpt_get_first_deform_matrices(scene, ob, deformmats, deformcos); - if(totleft) { + if (totleft) { /* there are deformation modifier which doesn't support deformation matrices * calculation. Need additional crazyspace correction */ @@ -445,15 +445,15 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3 ModifierData *md= modifiers_getVirtualModifierList(ob); Mesh *me= (Mesh*)ob->data; - for(; md; md= md->next) { + for (; md; md= md->next) { ModifierTypeInfo *mti= modifierType_getInfo(md->type); - if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; + if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; - if(mti->type==eModifierTypeType_OnlyDeform) { + if (mti->type==eModifierTypeType_OnlyDeform) { /* skip leading modifiers which have been already * handled in sculpt_get_first_deform_matrices */ - if(mti->deformMatrices && !deformed) + if (mti->deformMatrices && !deformed) continue; mti->deformVerts(md, ob, NULL, deformedVerts, me->totvert, 0, 0); @@ -465,7 +465,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3 crazyspace_set_quats_mesh(me, (float*)origVerts, (float*)deformedVerts, quats); - for(i=0; itotvert; i++) { + for (i=0; itotvert; i++) { float qmat[3][3], tmat[3][3]; quat_to_mat3(qmat, &quats[i*4]); @@ -477,14 +477,14 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3 MEM_freeN(quats); } - if(!*deformmats) { + if (!*deformmats) { int a, numVerts; Mesh *me= (Mesh*)ob->data; *deformcos= mesh_getVertexCos(me, &numVerts); *deformmats= MEM_callocN(sizeof(*(*deformmats))*numVerts, "defmats"); - for(a=0; a