Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2011-09-07 19:34:04 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2011-09-07 19:34:04 +0400
commitdbd6658d737b1592a633ddf6397be14e50e434d9 (patch)
tree57081721d70622a3c3141909b258f9bce8a5b1e3 /source/blender/modifiers
parentb5bd86e5907c3fa98546dabeda9703dfb15862f4 (diff)
parent884fc84793be1c5fdd6643ad267331381f8e1c6b (diff)
svn merge -r 37306:39975 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/CMakeLists.txt14
-rw-r--r--source/blender/modifiers/SConscript2
-rw-r--r--source/blender/modifiers/intern/MOD_armature.c1
-rw-r--r--source/blender/modifiers/intern/MOD_array.c1
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c1
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.c1
-rw-r--r--source/blender/modifiers/intern/MOD_build.c3
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c11
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c16
-rw-r--r--source/blender/modifiers/intern/MOD_collision.c1
-rw-r--r--source/blender/modifiers/intern/MOD_curve.c1
-rw-r--r--source/blender/modifiers/intern/MOD_decimate.c1
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c28
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c1
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c27
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim.c1
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c10
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c23
-rw-r--r--source/blender/modifiers/intern/MOD_lattice.c1
-rw-r--r--source/blender/modifiers/intern/MOD_mask.c93
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c8
-rw-r--r--source/blender/modifiers/intern/MOD_mirror.c1
-rw-r--r--source/blender/modifiers/intern/MOD_multires.c1
-rw-r--r--source/blender/modifiers/intern/MOD_none.c1
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c1
-rw-r--r--source/blender/modifiers/intern/MOD_particlesystem.c1
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c5
-rw-r--r--source/blender/modifiers/intern/MOD_shapekey.c3
-rw-r--r--source/blender/modifiers/intern/MOD_shrinkwrap.c1
-rw-r--r--source/blender/modifiers/intern/MOD_simpledeform.c17
-rw-r--r--source/blender/modifiers/intern/MOD_smoke.c6
-rw-r--r--source/blender/modifiers/intern/MOD_smooth.c6
-rw-r--r--source/blender/modifiers/intern/MOD_softbody.c1
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c37
-rw-r--r--source/blender/modifiers/intern/MOD_subsurf.c2
-rw-r--r--source/blender/modifiers/intern/MOD_surface.c1
-rw-r--r--source/blender/modifiers/intern/MOD_util.c16
-rw-r--r--source/blender/modifiers/intern/MOD_util.h10
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c3
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c20
-rw-r--r--source/blender/modifiers/intern/MOD_wave.c15
41 files changed, 221 insertions, 172 deletions
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 15c8d05f27d..52755f02056 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -25,17 +25,19 @@
# ***** END GPL LICENSE BLOCK *****
set(INC
- . ./intern
+ .
+ intern
+ ../blenkernel
+ ../blenkernel/intern
../blenlib
../blenloader
../makesdna
- ../blenkernel
- ../blenkernel/intern
+ ../makesrna
../render/extern/include
../editors/include
../gpu
- ../../../intern/guardedalloc
../../../intern/elbeem/extern
+ ../../../intern/guardedalloc
../../../extern/recastnavigation/Recast/Include
)
@@ -103,7 +105,9 @@ endif()
if(WITH_MOD_DECIMATE)
add_definitions(-DWITH_MOD_DECIMATE)
- list(APPEND INC ../../../intern/decimation/extern)
+ list(APPEND INC
+ ../../../intern/decimation/extern
+ )
endif()
if(NOT WITH_MOD_FLUID)
diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript
index 5d40803fb59..f90e637d151 100644
--- a/source/blender/modifiers/SConscript
+++ b/source/blender/modifiers/SConscript
@@ -6,7 +6,7 @@ sources = env.Glob('intern/*.c') + env.Glob('intern/*.cpp')
incs = '. ./intern'
incs += ' #/intern/guardedalloc #/intern/decimation/extern #/intern/bsp/extern #/intern/elbeem/extern #/extern/glew/include'
incs += ' ../render/extern/include ../blenloader'
-incs += ' ../include ../blenlib ../makesdna ../blenkernel ../blenkernel/intern'
+incs += ' ../include ../blenlib ../makesdna ../makesrna ../blenkernel ../blenkernel/intern'
incs += ' ../editors/include ../gpu'
incs += ' #extern/recastnavigation/Recast/Include'
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index a0ee047e319..0b46d950950 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -213,4 +213,5 @@ ModifierTypeInfo modifierType_Armature = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 90954fef1c7..c7fa75478f0 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -826,4 +826,5 @@ ModifierTypeInfo modifierType_Array = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 323ed71dd74..277f404f64d 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -150,4 +150,5 @@ ModifierTypeInfo modifierType_Bevel = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 4b4d0124aae..761f8dd0add 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -197,4 +197,5 @@ ModifierTypeInfo modifierType_Boolean = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index e293be5886d..1c56d81a798 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -299,5 +299,6 @@ ModifierTypeInfo modifierType_Build = {
/* dependsOnTime */ dependsOnTime,
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
- /* foreachIDLink */ NULL
+ /* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 5cb352ef482..4061128b5ad 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -177,10 +177,7 @@ static void sphere_do(
/* 3) if we were given a vertex group name,
* only those vertices should be affected */
- defgrp_index = defgroup_name_index(ob, cmd->defgrp_name);
-
- if ((ob->type == OB_MESH) && dm && defgrp_index >= 0)
- dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+ modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index);
if(flag & MOD_CAST_SIZE_FROM_RADIUS) {
len = cmd->radius;
@@ -335,10 +332,7 @@ static void cuboid_do(
/* 3) if we were given a vertex group name,
* only those vertices should be affected */
- defgrp_index = defgroup_name_index(ob, cmd->defgrp_name);
-
- if ((ob->type == OB_MESH) && dm && defgrp_index >= 0)
- dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+ modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index);
if (ctrl_ob) {
if(flag & MOD_CAST_USE_OB_TRANSFORM) {
@@ -638,4 +632,5 @@ ModifierTypeInfo modifierType_Cast = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index 30ddb3f7b9c..f5493162322 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -190,6 +190,19 @@ static void freeData(ModifierData *md)
}
}
+static void foreachIDLink(ModifierData *md, Object *ob,
+ IDWalkFunc walk, void *userData)
+{
+ ClothModifierData *clmd = (ClothModifierData*) md;
+
+ if(clmd->coll_parms) {
+ walk(userData, ob, (ID **)&clmd->coll_parms->group);
+ }
+
+ if(clmd->sim_parms && clmd->sim_parms->effector_weights) {
+ walk(userData, ob, (ID **)&clmd->sim_parms->effector_weights->group);
+ }
+}
ModifierTypeInfo modifierType_Cloth = {
/* name */ "Cloth",
@@ -215,5 +228,6 @@ ModifierTypeInfo modifierType_Cloth = {
/* dependsOnTime */ dependsOnTime,
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
- /* foreachIDLink */ NULL,
+ /* foreachIDLink */ foreachIDLink,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index 83ba8a12163..f4a9ea62ead 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -267,4 +267,5 @@ ModifierTypeInfo modifierType_Collision = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index ecd10250c00..d928c239eac 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -162,4 +162,5 @@ ModifierTypeInfo modifierType_Curve = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index ba9dbfc31ad..e3c39752bd1 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -218,4 +218,5 @@ ModifierTypeInfo modifierType_Decimate = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 02845ecaab7..fb7aeacecc8 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -134,6 +134,12 @@ static void foreachIDLink(ModifierData *md, Object *ob,
foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData);
}
+static void foreachTexLink(ModifierData *md, Object *ob,
+ TexWalkFunc walk, void *userData)
+{
+ walk(userData, ob, md, "texture");
+}
+
static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
{
DisplaceModifierData *dmd = (DisplaceModifierData*) md;
@@ -169,18 +175,16 @@ static void displaceModifier_do(
{
int i;
MVert *mvert;
- MDeformVert *dvert = NULL;
+ MDeformVert *dvert;
int defgrp_index;
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;
- defgrp_index = defgroup_name_index(ob, dmd->defgrp_name);
-
mvert = CDDM_get_verts(dm);
- if(defgrp_index >= 0)
- dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+ modifier_get_vgroup(ob, dm, dmd->defgrp_name, &dvert, &defgrp_index);
tex_co = MEM_callocN(sizeof(*tex_co) * numVerts,
"displaceModifier_do tex_co");
@@ -189,17 +193,10 @@ static void displaceModifier_do(
for(i = 0; i < numVerts; ++i) {
TexResult texres;
float delta = 0, strength = dmd->strength;
- MDeformWeight *def_weight = NULL;
if(dvert) {
- int j;
- for(j = 0; j < dvert[i].totweight; ++j) {
- if(dvert[i].dw[j].def_nr == defgrp_index) {
- def_weight = &dvert[i].dw[j];
- break;
- }
- }
- if(!def_weight || def_weight->weight==0.0f) continue;
+ weight= defvert_find_weight(dvert + i, defgrp_index);
+ if(weight == 0.0f) continue;
}
texres.nor = NULL;
@@ -207,7 +204,7 @@ static void displaceModifier_do(
delta = texres.tin - dmd->midlevel;
- if(def_weight) strength *= def_weight->weight;
+ if(dvert) strength *= weight;
delta *= strength;
CLAMP(delta, -10000, 10000);
@@ -292,4 +289,5 @@ ModifierTypeInfo modifierType_Displace = {
/* dependsOnNormals */ dependsOnNormals,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ foreachIDLink,
+ /* foreachTexLink */ foreachTexLink,
};
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index 8d0aea41b5c..db491742265 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -1311,4 +1311,5 @@ ModifierTypeInfo modifierType_EdgeSplit = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index f1bc0d33fd8..3d01661bc79 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -776,14 +776,14 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
{
DerivedMesh *explode, *dm=to_explode;
MFace *mf= NULL, *mface;
- ParticleSettings *part=psmd->psys->part;
+ /* ParticleSettings *part=psmd->psys->part; */ /* UNUSED */
ParticleSimulationData sim= {NULL};
ParticleData *pa=NULL, *pars=psmd->psys->particles;
- ParticleKey state;
+ ParticleKey state, birth;
EdgeHash *vertpahash;
EdgeHashIterator *ehi;
float *vertco= NULL, imat[4][4];
- float loc0[3], nor[3];
+ float rot[4];
float cfra;
/* float timestep; */
int *facepa=emd->facepa;
@@ -814,7 +814,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
for (i=0; i<totface; i++) {
/* 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];
@@ -868,26 +868,26 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
/* get particle */
pa= pars+i;
- /* get particle state */
- psys_particle_on_emitter(psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc0,nor,NULL,NULL,NULL,NULL);
- mul_m4_v3(ob->obmat,loc0);
+ psys_get_birth_coordinates(&sim, pa, &birth, 0, 0);
state.time=cfra;
psys_get_particle_state(&sim, i, &state, 1);
vertco=CDDM_get_vert(explode,v)->co;
-
mul_m4_v3(ob->obmat,vertco);
- VECSUB(vertco,vertco,loc0);
+ sub_v3_v3(vertco, birth.co);
/* apply rotation, size & location */
- mul_qt_v3(state.rot,vertco);
+ sub_qt_qtqt(rot, state.rot, birth.rot);
+ mul_qt_v3(rot, vertco);
+
if(emd->flag & eExplodeFlag_PaSize)
mul_v3_fl(vertco,pa->size);
- VECADD(vertco,vertco,state.co);
- mul_m4_v3(imat,vertco);
+ add_v3_v3(vertco, state.co);
+
+ mul_m4_v3(imat, vertco);
}
}
BLI_edgehashIterator_free(ehi);
@@ -911,7 +911,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];
@@ -1037,4 +1037,5 @@ ModifierTypeInfo modifierType_Explode = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c
index 354dc33ffe0..cce288b4ad5 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim.c
@@ -162,4 +162,5 @@ ModifierTypeInfo modifierType_Fluidsim = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 61345427d1c..277f0852f90 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -90,10 +90,10 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
fss->viscosityValue = 1.0;
fss->viscosityExponent = 6;
- // dg TODO: change this to []
- fss->gravx = 0.0;
- fss->gravy = 0.0;
- fss->gravz = -9.81;
+ fss->grav[0] = 0.0;
+ fss->grav[1] = 0.0;
+ fss->grav[2] = -9.81;
+
fss->animStart = 0.0;
fss->animEnd = 4.0;
fss->gstar = 0.005; // used as normgstar
@@ -111,7 +111,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
// no bounding box needed
// todo - reuse default init from elbeem!
- fss->typeFlags = OB_FSBND_PARTSLIP;
+ fss->typeFlags = OB_FSBND_PARTSLIP | OB_FSSG_NOOBS;
fss->domainNovecgen = 0;
fss->volumeInitType = 1; // volume
fss->partSlipValue = 0.2;
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 082c199b16f..785abc7d4d1 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -157,9 +157,8 @@ static void deformVerts(ModifierData *md, Object *ob,
int i, *index_pt;
const float falloff_squared= hmd->falloff * hmd->falloff; /* for faster comparisons */
- int max_dvert= 0;
- MDeformVert *dvert= NULL;
- int defgrp_index = -1;
+ MDeformVert *dvert;
+ int defgrp_index, max_dvert;
/* get world-space matrix of target, corrected for the space the verts are in */
if (hmd->subtarget[0] && pchan) {
@@ -174,21 +173,8 @@ static void deformVerts(ModifierData *md, Object *ob,
mul_serie_m4(mat, ob->imat, dmat, hmd->parentinv,
NULL, NULL, NULL, NULL, NULL);
- if((defgrp_index= defgroup_name_index(ob, hmd->name)) != -1) {
- Mesh *me = ob->data;
- if(dm) {
- dvert= dm->getVertDataArray(dm, CD_MDEFORMVERT);
- if(dvert) {
- max_dvert = numVerts;
- }
- }
- else if(me->dvert) {
- dvert= me->dvert;
- if(dvert) {
- max_dvert = me->totvert;
- }
- }
- }
+ modifier_get_vgroup(ob, dm, hmd->name, &dvert, &defgrp_index);
+ max_dvert = (dvert)? numVerts: 0;
/* Regarding index range checking below.
*
@@ -303,4 +289,5 @@ ModifierTypeInfo modifierType_Hook = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index 694f8fb3e52..31c17fb7376 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -156,4 +156,5 @@ ModifierTypeInfo modifierType_Lattice = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index b36d6848533..b7cdac9e246 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -45,6 +45,7 @@
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
+#include "BKE_action.h" /* get_pose_channel */
#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
@@ -102,7 +103,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
DerivedMesh *dm= derivedData, *result= NULL;
GHash *vertHash=NULL, *edgeHash, *faceHash;
GHashIterator *hashIter;
- MDeformVert *dvert= NULL;
+ MDeformVert *dvert= NULL, *dv;
int numFaces=0, numEdges=0, numVerts=0;
int maxVerts, maxEdges, maxFaces;
int i;
@@ -130,50 +131,46 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* if mode is to use selected armature bones, aggregate the bone groups */
if (mmd->mode == MOD_MASK_MODE_ARM) /* --- using selected bones --- */
{
- GHash *vgroupHash, *boneHash;
+ GHash *vgroupHash;
Object *oba= mmd->ob_arm;
bPoseChannel *pchan;
bDeformGroup *def;
+ char *bone_select_array;
+ int bone_select_tot= 0;
/* check that there is armature object with bones to use, otherwise return original mesh */
- if (ELEM(NULL, mmd->ob_arm, mmd->ob_arm->pose))
- return derivedData;
-
+ if (ELEM3(NULL, mmd->ob_arm, mmd->ob_arm->pose, ob->defbase.first))
+ return derivedData;
+
+ bone_select_array= MEM_mallocN(BLI_countlist(&ob->defbase) * sizeof(char), "mask array");
+
+ for (i = 0, def = ob->defbase.first; def; def = def->next, i++)
+ {
+ if (((pchan= get_pose_channel(oba->pose, def->name)) && pchan->bone && (pchan->bone->flag & BONE_SELECTED)))
+ {
+ bone_select_array[i]= TRUE;
+ bone_select_tot++;
+ }
+ else {
+ bone_select_array[i]= FALSE;
+ }
+ }
+
/* hashes for finding mapping of:
* - vgroups to indices -> vgroupHash (string, int)
* - bones to vgroup indices -> boneHash (index of vgroup, dummy)
*/
vgroupHash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "mask vgroup gh");
- boneHash= BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask bone gh");
/* build mapping of names of vertex groups to indices */
for (i = 0, def = ob->defbase.first; def; def = def->next, i++)
BLI_ghash_insert(vgroupHash, def->name, SET_INT_IN_POINTER(i));
- /* get selected-posechannel <-> vertexgroup index mapping */
- for (pchan= oba->pose->chanbase.first; pchan; pchan= pchan->next)
- {
- /* check if bone is selected */
- // TODO: include checks for visibility too?
- // FIXME: the depsgraph needs extensions to make this work in realtime...
- if ( (pchan->bone) && (pchan->bone->flag & BONE_SELECTED) )
- {
- /* check if hash has group for this bone */
- if (BLI_ghash_haskey(vgroupHash, pchan->name))
- {
- int defgrp_index= GET_INT_FROM_POINTER(BLI_ghash_lookup(vgroupHash, pchan->name));
-
- /* add index to hash (store under key only) */
- BLI_ghash_insert(boneHash, SET_INT_IN_POINTER(defgrp_index), pchan);
- }
- }
- }
-
/* if no bones selected, free hashes and return original mesh */
- if (BLI_ghash_size(boneHash) == 0)
+ if (bone_select_tot == 0)
{
BLI_ghash_free(vgroupHash, NULL, NULL);
- BLI_ghash_free(boneHash, NULL, NULL);
+ MEM_freeN(bone_select_array);
return derivedData;
}
@@ -183,7 +180,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
if (dvert == NULL)
{
BLI_ghash_free(vgroupHash, NULL, NULL);
- BLI_ghash_free(boneHash, NULL, NULL);
+ MEM_freeN(bone_select_array);
return derivedData;
}
@@ -192,28 +189,29 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vertHash= BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask vert gh");
/* add vertices which exist in vertexgroups into vertHash for filtering */
- for (i = 0; i < maxVerts; i++)
+ for (i= 0, dv= dvert; i < maxVerts; i++, dv++)
{
- MDeformWeight *def_weight = NULL;
+ MDeformWeight *dw= dv->dw;
int j;
-
- for (j= 0; j < dvert[i].totweight; j++)
+
+ for (j= dv->totweight; j > 0; j--, dw++)
{
- if (BLI_ghash_haskey(boneHash, SET_INT_IN_POINTER(dvert[i].dw[j].def_nr)))
+ if (bone_select_array[dw->def_nr])
{
- def_weight = &dvert[i].dw[j];
- break;
+ if(dw->weight != 0.0f) {
+ break;
+ }
}
}
/* check if include vert in vertHash */
if (mmd->flag & MOD_MASK_INV) {
/* if this vert is in the vgroup, don't include it in vertHash */
- if (def_weight) continue;
+ if (dw) continue;
}
else {
/* if this vert isn't in the vgroup, don't include it in vertHash */
- if (!def_weight) continue;
+ if (!dw) continue;
}
/* add to ghash for verts (numVerts acts as counter for mapping) */
@@ -223,7 +221,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* free temp hashes */
BLI_ghash_free(vgroupHash, NULL, NULL);
- BLI_ghash_free(boneHash, NULL, NULL);
+ MEM_freeN(bone_select_array);
}
else /* --- Using Nominated VertexGroup only --- */
{
@@ -241,28 +239,18 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vertHash= BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask vert2 bh");
/* add vertices which exist in vertexgroup into ghash for filtering */
- for (i = 0; i < maxVerts; i++)
+ for (i= 0, dv= dvert; i < maxVerts; i++, dv++)
{
- MDeformWeight *def_weight = NULL;
- int j;
-
- for (j= 0; j < dvert[i].totweight; j++)
- {
- if (dvert[i].dw[j].def_nr == defgrp_index)
- {
- def_weight = &dvert[i].dw[j];
- break;
- }
- }
+ const int weight_set= defvert_find_weight(dv, defgrp_index) != 0.0f;
/* check if include vert in vertHash */
if (mmd->flag & MOD_MASK_INV) {
/* if this vert is in the vgroup, don't include it in vertHash */
- if (def_weight) continue;
+ if (weight_set) continue;
}
else {
/* if this vert isn't in the vgroup, don't include it in vertHash */
- if (!def_weight) continue;
+ if (!weight_set) continue;
}
/* add to ghash for verts (numVerts acts as counter for mapping) */
@@ -419,4 +407,5 @@ ModifierTypeInfo modifierType_Mask = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index ba73f3fa0d1..8a0e64e7ee4 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -72,6 +72,8 @@ static void freeData(ModifierData *md)
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)
@@ -282,10 +284,7 @@ static void meshdeformModifier_do(
copy_v3_v3(dco[a], co);
}
- defgrp_index = defgroup_name_index(ob, mmd->defgrp_name);
-
- if(dm && defgrp_index >= 0)
- dvert= dm->getVertDataArray(dm, CD_MDEFORMVERT);
+ modifier_get_vgroup(ob, dm, mmd->defgrp_name, &dvert, &defgrp_index);
/* do deformation */
fac= 1.0f;
@@ -464,4 +463,5 @@ ModifierTypeInfo modifierType_MeshDeform = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index b1c765e5c9b..7cde87b20d9 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -363,4 +363,5 @@ ModifierTypeInfo modifierType_Mirror = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c
index 134574ae6c4..48b1112cad2 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -131,4 +131,5 @@ ModifierTypeInfo modifierType_Multires = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c
index 48c5b9a4c08..8fed2150a75 100644
--- a/source/blender/modifiers/intern/MOD_none.c
+++ b/source/blender/modifiers/intern/MOD_none.c
@@ -77,4 +77,5 @@ ModifierTypeInfo modifierType_None = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index 46d53e0db15..b0b43e018f7 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -350,4 +350,5 @@ ModifierTypeInfo modifierType_ParticleInstance = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index 533bfd203b5..5635ba33d80 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -242,4 +242,5 @@ ModifierTypeInfo modifierType_ParticleSystem = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 17e350482f0..486c98f82a0 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -275,7 +275,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 < 2) step_tot= 2;
+ 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 */
@@ -286,7 +286,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
else {
close= 0;
- if(step_tot < 2) step_tot= 2;
+ 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 */
@@ -903,4 +903,5 @@ ModifierTypeInfo modifierType_Screw = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c
index 94d23de6573..6e55466c1e4 100644
--- a/source/blender/modifiers/intern/MOD_shapekey.c
+++ b/source/blender/modifiers/intern/MOD_shapekey.c
@@ -148,5 +148,6 @@ ModifierTypeInfo modifierType_ShapeKey = {
/* dependsOnTime */ NULL,
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
- /* foreachIDLink */ NULL
+ /* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index e1fc4bc969f..ba25df19b3e 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -186,4 +186,5 @@ ModifierTypeInfo modifierType_Shrinkwrap = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index ea4771b679a..b2e3c9532b6 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -162,8 +162,8 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
float smd_limit[2], smd_factor;
SpaceTransform *transf = NULL, tmp_transf;
void (*simpleDeform_callback)(const float factor, const float dcut[3], float *co) = NULL; //Mode callback
- int vgroup = defgroup_name_index(ob, smd->vgroup_name);
- MDeformVert *dvert = NULL;
+ int vgroup;
+ MDeformVert *dvert;
//Safe-check
if(smd->origin == ob) smd->origin = NULL; //No self references
@@ -216,17 +216,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
smd_factor = smd->factor / MAX2(FLT_EPSILON, smd_limit[1]-smd_limit[0]);
}
-
- if(dm)
- {
- dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
- }
- else if(ob->type == OB_LATTICE)
- {
- dvert = lattice_get_deform_verts(ob);
- }
-
-
+ modifier_get_vgroup(ob, dm, smd->vgroup_name, &dvert, &vgroup);
switch(smd->mode)
{
@@ -395,4 +385,5 @@ ModifierTypeInfo modifierType_SimpleDeform = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c
index d8e94e92bfa..2e156d82ec6 100644
--- a/source/blender/modifiers/intern/MOD_smoke.c
+++ b/source/blender/modifiers/intern/MOD_smoke.c
@@ -43,6 +43,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_smoke_types.h"
+#include "DNA_object_force.h"
#include "BLI_utildefines.h"
@@ -156,6 +157,10 @@ static void foreachIDLink(ModifierData *md, Object *ob,
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) {
+ walk(userData, ob, (ID **)&smd->domain->effector_weights->group);
+ }
}
}
@@ -184,4 +189,5 @@ ModifierTypeInfo modifierType_Smoke = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
+ /* foreachTexLink */ NULL
};
diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c
index 5f76fad14b1..16898a80b53 100644
--- a/source/blender/modifiers/intern/MOD_smooth.c
+++ b/source/blender/modifiers/intern/MOD_smooth.c
@@ -123,10 +123,7 @@ static void smoothModifier_do(
medges = dm->getEdgeArray(dm);
numDMEdges = dm->getNumEdges(dm);
- defgrp_index = defgroup_name_index(ob, smd->defgrp_name);
-
- if (defgrp_index >= 0)
- dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+ modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
/* NOTICE: this can be optimized a little bit by moving the
* if (dvert) out of the loop, if needed */
@@ -273,4 +270,5 @@ ModifierTypeInfo modifierType_Smooth = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c
index 25996286735..c475328676b 100644
--- a/source/blender/modifiers/intern/MOD_softbody.c
+++ b/source/blender/modifiers/intern/MOD_softbody.c
@@ -87,4 +87,5 @@ ModifierTypeInfo modifierType_Softbody = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 1b7b724835c..afe6da8b38a 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -48,6 +48,7 @@
#include "MOD_modifiertypes.h"
+#include "MOD_util.h"
#include "MEM_guardedalloc.h"
@@ -231,16 +232,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
float (*vert_nors)[3]= NULL;
- float const ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
- float const ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
+ const float ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
+ const float ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
+ const float offset_fac_vg= smd->offset_fac_vg;
+ const float offset_fac_vg_inv= 1.0f - smd->offset_fac_vg;
/* weights */
- MDeformVert *dvert= NULL, *dv= NULL;
+ MDeformVert *dvert, *dv= NULL;
const int defgrp_invert = ((smd->flag & MOD_SOLIDIFY_VGROUP_INV) != 0);
- const int defgrp_index= defgroup_name_index(ob, smd->defgrp_name);
+ int defgrp_index;
- if (defgrp_index >= 0)
- dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+ modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
orig_mface = dm->getFaceArray(dm);
orig_medge = dm->getEdgeArray(dm);
@@ -391,8 +393,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
dv= dvert;
for(i=0; i<numVerts; i++, mv++) {
if(dv) {
- if(defgrp_invert) scalar_short_vgroup = scalar_short * (1.0f - defvert_find_weight(dv, defgrp_index));
- else scalar_short_vgroup = scalar_short * defvert_find_weight(dv, defgrp_index);
+ if(defgrp_invert) scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
+ else scalar_short_vgroup = defvert_find_weight(dv, defgrp_index);
+ scalar_short_vgroup= (offset_fac_vg + (scalar_short_vgroup * offset_fac_vg_inv)) * scalar_short;
dv++;
}
VECADDFAC(mv->co, mv->co, mv->no, scalar_short_vgroup);
@@ -405,8 +408,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
dv= dvert;
for(i=0; i<numVerts; i++, mv++) {
if(dv) {
- if(defgrp_invert) scalar_short_vgroup = scalar_short * (1.0f - defvert_find_weight(dv, defgrp_index));
- else scalar_short_vgroup = scalar_short * defvert_find_weight(dv, defgrp_index);
+ if(defgrp_invert) scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
+ else scalar_short_vgroup = defvert_find_weight(dv, defgrp_index);
+ scalar_short_vgroup= (offset_fac_vg + (scalar_short_vgroup * offset_fac_vg_inv)) * scalar_short;
dv++;
}
VECADDFAC(mv->co, mv->co, mv->no, scalar_short_vgroup);
@@ -466,15 +470,21 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* vertex group support */
if(dvert) {
+ float scalar;
+
dv= dvert;
if(defgrp_invert) {
for(i=0; i<numVerts; i++, dv++) {
- vert_angles[i] *= (1.0f - defvert_find_weight(dv, defgrp_index));
+ scalar= 1.0f - defvert_find_weight(dv, defgrp_index);
+ scalar= offset_fac_vg + (scalar * offset_fac_vg_inv);
+ vert_angles[i] *= scalar;
}
}
else {
for(i=0; i<numVerts; i++, dv++) {
- vert_angles[i] *= defvert_find_weight(dv, defgrp_index);
+ scalar= defvert_find_weight(dv, defgrp_index);
+ scalar= offset_fac_vg + (scalar * offset_fac_vg_inv);
+ vert_angles[i] *= scalar;
}
}
}
@@ -689,5 +699,6 @@ ModifierTypeInfo modifierType_Solidify = {
/* dependsOnTime */ NULL,
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
- /* foreachIDLink */ NULL
+ /* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index f780721ca07..6c825b213b8 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -152,4 +152,6 @@ ModifierTypeInfo modifierType_Subsurf = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
+
diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c
index 382358b179e..e30b7f2392d 100644
--- a/source/blender/modifiers/intern/MOD_surface.c
+++ b/source/blender/modifiers/intern/MOD_surface.c
@@ -192,4 +192,5 @@ ModifierTypeInfo modifierType_Surface = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index d008fcfc929..74fc022c343 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -37,6 +37,7 @@
#include <string.h>
+#include "DNA_lattice_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_curve_types.h"
@@ -47,6 +48,8 @@
#include "BLI_math_matrix.h"
#include "BKE_cdderivedmesh.h"
+#include "BKE_deform.h"
+#include "BKE_lattice.h"
#include "BKE_mesh.h"
#include "BKE_displist.h"
@@ -239,6 +242,19 @@ DerivedMesh *get_dm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*ve
return dm;
}
+void modifier_get_vgroup(Object *ob, DerivedMesh *dm, const char *name, MDeformVert **dvert, int *defgrp_index)
+{
+ *defgrp_index = defgroup_name_index(ob, name);
+ *dvert = NULL;
+
+ if(*defgrp_index >= 0) {
+ if(ob->type == OB_LATTICE)
+ *dvert = lattice_get_deform_verts(ob);
+ else if(dm)
+ *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+ }
+}
+
/* only called by BKE_modifier.h/modifier.c */
void modifier_type_init(ModifierTypeInfo *types[])
{
diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h
index b7862403459..5e6f377acf1 100644
--- a/source/blender/modifiers/intern/MOD_util.h
+++ b/source/blender/modifiers/intern/MOD_util.h
@@ -36,14 +36,15 @@
/* so modifier types match their defines */
#include "MOD_modifiertypes.h"
-struct Tex;
-struct TexResult;
struct CustomData;
struct DerivedMesh;
-struct Object;
-struct Scene;
struct EditMesh;
+struct MDeformVert;
struct ModifierData;
+struct Object;
+struct Scene;
+struct Tex;
+struct TexResult;
void get_texture_value(struct Tex *texture, float *tex_co, struct TexResult *texres);
void get_texture_coords(struct MappingInfoModifierData *dmd, struct Object *ob, struct DerivedMesh *dm, float (*co)[3], float (*texco)[3], int numVerts);
@@ -51,5 +52,6 @@ void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]);
void validate_layer_name(const struct CustomData *data, int type, char *name, char *outname);
struct DerivedMesh *get_cddm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]);
struct DerivedMesh *get_dm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int orco);
+void modifier_get_vgroup(struct Object *ob, struct DerivedMesh *dm, const char *name, struct MDeformVert **dvert, int *defgrp_index);
#endif /* MOD_UTIL_H */
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index a5d2e0b38c7..912c14adfdd 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -42,6 +42,7 @@
#include "DNA_object_types.h"
#include "BLI_math.h"
+#include "BLI_string.h"
#include "BLI_uvproject.h"
#include "BLI_utildefines.h"
@@ -83,6 +84,7 @@ static void copyData(ModifierData *md, ModifierData *target)
tumd->aspecty = umd->aspecty;
tumd->scalex = umd->scalex;
tumd->scaley = umd->scaley;
+ BLI_strncpy(tumd->uvlayer_name, umd->uvlayer_name, sizeof(umd->uvlayer_name));
}
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
@@ -432,4 +434,5 @@ ModifierTypeInfo modifierType_UVProject = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ foreachIDLink,
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index 27add27deb1..c1c3604d598 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -85,8 +85,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if(wmd->defgrp_name[0]) dataMask |= (1 << CD_MDEFORMVERT);
- dataMask |= (1 << CD_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);
@@ -140,6 +140,11 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u
walk(userData, ob, (ID **)&wmd->map_object);
}
+static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void *userData)
+{
+ walk(userData, ob, md, "texture");
+}
+
static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UNUSED(scene),
Object *UNUSED(ob), DagNode *obNode)
{
@@ -174,14 +179,16 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
float strength = wmd->strength;
float fac = 1.0f, weight;
int i;
- int defgrp_index = defgroup_name_index(ob, wmd->defgrp_name);
- MDeformVert *dv= NULL;
+ int defgrp_index;
+ MDeformVert *dvert, *dv= NULL;
float (*tex_co)[3]= NULL;
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 */
wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
@@ -221,8 +228,8 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
((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(defgrp_index >= 0) {
- dv = dm->getVertData(dm, i, CD_MDEFORMVERT);
+ if(dvert && defgrp_index >= 0) {
+ dv = &dvert[i];
if(dv) {
weight = defvert_find_weight(dv, defgrp_index) * wmd->strength;
@@ -362,4 +369,5 @@ ModifierTypeInfo modifierType_Warp = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ foreachIDLink,
+ /* foreachTexLink */ foreachTexLink,
};
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index 6dfe5314131..4b5769ff603 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -126,6 +126,12 @@ static void foreachIDLink(ModifierData *md, Object *ob,
foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData);
}
+static void foreachTexLink(ModifierData *md, Object *ob,
+ TexWalkFunc walk, void *userData)
+{
+ walk(userData, ob, md, "texture");
+}
+
static void updateDepgraph(ModifierData *md, DagForest *forest,
Scene *UNUSED(scene),
Object *UNUSED(ob),
@@ -256,7 +262,7 @@ static void waveModifier_do(WaveModifierData *md,
{
WaveModifierData *wmd = (WaveModifierData*) md;
MVert *mvert = NULL;
- MDeformVert *dvert = NULL;
+ MDeformVert *dvert;
int defgrp_index;
float ctime = BKE_curframe(scene);
float minfac =
@@ -281,11 +287,7 @@ static void waveModifier_do(WaveModifierData *md,
}
/* get the index of the deform group */
- defgrp_index = defgroup_name_index(ob, wmd->defgrp_name);
-
- if(defgrp_index >= 0){
- dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
- }
+ modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index);
if(wmd->damp == 0) wmd->damp = 10.0f;
@@ -470,4 +472,5 @@ ModifierTypeInfo modifierType_Wave = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
/* foreachIDLink */ foreachIDLink,
+ /* foreachTexLink */ foreachTexLink,
};