From 5a90ea77bc1333efe4e1e54984a080550ed3f707 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Mar 2012 06:24:53 +0000 Subject: style cleanup: follow style guide for formatting of if/for/while loops, and else if's --- source/blender/modifiers/intern/MOD_armature.c | 16 +-- source/blender/modifiers/intern/MOD_array.c | 38 +++--- source/blender/modifiers/intern/MOD_bevel.c | 2 +- source/blender/modifiers/intern/MOD_boolean.c | 14 +-- source/blender/modifiers/intern/MOD_boolean_util.c | 35 +++--- source/blender/modifiers/intern/MOD_build.c | 6 +- source/blender/modifiers/intern/MOD_cast.c | 92 ++++++++------ source/blender/modifiers/intern/MOD_cloth.c | 36 +++--- source/blender/modifiers/intern/MOD_collision.c | 42 +++---- source/blender/modifiers/intern/MOD_curve.c | 6 +- source/blender/modifiers/intern/MOD_decimate.c | 24 ++-- source/blender/modifiers/intern/MOD_displace.c | 26 ++-- source/blender/modifiers/intern/MOD_dynamicpaint.c | 6 +- source/blender/modifiers/intern/MOD_edgesplit.c | 4 +- source/blender/modifiers/intern/MOD_explode.c | 136 ++++++++++----------- source/blender/modifiers/intern/MOD_fluidsim.c | 14 +-- .../blender/modifiers/intern/MOD_fluidsim_util.c | 85 ++++++------- source/blender/modifiers/intern/MOD_hook.c | 56 ++++----- source/blender/modifiers/intern/MOD_lattice.c | 8 +- source/blender/modifiers/intern/MOD_mask.c | 2 +- source/blender/modifiers/intern/MOD_meshdeform.c | 93 +++++++------- source/blender/modifiers/intern/MOD_mirror.c | 16 +-- source/blender/modifiers/intern/MOD_multires.c | 12 +- source/blender/modifiers/intern/MOD_ocean.c | 8 +- .../modifiers/intern/MOD_particleinstance.c | 80 ++++++------ .../blender/modifiers/intern/MOD_particlesystem.c | 40 +++--- source/blender/modifiers/intern/MOD_remesh.c | 6 +- source/blender/modifiers/intern/MOD_screw.c | 44 ++++--- source/blender/modifiers/intern/MOD_shapekey.c | 16 +-- source/blender/modifiers/intern/MOD_shrinkwrap.c | 12 +- source/blender/modifiers/intern/MOD_simpledeform.c | 40 +++--- source/blender/modifiers/intern/MOD_smoke.c | 10 +- source/blender/modifiers/intern/MOD_smooth.c | 8 +- source/blender/modifiers/intern/MOD_solidify.c | 109 +++++++++-------- source/blender/modifiers/intern/MOD_subsurf.c | 6 +- source/blender/modifiers/intern/MOD_surface.c | 28 ++--- source/blender/modifiers/intern/MOD_util.c | 43 +++---- source/blender/modifiers/intern/MOD_uvproject.c | 65 +++++----- source/blender/modifiers/intern/MOD_warp.c | 52 ++++---- source/blender/modifiers/intern/MOD_wave.c | 60 ++++----- .../blender/modifiers/intern/MOD_weightvg_util.c | 14 +-- source/blender/modifiers/intern/MOD_weightvgedit.c | 18 +-- source/blender/modifiers/intern/MOD_weightvgmix.c | 26 ++-- .../modifiers/intern/MOD_weightvgproximity.c | 56 ++++----- 44 files changed, 773 insertions(+), 737 deletions(-) (limited to 'source/blender/modifiers/intern') diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 7260e39e982..fd9730238f5 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -129,7 +129,7 @@ static void deformVerts(ModifierData *md, Object *ob, numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name); /* free cache */ - if(amd->prevCos) { + if (amd->prevCos) { MEM_freeN(amd->prevCos); amd->prevCos= NULL; } @@ -142,7 +142,7 @@ static void deformVertsEM( ArmatureModifierData *amd = (ArmatureModifierData*) md; DerivedMesh *dm = derivedData; - if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); + if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */ @@ -150,12 +150,12 @@ static void deformVertsEM( numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name); /* free cache */ - if(amd->prevCos) { + if (amd->prevCos) { MEM_freeN(amd->prevCos); amd->prevCos= NULL; } - if(!derivedData) dm->release(dm); + if (!derivedData) dm->release(dm); } static void deformMatricesEM( @@ -166,12 +166,12 @@ static void deformMatricesEM( ArmatureModifierData *amd = (ArmatureModifierData*) md; DerivedMesh *dm = derivedData; - if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); + if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts, amd->deformflag, NULL, amd->defgrp_name); - if(!derivedData) dm->release(dm); + if (!derivedData) dm->release(dm); } static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedData, @@ -180,12 +180,12 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat ArmatureModifierData *amd = (ArmatureModifierData*) md; DerivedMesh *dm = derivedData; - if(!derivedData) dm = CDDM_from_mesh((Mesh*)ob->data, ob); + if (!derivedData) dm = CDDM_from_mesh((Mesh*)ob->data, ob); armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts, amd->deformflag, NULL, amd->defgrp_name); - if(!derivedData) dm->release(dm); + if (!derivedData) dm->release(dm); } ModifierTypeInfo modifierType_Armature = { diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 13c1739bd3f..621be8023a2 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -149,14 +149,14 @@ static float vertarray_size(MVert *mvert, int numVerts, int axis) float min_co, max_co; /* if there are no vertices, width is 0 */ - if(numVerts == 0) return 0; + if (numVerts == 0) return 0; /* find the minimum and maximum coordinates on the desired axis */ min_co = max_co = mvert->co[axis]; ++mvert; - for(i = 1; i < numVerts; ++i, ++mvert) { - if(mvert->co[axis] < min_co) min_co = mvert->co[axis]; - if(mvert->co[axis] > max_co) max_co = mvert->co[axis]; + for (i = 1; i < numVerts; ++i, ++mvert) { + if (mvert->co[axis] < min_co) min_co = mvert->co[axis]; + if (mvert->co[axis] > max_co) max_co = mvert->co[axis]; } return max_co - min_co; @@ -204,9 +204,9 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, MVert *src_mvert; /* need to avoid infinite recursion here */ - if(amd->start_cap && amd->start_cap != ob) + if (amd->start_cap && amd->start_cap != ob) start_cap = mesh_get_derived_final(scene, amd->start_cap, CD_MASK_MESH); - if(amd->end_cap && amd->end_cap != ob) + if (amd->end_cap && amd->end_cap != ob) end_cap = mesh_get_derived_final(scene, amd->end_cap, CD_MASK_MESH); unit_m4(offset); @@ -214,19 +214,19 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, src_mvert = dm->getVertArray(dm); maxVerts = dm->getNumVerts(dm); - if(amd->offset_type & MOD_ARR_OFF_CONST) + if (amd->offset_type & MOD_ARR_OFF_CONST) add_v3_v3v3(offset[3], offset[3], amd->offset); - if(amd->offset_type & MOD_ARR_OFF_RELATIVE) { - for(j = 0; j < 3; j++) + if (amd->offset_type & MOD_ARR_OFF_RELATIVE) { + for (j = 0; j < 3; j++) offset[3][j] += amd->scale[j] * vertarray_size(src_mvert, maxVerts, j); } - if((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) { + if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) { float obinv[4][4]; float result_mat[4][4]; - if(ob) + if (ob) invert_m4_m4(obinv, ob->obmat); else unit_m4(obinv); @@ -240,36 +240,36 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, /* calculate the offset matrix of the final copy (for merging) */ unit_m4(final_offset); - for(j=0; j < count - 1; j++) { + for (j=0; j < count - 1; j++) { mult_m4_m4m4(tmp_mat, offset, final_offset); copy_m4_m4(final_offset, tmp_mat); } - if(amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob) { + if (amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob) { Curve *cu = amd->curve_ob->data; - if(cu) { + if (cu) { float tmp_mat[3][3]; float scale; object_to_mat3(amd->curve_ob, tmp_mat); scale = mat3_to_scale(tmp_mat); - if(!cu->path) { + if (!cu->path) { cu->flag |= CU_PATH; // needed for path & bevlist makeDispListCurveTypes(scene, amd->curve_ob, 0); } - if(cu->path) + if (cu->path) length = scale*cu->path->totdist; } } /* calculate the maximum number of copies which will fit within the * prescribed length */ - if(amd->fit_type == MOD_ARR_FITLENGTH + if (amd->fit_type == MOD_ARR_FITLENGTH || amd->fit_type == MOD_ARR_FITCURVE) { float dist = sqrt(dot_v3v3(offset[3], offset[3])); - if(dist > 1e-6f) + if (dist > 1e-6f) /* this gives length = first copy start to last copy end * add a tiny offset for floating point rounding errors */ count = (length + 1e-6f) / dist; @@ -278,7 +278,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, count = 1; } - if(count < 1) + if (count < 1) count = 1; /* BMESH_TODO: bumping up the stack level avoids computing the normals diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 8b29ef952af..4bfcd86733c 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -83,7 +83,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(bmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; + if (bmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 2b3c1f00541..e4e89db403d 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -83,7 +83,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, { BooleanModifierData *bmd = (BooleanModifierData*) md; - if(bmd->object) { + if (bmd->object) { DagNode *curNode = dag_get_node(forest, bmd->object); dag_add_relation(forest, curNode, obNode, @@ -96,14 +96,14 @@ static DerivedMesh *get_quick_derivedMesh(DerivedMesh *derivedData, DerivedMesh { DerivedMesh *result = NULL; - if(derivedData->getNumPolys(derivedData) == 0 || dm->getNumPolys(dm) == 0) { + if (derivedData->getNumPolys(derivedData) == 0 || dm->getNumPolys(dm) == 0) { switch(operation) { case eBooleanModifierOp_Intersect: result = CDDM_new(0, 0, 0, 0, 0); break; case eBooleanModifierOp_Union: - if(derivedData->getNumPolys(derivedData)) result = derivedData; + if (derivedData->getNumPolys(derivedData)) result = derivedData; else result = CDDM_copy(dm); break; @@ -125,12 +125,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, BooleanModifierData *bmd = (BooleanModifierData*) md; DerivedMesh *dm; - if(!bmd->object) + if (!bmd->object) return derivedData; dm = bmd->object->derivedFinal; - if(dm) { + if (dm) { DerivedMesh *result; /* when one of objects is empty (has got no faces) we could speed up @@ -138,7 +138,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, * Returning mesh is depended on modifiers operation (sergey) */ result = get_quick_derivedMesh(derivedData, dm, bmd->operation); - if(result == NULL) { + if (result == NULL) { DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ DM_ensure_tessface(derivedData); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ @@ -153,7 +153,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* if new mesh returned, return it; otherwise there was * an error, so delete the modifier object */ - if(result) + if (result) return result; else modifier_setError(md, "%s", TIP_("Can't execute boolean operation.")); diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 65ab6666220..7d4ec3c3d81 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -185,17 +185,19 @@ static void FaceIt_Fill(CSG_IteratorPtr it, CSG_IFace *face) /* reverse face vertices if necessary */ face->vertex_index[1] = mface->v2; - if( face_it->flip == 0 ) { + if ( face_it->flip == 0 ) { face->vertex_index[0] = mface->v1; face->vertex_index[2] = mface->v3; - } else { + } + else { face->vertex_index[2] = mface->v1; face->vertex_index[0] = mface->v3; } if (mface->v4) { face->vertex_index[3] = mface->v4; face->vertex_number = 4; - } else { + } + else { face->vertex_number = 3; } @@ -234,17 +236,22 @@ static void FaceIt_Construct( if (ob->size[0] < 0.0f) { if (ob->size[1] < 0.0f && ob->size[2] < 0.0f) { it->flip = 1; - } else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) { + } + else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) { it->flip = 1; - } else { + } + else { it->flip = 0; } - } else { + } + else { if (ob->size[1] < 0.0f && ob->size[2] < 0.0f) { it->flip = 0; - } else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) { + } + else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) { it->flip = 0; - } else { + } + else { it->flip = 1; } } @@ -382,7 +389,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( origindex_layer = result->getTessFaceDataArray(result, CD_ORIGINDEX); // step through the face iterators - for(i = 0; !face_it->Done(face_it->it); i++) { + for (i = 0; !face_it->Done(face_it->it); i++) { Mesh *orig_me; Object *orig_ob; Material *orig_mat; @@ -422,8 +429,8 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( else mface->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat)); } - else if(orig_mat) { - if(orig_ob == ob1) { + else if (orig_mat) { + if (orig_ob == ob1) { // No need to change materian index for faces from left operand } else { @@ -433,8 +440,8 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( int a; mat_nr = 0; - for(a = 0; a < ob1->totcol; a++) { - if(give_current_material(ob1, a+1) == orig_mat) { + for (a = 0; a < ob1->totcol; a++) { + if (give_current_material(ob1, a+1) == orig_mat) { mat_nr = a; break; } @@ -456,7 +463,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( test_index_face(mface, &result->faceData, i, csgface.vertex_number); - if(origindex_layer && orig_ob == ob2) + if (origindex_layer && orig_ob == ob2) origindex_layer[i] = ORIGINDEX_NONE; } diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index a268f475bc8..ddfb793bd5d 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -172,7 +172,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), else if (numEdges_dst) { MEdge *medge, *me; - if(bmd->randomize) + if (bmd->randomize) BLI_array_randomize(edgeMap, sizeof(*edgeMap), numEdge_src, bmd->seed); @@ -183,11 +183,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), for (i = 0; i < numEdges_dst; i++) { me = medge + edgeMap[i]; - if(!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1))) { + if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1))) { BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(me->v1), SET_INT_IN_POINTER(BLI_ghash_size(vertHash))); } - if(!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2))) { + if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2))) { BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(me->v2), SET_INT_IN_POINTER(BLI_ghash_size(vertHash))); } } diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 6ca3a82dd0e..15940112527 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -86,7 +86,7 @@ static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) flag = cmd->flag & (MOD_CAST_X|MOD_CAST_Y|MOD_CAST_Z); - if((cmd->fac == 0.0f) || flag == 0) return 1; + if ((cmd->fac == 0.0f) || flag == 0) return 1; return 0; } @@ -97,7 +97,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(cmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; + if (cmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } @@ -157,7 +157,7 @@ static void sphere_do( * space), by default, but if the user defined a control object, * we use its location, transformed to ob's local space */ if (ctrl_ob) { - if(flag & MOD_CAST_USE_OB_TRANSFORM) { + if (flag & MOD_CAST_USE_OB_TRANSFORM) { invert_m4_m4(ctrl_ob->imat, ctrl_ob->obmat); mult_m4_m4m4(mat, ctrl_ob->imat, ob->obmat); invert_m4_m4(imat, mat); @@ -178,14 +178,14 @@ static void sphere_do( * only those vertices should be affected */ modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index); - if(flag & MOD_CAST_SIZE_FROM_RADIUS) { + if (flag & MOD_CAST_SIZE_FROM_RADIUS) { len = cmd->radius; } else { len = cmd->size; } - if(len <= 0) { + if (len <= 0) { for (i = 0; i < numVerts; i++) { len += len_v3v3(center, vertexCos[i]); } @@ -207,10 +207,11 @@ static void sphere_do( float weight; copy_v3_v3(tmp_co, vertexCos[i]); - if(ctrl_ob) { - if(flag & MOD_CAST_USE_OB_TRANSFORM) { + if (ctrl_ob) { + if (flag & MOD_CAST_USE_OB_TRANSFORM) { mul_m4_v3(mat, tmp_co); - } else { + } + else { sub_v3_v3(tmp_co, center); } } @@ -239,10 +240,11 @@ static void sphere_do( if (flag & MOD_CAST_Z) tmp_co[2] = fac*vec[2]*len + facm*tmp_co[2]; - if(ctrl_ob) { - if(flag & MOD_CAST_USE_OB_TRANSFORM) { + if (ctrl_ob) { + if (flag & MOD_CAST_USE_OB_TRANSFORM) { mul_m4_v3(imat, tmp_co); - } else { + } + else { add_v3_v3(tmp_co, center); } } @@ -257,10 +259,11 @@ static void sphere_do( float tmp_co[3]; copy_v3_v3(tmp_co, vertexCos[i]); - if(ctrl_ob) { - if(flag & MOD_CAST_USE_OB_TRANSFORM) { + if (ctrl_ob) { + if (flag & MOD_CAST_USE_OB_TRANSFORM) { mul_m4_v3(mat, tmp_co); - } else { + } + else { sub_v3_v3(tmp_co, center); } } @@ -283,10 +286,11 @@ static void sphere_do( if (flag & MOD_CAST_Z) tmp_co[2] = fac*vec[2]*len + facm*tmp_co[2]; - if(ctrl_ob) { - if(flag & MOD_CAST_USE_OB_TRANSFORM) { + if (ctrl_ob) { + if (flag & MOD_CAST_USE_OB_TRANSFORM) { mul_m4_v3(imat, tmp_co); - } else { + } + else { add_v3_v3(tmp_co, center); } } @@ -329,7 +333,7 @@ static void cuboid_do( modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index); if (ctrl_ob) { - if(flag & MOD_CAST_USE_OB_TRANSFORM) { + if (flag & MOD_CAST_USE_OB_TRANSFORM) { invert_m4_m4(ctrl_ob->imat, ctrl_ob->obmat); mult_m4_m4m4(mat, ctrl_ob->imat, ob->obmat); invert_m4_m4(imat, mat); @@ -339,17 +343,19 @@ static void cuboid_do( mul_v3_m4v3(center, ob->imat, ctrl_ob->obmat[3]); } - if((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) { - for(i = 0; i < 3; i++) { + if ((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) { + for (i = 0; i < 3; i++) { min[i] = -cmd->radius; max[i] = cmd->radius; } - } else if(!(flag & MOD_CAST_SIZE_FROM_RADIUS) && cmd->size > 0) { - for(i = 0; i < 3; i++) { + } + else if (!(flag & MOD_CAST_SIZE_FROM_RADIUS) && cmd->size > 0) { + for (i = 0; i < 3; i++) { min[i] = -cmd->size; max[i] = cmd->size; } - } else { + } + else { /* get bound box */ /* We can't use the object's bound box because other modifiers * may have changed the vertex data. */ @@ -406,10 +412,11 @@ static void cuboid_do( float tmp_co[3]; copy_v3_v3(tmp_co, vertexCos[i]); - if(ctrl_ob) { - if(flag & MOD_CAST_USE_OB_TRANSFORM) { + if (ctrl_ob) { + if (flag & MOD_CAST_USE_OB_TRANSFORM) { mul_m4_v3(mat, tmp_co); - } else { + } + else { sub_v3_v3(tmp_co, center); } } @@ -421,7 +428,7 @@ static void cuboid_do( } for (j = 0; j < dvert[i].totweight; ++j) { - if(dvert[i].dw[j].def_nr == defgrp_index) { + if (dvert[i].dw[j].def_nr == defgrp_index) { dw = &dvert[i].dw[j]; break; } @@ -482,10 +489,11 @@ static void cuboid_do( if (flag & MOD_CAST_Z) tmp_co[2] = facm * tmp_co[2] + fac * tmp_co[2] * fbb; - if(ctrl_ob) { - if(flag & MOD_CAST_USE_OB_TRANSFORM) { + if (ctrl_ob) { + if (flag & MOD_CAST_USE_OB_TRANSFORM) { mul_m4_v3(imat, tmp_co); - } else { + } + else { add_v3_v3(tmp_co, center); } } @@ -502,10 +510,11 @@ static void cuboid_do( float tmp_co[3]; copy_v3_v3(tmp_co, vertexCos[i]); - if(ctrl_ob) { - if(flag & MOD_CAST_USE_OB_TRANSFORM) { + if (ctrl_ob) { + if (flag & MOD_CAST_USE_OB_TRANSFORM) { mul_m4_v3(mat, tmp_co); - } else { + } + else { sub_v3_v3(tmp_co, center); } } @@ -550,10 +559,11 @@ static void cuboid_do( if (flag & MOD_CAST_Z) tmp_co[2] = facm * tmp_co[2] + fac * tmp_co[2] * fbb; - if(ctrl_ob) { - if(flag & MOD_CAST_USE_OB_TRANSFORM) { + if (ctrl_ob) { + if (flag & MOD_CAST_USE_OB_TRANSFORM) { mul_m4_v3(imat, tmp_co); - } else { + } + else { add_v3_v3(tmp_co, center); } } @@ -576,11 +586,12 @@ static void deformVerts(ModifierData *md, Object *ob, if (cmd->type == MOD_CAST_TYPE_CUBOID) { cuboid_do(cmd, ob, dm, vertexCos, numVerts); - } else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */ + } + else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */ sphere_do(cmd, ob, dm, vertexCos, numVerts); } - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } @@ -593,11 +604,12 @@ static void deformVertsEM( if (cmd->type == MOD_CAST_TYPE_CUBOID) { cuboid_do(cmd, ob, dm, vertexCos, numVerts); - } else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */ + } + else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */ sphere_do(cmd, ob, dm, vertexCos, numVerts); } - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index f23690454c0..d5d8439c749 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -61,7 +61,7 @@ static void initData(ModifierData *md) clmd->point_cache = BKE_ptcache_add(&clmd->ptcaches); /* check for alloc failing */ - if(!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache) + if (!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache) return; cloth_init (clmd); @@ -78,12 +78,12 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, if (!clmd->sim_parms || !clmd->coll_parms) { initData(md); - if(!clmd->sim_parms || !clmd->coll_parms) + if (!clmd->sim_parms || !clmd->coll_parms) return; } dm = get_dm(ob, NULL, derivedData, NULL, 0); - if(dm == derivedData) + if (dm == derivedData) dm = CDDM_copy(dm); CDDM_apply_vert_coords(dm, vertexCos); @@ -92,7 +92,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, clothModifier_do(clmd, md->scene, ob, dm, vertexCos); - if(result) { + if (result) { result->getVertCos(result, vertexCos); result->release(result); } @@ -106,8 +106,8 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, Scene *scene, Ob Base *base; - if(clmd) { - for(base = scene->base.first; base; base= base->next) { + if (clmd) { + for (base = scene->base.first; base; base= base->next) { Object *ob1= base->object; if (ob1 != ob) { CollisionModifierData *coll_clmd = (CollisionModifierData *)modifiers_findByType(ob1, eModifierType_Collision); @@ -125,10 +125,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; ClothModifierData *clmd = (ClothModifierData*)md; - if(cloth_uses_vgroup(clmd)) + if (cloth_uses_vgroup(clmd)) dataMask |= CD_MASK_MDEFORMVERT; - if(clmd->sim_parms->shapekey_rest != 0) + if (clmd->sim_parms->shapekey_rest != 0) dataMask |= CD_MASK_CLOTH_ORCO; return dataMask; @@ -139,20 +139,20 @@ static void copyData(ModifierData *md, ModifierData *target) ClothModifierData *clmd = (ClothModifierData*) md; ClothModifierData *tclmd = (ClothModifierData*) target; - if(tclmd->sim_parms) { - if(tclmd->sim_parms->effector_weights) + if (tclmd->sim_parms) { + if (tclmd->sim_parms->effector_weights) MEM_freeN(tclmd->sim_parms->effector_weights); MEM_freeN(tclmd->sim_parms); } - if(tclmd->coll_parms) + if (tclmd->coll_parms) MEM_freeN(tclmd->coll_parms); BKE_ptcache_free_list(&tclmd->ptcaches); tclmd->point_cache = NULL; tclmd->sim_parms = MEM_dupallocN(clmd->sim_parms); - if(clmd->sim_parms->effector_weights) + if (clmd->sim_parms->effector_weights) tclmd->sim_parms->effector_weights = MEM_dupallocN(clmd->sim_parms->effector_weights); tclmd->coll_parms = MEM_dupallocN(clmd->coll_parms); tclmd->point_cache = BKE_ptcache_copy_list(&tclmd->ptcaches, &clmd->ptcaches); @@ -169,17 +169,17 @@ static void freeData(ModifierData *md) ClothModifierData *clmd = (ClothModifierData*) md; if (clmd) { - if(G.rt > 0) + if (G.rt > 0) printf("clothModifier_freeData\n"); cloth_free_modifier_extern (clmd); - if(clmd->sim_parms) { - if(clmd->sim_parms->effector_weights) + if (clmd->sim_parms) { + if (clmd->sim_parms->effector_weights) MEM_freeN(clmd->sim_parms->effector_weights); MEM_freeN(clmd->sim_parms); } - if(clmd->coll_parms) + if (clmd->coll_parms) MEM_freeN(clmd->coll_parms); BKE_ptcache_free_list(&clmd->ptcaches); @@ -192,11 +192,11 @@ static void foreachIDLink(ModifierData *md, Object *ob, { ClothModifierData *clmd = (ClothModifierData*) md; - if(clmd->coll_parms) { + if (clmd->coll_parms) { walk(userData, ob, (ID **)&clmd->coll_parms->group); } - if(clmd->sim_parms && clmd->sim_parms->effector_weights) { + if (clmd->sim_parms && clmd->sim_parms->effector_weights) { walk(userData, ob, (ID **)&clmd->sim_parms->effector_weights->group); } } diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index a1467c55ecf..b3faf6c140a 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -73,19 +73,19 @@ static void freeData(ModifierData *md) if (collmd) { - if(collmd->bvhtree) + if (collmd->bvhtree) BLI_bvhtree_free(collmd->bvhtree); - if(collmd->x) + if (collmd->x) MEM_freeN(collmd->x); - if(collmd->xnew) + if (collmd->xnew) MEM_freeN(collmd->xnew); - if(collmd->current_x) + if (collmd->current_x) MEM_freeN(collmd->current_x); - if(collmd->current_xnew) + if (collmd->current_xnew) MEM_freeN(collmd->current_xnew); - if(collmd->current_v) + if (collmd->current_v) MEM_freeN(collmd->current_v); - if(collmd->mfaces) + if (collmd->mfaces) MEM_freeN(collmd->mfaces); collmd->x = NULL; @@ -117,16 +117,16 @@ static void deformVerts(ModifierData *md, Object *ob, MVert *tempVert = NULL; /* if possible use/create DerivedMesh */ - if(derivedData) dm = CDDM_copy(derivedData); - else if(ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob); + if (derivedData) dm = CDDM_copy(derivedData); + else if (ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob); - if(!ob->pd) + if (!ob->pd) { printf("CollisionModifier deformVerts: Should not happen!\n"); return; } - if(dm) + if (dm) { float current_time = 0; unsigned int numverts = 0; @@ -136,20 +136,20 @@ static void deformVerts(ModifierData *md, Object *ob, current_time = BKE_curframe(md->scene); - if(G.rt > 0) + if (G.rt > 0) printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew); numverts = dm->getNumVerts ( dm ); - if((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics())) + if ((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics())) { unsigned int i; // check if mesh has changed - if(collmd->x && (numverts != collmd->numverts)) + if (collmd->x && (numverts != collmd->numverts)) freeData((ModifierData *)collmd); - if(collmd->time_xnew == -1000) // first time + if (collmd->time_xnew == -1000) // first time { collmd->x = dm->dupVertArray(dm); // frame start position @@ -176,7 +176,7 @@ static void deformVerts(ModifierData *md, Object *ob, collmd->time_x = collmd->time_xnew = current_time; } - else if(numverts == collmd->numverts) { + else if (numverts == collmd->numverts) { // put positions to old positions tempVert = collmd->x; collmd->x = collmd->xnew; @@ -194,8 +194,8 @@ static void deformVerts(ModifierData *md, Object *ob, memcpy(collmd->current_x, collmd->x, numverts*sizeof(MVert)); /* check if GUI setting has changed for bvh */ - if(collmd->bvhtree) { - if(ob->pd->pdef_sboft != BLI_bvhtree_getepsilon(collmd->bvhtree)) { + if (collmd->bvhtree) { + if (ob->pd->pdef_sboft != BLI_bvhtree_getepsilon(collmd->bvhtree)) { BLI_bvhtree_free(collmd->bvhtree); collmd->bvhtree = bvhtree_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->current_x, numverts, ob->pd->pdef_sboft); } @@ -213,12 +213,12 @@ static void deformVerts(ModifierData *md, Object *ob, collmd->time_xnew = current_time; } - else if(numverts != collmd->numverts) { + else if (numverts != collmd->numverts) { freeData((ModifierData *)collmd); } } - else if(current_time < collmd->time_xnew) { + else if (current_time < collmd->time_xnew) { freeData((ModifierData *)collmd); } else { @@ -228,7 +228,7 @@ static void deformVerts(ModifierData *md, Object *ob, } } - if(dm) + if (dm) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 0ff37c6fa76..f516f971dc0 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -73,7 +73,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(cmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT; + if (cmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } @@ -131,11 +131,11 @@ static void deformVertsEM( { DerivedMesh *dm = derivedData; - if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); + if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0); - if(!derivedData) dm->release(dm); + if (!derivedData) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 3c3381dc36b..f55faf9c183 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -97,7 +97,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), if (mf->v4) numTris++; } - if(numTris<3) { + if (numTris<3) { modifier_setError(md, "%s", TIP_("Modifier requires more than 3 input faces (triangles).")); dm = CDDM_copy(dm); return dm; @@ -109,7 +109,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), lod.vertex_num= totvert; lod.face_num= numTris; - for(a=0; av1; tri[1]= mf->v2; tri[2]= mf->v3; - if(mf->v4) { + if (mf->v4) { tri = &lod.triangle_index_buffer[3*numTris++]; tri[0]= mf->v1; tri[1]= mf->v3; @@ -135,15 +135,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), } dmd->faceCount = 0; - if(LOD_LoadMesh(&lod) ) { - if( LOD_PreprocessMesh(&lod) ) { + if (LOD_LoadMesh(&lod) ) { + if ( LOD_PreprocessMesh(&lod) ) { /* we assume the decim_faces tells how much to reduce */ - while(lod.face_num > numTris*dmd->percent) { - if( LOD_CollapseEdge(&lod)==0) break; + while (lod.face_num > numTris*dmd->percent) { + if ( LOD_CollapseEdge(&lod)==0) break; } - if(lod.vertex_num>2) { + if (lod.vertex_num>2) { result = CDDM_new(lod.vertex_num, 0, lod.face_num, 0, 0); dmd->faceCount = lod.face_num; } @@ -151,16 +151,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), result = CDDM_new(lod.vertex_num, 0, 0, 0, 0); mvert = CDDM_get_verts(result); - for(a=0; aco, vbCo); } - if(lod.vertex_num>2) { + if (lod.vertex_num>2) { mface = CDDM_get_tessfaces(result); - for(a=0; av1 = tri[0]; diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 55971e358a9..f3d7a24e517 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -87,10 +87,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(dmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; + if (dmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; /* ask for UV coordinates if we need them */ - if(dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE; + if (dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE; return dataMask; } @@ -99,7 +99,7 @@ static int dependsOnTime(ModifierData *md) { DisplaceModifierData *dmd = (DisplaceModifierData *)md; - if(dmd->texture) { + if (dmd->texture) { return BKE_texture_dependsOnTime(dmd->texture); } else { @@ -151,7 +151,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, { DisplaceModifierData *dmd = (DisplaceModifierData*) md; - if(dmd->map_object && dmd->texmapping == MOD_DISP_MAP_OBJECT) { + if (dmd->map_object && dmd->texmapping == MOD_DISP_MAP_OBJECT) { DagNode *curNode = dag_get_node(forest, dmd->map_object); dag_add_relation(forest, curNode, obNode, @@ -159,7 +159,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, } - if(dmd->texmapping == MOD_DISP_MAP_GLOBAL) + if (dmd->texmapping == MOD_DISP_MAP_GLOBAL) dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Displace Modifier"); @@ -177,8 +177,8 @@ static void displaceModifier_do( float (*tex_co)[3]; float weight= 1.0f; /* init value unused but some compilers may complain */ - if(!dmd->texture) return; - if(dmd->strength == 0.0f) return; + if (!dmd->texture) return; + if (dmd->strength == 0.0f) return; mvert = CDDM_get_verts(dm); modifier_get_vgroup(ob, dm, dmd->defgrp_name, &dvert, &defgrp_index); @@ -187,13 +187,13 @@ static void displaceModifier_do( "displaceModifier_do tex_co"); get_texture_coords((MappingInfoModifierData *)dmd, ob, dm, vertexCos, tex_co, numVerts); - for(i = 0; i < numVerts; ++i) { + for (i = 0; i < numVerts; ++i) { TexResult texres; float delta = 0, strength = dmd->strength; - if(dvert) { + if (dvert) { weight= defvert_find_weight(dvert + i, defgrp_index); - if(weight == 0.0f) continue; + if (weight == 0.0f) continue; } texres.nor = NULL; @@ -201,7 +201,7 @@ static void displaceModifier_do( delta = texres.tin - dmd->midlevel; - if(dvert) strength *= weight; + if (dvert) strength *= weight; delta *= strength; CLAMP(delta, -10000, 10000); @@ -244,7 +244,7 @@ static void deformVerts(ModifierData *md, Object *ob, displaceModifier_do((DisplaceModifierData *)md, ob, dm, vertexCos, numVerts); - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } @@ -257,7 +257,7 @@ static void deformVertsEM( displaceModifier_do((DisplaceModifierData *)md, ob, dm, vertexCos, numVerts); - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index e567765d61b..5005e2c010d 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -75,7 +75,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) if (pmd->canvas) { DynamicPaintSurface *surface = pmd->canvas->surfaces.first; - for(; surface; surface=surface->next) { + for (; surface; surface=surface->next) { /* tface */ if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ || surface->init_color_type == MOD_DPAINT_INITIAL_TEXTURE) { @@ -143,10 +143,10 @@ static void foreachIDLink(ModifierData *md, Object *ob, { DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md; - if(pmd->canvas) { + if (pmd->canvas) { DynamicPaintSurface *surface = pmd->canvas->surfaces.first; - for(; surface; surface=surface->next) { + for (; surface; surface=surface->next) { walk(userData, ob, (ID **)&surface->brush_group); walk(userData, ob, (ID **)&surface->init_texture); } diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index e50c0d5521b..6ffacba3b68 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -134,7 +134,7 @@ static void copyData(ModifierData *md, ModifierData *target) static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, Object *ob, DerivedMesh *dm) { - if(!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG))) + if (!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG))) return dm; return doEdgeSplit(dm, emd, ob); @@ -149,7 +149,7 @@ static DerivedMesh *applyModifier( result = edgesplitModifier_do(emd, ob, derivedData); - if(result != derivedData) + if (result != derivedData) CDDM_calc_normals(result); return result; diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 39beecab22f..ddc79c4e4f8 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -67,7 +67,7 @@ static void freeData(ModifierData *md) { ExplodeModifierData *emd= (ExplodeModifierData*) md; - if(emd->facepa) MEM_freeN(emd->facepa); + if (emd->facepa) MEM_freeN(emd->facepa); } static void copyData(ModifierData *md, ModifierData *target) { @@ -88,7 +88,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) ExplodeModifierData *emd= (ExplodeModifierData*) md; CustomDataMask dataMask = 0; - if(emd->vgroup) + if (emd->vgroup) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; @@ -115,7 +115,7 @@ static void createFacepa(ExplodeModifierData *emd, BLI_srandom(psys->seed); - if(emd->facepa) + if (emd->facepa) MEM_freeN(emd->facepa); facepa = emd->facepa = MEM_callocN(sizeof(int)*totface, "explode_facepa"); @@ -123,21 +123,21 @@ static void createFacepa(ExplodeModifierData *emd, vertpa = MEM_callocN(sizeof(int)*totvert, "explode_vertpa"); /* initialize all faces & verts to no particle */ - for(i=0; ivgroup){ + if (emd->vgroup) { MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); - if(dvert){ + if (dvert) { const int defgrp_index= emd->vgroup-1; - for(i=0; iprotect)*val + emd->protect*0.5f; - if(val < defvert_find_weight(dvert, defgrp_index)) + if (val < defvert_find_weight(dvert, defgrp_index)) vertpa[i] = -1; } } @@ -145,17 +145,17 @@ static void createFacepa(ExplodeModifierData *emd, /* make tree of emitter locations */ tree=BLI_kdtree_new(totpart); - for(p=0,pa=psys->particles; pparticles; ppart->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,NULL,NULL,NULL,NULL,NULL); BLI_kdtree_insert(tree, p, co, NULL); } BLI_kdtree_balance(tree); /* set face-particle-indexes to nearest particle to face center */ - for(i=0,fa=mface; iv1].co,mvert[fa->v2].co); add_v3_v3(center, mvert[fa->v3].co); - if(fa->v4){ + if (fa->v4) { add_v3_v3(center, mvert[fa->v4].co); mul_v3_fl(center,0.25); } @@ -167,19 +167,19 @@ static void createFacepa(ExplodeModifierData *emd, v1=vertpa[fa->v1]; v2=vertpa[fa->v2]; v3=vertpa[fa->v3]; - if(fa->v4) + if (fa->v4) v4=vertpa[fa->v4]; - if(v1>=0 && v2>=0 && v3>=0 && (fa->v4==0 || v4>=0)) + if (v1>=0 && v2>=0 && v3>=0 && (fa->v4==0 || v4>=0)) facepa[i]=p; - if(v1>=0) vertpa[fa->v1]=p; - if(v2>=0) vertpa[fa->v2]=p; - if(v3>=0) vertpa[fa->v3]=p; - if(fa->v4 && v4>=0) vertpa[fa->v4]=p; + if (v1>=0) vertpa[fa->v1]=p; + if (v2>=0) vertpa[fa->v2]=p; + if (v3>=0) vertpa[fa->v3]=p; + if (fa->v4 && v4>=0) vertpa[fa->v4]=p; } - if(vertpa) MEM_freeN(vertpa); + if (vertpa) MEM_freeN(vertpa); BLI_kdtree_free(tree); } @@ -246,7 +246,7 @@ static void remap_uvs_3_6_9_12(DerivedMesh *dm, DerivedMesh *split, int numlayer MTFace *mf, *df1, *df2, *df3; int l; - for(l=0; lfaceData, CD_MTFACE, l); df1 = mf+cur; df2 = df1 + 1; @@ -294,7 +294,7 @@ static void remap_uvs_5_10(DerivedMesh *dm, DerivedMesh *split, int numlayer, in MTFace *mf, *df1, *df2; int l; - for(l=0; lfaceData, CD_MTFACE, l); df1 = mf+cur; df2 = df1 + 1; @@ -355,7 +355,7 @@ static void remap_uvs_15(DerivedMesh *dm, DerivedMesh *split, int numlayer, int MTFace *mf, *df1, *df2, *df3, *df4; int l; - for(l=0; lfaceData, CD_MTFACE, l); df1 = mf+cur; df2 = df1 + 1; @@ -419,7 +419,7 @@ static void remap_uvs_7_11_13_14(DerivedMesh *dm, DerivedMesh *split, int numlay MTFace *mf, *df1, *df2, *df3; int l; - for(l=0; lfaceData, CD_MTFACE, l); df1 = mf+cur; df2 = df1 + 1; @@ -468,7 +468,7 @@ static void remap_uvs_19_21_22(DerivedMesh *dm, DerivedMesh *split, int numlayer MTFace *mf, *df1, *df2; int l; - for(l=0; lfaceData, CD_MTFACE, l); df1 = mf+cur; df2 = df1 + 1; @@ -519,7 +519,7 @@ static void remap_uvs_23(DerivedMesh *dm, DerivedMesh *split, int numlayer, int MTFace *mf, *df1, *df2; int l; - for(l=0; lfaceData, CD_MTFACE, l); df1 = mf+cur; df2 = df1 + 1; @@ -569,7 +569,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) vertpa[mf->v1]=facepa[i]; vertpa[mf->v2]=facepa[i]; vertpa[mf->v3]=facepa[i]; - if(mf->v4) + if (mf->v4) vertpa[mf->v4]=facepa[i]; } @@ -579,37 +579,37 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) v2=vertpa[mf->v2]; v3=vertpa[mf->v3]; - if(v1!=v2){ + if (v1!=v2) { BLI_edgehash_insert(edgehash, mf->v1, mf->v2, NULL); (*fs) |= 1; } - if(v2!=v3){ + if (v2!=v3) { BLI_edgehash_insert(edgehash, mf->v2, mf->v3, NULL); (*fs) |= 2; } - if(mf->v4){ + if (mf->v4) { v4=vertpa[mf->v4]; - if(v3!=v4){ + if (v3!=v4) { BLI_edgehash_insert(edgehash, mf->v3, mf->v4, NULL); (*fs) |= 4; } - if(v1!=v4){ + if (v1!=v4) { BLI_edgehash_insert(edgehash, mf->v1, mf->v4, NULL); (*fs) |= 8; } /* mark center vertex as a fake edge split */ - if(*fs == 15) + if (*fs == 15) BLI_edgehash_insert(edgehash, mf->v1, mf->v3, NULL); } else { (*fs) |= 16; /* mark face as tri */ - if(v1!=v3){ + if (v1!=v3) { BLI_edgehash_insert(edgehash, mf->v1, mf->v3, NULL); (*fs) |= 4; } @@ -619,21 +619,21 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) /* count splits & create indexes for new verts */ ehi= BLI_edgehashIterator_new(edgehash); totesplit=totvert; - for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { + for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totesplit)); totesplit++; } BLI_edgehashIterator_free(ehi); /* count new faces due to splitting */ - for(i=0,fs=facesplit; ifaceData, CD_MTFACE); /* copy new faces & verts (is it really this painful with custom data??) */ - for(i=0; igetVert(dm, i, &source); @@ -655,7 +655,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) /* create new verts */ ehi= BLI_edgehashIterator_new(edgehash); - for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { + for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { BLI_edgehashIterator_getKey(ehi, &ed_v1, &ed_v2); esplit= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi)); mv=CDDM_get_vert(splitdm, ed_v2); @@ -675,7 +675,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) /* create new faces */ curdupface=0;//=totface; //curdupin=totesplit; - for(i=0,fs=facesplit; igetTessFaceData(dm, i, CD_MFACE); switch(*fs) { @@ -716,18 +716,18 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) case 9: case 12: remap_faces_3_6_9_12(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]); - if(numlayer) + if (numlayer) remap_uvs_3_6_9_12(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]); break; case 5: case 10: remap_faces_5_10(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]); - if(numlayer) + if (numlayer) remap_uvs_5_10(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]); break; case 15: remap_faces_15(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]); - if(numlayer) + if (numlayer) remap_uvs_15(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]); break; case 7: @@ -735,19 +735,19 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) case 13: case 14: remap_faces_7_11_13_14(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]); - if(numlayer) + if (numlayer) remap_uvs_7_11_13_14(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]); break; case 19: case 21: case 22: remap_faces_19_21_22(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2]); - if(numlayer) + if (numlayer) remap_uvs_19_21_22(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2]); break; case 23: remap_faces_23(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2]); - if(numlayer) + if (numlayer) remap_uvs_23(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2]); break; case 0: @@ -755,7 +755,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) df1 = get_dface(dm, splitdm, curdupface, i, mf); facepa[curdupface] = vertpa[mf->v1]; - if(df1->v4) + if (df1->v4) df1->flag |= ME_FACE_SEL; else df1->flag &= ~ME_FACE_SEL; @@ -765,7 +765,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) curdupface += add_faces[*fs]+1; } - for(i=0; ifaceData, i, (mf->flag & ME_FACE_SEL ? 4 : 3)); } @@ -833,7 +833,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, /* do mindex + totvert to ensure the vertex index to be the first * with BLI_edgehashIterator_getKey */ - if(facepa[i]==totpart || cfra < (pars+facepa[i])->time) + if (facepa[i]==totpart || cfra < (pars+facepa[i])->time) mindex = totvert+totpart; else mindex = totvert+facepa[i]; @@ -844,13 +844,13 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, BLI_edgehash_insert(vertpahash, mf->v1, mindex, NULL); BLI_edgehash_insert(vertpahash, mf->v2, mindex, NULL); BLI_edgehash_insert(vertpahash, mf->v3, mindex, NULL); - if(mf->v4) + if (mf->v4) BLI_edgehash_insert(vertpahash, mf->v4, mindex, NULL); } /* make new vertice indexes & count total vertices after duplication */ ehi= BLI_edgehashIterator_new(vertpahash); - for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { + for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totdup)); totdup++; } @@ -868,7 +868,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, /* duplicate & displace vertices */ ehi= BLI_edgehashIterator_new(vertpahash); - for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { + for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { MVert source; MVert *dest; @@ -883,7 +883,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, DM_copy_vert_data(dm, explode, ed_v1, v, 1); *dest = source; - if(ed_v2 != totpart) { + if (ed_v2 != totpart) { /* get particle */ pa= pars + ed_v2; @@ -901,7 +901,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, sub_qt_qtqt(rot, state.rot, birth.rot); mul_qt_v3(rot, vertco); - if(emd->flag & eExplodeFlag_PaSize) + if (emd->flag & eExplodeFlag_PaSize) mul_v3_fl(vertco,pa->size); add_v3_v3(vertco, state.co); @@ -919,9 +919,9 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, if (facepa[i]!=totpart) { pa=pars+facepa[i]; - if(pa->alive==PARS_UNBORN && (emd->flag&eExplodeFlag_Unborn)==0) continue; - if(pa->alive==PARS_ALIVE && (emd->flag&eExplodeFlag_Alive)==0) continue; - if(pa->alive==PARS_DEAD && (emd->flag&eExplodeFlag_Dead)==0) continue; + if (pa->alive==PARS_UNBORN && (emd->flag&eExplodeFlag_Unborn)==0) continue; + if (pa->alive==PARS_ALIVE && (emd->flag&eExplodeFlag_Alive)==0) continue; + if (pa->alive==PARS_DEAD && (emd->flag&eExplodeFlag_Dead)==0) continue; } dm->getTessFace(dm,i,&source); @@ -929,7 +929,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, orig_v4 = source.v4; - if(facepa[i]!=totpart && cfra < pa->time) + if (facepa[i]!=totpart && cfra < pa->time) mindex = totvert+totpart; else mindex = totvert+facepa[i]; @@ -937,7 +937,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, source.v1 = edgecut_get(vertpahash, source.v1, mindex); source.v2 = edgecut_get(vertpahash, source.v2, mindex); source.v3 = edgecut_get(vertpahash, source.v3, mindex); - if(source.v4) + if (source.v4) source.v4 = edgecut_get(vertpahash, source.v4, mindex); DM_copy_tessface_data(dm,explode,i,u,1); @@ -945,7 +945,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, *mf = source; /* override uv channel for particle age */ - if(mtface) { + if (mtface) { float age = (cfra - pa->time)/pa->lifetime; /* Clamp to this range to avoid flipping to the other side of the coordinates. */ CLAMP(age, 0.001f, 0.999f); @@ -968,7 +968,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, CDDM_tessfaces_to_faces(explode); CDDM_calc_normals(explode); - if(psmd->psys->lattice){ + if (psmd->psys->lattice) { end_latt_deform(psmd->psys->lattice); psmd->psys->lattice= NULL; } @@ -981,8 +981,8 @@ static ParticleSystemModifierData * findPrecedingParticlesystem(Object *ob, Modi ModifierData *md; ParticleSystemModifierData *psmd= NULL; - for (md=ob->modifiers.first; emd!=md; md=md->next){ - if(md->type==eModifierType_ParticleSystem) + for (md=ob->modifiers.first; emd!=md; md=md->next) { + if (md->type==eModifierType_ParticleSystem) psmd= (ParticleSystemModifierData*) md; } return psmd; @@ -998,29 +998,29 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ - if(psmd){ + if (psmd) { ParticleSystem * psys=psmd->psys; - if(psys==NULL || psys->totpart==0) return derivedData; - if(psys->part==NULL || psys->particles==NULL) return derivedData; - if(psmd->dm==NULL) return derivedData; + if (psys==NULL || psys->totpart==0) return derivedData; + if (psys->part==NULL || psys->particles==NULL) return derivedData; + if (psmd->dm==NULL) return derivedData; /* 1. find faces to be exploded if needed */ - if(emd->facepa == NULL + if (emd->facepa == NULL || psmd->flag&eParticleSystemFlag_Pars || emd->flag&eExplodeFlag_CalcFaces || MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumTessFaces(dm)) { - if(psmd->flag & eParticleSystemFlag_Pars) + if (psmd->flag & eParticleSystemFlag_Pars) psmd->flag &= ~eParticleSystemFlag_Pars; - if(emd->flag & eExplodeFlag_CalcFaces) + if (emd->flag & eExplodeFlag_CalcFaces) emd->flag &= ~eExplodeFlag_CalcFaces; createFacepa(emd,psmd,derivedData); } /* 2. create new mesh */ - if(emd->flag & eExplodeFlag_EdgeCut){ + if (emd->flag & eExplodeFlag_EdgeCut) { int *facepa = emd->facepa; DerivedMesh *splitdm=cutEdges(emd,dm); DerivedMesh *explode=explodeMesh(emd, psmd, md->scene, ob, splitdm); diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 3df8718a7c1..9a80f241a00 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -68,7 +68,7 @@ static void copyData(ModifierData *md, ModifierData *target) FluidsimModifierData *fluidmd= (FluidsimModifierData*) md; FluidsimModifierData *tfluidmd= (FluidsimModifierData*) target; - if(tfluidmd->fss) + if (tfluidmd->fss) MEM_freeN(tfluidmd->fss); tfluidmd->fss = MEM_dupallocN(fluidmd->fss); @@ -85,7 +85,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *result = NULL; /* check for alloc failing */ - if(!fluidmd->fss) { + if (!fluidmd->fss) { initData(md); if (!fluidmd->fss) { @@ -105,15 +105,15 @@ static void updateDepgraph( FluidsimModifierData *fluidmd= (FluidsimModifierData*) md; Base *base; - if(fluidmd && fluidmd->fss) { - if(fluidmd->fss->type == OB_FLUIDSIM_DOMAIN) { - for(base = scene->base.first; base; base= base->next) { + if (fluidmd && fluidmd->fss) { + if (fluidmd->fss->type == OB_FLUIDSIM_DOMAIN) { + for (base = scene->base.first; base; base= base->next) { Object *ob1= base->object; - if(ob1 != ob) { + if (ob1 != ob) { FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob1, eModifierType_Fluidsim); // only put dependancies from NON-DOMAIN fluids in here - if(fluidmdtmp && fluidmdtmp->fss && (fluidmdtmp->fss->type!=OB_FLUIDSIM_DOMAIN)) { + if (fluidmdtmp && fluidmdtmp->fss && (fluidmdtmp->fss->type!=OB_FLUIDSIM_DOMAIN)) { DagNode *curNode = dag_get_node(forest, ob1); dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Fluidsim Object"); } diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 2ccae9671b3..9cd656c3621 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -66,13 +66,13 @@ void fluidsim_init(FluidsimModifierData *fluidmd) { #ifdef WITH_MOD_FLUID - if(fluidmd) + if (fluidmd) { FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings"); fluidmd->fss = fss; - if(!fss) + if (!fss) return; fss->fmd = fluidmd; @@ -199,21 +199,21 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam // read number of normals - if(gotBytes) + if (gotBytes) gotBytes = gzread(gzf, &wri, sizeof(wri)); // skip normals gotBytes = gzseek(gzf, numverts * 3 * sizeof(float), SEEK_CUR) != -1; /* get no. of triangles */ - if(gotBytes) + if (gotBytes) gotBytes = gzread(gzf, &wri, sizeof(wri)); numfaces = wri; gzclose(gzf); // ------------------------------------------------ - if(!numfaces || !numverts || !gotBytes) + if (!numfaces || !numverts || !gotBytes) return NULL; gzf = BLI_gzopen(filename, "rb"); @@ -224,7 +224,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam dm = CDDM_new(numverts, 0, 0, numfaces * 3, numfaces); - if(!dm) + if (!dm) { gzclose(gzf); return NULL; @@ -236,30 +236,30 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam // read vertex position from file mv = CDDM_get_verts(dm); - for(i=0; ico, sizeof(float) * 3); // should be the same as numverts gotBytes = gzread(gzf, &wri, sizeof(wri)); - if(wri != numverts) + if (wri != numverts) { - if(dm) + if (dm) dm->release(dm); gzclose(gzf); return NULL; } normals = MEM_callocN(sizeof(short) * numverts * 3, "fluid_tmp_normals" ); - if(!normals) + if (!normals) { - if(dm) + if (dm) dm->release(dm); gzclose(gzf); return NULL; } // read normals from file (but don't save them yet) - for(i=numverts, no_s= normals; i>0; i--, no_s += 3) + for (i=numverts, no_s= normals; i>0; i--, no_s += 3) { gotBytes = gzread(gzf, no, sizeof(float) * 3); normal_float_to_short_v3(no_s, no); @@ -268,9 +268,9 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam /* read no. of triangles */ gotBytes = gzread(gzf, &wri, sizeof(wri)); - if(wri!=numfaces) { + if (wri!=numfaces) { printf("Fluidsim: error in reading data from file.\n"); - if(dm) + if (dm) dm->release(dm); gzclose(gzf); MEM_freeN(normals); @@ -280,7 +280,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam // read triangles from file mp = CDDM_get_polys(dm); ml = CDDM_get_loops(dm); - for(i=0; i < numfaces; i++, mp++, ml += 3) + for (i=0; i < numfaces; i++, mp++, ml += 3) { int face[3]; @@ -319,7 +319,7 @@ void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4], int i; float vec[3]; - if(totvert == 0) { + if (totvert == 0) { zero_v3(start); zero_v3(size); return; @@ -330,25 +330,25 @@ void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4], bbsx = vec[0]; bbsy = vec[1]; bbsz = vec[2]; bbex = vec[0]; bbey = vec[1]; bbez = vec[2]; - for(i = 1; i < totvert; i++) { + for (i = 1; i < totvert; i++) { copy_v3_v3(vec, mvert[i].co); mul_m4_v3(obmat, vec); - if(vec[0] < bbsx){ bbsx= vec[0]; } - if(vec[1] < bbsy){ bbsy= vec[1]; } - if(vec[2] < bbsz){ bbsz= vec[2]; } - if(vec[0] > bbex){ bbex= vec[0]; } - if(vec[1] > bbey){ bbey= vec[1]; } - if(vec[2] > bbez){ bbez= vec[2]; } + if (vec[0] < bbsx) { bbsx= vec[0]; } + if (vec[1] < bbsy) { bbsy= vec[1]; } + if (vec[2] < bbsz) { bbsz= vec[2]; } + if (vec[0] > bbex) { bbex= vec[0]; } + if (vec[1] > bbey) { bbey= vec[1]; } + if (vec[2] > bbez) { bbez= vec[2]; } } // return values... - if(start) { + if (start) { start[0] = bbsx; start[1] = bbsy; start[2] = bbsz; } - if(size) { + if (size) { size[0] = bbex-bbsx; size[1] = bbey-bbsy; size[2] = bbez-bbsz; @@ -365,7 +365,7 @@ void fluid_estimate_memory(Object *ob, FluidsimSettings *fss, char *value) value[0]= '\0'; - if(ob->type == OB_MESH) { + if (ob->type == OB_MESH) { /* use mesh bounding box and object scaling */ mesh= ob->data; @@ -388,15 +388,15 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * // mesh and vverts have to be valid from loading... - if(fss->meshVelocities) + if (fss->meshVelocities) MEM_freeN(fss->meshVelocities); - if(len<7) + if (len<7) { return; } - if(fss->domainNovecgen>0) return; + if (fss->domainNovecgen>0) return; fss->meshVelocities = MEM_callocN(sizeof(FluidVertexVelocity)*dm->getNumVerts(dm), "Fluidsim_velocities"); fss->totvert = totvert; @@ -418,16 +418,16 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * } gzread(gzf, &wri, sizeof( wri )); - if(wri != totvert) + if (wri != totvert) { MEM_freeN(fss->meshVelocities); fss->meshVelocities = NULL; return; } - for(i=0; iguiDisplayMode; - } else { + } + else { displaymode = fss->renderDisplayMode; } @@ -483,15 +484,15 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim dm = fluidsim_read_obj(targetFile, &mp_example); - if(!dm) + if (!dm) { // switch, abort background rendering when fluidsim mesh is missing const char *strEnvName2 = "BLENDER_ELBEEMBOBJABORT"; // from blendercall.cpp - if(G.background==1) { - if(getenv(strEnvName2)) { + if (G.background==1) { + if (getenv(strEnvName2)) { int elevel = atoi(getenv(strEnvName2)); - if(elevel>0) { + if (elevel>0) { printf("Env. var %s set, fluid sim mesh '%s' not found, aborting render...\n",strEnvName2, targetFile); exit(1); } @@ -509,7 +510,7 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim fluidsim_read_vel_cache(fluidmd, dm, targetFile); } else { - if(fss->meshVelocities) + if (fss->meshVelocities) MEM_freeN(fss->meshVelocities); fss->meshVelocities = NULL; @@ -532,11 +533,11 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, framenr= (int)scene->r.cfra; // only handle fluidsim domains - if(fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN)) + if (fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN)) return dm; // sanity check - if(!fluidmd || (fluidmd && !fluidmd->fss)) + if (!fluidmd || (fluidmd && !fluidmd->fss)) return dm; fss = fluidmd->fss; @@ -552,7 +553,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, /* try to read from cache */ /* if the frame is there, fine, otherwise don't do anything */ - if((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams))) + if ((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams))) return result; return dm; diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 97e406c6960..d8fbb6f468f 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -81,8 +81,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(hmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT; - if(hmd->indexar) dataMask |= CD_MASK_ORIGINDEX; + if (hmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT; + if (hmd->indexar) dataMask |= CD_MASK_ORIGINDEX; return dataMask; } @@ -130,12 +130,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, static float hook_falloff(float *co_1, float *co_2, const float falloff_squared, float fac) { - if(falloff_squared) { + if (falloff_squared) { float len_squared = len_squared_v3v3(co_1, co_2); - if(len_squared > falloff_squared) { + if (len_squared > falloff_squared) { return 0.0f; } - else if(len_squared > 0.0f) { + else if (len_squared > 0.0f) { return fac * (1.0f - (len_squared / falloff_squared)); } } @@ -178,28 +178,28 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm, * not correct them on exit editmode. - zr */ - if(hmd->force == 0.0f) { + if (hmd->force == 0.0f) { /* do nothing, avoid annoying checks in the loop */ } - else if(hmd->indexar) { /* vertex indices? */ + else if (hmd->indexar) { /* vertex indices? */ const float fac_orig= hmd->force; float fac; const int *origindex_ar; /* if DerivedMesh is present and has original index data, use it */ - if(dm && (origindex_ar= dm->getVertDataArray(dm, CD_ORIGINDEX))) { - for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) { - if(*index_pt < numVerts) { + if (dm && (origindex_ar= dm->getVertDataArray(dm, CD_ORIGINDEX))) { + for (i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) { + if (*index_pt < numVerts) { int j; - for(j = 0; j < numVerts; j++) { - if(origindex_ar[j] == *index_pt) { + for (j = 0; j < numVerts; j++) { + if (origindex_ar[j] == *index_pt) { float *co = vertexCos[j]; - if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { - if(dvert) + if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + if (dvert) fac *= defvert_find_weight(dvert+j, defgrp_index); - if(fac) { + if (fac) { mul_v3_m4v3(vec, mat, co); interp_v3_v3v3(co, co, vec, fac); } @@ -210,14 +210,14 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm, } } else { /* missing dm or ORIGINDEX */ - for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) { - if(*index_pt < numVerts) { + for (i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) { + if (*index_pt < numVerts) { float *co = vertexCos[*index_pt]; - if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { - if(dvert) + if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + if (dvert) fac *= defvert_find_weight(dvert+(*index_pt), defgrp_index); - if(fac) { + if (fac) { mul_v3_m4v3(vec, mat, co); interp_v3_v3v3(co, co, vec, fac); } @@ -226,16 +226,16 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm, } } } - else if(dvert) { /* vertex group hook */ + else if (dvert) { /* vertex group hook */ const float fac_orig= hmd->force; - for(i = 0; i < max_dvert; i++, dvert++) { + for (i = 0; i < max_dvert; i++, dvert++) { float fac; float *co = vertexCos[i]; - if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { fac *= defvert_find_weight(dvert, defgrp_index); - if(fac) { + if (fac) { mul_v3_m4v3(vec, mat, co); interp_v3_v3v3(co, co, vec, fac); } @@ -251,12 +251,12 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, HookModifierData *hmd = (HookModifierData*) md; DerivedMesh *dm = derivedData; /* We need a valid dm for meshes when a vgroup is set... */ - if(!dm && ob->type == OB_MESH && hmd->name[0] != '\0') + if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0') dm = get_dm(ob, NULL, dm, NULL, 0); deformVerts_do(hmd, ob, dm, vertexCos, numVerts); - if(derivedData != dm) + if (derivedData != dm) dm->release(dm); } @@ -266,12 +266,12 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD HookModifierData *hmd = (HookModifierData*) md; DerivedMesh *dm = derivedData; /* We need a valid dm for meshes when a vgroup is set... */ - if(!dm && ob->type == OB_MESH && hmd->name[0] != '\0') + if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0') dm = get_dm(ob, editData, dm, NULL, 0); deformVerts_do(hmd, ob, dm, vertexCos, numVerts); - if(derivedData != dm) + if (derivedData != dm) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 00a634e8838..35503f9e462 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -65,7 +65,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(lmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT; + if (lmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } @@ -94,7 +94,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, { LatticeModifierData *lmd = (LatticeModifierData*) md; - if(lmd->object) { + if (lmd->object) { DagNode *latNode = dag_get_node(forest, lmd->object); dag_add_relation(forest, latNode, obNode, @@ -124,11 +124,11 @@ static void deformVertsEM( { DerivedMesh *dm = derivedData; - if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); + if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0); - if(!derivedData) dm->release(dm); + if (!derivedData) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index b9768ff9999..da4a489838f 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -203,7 +203,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, for (j= dv->totweight; j > 0; j--, dw++) { if (dw->def_nr < defbase_tot) { if (bone_select_array[dw->def_nr]) { - if(dw->weight != 0.0f) { + if (dw->weight != 0.0f) { break; } } diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index c8ce1b9b88a..08626e55231 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -66,14 +66,14 @@ static void freeData(ModifierData *md) { MeshDeformModifierData *mmd = (MeshDeformModifierData*) md; - if(mmd->bindinfluences) MEM_freeN(mmd->bindinfluences); - if(mmd->bindoffsets) MEM_freeN(mmd->bindoffsets); - if(mmd->bindcagecos) MEM_freeN(mmd->bindcagecos); - if(mmd->dyngrid) MEM_freeN(mmd->dyngrid); - if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences); - if(mmd->dynverts) MEM_freeN(mmd->dynverts); - if(mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */ - if(mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */ + if (mmd->bindinfluences) MEM_freeN(mmd->bindinfluences); + if (mmd->bindoffsets) MEM_freeN(mmd->bindoffsets); + if (mmd->bindcagecos) MEM_freeN(mmd->bindcagecos); + if (mmd->dyngrid) MEM_freeN(mmd->dyngrid); + if (mmd->dyninfluences) MEM_freeN(mmd->dyninfluences); + if (mmd->dynverts) MEM_freeN(mmd->dynverts); + if (mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */ + if (mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */ } static void copyData(ModifierData *md, ModifierData *target) @@ -91,7 +91,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(mmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; + if (mmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } @@ -141,20 +141,20 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3 totweight= 0.0f; size= mmd->dyngridsize; - for(i=0; i<3; i++) { + for (i=0; i<3; i++) { gridvec[i]= (vec[i] - mmd->dyncellmin[i] - mmd->dyncellwidth*0.5f)/mmd->dyncellwidth; ivec[i]= (int)gridvec[i]; dvec[i]= gridvec[i] - ivec[i]; } - for(i=0; i<8; i++) { - if(i & 1) { x= ivec[0]+1; wx= dvec[0]; } + for (i=0; i<8; i++) { + if (i & 1) { x= ivec[0]+1; wx= dvec[0]; } else { x= ivec[0]; wx= 1.0f-dvec[0]; } - if(i & 2) { y= ivec[1]+1; wy= dvec[1]; } + if (i & 2) { y= ivec[1]+1; wy= dvec[1]; } else { y= ivec[1]; wy= 1.0f-dvec[1]; } - if(i & 4) { z= ivec[2]+1; wz= dvec[2]; } + if (i & 4) { z= ivec[2]+1; wz= dvec[2]; } else { z= ivec[2]; wz= 1.0f-dvec[2]; } CLAMP(x, 0, size-1); @@ -166,7 +166,7 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3 cell= &mmd->dyngrid[a]; inf= mmd->dyninfluences + cell->offset; - for(j=0; jtotinfluence; j++, inf++) { + for (j=0; jtotinfluence; j++, inf++) { cageco= dco[inf->vertex]; cageweight= weight*inf->weight; co[0] += cageweight*cageco[0]; @@ -197,13 +197,13 @@ static void meshdeformModifier_do( int a, b, totvert, totcagevert, defgrp_index; float (*cagecos)[3]; - if(!mmd->object || (!mmd->bindcagecos && !mmd->bindfunc)) + if (!mmd->object || (!mmd->bindcagecos && !mmd->bindfunc)) return; /* get cage derivedmesh */ - if(em) { + if (em) { tmpdm= editbmesh_get_derived_cage_and_final(md->scene, ob, em, &cagedm, 0); - if(tmpdm) + if (tmpdm) tmpdm->release(tmpdm); } else @@ -211,13 +211,13 @@ static void meshdeformModifier_do( /* if we don't have one computed, use derivedmesh from data * without any modifiers */ - if(!cagedm) { + if (!cagedm) { cagedm= get_dm(mmd->object, NULL, NULL, NULL, 0); - if(cagedm) + if (cagedm) cagedm->needsFree= 1; } - if(!cagedm) { + if (!cagedm) { modifier_setError(md, "%s", TIP_("Can't get mesh from cage object.")); return; } @@ -230,11 +230,11 @@ static void meshdeformModifier_do( copy_m3_m4(icagemat, iobmat); /* bind weights if needed */ - if(!mmd->bindcagecos) { + if (!mmd->bindcagecos) { static int recursive = 0; /* progress bar redraw can make this recursive .. */ - if(!recursive) { + if (!recursive) { recursive = 1; mmd->bindfunc(md->scene, mmd, (float*)vertexCos, numVerts, cagemat); recursive = 0; @@ -245,7 +245,7 @@ static void meshdeformModifier_do( totvert= numVerts; totcagevert= cagedm->getNumVerts(cagedm); - if(mmd->totvert != totvert) { + if (mmd->totvert != totvert) { modifier_setError(md, TIP_("Verts changed from %d to %d."), mmd->totvert, totvert); cagedm->release(cagedm); return; @@ -254,7 +254,8 @@ static void meshdeformModifier_do( modifier_setError(md, TIP_("Cage verts changed from %d to %d."), mmd->totcagevert, totcagevert); cagedm->release(cagedm); return; - } else if (mmd->bindcagecos == NULL) { + } + else if (mmd->bindcagecos == NULL) { modifier_setError(md, "%s", TIP_("Bind data missing.")); cagedm->release(cagedm); return; @@ -269,11 +270,11 @@ static void meshdeformModifier_do( bindcagecos= (float(*)[3])mmd->bindcagecos; dco= MEM_callocN(sizeof(*dco)*totcagevert, "MDefDco"); - for(a=0; abindmat, co); /* compute difference with world space bind coord */ sub_v3_v3v3(dco[a], co, bindcagecos[a]); @@ -287,12 +288,12 @@ static void meshdeformModifier_do( /* do deformation */ fac= 1.0f; - for(b=0; bflag & MOD_MDEF_DYNAMIC_BIND) - if(!mmd->dynverts[b]) + for (b=0; bflag & MOD_MDEF_DYNAMIC_BIND) + if (!mmd->dynverts[b]) continue; - if(dvert) { + if (dvert) { fac= defvert_find_weight(&dvert[b], defgrp_index); if (mmd->flag & MOD_MDEF_INVERT_VGROUP) { @@ -304,7 +305,7 @@ static void meshdeformModifier_do( } } - if(mmd->flag & MOD_MDEF_DYNAMIC_BIND) { + if (mmd->flag & MOD_MDEF_DYNAMIC_BIND) { /* transform coordinate into cage's local space */ mul_v3_m4v3(co, cagemat, vertexCos[b]); totweight= meshdeform_dynamic_bind(mmd, dco, co); @@ -313,17 +314,17 @@ static void meshdeformModifier_do( totweight= 0.0f; zero_v3(co); - for(a=offsets[b]; a 0.0f) { + if (totweight > 0.0f) { mul_v3_fl(co, fac/totweight); mul_m3_v3(icagemat, co); - if(G.rt != 527) + if (G.rt != 527) add_v3_v3(vertexCos[b], co); else copy_v3_v3(vertexCos[b], co); @@ -349,7 +350,7 @@ static void deformVerts(ModifierData *md, Object *ob, meshdeformModifier_do(md, ob, dm, vertexCos, numVerts); - if(dm && dm != derivedData) + if (dm && dm != derivedData) dm->release(dm); } @@ -363,7 +364,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, meshdeformModifier_do(md, ob, dm, vertexCos, numVerts); - if(dm && dm != derivedData) + if (dm && dm != derivedData) dm->release(dm); } @@ -376,18 +377,18 @@ void modifier_mdef_compact_influences(ModifierData *md) int totinfluence, totvert, totcagevert, a, b; weights= mmd->bindweights; - if(!weights) + if (!weights) return; totvert= mmd->totvert; totcagevert= mmd->totcagevert; /* count number of influences above threshold */ - for(b=0; b MESHDEFORM_MIN_INFLUENCE) + if (weight > MESHDEFORM_MIN_INFLUENCE) mmd->totinfluence++; } } @@ -399,23 +400,23 @@ void modifier_mdef_compact_influences(ModifierData *md) /* write influences */ totinfluence= 0; - for(b=0; bbindoffsets[b]= totinfluence; totweight= 0.0f; /* sum total weight */ - for(a=0; a MESHDEFORM_MIN_INFLUENCE) + if (weight > MESHDEFORM_MIN_INFLUENCE) totweight += weight; } /* assign weights normalized */ - for(a=0; a MESHDEFORM_MIN_INFLUENCE) { + if (weight > MESHDEFORM_MIN_INFLUENCE) { mmd->bindinfluences[totinfluence].weight= weight/totweight; mmd->bindinfluences[totinfluence].vertex= a; totinfluence++; diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index b4129483c8d..1284d5a6769 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -84,7 +84,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, { MirrorModifierData *mmd = (MirrorModifierData*) md; - if(mmd->mirror_ob) { + if (mmd->mirror_ob) { DagNode *latNode = dag_get_node(forest, mmd->mirror_ob); dag_add_relation(forest, latNode, obNode, @@ -274,7 +274,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd, if (flip_map) { for (i = 0; i < maxVerts; dvert++, i++) { /* merged vertices get both groups, others get flipped */ - if(do_vtargetmap && (vtargetmap[i] != -1)) + if (do_vtargetmap && (vtargetmap[i] != -1)) defvert_flip_merged(dvert, flip_map, flip_map_len); else defvert_flip(dvert, flip_map, flip_map_len); @@ -302,18 +302,18 @@ static DerivedMesh *mirrorModifier__doMirror(MirrorModifierData *mmd, DerivedMesh *result = dm; /* check which axes have been toggled and mirror accordingly */ - if(mmd->flag & MOD_MIR_AXIS_X) { + if (mmd->flag & MOD_MIR_AXIS_X) { result = doMirrorOnAxis(mmd, ob, result, 0); } - if(mmd->flag & MOD_MIR_AXIS_Y) { + if (mmd->flag & MOD_MIR_AXIS_Y) { DerivedMesh *tmp = result; result = doMirrorOnAxis(mmd, ob, result, 1); - if(tmp != dm) tmp->release(tmp); /* free intermediate results */ + if (tmp != dm) tmp->release(tmp); /* free intermediate results */ } - if(mmd->flag & MOD_MIR_AXIS_Z) { + if (mmd->flag & MOD_MIR_AXIS_Z) { DerivedMesh *tmp = result; result = doMirrorOnAxis(mmd, ob, result, 2); - if(tmp != dm) tmp->release(tmp); /* free intermediate results */ + if (tmp != dm) tmp->release(tmp); /* free intermediate results */ } return result; @@ -329,7 +329,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, result = mirrorModifier__doMirror(mmd, ob, derivedData); - if(result != derivedData) + if (result != derivedData) CDDM_calc_normals(result); return result; diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 95bea9ddce3..57268d04947 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -77,8 +77,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, DerivedMesh *result; Mesh *me= (Mesh*)ob->data; - if(mmd->totlvl) { - if(!CustomData_get_layer(&me->ldata, CD_MDISPS)) { + if (mmd->totlvl) { + if (!CustomData_get_layer(&me->ldata, CD_MDISPS)) { /* multires always needs a displacement layer */ CustomData_add_layer(&me->ldata, CD_MDISPS, CD_CALLOC, NULL, me->totloop); } @@ -86,19 +86,19 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, result = multires_dm_create_from_derived(mmd, 0, dm, ob, useRenderParams); - if(result == dm) + if (result == dm) return dm; - if(useRenderParams || !isFinalCalc) { + if (useRenderParams || !isFinalCalc) { DerivedMesh *cddm; cddm= CDDM_copy(result); /* copy hidden flag to vertices */ - if(!useRenderParams) { + if (!useRenderParams) { struct MDisps *mdisps; mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS); - if(mdisps) { + if (mdisps) { subsurf_copy_grid_hidden(result, me->mpoly, cddm->getVertArray(cddm), mdisps); diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index b3553c04cf4..4119f49dcdb 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -240,7 +240,7 @@ static void dm_get_bounds(DerivedMesh *dm, float *sx, float *sy, float *ox, floa copy_v3_v3(min, mvert->co); copy_v3_v3(max, mvert->co); - for(v=1; vco[0]); min[1]=MIN2(min[1],mvert->co[1]); min[2]=MIN2(min[2],mvert->co[2]); @@ -352,7 +352,7 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd) /* add uvs */ cdlayer= CustomData_number_of_layers(&result->loopData, CD_MLOOPUV); - if(cdlayer < MAX_MTFACE) { + if (cdlayer < MAX_MTFACE) { MLoopUV *mloopuvs= CustomData_add_layer(&result->loopData, CD_MLOOPUV, CD_CALLOC, NULL, num_faces * 4); if (mloopuvs) { /* unlikely to fail */ @@ -455,7 +455,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob, if (omd->flag & MOD_OCEAN_GENERATE_FOAM) { int cdlayer= CustomData_number_of_layers(&dm->loopData, CD_MLOOPCOL); - if(cdlayer < MAX_MCOL) { + if (cdlayer < MAX_MCOL) { MLoopCol *mloopcols= CustomData_add_layer_named(&dm->loopData, CD_MLOOPCOL, CD_CALLOC, NULL, num_faces * 4, omd->foamlayername); if (mloopcols) { /* unlikely to fail */ @@ -540,7 +540,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, result = doOcean(md, ob, derivedData, 0); - if(result != derivedData) + if (result != derivedData) CDDM_calc_normals(result); return result; diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 3f600947b1a..628104295f7 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -126,27 +126,27 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, trackneg=((ob->trackflag>2)?1:0); - if(pimd->ob==ob){ + if (pimd->ob==ob) { pimd->ob= NULL; return derivedData; } - if(pimd->ob){ + if (pimd->ob) { psys = BLI_findlink(&pimd->ob->particlesystem,pimd->psys-1); - if(psys==NULL || psys->totpart==0) + if (psys==NULL || psys->totpart==0) return derivedData; } else return derivedData; - if(pimd->flag & eParticleInstanceFlag_Parents) + if (pimd->flag & eParticleInstanceFlag_Parents) totpart+=psys->totpart; - if(pimd->flag & eParticleInstanceFlag_Children){ - if(totpart==0) + if (pimd->flag & eParticleInstanceFlag_Children) { + if (totpart==0) first_particle=psys->totpart; totpart+=psys->totchild; } - if(totpart==0) + if (totpart==0) return derivedData; sim.scene = md->scene; @@ -154,20 +154,20 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, sim.psys = psys; sim.psmd = psys_get_modifier(pimd->ob, psys); - if(pimd->flag & eParticleInstanceFlag_UseSize) { + if (pimd->flag & eParticleInstanceFlag_UseSize) { int p; float *si; si = size = MEM_callocN(totpart * sizeof(float), "particle size array"); - if(pimd->flag & eParticleInstanceFlag_Parents) { - for(p=0, pa= psys->particles; ptotpart; p++, pa++, si++) + if (pimd->flag & eParticleInstanceFlag_Parents) { + for (p=0, pa= psys->particles; ptotpart; p++, pa++, si++) *si = pa->size; } - if(pimd->flag & eParticleInstanceFlag_Children) { + if (pimd->flag & eParticleInstanceFlag_Children) { ChildParticle *cpa = psys->child; - for(p=0; ptotchild; p++, cpa++, si++) { + for (p=0; ptotchild; p++, cpa++, si++) { *si = psys_get_child_size(psys, cpa, 0.0f, NULL); } } @@ -183,7 +183,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, psys->lattice=psys_get_lattice(&sim); - if(psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED){ + if (psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) { float min_r[3], max_r[3]; INIT_MINMAX(min_r, max_r); @@ -197,7 +197,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, mvert=result->getVertArray(result); orig_mvert=dm->getVertArray(dm); - for(i=0; ico[(axis+1)%3]=temp_co[(track+1)%3]; mv->co[(axis+2)%3]=temp_co[(track+2)%3]; - if((psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) && pimd->flag & eParticleInstanceFlag_Path){ + if ((psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) && pimd->flag & eParticleInstanceFlag_Path) { float ran = 0.0f; - if(pimd->random_position != 0.0f) { + if (pimd->random_position != 0.0f) { BLI_srandom(psys->seed + (i/totvert)%totpart); ran = pimd->random_position * BLI_frand(); } - if(pimd->flag & eParticleInstanceFlag_KeepShape) { + if (pimd->flag & eParticleInstanceFlag_KeepShape) { state.time = pimd->position * (1.0f - ran); } else { state.time=(mv->co[axis]-min_co)/(max_co-min_co) * pimd->position * (1.0f - ran); - if(trackneg) + if (trackneg) state.time=1.0f-state.time; mv->co[axis] = 0.0; @@ -236,7 +236,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, normalize_v3(state.vel); /* TODO: incremental rotations somehow */ - if(state.vel[axis] < -0.9999f || state.vel[axis] > 0.9999f) { + if (state.vel[axis] < -0.9999f || state.vel[axis] > 0.9999f) { state.rot[0] = 1; state.rot[1] = state.rot[2] = state.rot[3] = 0.0f; } @@ -251,13 +251,13 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, } } - else{ + else { state.time=-1.0; psys_get_particle_state(&sim, first_particle + i/totvert, &state,1); } mul_qt_v3(state.rot,mv->co); - if(pimd->flag & eParticleInstanceFlag_UseSize) + if (pimd->flag & eParticleInstanceFlag_UseSize) mul_v3_fl(mv->co, size[i/totvert]); add_v3_v3(mv->co, state.co); } @@ -265,31 +265,36 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, mface=result->getTessFaceArray(result); orig_mface=dm->getTessFaceArray(dm); - for(i=0; iflag & eParticleInstanceFlag_Parents){ - if(i/totface>=psys->totpart){ - if(psys->part->childtype==PART_CHILD_PARTICLES) + if (pimd->flag & eParticleInstanceFlag_Parents) { + if (i/totface>=psys->totpart) { + if (psys->part->childtype==PART_CHILD_PARTICLES) { pa=psys->particles+(psys->child+i/totface-psys->totpart)->parent; - else + } + else { pa= NULL; + } } - else + else { pa=pars+i/totface; + } } - else{ - if(psys->part->childtype==PART_CHILD_PARTICLES) + else { + if (psys->part->childtype==PART_CHILD_PARTICLES) { pa=psys->particles+(psys->child+i/totface)->parent; - else + } + else { pa= NULL; + } } - if(pa){ - if(pa->alive==PARS_UNBORN && (pimd->flag&eParticleInstanceFlag_Unborn)==0) continue; - if(pa->alive==PARS_ALIVE && (pimd->flag&eParticleInstanceFlag_Alive)==0) continue; - if(pa->alive==PARS_DEAD && (pimd->flag&eParticleInstanceFlag_Dead)==0) continue; + if (pa) { + if (pa->alive==PARS_UNBORN && (pimd->flag&eParticleInstanceFlag_Unborn)==0) continue; + if (pa->alive==PARS_ALIVE && (pimd->flag&eParticleInstanceFlag_Alive)==0) continue; + if (pa->alive==PARS_DEAD && (pimd->flag&eParticleInstanceFlag_Dead)==0) continue; } inMF = orig_mface + i%totface; @@ -299,18 +304,19 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, mf->v1+=(i/totface)*totvert; mf->v2+=(i/totface)*totvert; mf->v3+=(i/totface)*totvert; - if(mf->v4) + if (mf->v4) { mf->v4+=(i/totface)*totvert; + } } CDDM_calc_edges_tessface(result); - if(psys->lattice){ + if (psys->lattice) { end_latt_deform(psys->lattice); psys->lattice= NULL; } - if(size) + if (size) MEM_freeN(size); CDDM_tessfaces_to_faces(result); /*builds ngon faces from tess (mface) faces*/ diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index ad8642497fb..d93779fc07d 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -59,7 +59,7 @@ static void freeData(ModifierData *md) { ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md; - if(psmd->dm){ + if (psmd->dm) { psmd->dm->needsFree = 1; psmd->dm->release(psmd->dm); psmd->dm = NULL; @@ -67,7 +67,7 @@ static void freeData(ModifierData *md) /* ED_object_modifier_remove may have freed this first before calling * modifier_free (which calls this function) */ - if(psmd->psys) + if (psmd->psys) psmd->psys->flag |= PSYS_DELETE; } static void copyData(ModifierData *md, ModifierData *target) @@ -90,21 +90,21 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) MTex *mtex; int i; - if(!psmd->psys->part) + if (!psmd->psys->part) return 0; - for(i=0; ipsys->part->mtex[i]; - if(mtex && mtex->mapto && (mtex->texco & TEXCO_UV)) + if (mtex && mtex->mapto && (mtex->texco & TEXCO_UV)) dataMask |= CD_MASK_MTFACE; } - if(psmd->psys->part->tanfac != 0.0f) + if (psmd->psys->part->tanfac != 0.0f) dataMask |= CD_MASK_MTFACE; /* ask for vertexgroups if we need them */ - for(i=0; ipsys->vgroup[i]){ + for (i=0; ipsys->vgroup[i]) { dataMask |= CD_MASK_MDEFORMVERT; break; } @@ -132,29 +132,29 @@ static void deformVerts(ModifierData *md, Object *ob, ParticleSystem * psys= NULL; int needsFree=0; - if(ob->particlesystem.first) + if (ob->particlesystem.first) psys=psmd->psys; else return; - if(!psys_check_enabled(ob, psys)) + if (!psys_check_enabled(ob, psys)) return; - if(dm==NULL) { + if (dm==NULL) { dm= get_dm(ob, NULL, NULL, vertexCos, 1); - if(!dm) + if (!dm) return; needsFree= 1; } /* clear old dm */ - if(psmd->dm){ + if (psmd->dm) { psmd->dm->needsFree = 1; psmd->dm->release(psmd->dm); } - else if(psmd->flag & eParticleSystemFlag_file_loaded) { + else if (psmd->flag & eParticleSystemFlag_file_loaded) { /* in file read dm just wasn't saved in file so no need to reset everything */ psmd->flag &= ~eParticleSystemFlag_file_loaded; } @@ -168,7 +168,7 @@ static void deformVerts(ModifierData *md, Object *ob, CDDM_apply_vert_coords(psmd->dm, vertexCos); CDDM_calc_normals(psmd->dm); - if(needsFree){ + if (needsFree) { dm->needsFree = 1; dm->release(dm); } @@ -177,9 +177,9 @@ static void deformVerts(ModifierData *md, Object *ob, psmd->dm->needsFree = 0; /* report change in mesh structure */ - if(psmd->dm->getNumVerts(psmd->dm)!=psmd->totdmvert || + if (psmd->dm->getNumVerts(psmd->dm)!=psmd->totdmvert || psmd->dm->getNumEdges(psmd->dm)!=psmd->totdmedge || - psmd->dm->getNumTessFaces(psmd->dm)!=psmd->totdmface){ + psmd->dm->getNumTessFaces(psmd->dm)!=psmd->totdmface) { psys->recalc |= PSYS_RECALC_RESET; @@ -188,7 +188,7 @@ static void deformVerts(ModifierData *md, Object *ob, psmd->totdmface= psmd->dm->getNumTessFaces(psmd->dm); } - if(psys) { + if (psys) { psmd->flag &= ~eParticleSystemFlag_psys_updated; particle_system_update(md->scene, ob, psys); psmd->flag |= eParticleSystemFlag_psys_updated; @@ -204,11 +204,11 @@ static void deformVertsEM( { DerivedMesh *dm = derivedData; - if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data); + if (!derivedData) dm = CDDM_from_editmesh(editData, ob->data); deformVerts(md, ob, dm, vertexCos, numVerts); - if(!derivedData) dm->release(dm); + if (!derivedData) dm->release(dm); } #endif diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index a608defc434..ea3912afad5 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -101,7 +101,7 @@ static void *dualcon_alloc_output(int totvert, int totquad) { DualConOutput *output; - if(!(output = MEM_callocN(sizeof(DualConOutput), + if (!(output = MEM_callocN(sizeof(DualConOutput), "DualConOutput"))) return NULL; @@ -135,7 +135,7 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4]) cur_poly->loopstart = output->curface * 4; cur_poly->totloop = 4; - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) mloop[output->curface * 4 + i].v = vert_indices[i]; output->curface++; @@ -160,7 +160,7 @@ static DerivedMesh *applyModifier(ModifierData *md, init_dualcon_mesh(&input, dm); - if(rmd->flag & MOD_REMESH_FLOOD_FILL) + if (rmd->flag & MOD_REMESH_FLOOD_FILL) flags |= DUALCON_FLOOD_FILL; switch(rmd->mode) { diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 52574e89d89..ae21d3d66ad 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -207,11 +207,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, normalize_v3(axis_vec); /* screw */ - if(ltmd->flag & MOD_SCREW_OBJECT_OFFSET) { + if (ltmd->flag & MOD_SCREW_OBJECT_OFFSET) { /* find the offset along this axis relative to this objects matrix */ float totlen = len_v3(mtx_tx[3]); - if(totlen != 0.0f) { + if (totlen != 0.0f) { float zero[3]={0.0f, 0.0f, 0.0f}; float cp[3]; screw_ofs= closest_to_line_v3(cp, mtx_tx[3], zero, axis_vec); @@ -224,7 +224,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* angle */ #if 0 // cant incluide this, not predictable enough, though quite fun,. - if(ltmd->flag & MOD_SCREW_OBJECT_ANGLE) { + if (ltmd->flag & MOD_SCREW_OBJECT_ANGLE) { float mtx3_tx[3][3]; copy_m3_m4(mtx3_tx, mtx_tx); @@ -248,7 +248,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, cross_v3_v3v3(axis_tmp, cross1, c2); normalize_v3(axis_tmp); - if(len_v3v3(axis_tmp, axis_vec) > 1.0f) + if (len_v3v3(axis_tmp, axis_vec) > 1.0f) angle= -angle; } @@ -276,7 +276,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (fabsf(screw_ofs) <= (FLT_EPSILON*100.0f) && fabsf(fabsf(angle) - ((float)M_PI * 2.0f)) <= (FLT_EPSILON*100.0f)) { close= 1; step_tot--; - if(step_tot < 3) step_tot= 3; + if (step_tot < 3) step_tot= 3; maxVerts = totvert * step_tot; /* -1 because we're joining back up */ maxEdges = (totvert * step_tot) + /* these are the edges between new verts */ @@ -287,7 +287,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } else { close= 0; - if(step_tot < 3) step_tot= 3; + if (step_tot < 3) step_tot= 3; maxVerts = totvert * step_tot; /* -1 because we're joining back up */ maxEdges = (totvert * (step_tot-1)) + /* these are the edges between new verts */ @@ -333,7 +333,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, med_new->flag= med_orig->flag & ~ME_LOOSEEDGE; } - if(ltmd->flag & MOD_SCREW_NORMAL_CALC) { + if (ltmd->flag & MOD_SCREW_NORMAL_CALC) { /* * Normal Calculation (for face flipping) * Sort edge verts for correct face flipping @@ -459,7 +459,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /*printf("Loop on connected vert: %i\n", i);*/ - for(j=0; j<2; j++) { + for (j=0; j<2; j++) { /*printf("\tSide: %i\n", j);*/ screwvert_iter_init(<_iter, vert_connect, i, j); if (j == 1) { @@ -564,7 +564,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, ed_loop_flip= !ed_loop_flip; /* if its closed, we only need 1 loop */ - for(j=ed_loop_closed; j<2; j++) { + for (j=ed_loop_closed; j<2; j++) { /*printf("Ordering Side J %i\n", j);*/ screwvert_iter_init(<_iter, vert_connect, v_best, j); @@ -587,7 +587,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (ed_loop_flip == 0) { /*printf("\t\t\tFlipping 0\n");*/ SWAP(unsigned int, lt_iter.e->v1, lt_iter.e->v2); - }/* else { + } + /* else { printf("\t\t\tFlipping Not 0\n"); }*/ } @@ -595,13 +596,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (ed_loop_flip == 1) { /*printf("\t\t\tFlipping 1\n");*/ SWAP(unsigned int, lt_iter.e->v1, lt_iter.e->v2); - }/* else { + } + /* else { printf("\t\t\tFlipping Not 1\n"); }*/ - }/* else { + } + /* else { printf("\t\tIncorrect edge topology"); }*/ - }/* else { + } + /* else { printf("\t\tNo Edge at this point\n"); }*/ screwvert_iter_step(<_iter); @@ -700,7 +704,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, copy_m3_m4(mat3, mat); } - if(screw_ofs) + if (screw_ofs) madd_v3_v3fl(mat[3], axis_vec, screw_ofs * ((float)step / (float)(step_tot-1))); /* copy a slice */ @@ -711,7 +715,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, for (j=0; jv2; @@ -890,7 +894,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } #endif - if((ltmd->flag & MOD_SCREW_NORMAL_CALC) == 0) { + if ((ltmd->flag & MOD_SCREW_NORMAL_CALC) == 0) { /* BMESH_TODO, we only need to get vertex normals here, this is way overkill */ CDDM_calc_normals(result); } @@ -906,7 +910,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, { ScrewModifierData *ltmd= (ScrewModifierData*) md; - if(ltmd->ob_axis) { + if (ltmd->ob_axis) { DagNode *curNode= dag_get_node(forest, ltmd->ob_axis); dag_add_relation(forest, curNode, obNode, diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index 8a93a8a6d6f..a91019b0228 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -58,9 +58,9 @@ static void deformVerts(ModifierData *md, Object *ob, KeyBlock *kb= ob_get_keyblock(ob); float (*deformedVerts)[3]; - if(kb && kb->totelem == numVerts) { + if (kb && kb->totelem == numVerts) { deformedVerts= (float(*)[3])do_ob_key(md->scene, ob); - if(deformedVerts) { + if (deformedVerts) { memcpy(vertexCos, deformedVerts, sizeof(float)*3*numVerts); MEM_freeN(deformedVerts); } @@ -76,13 +76,13 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat (void)vertexCos; /* unused */ - if(kb && kb->totelem==numVerts && kb!=key->refkey) { + if (kb && kb->totelem==numVerts && kb!=key->refkey) { int a; - if(ob->shapeflag & OB_SHAPE_LOCK) scale_m3_fl(scale, 1); + if (ob->shapeflag & OB_SHAPE_LOCK) scale_m3_fl(scale, 1); else scale_m3_fl(scale, kb->curval); - for(a=0; atype == KEY_RELATIVE) + if (key && key->type == KEY_RELATIVE) deformVerts(md, ob, derivedData, vertexCos, numVerts, 0, 0); } @@ -114,11 +114,11 @@ static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob, (void)vertexCos; /* unused */ - if(kb && kb->totelem==numVerts && kb!=key->refkey) { + if (kb && kb->totelem==numVerts && kb!=key->refkey) { int a; scale_m3_fl(scale, kb->curval); - for(a=0; avgroup_name[0]) + if (smd->vgroup_name[0]) dataMask |= CD_MASK_MDEFORMVERT; - if(smd->shrinkType == MOD_SHRINKWRAP_PROJECT + if (smd->shrinkType == MOD_SHRINKWRAP_PROJECT && smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) dataMask |= CD_MASK_MVERT; @@ -119,12 +119,12 @@ static void deformVerts(ModifierData *md, Object *ob, CustomDataMask dataMask = requiredDataMask(ob, md); /* ensure we get a CDDM with applied vertex coords */ - if(dataMask) + if (dataMask) dm= get_cddm(ob, NULL, dm, vertexCos); shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, ob, dm, vertexCos, numVerts); - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } @@ -134,12 +134,12 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD CustomDataMask dataMask = requiredDataMask(ob, md); /* ensure we get a CDDM with applied vertex coords */ - if(dataMask) + if (dataMask) dm= get_cddm(ob, editData, dm, vertexCos); shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, ob, dm, vertexCos, numVerts); - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 9fb72bb4abc..6c1325b0bde 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -58,8 +58,8 @@ static void axis_limit(int axis, const float limits[2], float co[3], float dcut[3]) { float val = co[axis]; - if(limits[0] > val) val = limits[0]; - if(limits[1] < val) val = limits[1]; + if (limits[0] > val) val = limits[0]; + if (limits[1] < val) val = limits[1]; dcut[axis] = co[axis] - val; co[axis] = val; @@ -112,7 +112,7 @@ static void simpleDeform_twist(const float factor, const float *dcut, float *co) co[1] = x*sint + y*cost; co[2] = z; - if(dcut) { + if (dcut) { co[0] += dcut[0]; co[1] += dcut[1]; co[2] += dcut[2]; @@ -157,15 +157,15 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object MDeformVert *dvert; //Safe-check - if(smd->origin == ob) smd->origin = NULL; //No self references + if (smd->origin == ob) smd->origin = NULL; //No self references - if(smd->limit[0] < 0.0f) smd->limit[0] = 0.0f; - if(smd->limit[0] > 1.0f) smd->limit[0] = 1.0f; + if (smd->limit[0] < 0.0f) smd->limit[0] = 0.0f; + if (smd->limit[0] > 1.0f) smd->limit[0] = 1.0f; smd->limit[0] = MIN2(smd->limit[0], smd->limit[1]); //Upper limit >= than lower limit //Calculate matrixs do convert between coordinate spaces - if(smd->origin) { + if (smd->origin) { transf = &tmp_transf; if (smd->originOpts & MOD_SIMPLEDEFORM_ORIGIN_LOCAL) { @@ -185,12 +185,12 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object float lower = FLT_MAX; float upper = -FLT_MAX; - for(i=0; imode != MOD_SIMPLEDEFORM_MODE_BEND) { /* Bend mode shoulnt have any lock axis */ - if(smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_X) axis_limit(0, lock_axis, co, dcut); - if(smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_Y) axis_limit(1, lock_axis, co, dcut); + if (smd->mode != MOD_SIMPLEDEFORM_MODE_BEND) { /* Bend mode shoulnt have any lock axis */ + if (smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_X) axis_limit(0, lock_axis, co, dcut); + if (smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_Y) axis_limit(1, lock_axis, co, dcut); } axis_limit(limit_axis, smd_limit, co, dcut); simpleDeform_callback(smd_factor, dcut, co); //Apply deform interp_v3_v3v3(vertexCos[i], vertexCos[i], co, weight); //Use vertex weight has coef of linear interpolation - if(transf) space_transform_invert(transf, vertexCos[i]); + if (transf) space_transform_invert(transf, vertexCos[i]); } } } @@ -281,7 +281,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(smd->vgroup_name[0]) + if (smd->vgroup_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; @@ -316,12 +316,12 @@ static void deformVerts(ModifierData *md, Object *ob, /* we implement requiredDataMask but thats not really useful since * mesh_calc_modifiers pass a NULL derivedData */ - if(dataMask) + if (dataMask) dm= get_dm(ob, NULL, dm, NULL, 0); SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts); - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } @@ -336,12 +336,12 @@ static void deformVertsEM(ModifierData *md, Object *ob, /* we implement requiredDataMask but thats not really useful since * mesh_calc_modifiers pass a NULL derivedData */ - if(dataMask) + if (dataMask) dm= get_dm(ob, editData, dm, NULL, 0); SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts); - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index 8e045aba030..706c9817a0a 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -93,7 +93,7 @@ static void deformVerts(ModifierData *md, Object *ob, smokeModifier_do(smd, md->scene, ob, dm); - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } @@ -113,7 +113,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, if (smd->domain->fluid_group || smd->domain->coll_group) { GroupObject *go = NULL; - if(smd->domain->fluid_group) + if (smd->domain->fluid_group) for (go = smd->domain->fluid_group->gobject.first; go; go = go->next) { if (go->ob) { SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke); @@ -126,7 +126,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, } } - if(smd->domain->coll_group) + if (smd->domain->coll_group) for (go = smd->domain->coll_group->gobject.first; go; go = go->next) { if (go->ob) { SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke); @@ -159,12 +159,12 @@ static void foreachIDLink(ModifierData *md, Object *ob, { SmokeModifierData *smd = (SmokeModifierData*) md; - if(smd->type==MOD_SMOKE_TYPE_DOMAIN && smd->domain) { + if (smd->type==MOD_SMOKE_TYPE_DOMAIN && smd->domain) { walk(userData, ob, (ID **)&smd->domain->coll_group); walk(userData, ob, (ID **)&smd->domain->fluid_group); walk(userData, ob, (ID **)&smd->domain->eff_group); - if(smd->domain->effector_weights) { + if (smd->domain->effector_weights) { walk(userData, ob, (ID **)&smd->domain->effector_weights->group); } } diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 7b7597af6d6..b909e1f6512 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -78,7 +78,7 @@ static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) flag = smd->flag & (MOD_SMOOTH_X|MOD_SMOOTH_Y|MOD_SMOOTH_Z); /* disable if modifier is off for X, Y and Z or if factor is 0 */ - if((smd->fac == 0.0f) || flag == 0) return 1; + if ((smd->fac == 0.0f) || flag == 0) return 1; return 0; } @@ -89,7 +89,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; + if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } @@ -221,7 +221,7 @@ static void deformVerts( smoothModifier_do((SmoothModifierData *)md, ob, dm, vertexCos, numVerts); - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } @@ -234,7 +234,7 @@ static void deformVertsEM( smoothModifier_do((SmoothModifierData *)md, ob, dm, vertexCos, numVerts); - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index cca4cda7e20..5a749902a0c 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -84,7 +84,7 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3]) #endif face_nors = CustomData_get_layer(&dm->polyData, CD_NORMAL); - if(!face_nors) { + if (!face_nors) { calc_face_nors = 1; face_nors = CustomData_add_layer(&dm->polyData, CD_NORMAL, CD_CALLOC, NULL, numFaces); } @@ -119,11 +119,11 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3]) } /* --- end define --- */ - for(i = 0; i < numFaces; i++, mp++) { + for (i = 0; i < numFaces; i++, mp++) { int j; f_no = face_nors[i]; - if(calc_face_nors) + if (calc_face_nors) mesh_calc_poly_normal(mp, mloop+mp->loopstart, mvert, f_no); ml = mloop + mp->loopstart; @@ -132,7 +132,7 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3]) } } - for(edge_iter = BLI_edgehashIterator_new(edge_hash); !BLI_edgehashIterator_isDone(edge_iter); BLI_edgehashIterator_step(edge_iter)) { + for (edge_iter = BLI_edgehashIterator_new(edge_hash); !BLI_edgehashIterator_isDone(edge_iter); BLI_edgehashIterator_step(edge_iter)) { /* Get the edge vert indices, and edge value (the face indices that use it)*/ BLI_edgehashIterator_getKey(edge_iter, &ed_v1, &ed_v2); edge_ref = BLI_edgehashIterator_getValue(edge_iter); @@ -143,7 +143,8 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3]) add_v3_v3v3(edge_normal, face_nors[edge_ref->f1], face_nors[edge_ref->f2]); normalize_v3(edge_normal); mul_v3_fl(edge_normal, angle_normalized_v3v3(face_nors[edge_ref->f1], face_nors[edge_ref->f2])); - } else { + } + else { /* only one face attached to that edge */ /* an edge without another attached- the weight on this is * undefined, M_PI/2 is 90d in radians and that seems good enough */ @@ -158,8 +159,8 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3]) } /* normalize vertex normals and assign */ - for(i = 0; i < numVerts; i++, mv++) { - if(normalize_v3(temp_nors[i]) == 0.0f) { + for (i = 0; i < numVerts; i++, mv++) { + if (normalize_v3(temp_nors[i]) == 0.0f) { normal_short_to_float_v3(temp_nors[i], mv->no); } } @@ -192,7 +193,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; + if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } @@ -257,17 +258,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, orig_mloop = dm->getLoopArray(dm); orig_mpoly = dm->getPolyArray(dm); - if(smd->flag & MOD_SOLIDIFY_RIM) { + if (smd->flag & MOD_SOLIDIFY_RIM) { EdgeHash *edgehash = BLI_edgehash_new(); EdgeHashIterator *ehi; unsigned int v1, v2; int eidx; - for(i=0, mv=orig_mvert; iflag &= ~ME_VERT_TMP_TAG; } - for(i=0, ed=orig_medge; iv1, ed->v2, SET_INT_IN_POINTER(i)); } @@ -279,7 +280,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, const unsigned int ml_v1 = _v1; \ const unsigned int ml_v2 = _v2; \ eidx= GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, ml_v1, ml_v2)); \ - if(edge_users[eidx] == INVALID_UNUSED) { \ + if (edge_users[eidx] == INVALID_UNUSED) { \ ed= orig_medge + eidx; \ edge_users[eidx] = (ml_v1 < ml_v2) == (ed->v1 < ed->v2) ? i : (i + numFaces); \ edge_order[eidx] = edge_ord; \ @@ -307,9 +308,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, #undef INVALID_PAIR ehi= BLI_edgehashIterator_new(edgehash); - for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { + for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { eidx= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi)); - if(edge_users[eidx] >= 0) { + if (edge_users[eidx] >= 0) { BLI_edgehashIterator_getKey(ehi, &v1, &v2); orig_mvert[v1].flag |= ME_VERT_TMP_TAG; orig_mvert[v2].flag |= ME_VERT_TMP_TAG; @@ -320,8 +321,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } BLI_edgehashIterator_free(ehi); - for(i=0, mv=orig_mvert; iflag & ME_VERT_TMP_TAG) { + for (i=0, mv=orig_mvert; iflag & ME_VERT_TMP_TAG) { old_vert_arr[i] = BLI_array_count(new_vert_arr); BLI_array_append(new_vert_arr, i); newEdges++; @@ -333,7 +334,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, BLI_edgehash_free(edgehash, NULL); } - if(smd->flag & MOD_SOLIDIFY_NORMAL_CALC) { + if (smd->flag & MOD_SOLIDIFY_NORMAL_CALC) { vert_nors= MEM_callocN(sizeof(float) * numVerts * 3, "mod_solid_vno_hq"); dm_calc_normal(dm, vert_nors); } @@ -372,7 +373,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, mp->loopstart+(mp->totloop-j-1)+dm->numLoopData, 1); } - if(mat_ofs) { + if (mat_ofs) { mp->mat_nr += mat_ofs; CLAMP(mp->mat_nr, 0, mat_nr_max); } @@ -395,25 +396,25 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } } - for(i=0, ed=medge+numEdges; iv1 += numVerts; ed->v2 += numVerts; } /* note, copied vertex layers don't have flipped normals yet. do this after applying offset */ - if((smd->flag & MOD_SOLIDIFY_EVEN) == 0) { + if ((smd->flag & MOD_SOLIDIFY_EVEN) == 0) { /* no even thickness, very simple */ float scalar_short; float scalar_short_vgroup; - if(ofs_new != 0.0f) { + if (ofs_new != 0.0f) { scalar_short= scalar_short_vgroup= ofs_new / 32767.0f; mv= mvert + ((ofs_new >= ofs_orig) ? 0 : numVerts); dv= dvert; - for(i=0; i= ofs_orig) ? numVerts : 0); /* same as above but swapped, intentional use of 'ofs_new' */ dv= dvert; - for(i=0; ipolyData, CD_NORMAL); - if(!face_nors) { + if (!face_nors) { face_nors = CustomData_add_layer(&dm->polyData, CD_NORMAL, CD_CALLOC, NULL, dm->numPolyData); face_nors_calc= 1; } - if(vert_nors==NULL) { + if (vert_nors==NULL) { vert_nors= MEM_mallocN(sizeof(float) * numVerts * 3, "mod_solid_vno"); - for(i=0, mv=mvert; ino); } } @@ -491,19 +492,19 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, BLI_array_free(face_angles); /* vertex group support */ - if(dvert) { + if (dvert) { float scalar; dv= dvert; - if(defgrp_invert) { - for(i=0; i= ofs_orig) ? 0 : numVerts); - for(i=0; ico, vert_nors[i], ofs_new * (vert_angles[i] / vert_accum[i])); } } } - if(ofs_orig) { + if (ofs_orig) { mv= mvert + ((ofs_new >= ofs_orig) ? numVerts : 0); /* same as above but swapped, intentional use of 'ofs_new' */ - for(i=0; ico, vert_nors[i], ofs_orig * (vert_angles[i] / vert_accum[i])); } } @@ -534,18 +535,18 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, MEM_freeN(vert_angles); } - if(vert_nors) + if (vert_nors) MEM_freeN(vert_nors); /* flip vertex normals for copied verts */ mv= mvert + numVerts; - for(i=0; ino[0]= -mv->no[0]; mv->no[1]= -mv->no[1]; mv->no[2]= -mv->no[2]; } - if(smd->flag & MOD_SOLIDIFY_RIM) { + if (smd->flag & MOD_SOLIDIFY_RIM) { int *origindex; /* bugger, need to re-calculate the normals for the new edge faces. @@ -569,14 +570,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* add faces & edges */ origindex= result->getEdgeDataArray(result, CD_ORIGINDEX); ed= medge + (numEdges * 2); - for(i=0; iv1= new_vert_arr[i]; ed->v2= new_vert_arr[i] + numVerts; ed->flag |= ME_EDGEDRAW; origindex[numEdges * 2 + i]= ORIGINDEX_NONE; - if(crease_rim) + if (crease_rim) ed->crease= crease_rim; } @@ -587,12 +588,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, mp = mpoly + (numFaces * 2); ml = mloop + (numLoops * 2); j = 0; - for(i=0; i= numFaces) { + if (fidx >= numFaces) { fidx -= numFaces; flip= 1; } @@ -620,7 +621,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops*2+j+2, 1); CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops*2+j+3, 1); - if(flip) { + if (flip) { ml[j].v = ed->v1; ml[j++].e = eidx; @@ -653,18 +654,18 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } /* use the next material index if option enabled */ - if(mat_ofs_rim) { + if (mat_ofs_rim) { mp->mat_nr += mat_ofs_rim; CLAMP(mp->mat_nr, 0, mat_nr_max); } - if(crease_outer) { + if (crease_outer) { /* crease += crease_outer; without wrapping */ unsigned char *cr= (unsigned char *)&(ed->crease); int tcr= *cr + crease_outer; *cr= tcr > 255 ? 255 : tcr; } - if(crease_inner) { + if (crease_inner) { /* crease += crease_inner; without wrapping */ unsigned char *cr= (unsigned char *)&(medge[numEdges + eidx].crease); int tcr= *cr + crease_inner; @@ -685,7 +686,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, #ifdef SOLIDIFY_SIDE_NORMALS ed= medge + (numEdges * 2); - for(i=0; iv1]); - for(j=0; j<2; j++) { /* loop over both verts of the edge */ + for (j=0; j<2; j++) { /* loop over both verts of the edge */ nor_short= mvert[*(&ed->v1 + j)].no; normal_short_to_float_v3(nor, nor_short); add_v3_v3(nor, nor_cpy); diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 5d6d6c2e82c..be1ceeee317 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -73,10 +73,10 @@ static void freeData(ModifierData *md) { SubsurfModifierData *smd = (SubsurfModifierData*) md; - if(smd->mCache) { + if (smd->mCache) { ccgSubSurf_free(smd->mCache); } - if(smd->emCache) { + if (smd->emCache) { ccgSubSurf_free(smd->emCache); } } @@ -100,7 +100,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, result = subsurf_make_derived_from_derived(derivedData, smd, useRenderParams, NULL, isFinalCalc, 0, (ob->flag & OB_MODE_EDIT)); - if(useRenderParams || !isFinalCalc) { + if (useRenderParams || !isFinalCalc) { DerivedMesh *cddm= CDDM_copy(result); result->release(result); result= cddm; diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index ccb6e79eb64..86e11aca5b7 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -61,18 +61,18 @@ static void freeData(ModifierData *md) SurfaceModifierData *surmd = (SurfaceModifierData*) md; if (surmd) { - if(surmd->bvhtree) { + if (surmd->bvhtree) { free_bvhtree_from_mesh(surmd->bvhtree); MEM_freeN(surmd->bvhtree); } - if(surmd->dm) + if (surmd->dm) surmd->dm->release(surmd->dm); - if(surmd->x) + if (surmd->x) MEM_freeN(surmd->x); - if(surmd->v) + if (surmd->v) MEM_freeN(surmd->v); surmd->bvhtree = NULL; @@ -94,11 +94,11 @@ static void deformVerts(ModifierData *md, Object *ob, { SurfaceModifierData *surmd = (SurfaceModifierData*) md; - if(surmd->dm) + if (surmd->dm) surmd->dm->release(surmd->dm); /* if possible use/create DerivedMesh */ - if(derivedData) surmd->dm = CDDM_copy(derivedData); + if (derivedData) surmd->dm = CDDM_copy(derivedData); else surmd->dm = get_dm(ob, NULL, NULL, NULL, 0); if (!ob->pd) { @@ -106,7 +106,7 @@ static void deformVerts(ModifierData *md, Object *ob, return; } - if(surmd->dm) { + if (surmd->dm) { unsigned int numverts = 0, i = 0; int init = 0; float *vec; @@ -117,12 +117,12 @@ static void deformVerts(ModifierData *md, Object *ob, numverts = surmd->dm->getNumVerts ( surmd->dm ); - if(numverts != surmd->numverts || surmd->x == NULL || surmd->v == NULL || md->scene->r.cfra != surmd->cfra+1) { - if(surmd->x) { + if (numverts != surmd->numverts || surmd->x == NULL || surmd->v == NULL || md->scene->r.cfra != surmd->cfra+1) { + if (surmd->x) { MEM_freeN(surmd->x); surmd->x = NULL; } - if(surmd->v) { + if (surmd->v) { MEM_freeN(surmd->v); surmd->v = NULL; } @@ -136,11 +136,11 @@ static void deformVerts(ModifierData *md, Object *ob, } /* convert to global coordinates and calculate velocity */ - for(i = 0, x = surmd->x, v = surmd->v; ix, v = surmd->v; idm, i)->co; mul_m4_v3(ob->obmat, vec); - if(init) + if (init) v->co[0] = v->co[1] = v->co[2] = 0.0f; else sub_v3_v3v3(v->co, vec, x->co); @@ -150,12 +150,12 @@ static void deformVerts(ModifierData *md, Object *ob, surmd->cfra = md->scene->r.cfra; - if(surmd->bvhtree) + if (surmd->bvhtree) free_bvhtree_from_mesh(surmd->bvhtree); else surmd->bvhtree = MEM_callocN(sizeof(BVHTreeFromMesh), "BVHTreeFromMesh"); - if(surmd->dm->getNumTessFaces(surmd->dm)) + if (surmd->dm->getNumTessFaces(surmd->dm)) bvhtree_from_mesh_faces(surmd->bvhtree, surmd->dm, 0.0, 2, 6); else bvhtree_from_mesh_edges(surmd->bvhtree, surmd->dm, 0.0, 2, 6); diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 11bf5bc6edf..05d1401f8b8 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -68,7 +68,7 @@ void get_texture_value(Tex *texture, float *tex_co, TexResult *texres) * intensity, so calculate one (formula from do_material_tex). * if the texture didn't give an RGB value, copy the intensity across */ - if(result_type & TEX_RGB) + if (result_type & TEX_RGB) texres->tin = (0.35f * texres->tr + 0.45f * texres->tg + 0.2f * texres->tb); else @@ -84,16 +84,16 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob, int texmapping = dmd->texmapping; float mapob_imat[4][4]; - if(texmapping == MOD_DISP_MAP_OBJECT) { - if(dmd->map_object) + if (texmapping == MOD_DISP_MAP_OBJECT) { + if (dmd->map_object) invert_m4_m4(mapob_imat, dmd->map_object->obmat); else /* if there is no map object, default to local */ texmapping = MOD_DISP_MAP_LOCAL; } /* UVs need special handling, since they come from faces */ - if(texmapping == MOD_DISP_MAP_UV) { - if(CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) { + if (texmapping == MOD_DISP_MAP_UV) { + if (CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) { MPoly *mpoly = dm->getPolyArray(dm); MPoly *mp; MLoop *mloop = dm->getLoopArray(dm); @@ -107,7 +107,7 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob, mloop_uv = CustomData_get_layer_named(&dm->loopData, CD_MLOOPUV, uvname); /* verts are given the UV from the first face that uses them */ - for(i = 0, mp = mpoly; i < numPolys; ++i, ++mp) { + for (i = 0, mp = mpoly; i < numPolys; ++i, ++mp) { unsigned int fidx= mp->totloop - 1; do { @@ -126,11 +126,12 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob, MEM_freeN(done); return; - } else /* if there are no UVs, default to local */ + } + else /* if there are no UVs, default to local */ texmapping = MOD_DISP_MAP_LOCAL; } - for(i = 0; i < numVerts; ++i, ++co, ++texco) { + for (i = 0; i < numVerts; ++i, ++co, ++texco) { switch(texmapping) { case MOD_DISP_MAP_LOCAL: copy_v3_v3(*texco, *co); @@ -150,7 +151,7 @@ void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3]) { while((md=md->next) && md->type==eModifierType_Armature) { ArmatureModifierData *amd = (ArmatureModifierData*) md; - if(amd->multi && amd->prevCos==NULL) + if (amd->multi && amd->prevCos==NULL) amd->prevCos= MEM_dupallocN(vertexCos); else break; @@ -161,10 +162,10 @@ void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3]) /* returns a cdderivedmesh if dm == NULL or is another type of derivedmesh */ DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3]) { - if(dm && dm->type == DM_TYPE_CDDM) + if (dm && dm->type == DM_TYPE_CDDM) return dm; - if(!dm) { + if (!dm) { dm= get_dm(ob, em, dm, vertexCos, 0); } else { @@ -172,7 +173,7 @@ DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float CDDM_apply_vert_coords(dm, vertexCos); } - if(dm) + if (dm) CDDM_calc_normals(dm); return dm; @@ -181,22 +182,22 @@ DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float /* returns a derived mesh if dm == NULL, for deforming modifiers that need it */ DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco) { - if(dm) + if (dm) return dm; - if(ob->type==OB_MESH) { - if(em) dm= CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE); + if (ob->type==OB_MESH) { + if (em) dm= CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE); else dm = CDDM_from_mesh((struct Mesh *)(ob->data), ob); - if(vertexCos) { + if (vertexCos) { CDDM_apply_vert_coords(dm, vertexCos); //CDDM_calc_normals(dm); } - if(orco) + if (orco) DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, get_mesh_orco_verts(ob)); } - else if(ELEM3(ob->type,OB_FONT,OB_CURVE,OB_SURF)) { + else if (ELEM3(ob->type,OB_FONT,OB_CURVE,OB_SURF)) { dm= CDDM_from_curve(ob); } @@ -208,10 +209,10 @@ void modifier_get_vgroup(Object *ob, DerivedMesh *dm, const char *name, MDeformV *defgrp_index = defgroup_name_index(ob, name); *dvert = NULL; - if(*defgrp_index >= 0) { - if(ob->type == OB_LATTICE) + if (*defgrp_index >= 0) { + if (ob->type == OB_LATTICE) *dvert = lattice_get_deform_verts(ob); - else if(dm) + else if (dm) *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); } } diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index b9a4821bb7a..ed74d657cac 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -61,7 +61,7 @@ static void initData(ModifierData *md) UVProjectModifierData *umd = (UVProjectModifierData*) md; int i; - for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i) + for (i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i) umd->projectors[i] = NULL; umd->image = NULL; umd->flags = 0; @@ -76,7 +76,7 @@ static void copyData(ModifierData *md, ModifierData *target) UVProjectModifierData *tumd = (UVProjectModifierData*) target; int i; - for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i) + for (i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i) tumd->projectors[i] = umd->projectors[i]; tumd->image = umd->image; tumd->flags = umd->flags; @@ -104,7 +104,7 @@ static void foreachObjectLink(ModifierData *md, Object *ob, UVProjectModifierData *umd = (UVProjectModifierData*) md; int i; - for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i) + for (i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i) walk(userData, ob, &umd->projectors[i]); } @@ -127,8 +127,8 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, UVProjectModifierData *umd = (UVProjectModifierData*) md; int i; - for(i = 0; i < umd->num_projectors; ++i) { - if(umd->projectors[i]) { + for (i = 0; i < umd->num_projectors; ++i) { + if (umd->projectors[i]) { DagNode *curNode = dag_get_node(forest, umd->projectors[i]); dag_add_relation(forest, curNode, obNode, @@ -167,21 +167,21 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, aspect = aspx / aspy; - for(i = 0; i < umd->num_projectors; ++i) - if(umd->projectors[i]) + for (i = 0; i < umd->num_projectors; ++i) + if (umd->projectors[i]) projectors[num_projectors++].ob = umd->projectors[i]; - if(num_projectors == 0) return dm; + if (num_projectors == 0) return dm; /* make sure there are UV Maps available */ - if(!CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) return dm; + if (!CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) return dm; /* make sure we're using an existing layer */ CustomData_validate_layer_name(&dm->loopData, CD_MLOOPUV, umd->uvlayer_name, uvname); /* calculate a projection matrix and normal for each projector */ - for(i = 0; i < num_projectors; ++i) { + for (i = 0; i < num_projectors; ++i) { float tmpmat[4][4]; float offsetmat[4][4]; Camera *cam = NULL; @@ -190,10 +190,10 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, projectors[i].uci= NULL; - if(projectors[i].ob->type == OB_CAMERA) { + if (projectors[i].ob->type == OB_CAMERA) { cam = (Camera *)projectors[i].ob->data; - if(cam->flag & CAM_PANORAMA) { + if (cam->flag & CAM_PANORAMA) { projectors[i].uci= project_camera_info(projectors[i].ob, NULL, aspx, aspy); project_camera_info_scale(projectors[i].uci, scax, scay); free_uci= 1; @@ -204,7 +204,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, float scale= (cam->type == CAM_PERSP) ? cam->clipsta * sensor / cam->lens : cam->ortho_scale; float xmax, xmin, ymax, ymin; - if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { + if (sensor_fit==CAMERA_SENSOR_FIT_HOR) { xmax = 0.5f * scale; ymax = xmax / aspect; } @@ -222,17 +222,19 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, ymin *= scay; ymax *= scay; - if(cam->type == CAM_PERSP) { + if (cam->type == CAM_PERSP) { float perspmat[4][4]; perspective_m4( perspmat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend); mult_m4_m4m4(tmpmat, perspmat, projectors[i].projmat); - } else { /* if(cam->type == CAM_ORTHO) */ + } + else { /* if(cam->type == CAM_ORTHO) */ float orthomat[4][4]; orthographic_m4( orthomat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend); mult_m4_m4m4(tmpmat, orthomat, projectors[i].projmat); } } - } else { + } + else { copy_m4_m4(tmpmat, projectors[i].projmat); } @@ -282,22 +284,22 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, dm->getVertCos(dm, coords); /* convert coords to world space */ - for(i = 0, co = coords; i < numVerts; ++i, ++co) + for (i = 0, co = coords; i < numVerts; ++i, ++co) mul_m4_v3(ob->obmat, *co); /* if only one projector, project coords to UVs */ - if(num_projectors == 1 && projectors[0].uci==NULL) - for(i = 0, co = coords; i < numVerts; ++i, ++co) + if (num_projectors == 1 && projectors[0].uci==NULL) + for (i = 0, co = coords; i < numVerts; ++i, ++co) mul_project_m4_v3(projectors[0].projmat, *co); mpoly = dm->getPolyArray(dm); mloop = dm->getLoopArray(dm); /* apply coords as UVs, and apply image if tfaces are new */ - for(i = 0, mp = mpoly; i < numPolys; ++i, ++mp, ++mt) { - if(override_image || !image || (mtexpoly == NULL || mt->tpage == image)) { - if(num_projectors == 1) { - if(projectors[0].uci) { + for (i = 0, mp = mpoly; i < numPolys; ++i, ++mp, ++mt) { + if (override_image || !image || (mtexpoly == NULL || mt->tpage == image)) { + if (num_projectors == 1) { + if (projectors[0].uci) { unsigned int fidx= mp->totloop - 1; do { unsigned int lidx= mp->loopstart + fidx; @@ -314,7 +316,8 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, copy_v2_v2(mloop_uv[lidx].uv, coords[vidx]); } while (fidx--); } - } else { + } + else { /* multiple projectors, select the closest to face normal direction */ float face_no[3]; int j; @@ -330,16 +333,16 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, best_dot = dot_v3v3(projectors[0].normal, face_no); best_projector = &projectors[0]; - for(j = 1; j < num_projectors; ++j) { + for (j = 1; j < num_projectors; ++j) { float tmp_dot = dot_v3v3(projectors[j].normal, face_no); - if(tmp_dot > best_dot) { + if (tmp_dot > best_dot) { best_dot = tmp_dot; best_projector = &projectors[j]; } } - if(best_projector->uci) { + if (best_projector->uci) { unsigned int fidx= mp->totloop - 1; do { unsigned int lidx= mp->loopstart + fidx; @@ -363,17 +366,17 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, } } - if(override_image && mtexpoly) { + if (override_image && mtexpoly) { mt->tpage = image; } } MEM_freeN(coords); - if(free_uci) { + if (free_uci) { int j; - for(j = 0; j < num_projectors; ++j) { - if(projectors[j].uci) { + for (j = 0; j < num_projectors; ++j) { + if (projectors[j].uci) { MEM_freeN(projectors[j].uci); } } diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 4d058197be5..a318d9b68af 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -88,11 +88,11 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(wmd->defgrp_name[0]) dataMask |= (CD_MASK_MDEFORMVERT); + if (wmd->defgrp_name[0]) dataMask |= (CD_MASK_MDEFORMVERT); dataMask |= (CD_MASK_MDEFORMVERT); /* ask for UV coordinates if we need them */ - if(wmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE); + if (wmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE); return dataMask; } @@ -101,7 +101,7 @@ static int dependsOnTime(ModifierData *md) { WarpModifierData *wmd = (WarpModifierData *)md; - if(wmd->texture) { + if (wmd->texture) { return BKE_texture_dependsOnTime(wmd->texture); } else { @@ -153,7 +153,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN { WarpModifierData *wmd = (WarpModifierData*) md; - if(wmd->object_from && wmd->object_to) { + if (wmd->object_from && wmd->object_to) { DagNode *fromNode = dag_get_node(forest, wmd->object_from); DagNode *toNode = dag_get_node(forest, wmd->object_to); @@ -161,7 +161,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN dag_add_relation(forest, toNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier2"); } - if((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object) { + if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object) { DagNode *curNode = dag_get_node(forest, wmd->map_object); dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier3"); } @@ -187,12 +187,12 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, float (*tex_co)[3]= NULL; - if(!(wmd->object_from && wmd->object_to)) + if (!(wmd->object_from && wmd->object_to)) return; modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index); - if(wmd->curfalloff==NULL) /* should never happen, but bad lib linking could cause it */ + if (wmd->curfalloff==NULL) /* should never happen, but bad lib linking could cause it */ wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); invert_m4_m4(obinv, ob->obmat); @@ -207,7 +207,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, unit_m4(mat_unit); - if(strength < 0.0f) { + if (strength < 0.0f) { float loc[3]; strength = -strength; @@ -219,24 +219,24 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, } weight= strength; - if(wmd->texture) { + if (wmd->texture) { tex_co = MEM_mallocN(sizeof(*tex_co) * numVerts, "warpModifier_do tex_co"); get_texture_coords((MappingInfoModifierData *)wmd, ob, dm, vertexCos, tex_co, numVerts); } - for(i = 0; i < numVerts; i++) { + for (i = 0; i < numVerts; i++) { float *co = vertexCos[i]; - if(wmd->falloff_type==eWarp_Falloff_None || + if (wmd->falloff_type==eWarp_Falloff_None || ((fac=len_v3v3(co, mat_from[3])) < wmd->falloff_radius && (fac=(wmd->falloff_radius-fac)/wmd->falloff_radius)) ) { /* skip if no vert group found */ - if(dvert && defgrp_index >= 0) { + if (dvert && defgrp_index >= 0) { dv = &dvert[i]; - if(dv) { + if (dv) { weight = defvert_find_weight(dv, defgrp_index) * strength; - if(weight <= 0.0f) /* Should never occure... */ + if (weight <= 0.0f) /* Should never occure... */ continue; } } @@ -272,7 +272,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, fac *= weight; - if(tex_co) { + if (tex_co) { TexResult texres; texres.nor = NULL; get_texture_value(wmd->texture, tex_co[i], &texres); @@ -282,11 +282,11 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, /* into the 'from' objects space */ mul_m4_v3(mat_from_inv, co); - if(fac >= 1.0f) { + if (fac >= 1.0f) { mul_m4_v3(mat_final, co); } - else if(fac > 0.0f) { - if(wmd->flag & MOD_WARP_VOLUME_PRESERVE) { + else if (fac > 0.0f) { + if (wmd->flag & MOD_WARP_VOLUME_PRESERVE) { /* interpolate the matrix for nicer locations */ blend_m4_m4m4(tmat, mat_unit, mat_final, fac); mul_m4_v3(tmat, co); @@ -303,7 +303,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, } } - if(tex_co) + if (tex_co) MEM_freeN(tex_co); } @@ -319,14 +319,14 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, DerivedMesh *dm= NULL; int use_dm= warp_needs_dm((WarpModifierData *)md); - if(use_dm) { + if (use_dm) { dm= get_cddm(ob, NULL, derivedData, vertexCos); } warpModifier_do((WarpModifierData *)md, ob, dm, vertexCos, numVerts); - if(use_dm) { - if(dm != derivedData) dm->release(dm); + if (use_dm) { + if (dm != derivedData) dm->release(dm); } } @@ -336,15 +336,15 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD DerivedMesh *dm = derivedData; int use_dm= warp_needs_dm((WarpModifierData *)md); - if(use_dm) { - if(!derivedData) + if (use_dm) { + if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); } deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0); - if(use_dm) { - if(!derivedData) dm->release(dm); + if (use_dm) { + if (!derivedData) dm->release(dm); } } diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 15f78e15073..87c0df3e12f 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -138,14 +138,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, { WaveModifierData *wmd = (WaveModifierData*) md; - if(wmd->objectcenter) { + if (wmd->objectcenter) { DagNode *curNode = dag_get_node(forest, wmd->objectcenter); dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA, "Wave Modifier"); } - if(wmd->map_object) { + if (wmd->map_object) { DagNode *curNode = dag_get_node(forest, wmd->map_object); dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA, @@ -160,11 +160,11 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) /* ask for UV coordinates if we need them */ - if(wmd->texture && wmd->texmapping == MOD_DISP_MAP_UV) + if (wmd->texture && wmd->texmapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE; /* ask for vertexgroups if we need them */ - if(wmd->defgrp_name[0]) + if (wmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; @@ -187,10 +187,10 @@ static void waveModifier_do(WaveModifierData *md, const float falloff= wmd->falloff; float falloff_fac= 1.0f; /* when falloff == 0.0f this stays at 1.0f */ - if(wmd->flag & MOD_WAVE_NORM && ob->type == OB_MESH) + if (wmd->flag & MOD_WAVE_NORM && ob->type == OB_MESH) mvert = dm->getVertArray(dm); - if(wmd->objectcenter){ + if (wmd->objectcenter) { float mat[4][4]; /* get the control object's location in local coordinates */ invert_m4_m4(ob->imat, ob->obmat); @@ -203,32 +203,32 @@ static void waveModifier_do(WaveModifierData *md, /* get the index of the deform group */ modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index); - if(wmd->damp == 0) wmd->damp = 10.0f; + if (wmd->damp == 0) wmd->damp = 10.0f; - if(wmd->lifetime != 0.0f) { + if (wmd->lifetime != 0.0f) { float x = ctime - wmd->timeoffs; - if(x > wmd->lifetime) { + if (x > wmd->lifetime) { lifefac = x - wmd->lifetime; - if(lifefac > wmd->damp) lifefac = 0.0; + if (lifefac > wmd->damp) lifefac = 0.0; else lifefac = (float)(wmd->height * (1.0f - sqrtf(lifefac / wmd->damp))); } } - if(wmd->texture) { + if (wmd->texture) { tex_co = MEM_mallocN(sizeof(*tex_co) * numVerts, "waveModifier_do tex_co"); get_texture_coords((MappingInfoModifierData *)wmd, ob, dm, vertexCos, tex_co, numVerts); } - if(lifefac != 0.0f) { + if (lifefac != 0.0f) { /* avoid divide by zero checks within the loop */ float falloff_inv= falloff ? 1.0f / falloff : 1.0f; int i; - for(i = 0; i < numVerts; i++) { + for (i = 0; i < numVerts; i++) { float *co = vertexCos[i]; float x = co[0] - wmd->startx; float y = co[1] - wmd->starty; @@ -236,11 +236,11 @@ static void waveModifier_do(WaveModifierData *md, float def_weight= 1.0f; /* get weights */ - if(dvert) { + if (dvert) { def_weight= defvert_find_weight(&dvert[i], defgrp_index); /* if this vert isn't in the vgroup, don't deform it */ - if(def_weight == 0.0f) { + if (def_weight == 0.0f) { continue; } } @@ -260,12 +260,12 @@ static void waveModifier_do(WaveModifierData *md, /* this way it makes nice circles */ amplit -= (ctime - wmd->timeoffs) * wmd->speed; - if(wmd->flag & MOD_WAVE_CYCL) { + if (wmd->flag & MOD_WAVE_CYCL) { amplit = (float)fmodf(amplit - wmd->width, 2.0f * wmd->width) + wmd->width; } - if(falloff != 0.0f) { + if (falloff != 0.0f) { float dist = 0.0f; switch(wmd_axis) { @@ -285,12 +285,12 @@ static void waveModifier_do(WaveModifierData *md, } /* GAUSSIAN */ - if((falloff_fac != 0.0f) && (amplit > -wmd->width) && (amplit < wmd->width)) { + if ((falloff_fac != 0.0f) && (amplit > -wmd->width) && (amplit < wmd->width)) { amplit = amplit * wmd->narrow; amplit = (float)(1.0f / expf(amplit * amplit) - minfac); /*apply texture*/ - if(wmd->texture) { + if (wmd->texture) { TexResult texres; texres.nor = NULL; get_texture_value(wmd->texture, tex_co[i], &texres); @@ -300,15 +300,15 @@ static void waveModifier_do(WaveModifierData *md, /*apply weight & falloff */ amplit *= def_weight * falloff_fac; - if(mvert) { + if (mvert) { /* move along normals */ - if(wmd->flag & MOD_WAVE_NORM_X) { + if (wmd->flag & MOD_WAVE_NORM_X) { co[0] += (lifefac * amplit) * mvert[i].no[0] / 32767.0f; } - if(wmd->flag & MOD_WAVE_NORM_Y) { + if (wmd->flag & MOD_WAVE_NORM_Y) { co[1] += (lifefac * amplit) * mvert[i].no[1] / 32767.0f; } - if(wmd->flag & MOD_WAVE_NORM_Z) { + if (wmd->flag & MOD_WAVE_NORM_Z) { co[2] += (lifefac * amplit) * mvert[i].no[2] / 32767.0f; } } @@ -320,7 +320,7 @@ static void waveModifier_do(WaveModifierData *md, } } - if(wmd->texture) MEM_freeN(tex_co); + if (wmd->texture) MEM_freeN(tex_co); } static void deformVerts(ModifierData *md, Object *ob, @@ -333,14 +333,14 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *dm= derivedData; WaveModifierData *wmd = (WaveModifierData *)md; - if(wmd->flag & MOD_WAVE_NORM) + if (wmd->flag & MOD_WAVE_NORM) dm= get_cddm(ob, NULL, dm, vertexCos); - else if(wmd->texture || wmd->defgrp_name[0]) + else if (wmd->texture || wmd->defgrp_name[0]) dm= get_dm(ob, NULL, dm, NULL, 0); waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts); - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } @@ -351,14 +351,14 @@ static void deformVertsEM( DerivedMesh *dm= derivedData; WaveModifierData *wmd = (WaveModifierData *)md; - if(wmd->flag & MOD_WAVE_NORM) + if (wmd->flag & MOD_WAVE_NORM) dm= get_cddm(ob, editData, dm, vertexCos); - else if(wmd->texture || wmd->defgrp_name[0]) + else if (wmd->texture || wmd->defgrp_name[0]) dm= get_dm(ob, editData, dm, NULL, 0); waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts); - if(dm != derivedData) + if (dm != derivedData) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 95e752c35df..47a2aeaf4a2 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -64,14 +64,14 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm /* Return immediately, if we have nothing to do! */ /* Also security checks... */ - if(((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL)) + if (((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL)) || !ELEM7(falloff_type, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH, MOD_WVG_MAPPING_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM, MOD_WVG_MAPPING_STEP)) return; /* Map each weight (vertex) to its new value, accordingly to the chosen mode. */ - for(i = 0; i < num; ++i) { + for (i = 0; i < num; ++i) { float fac = new_w[i]; /* Code borrowed from the warp modifier. */ @@ -146,7 +146,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne MEM_freeN(v_co); /* For each weight (vertex), make the mix between org and new weights. */ - for(i = 0; i < num; ++i) { + for (i = 0; i < num; ++i) { int idx = indices ? indices[i] : i; TexResult texres; float h, s, v; /* For HSV color space. */ @@ -237,7 +237,7 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws, { int i; - for(i = 0; i < num; i++) { + for (i = 0; i < num; i++) { float w = weights[i]; MDeformVert *dv = &dvert[indices ? indices[i] : i]; MDeformWeight *dw = dws ? dws[i] : defvert_find_index(dv, defgrp_idx); @@ -246,8 +246,8 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws, CLAMP(w, 0.0f, 1.0f); /* If the vertex is in this vgroup, remove it if needed, or just update it. */ - if(dw != NULL) { - if(do_rem && w < rem_thresh) { + if (dw != NULL) { + if (do_rem && w < rem_thresh) { defvert_remove_group(dv, dw); } else { @@ -255,7 +255,7 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws, } } /* Else, add it if needed! */ - else if(do_add && w > add_thresh) { + else if (do_add && w > add_thresh) { defvert_add_index_notest(dv, defgrp_idx, w); } } diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 53bbaccd284..d6bcca5524a 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -111,7 +111,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) dataMask |= CD_MASK_MDEFORMVERT; /* Ask for UV coordinates if we need them. */ - if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV) + if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE; /* No need to ask for CD_PREVIEW_MLOOPCOL... */ @@ -123,7 +123,7 @@ static int dependsOnTime(ModifierData *md) { WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md; - if(wmd->mask_texture) + if (wmd->mask_texture) return BKE_texture_dependsOnTime(wmd->mask_texture); return 0; } @@ -156,14 +156,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md; DagNode *curNode; - if(wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) { + if (wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) { curNode = dag_get_node(forest, wmd->mask_tex_map_obj); dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "WeightVGEdit Modifier"); } - if(wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) + if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "WeightVGEdit Modifier"); } @@ -211,15 +211,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts); /* If no vertices were ever added to an object's vgroup, dvert might be NULL. */ - if(!dvert) + if (!dvert) /* If this modifier is not allowed to add vertices, just return. */ - if(!do_add) + if (!do_add) return dm; /* Else, add a valid data layer! */ dvert = CustomData_add_layer_named(&dm->vertData, CD_MDEFORMVERT, CD_CALLOC, NULL, numVerts, wmd->defgrp_name); /* Ultimate security check. */ - if(!dvert) + if (!dvert) return dm; /* Get org weights, assuming 0.0 for vertices not in given vgroup. */ @@ -228,7 +228,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der dw = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGEdit Modifier, dw"); for (i = 0; i < numVerts; i++) { dw[i] = defvert_find_index(&dvert[i], defgrp_idx); - if(dw[i]) { + if (dw[i]) { org_w[i] = new_w[i] = dw[i]->weight; } else { @@ -252,7 +252,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* If weight preview enabled... */ #if 0 /* XXX Currently done in mod stack :/ */ - if(do_prev) + if (do_prev) DM_update_weight_mcol(ob, dm, 0, org_w, 0, NULL); #endif diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 7e90a2d5526..cf4f9b31a7f 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -153,7 +153,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) dataMask |= CD_MASK_MDEFORMVERT; /* Ask for UV coordinates if we need them. */ - if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV) + if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE; /* No need to ask for CD_PREVIEW_MLOOPCOL... */ @@ -165,7 +165,7 @@ static int dependsOnTime(ModifierData *md) { WeightVGMixModifierData *wmd = (WeightVGMixModifierData*) md; - if(wmd->mask_texture) + if (wmd->mask_texture) return BKE_texture_dependsOnTime(wmd->mask_texture); return 0; } @@ -198,14 +198,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN WeightVGMixModifierData *wmd = (WeightVGMixModifierData*) md; DagNode *curNode; - if(wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) { + if (wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) { curNode = dag_get_node(forest, wmd->mask_tex_map_obj); dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "WeightVGMix Modifier"); } - if(wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) + if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "WeightVGMix Modifier"); } @@ -258,15 +258,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts); /* If no vertices were ever added to an object's vgroup, dvert might be NULL. */ - if(!dvert) + if (!dvert) /* If not affecting all vertices, just return. */ - if(wmd->mix_set != MOD_WVG_SET_ALL) + if (wmd->mix_set != MOD_WVG_SET_ALL) return dm; /* Else, add a valid data layer! */ dvert = CustomData_add_layer_named(&dm->vertData, CD_MDEFORMVERT, CD_CALLOC, NULL, numVerts, wmd->defgrp_name_a); /* Ultimate security check. */ - if(!dvert) + if (!dvert) return dm; /* Find out which vertices to work on. */ @@ -278,7 +278,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* All vertices in first vgroup. */ for (i = 0; i < numVerts; i++) { MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx); - if(dw) { + if (dw) { tdw1[numIdx] = dw; tdw2[numIdx] = defvert_find_index(&dvert[i], defgrp_idx2); tidx[numIdx++] = i; @@ -289,7 +289,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* All vertices in second vgroup. */ for (i = 0; i < numVerts; i++) { MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx2); - if(dw) { + if (dw) { tdw1[numIdx] = defvert_find_index(&dvert[i], defgrp_idx); tdw2[numIdx] = dw; tidx[numIdx++] = i; @@ -301,7 +301,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der for (i = 0; i < numVerts; i++) { MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx); MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2); - if(adw || bdw) { + if (adw || bdw) { tdw1[numIdx] = adw; tdw2[numIdx] = bdw; tidx[numIdx++] = i; @@ -313,7 +313,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der for (i = 0; i < numVerts; i++) { MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx); MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2); - if(adw && bdw) { + if (adw && bdw) { tdw1[numIdx] = adw; tdw2[numIdx] = bdw; tidx[numIdx++] = i; @@ -330,7 +330,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der numIdx = -1; break; } - if(numIdx == 0) { + if (numIdx == 0) { /* Use no vertices! Hence, return org data. */ MEM_freeN(tdw1); MEM_freeN(tdw2); @@ -380,7 +380,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* If weight preview enabled... */ #if 0 /* XXX Currently done in mod stack :/ */ - if(do_prev) + if (do_prev) DM_update_weight_mcol(ob, dm, 0, org_w, numIdx, indices); #endif diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index c15edec9108..241fcd05eab 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -80,7 +80,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3], if (dist_v) { /* Create a bvh-tree of the given target's verts. */ bvhtree_from_mesh_verts(&treeData_v, target, 0.0, 2, 6); - if(treeData_v.tree == NULL) { + if (treeData_v.tree == NULL) { OUT_OF_MEMORY(); return; } @@ -88,7 +88,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3], if (dist_e) { /* Create a bvh-tree of the given target's edges. */ bvhtree_from_mesh_edges(&treeData_e, target, 0.0, 2, 6); - if(treeData_e.tree == NULL) { + if (treeData_e.tree == NULL) { OUT_OF_MEMORY(); return; } @@ -96,7 +96,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3], if (dist_f) { /* Create a bvh-tree of the given target's faces. */ bvhtree_from_mesh_faces(&treeData_f, target, 0.0, 2, 6); - if(treeData_f.tree == NULL) { + if (treeData_f.tree == NULL) { OUT_OF_MEMORY(); return; } @@ -165,7 +165,7 @@ static void get_vert2ob_distance(int numVerts, float (*v_cos)[3], float *dist, float v_wco[3]; unsigned int i= numVerts; - while(i-- > 0) { + while (i-- > 0) { /* Get world-coordinates of the vertex (constraints and anim included). */ mul_v3_m4v3(v_wco, ob->obmat, v_cos[i]); /* Return distance between both coordinates. */ @@ -189,27 +189,27 @@ void do_map(float *weights, const int nidx, const float min_d, const float max_d { const float range_inv= 1.0f / (max_d - min_d); /* invert since multiplication is faster */ unsigned int i= nidx; - if(max_d == min_d) { + if (max_d == min_d) { while (i-- > 0) { weights[i] = (weights[i] >= max_d) ? 1.0f : 0.0f; /* "Step" behavior... */ } } - else if(max_d > min_d) { + else if (max_d > min_d) { while (i-- > 0) { if (weights[i] >= max_d) weights[i]= 1.0f; /* most likely case first */ - else if(weights[i] <= min_d) weights[i]= 0.0f; + else if (weights[i] <= min_d) weights[i]= 0.0f; else weights[i]= (weights[i] - min_d) * range_inv; } } else { while (i-- > 0) { if (weights[i] <= max_d) weights[i]= 1.0f; /* most likely case first */ - else if(weights[i] >= min_d) weights[i]= 0.0f; + else if (weights[i] >= min_d) weights[i]= 0.0f; else weights[i]= (weights[i] - min_d) * range_inv; } } - if(!ELEM(mode, MOD_WVG_MAPPING_NONE, MOD_WVG_MAPPING_CURVE)) { + if (!ELEM(mode, MOD_WVG_MAPPING_NONE, MOD_WVG_MAPPING_CURVE)) { weightvg_do_map(nidx, weights, mode, NULL); } } @@ -264,7 +264,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) dataMask |= CD_MASK_MDEFORMVERT; /* Ask for UV coordinates if we need them. */ - if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV) + if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE; /* No need to ask for CD_PREVIEW_MLOOPCOL... */ @@ -276,7 +276,7 @@ static int dependsOnTime(ModifierData *md) { WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData*) md; - if(wmd->mask_texture) + if (wmd->mask_texture) return BKE_texture_dependsOnTime(wmd->mask_texture); return 0; } @@ -316,14 +316,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN "WeightVGProximity Modifier"); } - if(wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) { + if (wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) { curNode = dag_get_node(forest, wmd->mask_tex_map_obj); dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "WeightVGProximity Modifier"); } - if(wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) + if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "WeightVGProximity Modifier"); } @@ -385,7 +385,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts); /* If no vertices were ever added to an object's vgroup, dvert might be NULL. * As this modifier never add vertices to vgroup, just return. */ - if(!dvert) + if (!dvert) return dm; /* Find out which vertices to work on (all vertices in vgroup), and get their relevant weight. @@ -395,20 +395,20 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der tdw = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGProximity Modifier, tdw"); for (i = 0; i < numVerts; i++) { MDeformWeight *_dw = defvert_find_index(&dvert[i], defgrp_idx); - if(_dw) { + if (_dw) { tidx[numIdx] = i; tw[numIdx] = _dw->weight; tdw[numIdx++] = _dw; } } /* If no vertices found, return org data! */ - if(numIdx == 0) { + if (numIdx == 0) { MEM_freeN(tidx); MEM_freeN(tw); MEM_freeN(tdw); return dm; } - if(numIdx != numVerts) { + if (numIdx != numVerts) { indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGProximity Modifier, indices"); memcpy(indices, tidx, sizeof(int) * numIdx); org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, org_w"); @@ -427,7 +427,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Get our vertex coordinates. */ v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos"); - if(numIdx != numVerts) { + if (numIdx != numVerts) { /* XXX In some situations, this code can be up to about 50 times more performant * than simply using getVertCo for each affected vertex... */ @@ -443,7 +443,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Compute wanted distances. */ if (wmd->proximity_mode == MOD_WVG_PROXIMITY_OBJECT) { const float dist = get_ob2ob_distance(ob, obr); - for(i = 0; i < numIdx; i++) + for (i = 0; i < numIdx; i++) new_w[i] = dist; } else if (wmd->proximity_mode == MOD_WVG_PROXIMITY_GEOMETRY) { @@ -477,17 +477,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der space_transform_setup(&loc2trgt, ob, obr); get_vert2geom_distance(numIdx, v_cos, dists_v, dists_e, dists_f, target_dm, &loc2trgt); - for(i = 0; i < numIdx; i++) { + for (i = 0; i < numIdx; i++) { new_w[i] = dists_v ? dists_v[i] : FLT_MAX; - if(dists_e) + if (dists_e) new_w[i] = minf(dists_e[i], new_w[i]); - if(dists_f) + if (dists_f) new_w[i] = minf(dists_f[i], new_w[i]); } - if(free_target_dm) target_dm->release(target_dm); - if(dists_v) MEM_freeN(dists_v); - if(dists_e) MEM_freeN(dists_e); - if(dists_f) MEM_freeN(dists_f); + if (free_target_dm) target_dm->release(target_dm); + if (dists_v) MEM_freeN(dists_v); + if (dists_e) MEM_freeN(dists_e); + if (dists_f) MEM_freeN(dists_f); } /* Else, fall back to default obj2vert behavior. */ else { @@ -512,7 +512,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* If weight preview enabled... */ #if 0 /* XXX Currently done in mod stack :/ */ - if(do_prev) + if (do_prev) DM_update_weight_mcol(ob, dm, 0, org_w, numIdx, indices); #endif @@ -520,7 +520,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der MEM_freeN(org_w); MEM_freeN(new_w); MEM_freeN(dw); - if(indices) + if (indices) MEM_freeN(indices); MEM_freeN(v_cos); -- cgit v1.2.3