diff options
author | Joseph Eagar <joeedh@gmail.com> | 2010-09-04 09:31:25 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2010-09-04 09:31:25 +0400 |
commit | bb7339a7aec37bdb2ee8a21599e6c65b37ef1277 (patch) | |
tree | 6fb8da94c6e43098c606f768e722484b04b8645c /source/blender/modifiers/intern | |
parent | 37f2c8a64c3277f100ab084ef1bb3846bc7b2c62 (diff) | |
parent | 8a320974f1b3e6004db3b3ad64f97742f878cbee (diff) |
merge with trunk at r31523
Diffstat (limited to 'source/blender/modifiers/intern')
29 files changed, 197 insertions, 125 deletions
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index f0c28cb8aef..d0e36f90ff5 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -30,9 +30,10 @@ * */ -#include "string.h" +#include <string.h> #include "DNA_armature_types.h" +#include "DNA_object_types.h" #include "BKE_cdderivedmesh.h" #include "BKE_lattice.h" diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index ef518531f13..98295ae0d8e 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -32,13 +32,16 @@ /* Array modifier: duplicates the object multiple times along an axis */ -#include "DNA_curve_types.h" -#include "DNA_meshdata_types.h" +#include "MEM_guardedalloc.h" #include "BLI_math.h" #include "BLI_ghash.h" #include "BLI_edgehash.h" +#include "DNA_curve_types.h" +#include "DNA_meshdata_types.h" +#include "DNA_object_types.h" + #include "BKE_cdderivedmesh.h" #include "BKE_displist.h" #include "BKE_mesh.h" diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 1ece8581963..e37bf18a293 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -29,6 +29,7 @@ * ***** END GPL LICENSE BLOCK ***** * */ +#include "MEM_guardedalloc.h" #include "BKE_bmesh.h" #include "BKE_cdderivedmesh.h" diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 116f5ab22d2..4e8e3117b7e 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -30,6 +30,7 @@ * */ +#include "DNA_object_types.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 705756fd25d..a0532f9db5c 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -34,6 +34,8 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "MEM_guardedalloc.h" + #include "BLI_math.h" #include "BLI_ghash.h" diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 36b6cad59b6..e027cc1fccc 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -30,6 +30,8 @@ * */ +#include "MEM_guardedalloc.h" + #include "BLI_rand.h" #include "BLI_ghash.h" diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 338454f0e6a..10843cf9677 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -31,6 +31,7 @@ */ #include "DNA_meshdata_types.h" +#include "DNA_object_types.h" #include "BLI_math.h" diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 5050333cd43..bfb5f6ee028 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -30,6 +30,12 @@ * */ +#include "DNA_cloth_types.h" +#include "DNA_scene_types.h" +#include "DNA_object_types.h" + +#include "MEM_guardedalloc.h" + #include "BKE_cloth.h" #include "BKE_cdderivedmesh.h" #include "BKE_global.h" diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 1c63f48e12d..fd43e057144 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -31,6 +31,10 @@ */ #include "DNA_scene_types.h" +#include "DNA_object_types.h" +#include "DNA_meshdata_types.h" + +#include "MEM_guardedalloc.h" #include "BLI_math.h" diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 6f1142ae6b9..97c7a4b01d6 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -30,9 +30,10 @@ * */ -#include "string.h" +#include <string.h> #include "DNA_scene_types.h" +#include "DNA_object_types.h" #include "BKE_cdderivedmesh.h" #include "BKE_lattice.h" diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index fc6eae5491c..6dbe3d3622c 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -31,6 +31,7 @@ */ #include "DNA_meshdata_types.h" +#include "DNA_object_types.h" #include "BLI_math.h" diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index f272e7f18a6..c683bee0b35 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -32,6 +32,7 @@ #include "DNA_scene_types.h" #include "DNA_object_fluidsim.h" +#include "DNA_object_types.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 6715e2b78c0..2c9ae311585 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -32,6 +32,7 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" +#include "DNA_object_types.h" #include "BLI_math.h" diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index c5100578fff..4270f2ff6e8 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -30,7 +30,9 @@ * */ -#include "string.h" +#include <string.h> + +#include "DNA_object_types.h" #include "BKE_cdderivedmesh.h" #include "BKE_lattice.h" diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 2505458c4d7..6a62ce645d8 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -30,11 +30,14 @@ * */ +#include "MEM_guardedalloc.h" + +#include "BLI_ghash.h" + #include "DNA_armature_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" - -#include "BLI_ghash.h" +#include "DNA_object_types.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index defc23fc468..b89db2fdc2d 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -32,6 +32,7 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" +#include "DNA_object_types.h" #include "BLI_math.h" @@ -128,7 +129,7 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3 float weight, cageweight, totweight, *cageco; int i, j, a, x, y, z, size; - co[0]= co[1]= co[2]= 0.0f; + zero_v3(co); totweight= 0.0f; size= mmd->dyngridsize; @@ -313,7 +314,7 @@ static void meshdeformModifier_do( } else { totweight= 0.0f; - co[0]= co[1]= co[2]= 0.0f; + zero_v3(co); for(a=offsets[b]; a<offsets[b+1]; a++) { weight= influences[a].weight; diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 2b9fa45ae9b..331d6e3a444 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -30,8 +30,8 @@ * */ - #include "DNA_meshdata_types.h" +#include "DNA_object_types.h" #include "BLI_math.h" diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 0498c57e0a8..81490c9d7db 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -38,6 +38,8 @@ #include "BKE_paint.h" #include "BKE_particle.h" +#include "DNA_mesh_types.h" + static void initData(ModifierData *md) { MultiresModifierData *mmd = (MultiresModifierData*)md; @@ -66,6 +68,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, int sculpting= (ob->mode & OB_MODE_SCULPT) && ss; MultiresModifierData *mmd = (MultiresModifierData*)md; DerivedMesh *result; + Mesh *me= (Mesh*)ob->data; + + if(mmd->totlvl) { + if(!CustomData_get_layer(&me->pdata, CD_MDISPS)) { + /* multires can't work without displacement layer */ + modifier_setError(md, "Modifier needs mesh with displacement data."); + return dm; + } + } result = multires_dm_create_from_derived(mmd, 0, dm, ob, useRenderParams, isFinalCalc); diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c index 3a5dc4dce33..0c749b79f5a 100644 --- a/source/blender/modifiers/intern/MOD_none.c +++ b/source/blender/modifiers/intern/MOD_none.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation; - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2005 Blender Foundation. * All rights reserved. diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index c1e5eda746e..100a22603d5 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -32,6 +32,8 @@ #include "DNA_meshdata_types.h" +#include "MEM_guardedalloc.h" + #include "BLI_math.h" #include "BLI_listbase.h" #include "BLI_rand.h" diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 16990c2522b..783bad15c70 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -33,6 +33,7 @@ /* Screw modifier: revolves the edges about an axis */ #include "DNA_meshdata_types.h" +#include "DNA_object_types.h" #include "BLI_math.h" @@ -60,39 +61,45 @@ typedef struct ScrewVertIter { MEdge *e; } ScrewVertIter; -#define ScrewVertIter_INIT(iter, array, v_init, dir)\ - iter.v_array = array;\ - iter.v = v_init;\ - if (v_init>=0) {\ - iter.v_poin = &array[v_init];\ - iter.v_other = iter.v_poin->v[dir];\ - if (dir)\ - iter.e = iter.v_poin->e[0];\ - else\ - iter.e = iter.v_poin->e[1];\ - } else {\ - iter.v_poin= NULL;\ - iter.e= NULL;\ + +static void screwvert_iter_init(ScrewVertIter *iter, ScrewVertConnect *array, int v_init, int dir) +{ + iter->v_array = array; + iter->v = v_init; + + if (v_init >= 0) { + iter->v_poin = &array[v_init]; + iter->v_other = iter->v_poin->v[dir]; + iter->e = iter->v_poin->e[!dir]; + } + else { + iter->v_poin= NULL; + iter->e= NULL; } +} -#define ScrewVertIter_NEXT(iter)\ - if (iter.v_poin->v[0] == iter.v_other) {\ - iter.v_other= iter.v;\ - iter.v= iter.v_poin->v[1];\ - } else if (iter.v_poin->v[1] == iter.v_other) {\ - iter.v_other= iter.v;\ - iter.v= iter.v_poin->v[0];\ - }\ - if (iter.v >=0) {\ - iter.v_poin= &iter.v_array[iter.v];\ - if ( iter.v_poin->e[0] != iter.e ) iter.e= iter.v_poin->e[0];\ - else iter.e= iter.v_poin->e[1];\ - } else {\ - iter.e= NULL;\ - iter.v_poin= NULL;\ +static void screwvert_iter_step(ScrewVertIter *iter) +{ + if (iter->v_poin->v[0] == iter->v_other) { + iter->v_other= iter->v; + iter->v= iter->v_poin->v[1]; } - + else if (iter->v_poin->v[1] == iter->v_other) { + iter->v_other= iter->v; + iter->v= iter->v_poin->v[0]; + } + if (iter->v >= 0) { + iter->v_poin= &iter->v_array[iter->v]; + iter->e= iter->v_poin->e[(iter->v_poin->e[0] == iter->e)]; + } + else { + iter->e= NULL; + iter->v_poin= NULL; + } +} + + static void initData(ModifierData *md) { ScrewModifierData *ltmd= (ScrewModifierData*) md; @@ -130,9 +137,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, int *origindex; int mface_index=0; + int step; int i, j; int i1,i2; - int steps= ltmd->steps; + int step_tot= ltmd->steps; + const int do_flip = ltmd->flag & MOD_SCREW_NORMAL_FLIP ? 1 : 0; int maxVerts=0, maxEdges=0, maxFaces=0; int totvert= dm->getNumVerts(dm); int totedge= dm->getNumEdges(dm); @@ -166,7 +175,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (!totvert) return CDDM_from_template(dm, 0, 0, 0, 0, 0); - steps= useRenderParams ? ltmd->render_steps : ltmd->steps; + step_tot= useRenderParams ? ltmd->render_steps : ltmd->steps; switch(ltmd->axis) { case 0: @@ -186,16 +195,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, axis_vec[ltmd->axis]= 1.0f; if (ltmd->ob_axis) { - float mtx3_tx[3][3]; /* calc the matrix relative to the axis object */ invert_m4_m4(mtx_tmp_a, ob->obmat); copy_m4_m4(mtx_tx_inv, ltmd->ob_axis->obmat); mul_m4_m4m4(mtx_tx, mtx_tx_inv, mtx_tmp_a); - copy_m3_m4(mtx3_tx, mtx_tx); - /* calc the axis vec */ - mul_m3_v3(mtx3_tx, axis_vec); + mul_mat3_m4_v3(mtx_tx, axis_vec); /* only rotation component */ normalize_v3(axis_vec); /* screw */ @@ -217,7 +223,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, #if 0 // cant incluide this, not pradictable enough, though quite fun,. if(ltmd->flag & MOD_SCREW_OBJECT_ANGLE) { - + float mtx3_tx[3][3]; + copy_m3_m4(mtx3_tx, mtx_tx); float vec[3] = {0,1,0}; float cross1[3]; @@ -260,30 +267,30 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, screw_ofs *= ltmd->iter; /* multiplying the steps is a bit tricky, this works best */ - steps = ((steps + 1) * ltmd->iter) - (ltmd->iter - 1); + step_tot = ((step_tot + 1) * ltmd->iter) - (ltmd->iter - 1); /* will the screw be closed? * Note! smaller then FLT_EPSILON*100 gives problems with float precission so its never closed. */ if (fabs(screw_ofs) <= (FLT_EPSILON*100) && fabs(fabs(angle) - (M_PI * 2)) <= (FLT_EPSILON*100)) { close= 1; - steps--; - if(steps < 2) steps= 2; + step_tot--; + if(step_tot < 2) step_tot= 2; - maxVerts = totvert * steps; /* -1 because we're joining back up */ - maxEdges = (totvert * steps) + /* these are the edges between new verts */ - (totedge * steps); /* -1 because vert edges join */ - maxFaces = totedge * steps; + maxVerts = totvert * step_tot; /* -1 because we're joining back up */ + maxEdges = (totvert * step_tot) + /* these are the edges between new verts */ + (totedge * step_tot); /* -1 because vert edges join */ + maxFaces = totedge * step_tot; screw_ofs= 0.0f; } else { close= 0; - if(steps < 2) steps= 2; + if(step_tot < 2) step_tot= 2; - maxVerts = totvert * steps; /* -1 because we're joining back up */ - maxEdges = (totvert * (steps-1)) + /* these are the edges between new verts */ - (totedge * steps); /* -1 because vert edges join */ - maxFaces = totedge * (steps-1); + maxVerts = totvert * step_tot; /* -1 because we're joining back up */ + maxEdges = (totvert * (step_tot-1)) + /* these are the edges between new verts */ + (totedge * step_tot); /* -1 because vert edges join */ + maxFaces = totedge * (step_tot-1); } result= CDDM_from_template(dm, maxVerts, maxEdges, maxFaces, 0, 0); @@ -397,11 +404,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, for (i=0; i<totedge; i++, med_new++) { vc= &vert_connect[med_new->v1]; - if (vc->v[0]==-1) { /* unused */ + if (vc->v[0] == -1) { /* unused */ vc->v[0]= med_new->v2; vc->e[0]= med_new; } - else if (vc->v[1]==-1) { + else if (vc->v[1] == -1) { vc->v[1]= med_new->v2; vc->e[1]= med_new; } @@ -412,11 +419,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, vc= &vert_connect[med_new->v2]; /* same as above but swap v1/2 */ - if (vc->v[0]==-1) { /* unused */ + if (vc->v[0] == -1) { /* unused */ vc->v[0]= med_new->v1; vc->e[0]= med_new; } - else if (vc->v[1]==-1) { + else if (vc->v[1] == -1) { vc->v[1]= med_new->v1; vc->e[1]= med_new; } @@ -428,7 +435,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* find the first vert */ vc= vert_connect; for (i=0; i < totvert; i++, vc++) { - int VBEST=-1, ed_loop_closed=0; /* vert and vert new */ + int v_best=-1, ed_loop_closed=0; /* vert and vert new */ int ed_loop_flip; float fl= -1.0f; ScrewVertIter lt_iter; @@ -436,14 +443,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* Now do search for connected verts, order all edges and flip them * so resulting faces are flipped the right way */ vc_tot_linked= 0; /* count the number of linked verts for this loop */ - if (vc->flag==0) { + if (vc->flag == 0) { /*printf("Loop on connected vert: %i\n", i);*/ for(j=0; j<2; j++) { /*printf("\tSide: %i\n", j);*/ - ScrewVertIter_INIT(lt_iter, vert_connect, i, j); - if (j==1) { - ScrewVertIter_NEXT(lt_iter); + screwvert_iter_init(<_iter, vert_connect, i, j); + if (j == 1) { + screwvert_iter_step(<_iter); } while (lt_iter.v_poin) { /*printf("\t\tVERT: %i\n", lt_iter.v);*/ @@ -458,10 +465,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /*printf("Testing 2 floats %f : %f\n", fl, lt_iter.v_poin->dist);*/ if (fl <= lt_iter.v_poin->dist) { fl= lt_iter.v_poin->dist; - VBEST= lt_iter.v; - /*printf("\t\t\tVERT BEST: %i\n", VBEST);*/ + v_best= lt_iter.v; + /*printf("\t\t\tVERT BEST: %i\n", v_best);*/ } - ScrewVertIter_NEXT(lt_iter); + screwvert_iter_step(<_iter); if (!lt_iter.v_poin) { /*printf("\t\t\tFound End Also Num %i\n", j);*/ /*endpoints[j]= lt_iter.v_other;*/ /* other is still valid */ @@ -471,14 +478,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } /* now we have a collection of used edges. flip their edges the right way*/ - /*if (VBEST !=-1) - */ + /*if (v_best != -1) - */ /*printf("Done Looking - vc_tot_linked: %i\n", vc_tot_linked);*/ if (vc_tot_linked>1) { float vf_1, vf_2, vf_best; - vc_tmp= &vert_connect[VBEST]; + vc_tmp= &vert_connect[v_best]; tmpf1= vert_connect[vc_tmp->v[0]].co; tmpf2= vert_connect[vc_tmp->v[1]].co; @@ -502,7 +509,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, else { /* not so simple to work out which edge is higher */ sub_v3_v3v3(tmp_vec1, tmpf1, vc_tmp->co); - sub_v3_v3v3(tmp_vec1, tmpf2, vc_tmp->co); + sub_v3_v3v3(tmp_vec2, tmpf2, vc_tmp->co); normalize_v3(tmp_vec1); normalize_v3(tmp_vec2); @@ -530,9 +537,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /*printf("flip direction %i\n", ed_loop_flip);*/ - /* switch the flip option if set */ - if (ltmd->flag & MOD_SCREW_NORMAL_FLIP) + /* switch the flip option if set + * note: flip is now done at face level so copying vgroup slizes is easier */ + /* + if (do_flip) ed_loop_flip= !ed_loop_flip; + */ if (angle < 0.0f) ed_loop_flip= !ed_loop_flip; @@ -541,7 +551,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, for(j=ed_loop_closed; j<2; j++) { /*printf("Ordering Side J %i\n", j);*/ - ScrewVertIter_INIT(lt_iter, vert_connect, VBEST, j); + screwvert_iter_init(<_iter, vert_connect, v_best, j); /*printf("\n\nStarting - Loop\n");*/ lt_iter.v_poin->flag= 1; /* so a non loop will traverse the other side */ @@ -549,7 +559,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* If this is the vert off the best vert and * the best vert has 2 edges connected too it * then swap the flip direction */ - if (j==1 && (vc_tmp->v[0] > -1) && (vc_tmp->v[1] > -1)) + if (j == 1 && (vc_tmp->v[0] > -1) && (vc_tmp->v[1] > -1)) ed_loop_flip= !ed_loop_flip; while (lt_iter.v_poin && lt_iter.v_poin->flag != 2) { @@ -558,7 +568,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, lt_iter.v_poin->flag= 2; if (lt_iter.e) { if (lt_iter.v == lt_iter.e->v1) { - if (ed_loop_flip==0) { + if (ed_loop_flip == 0) { /*printf("\t\t\tFlipping 0\n");*/ SWAP(int, lt_iter.e->v1, lt_iter.e->v2); }/* else { @@ -566,7 +576,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, }*/ } else if (lt_iter.v == lt_iter.e->v2) { - if (ed_loop_flip==1) { + if (ed_loop_flip == 1) { /*printf("\t\t\tFlipping 1\n");*/ SWAP(int, lt_iter.e->v1, lt_iter.e->v2); }/* else { @@ -578,7 +588,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, }/* else { printf("\t\tNo Edge at this point\n"); }*/ - ScrewVertIter_NEXT(lt_iter); + screwvert_iter_step(<_iter); } } } @@ -590,8 +600,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, * * calculate vertex normals that can be propodated on lathing * use edge connectivity work this out */ - if (vc->v[0]>=0) { - if (vc->v[1]>=0) { + if (vc->v[0] >= 0) { + if (vc->v[1] >= 0) { /* 2 edges connedted */ /* make 2 connecting vert locations relative to the middle vert */ sub_v3_v3v3(tmp_vec1, mvert_new[vc->v[0]].co, mvert_new[i].co); @@ -646,34 +656,24 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } } else { + mv_orig= mvert_orig; + mv_new= mvert_new; - if (ltmd->flag & MOD_SCREW_NORMAL_FLIP) { - mv_orig= mvert_orig; - mv_new= mvert_new + (totvert-1); - - for (i=0; i < totvert; i++, mv_new--, mv_orig++) { - copy_v3_v3(mv_new->co, mv_orig->co); - } - } - else { - mv_orig= mvert_orig; - mv_new= mvert_new; - - for (i=0; i < totvert; i++, mv_new++, mv_orig++) { - copy_v3_v3(mv_new->co, mv_orig->co); - } + for (i=0; i < totvert; i++, mv_new++, mv_orig++) { + copy_v3_v3(mv_new->co, mv_orig->co); } } /* done with edge connectivity based normal flipping */ + DM_copy_vert_data(dm, result, 0, 0, totvert); /* Add Faces */ - for (i=1; i < steps; i++) { + for (step=1; step < step_tot; step++) { + const int varray_stride= totvert * step; float step_angle; - float no_tx[3]; + float nor_tx[3]; /* Rotation Matrix */ - if (close) step_angle= (angle / steps) * i; - else step_angle= (angle / (steps-1)) * i; + step_angle= (angle / (step_tot - (!close))) * step; if (ltmd->ob_axis) { axis_angle_to_mat3(mat3, axis_vec, step_angle); @@ -686,18 +686,21 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } if(screw_ofs) - madd_v3_v3fl(mat[3], axis_vec, screw_ofs * ((float)i / (float)(steps-1))); + madd_v3_v3fl(mat[3], axis_vec, screw_ofs * ((float)step / (float)(step_tot-1))); + /* copy a slice */ + DM_copy_vert_data(dm, result, 0, varray_stride, totvert); + mv_new_base= mvert_new; - mv_new= &mvert_new[totvert*i]; /* advance to the next slice */ + mv_new= &mvert_new[varray_stride]; /* advance to the next slice */ for (j=0; j<totvert; j++, mv_new_base++, mv_new++) { /* set normal */ if(vert_connect) { - mul_v3_m3v3(no_tx, mat3, vert_connect[j].no); + mul_v3_m3v3(nor_tx, mat3, vert_connect[j].no); /* set the normal now its transformed */ - normal_float_to_short_v3(mv_new->no, no_tx); + normal_float_to_short_v3(mv_new->no, nor_tx); } /* set location */ @@ -718,7 +721,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } /* add the new edge */ - med_new->v1= j+(i*totvert); + med_new->v1= varray_stride + j; med_new->v2= med_new->v1 - totvert; med_new->flag= ME_EDGEDRAW|ME_EDGERENDER; med_new++; @@ -733,9 +736,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (close) { /* last loop of edges, previous loop dosnt account for the last set of edges */ + const int varray_stride= (step_tot - 1) * totvert; + for (i=0; i<totvert; i++) { med_new->v1= i; - med_new->v2= i+((steps-1)*totvert); + med_new->v2= varray_stride + i; med_new->flag= ME_EDGEDRAW|ME_EDGERENDER; med_new++; } @@ -748,14 +753,22 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* for each edge, make a cylinder of quads */ i1= med_new_firstloop->v1; i2= med_new_firstloop->v2; - - for (j=0; j < steps-1; j++) { + + for (step=0; step < step_tot-1; step++) { /* new face */ - mf_new->v1= i1; - mf_new->v2= i2; - mf_new->v3= i2 + totvert; - mf_new->v4= i1 + totvert; + if(do_flip) { + mf_new->v4= i1; + mf_new->v3= i2; + mf_new->v2= i2 + totvert; + mf_new->v1= i1 + totvert; + } + else { + mf_new->v1= i1; + mf_new->v2= i2; + mf_new->v3= i2 + totvert; + mf_new->v4= i1 + totvert; + } if( !mf_new->v3 || !mf_new->v4 ) { SWAP(int, mf_new->v1, mf_new->v3); @@ -767,7 +780,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, mface_index++; /* new vertical edge */ - if (j) { /* The first set is alredy dome */ + if (step) { /* The first set is already dome */ med_new->v1= i1; med_new->v2= i2; med_new->flag= med_new_firstloop->flag; @@ -780,10 +793,18 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* close the loop*/ if (close) { - mf_new->v1= i1; - mf_new->v2= i2; - mf_new->v3= med_new_firstloop->v2; - mf_new->v4= med_new_firstloop->v1; + if(do_flip) { + mf_new->v4= i1; + mf_new->v3= i2; + mf_new->v2= med_new_firstloop->v2; + mf_new->v1= med_new_firstloop->v1; + } + else { + mf_new->v1= i1; + mf_new->v2= i2; + mf_new->v3= med_new_firstloop->v2; + mf_new->v4= med_new_firstloop->v1; + } if( !mf_new->v3 || !mf_new->v4 ) { SWAP(int, mf_new->v1, mf_new->v3); @@ -803,7 +824,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, med_new++; } - if((ltmd->flag & MOD_SCREW_NORMAL_CALC)==0) { + if((ltmd->flag & MOD_SCREW_NORMAL_CALC) == 0) { CDDM_calc_normals(result); } diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index f4561d7cdae..6526be4cb53 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -30,12 +30,14 @@ * */ -#include "string.h" +#include <string.h> #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_shrinkwrap.h" +#include "DNA_object_types.h" + #include "depsgraph_private.h" #include "MOD_util.h" diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 79190c409cc..c64fec4075d 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -31,6 +31,7 @@ */ #include "DNA_meshdata_types.h" +#include "DNA_object_types.h" #include "BLI_math.h" diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index df8372876bd..25153de7be4 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -34,6 +34,8 @@ #include "MEM_guardedalloc.h" +#include "DNA_object_types.h" + #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_smoke.h" diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 5853b7a51ee..25072ee7b9b 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation; - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2005 Blender Foundation. * All rights reserved. @@ -30,7 +30,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include "string.h" +#include <string.h> #include "DNA_modifier_types.h" #include "DNA_object_types.h" diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index 9592a3ce123..5750e042199 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation; - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Contributor(s): Ben Batt * diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 5d3c428c12d..3deef13735f 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -34,6 +34,7 @@ #include "DNA_meshdata_types.h" #include "DNA_camera_types.h" +#include "DNA_object_types.h" #include "BLI_math.h" #include "BLI_uvproject.h" diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 27e1e071e60..a4cf8f4a2c2 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -34,6 +34,7 @@ #include "DNA_meshdata_types.h" #include "DNA_scene_types.h" +#include "DNA_object_types.h" #include "BKE_DerivedMesh.h" #include "BKE_object.h" diff --git a/source/blender/modifiers/intern/Makefile b/source/blender/modifiers/intern/Makefile index 849bc11662e..94ea068a1bc 100644 --- a/source/blender/modifiers/intern/Makefile +++ b/source/blender/modifiers/intern/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. |