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:
authorJanne Karhu <jhkarh@gmail.com>2008-03-31 23:57:40 +0400
committerJanne Karhu <jhkarh@gmail.com>2008-03-31 23:57:40 +0400
commit5e3ff914cbde895b54dda11bb3689c35937ac7d0 (patch)
tree9c54f5ae36bbb0502ebdf4499425582a375c588b
parent1ccf92aecd62914b87e0c4f1e70ba01b2e4eca09 (diff)
Fix for bug: [#8302] Particle atributes (Materials) wrong behavior
-Particle texture calculations weren't using the mtex->def_var properly -Texture buttons didn't set proper update flags for hair
-rw-r--r--source/blender/blenkernel/intern/particle.c26
-rw-r--r--source/blender/src/buttons_shading.c16
2 files changed, 23 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 04e9d63b9b5..6b2f2f911c6 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3092,6 +3092,7 @@ static void get_cpa_texture(DerivedMesh *dm, Material *ma, int face_index, float
if(ma) for(m=0; m<MAX_MTEX; m++){
mtex=ma->mtex[m];
if(mtex && (ma->septex & (1<<m))==0){
+ float def=mtex->def_var;
float var=mtex->varfac;
short blend=mtex->blendtype;
short neg=mtex->pmaptoneg;
@@ -3126,13 +3127,13 @@ static void get_cpa_texture(DerivedMesh *dm, Material *ma, int face_index, float
ptex->time= texture_value_blend(mtex->def_var,ptex->time,value,var,blend,neg & MAP_PA_TIME);
}
if((event & mtex->pmapto) & MAP_PA_LENGTH)
- ptex->length= texture_value_blend(value,ptex->length,value,var,blend,neg & MAP_PA_LENGTH);
+ ptex->length= texture_value_blend(def,ptex->length,value,var,blend,neg & MAP_PA_LENGTH);
if((event & mtex->pmapto) & MAP_PA_CLUMP)
- ptex->clump= texture_value_blend(value,ptex->clump,value,var,blend,neg & MAP_PA_CLUMP);
+ ptex->clump= texture_value_blend(def,ptex->clump,value,var,blend,neg & MAP_PA_CLUMP);
if((event & mtex->pmapto) & MAP_PA_KINK)
- ptex->kink= texture_value_blend(value,ptex->kink,value,var,blend,neg & MAP_PA_KINK);
+ ptex->kink= texture_value_blend(def,ptex->kink,value,var,blend,neg & MAP_PA_KINK);
if((event & mtex->pmapto) & MAP_PA_ROUGH)
- ptex->rough= texture_value_blend(value,ptex->rough,value,var,blend,neg & MAP_PA_ROUGH);
+ ptex->rough= texture_value_blend(def,ptex->rough,value,var,blend,neg & MAP_PA_ROUGH);
}
}
if(event & MAP_PA_TIME) { CLAMP(ptex->time,0.0,1.0); }
@@ -3152,6 +3153,7 @@ void psys_get_texture(Object *ob, Material *ma, ParticleSystemModifierData *psmd
mtex=ma->mtex[m];
if(mtex && (ma->septex & (1<<m))==0){
float var=mtex->varfac;
+ float def=mtex->def_var;
short blend=mtex->blendtype;
short neg=mtex->pmaptoneg;
@@ -3192,24 +3194,24 @@ void psys_get_texture(Object *ob, Material *ma, ParticleSystemModifierData *psmd
setvars |= MAP_PA_TIME;
}
else
- ptex->time= texture_value_blend(mtex->def_var,ptex->time,value,var,blend,neg & MAP_PA_TIME);
+ ptex->time= texture_value_blend(def,ptex->time,value,var,blend,neg & MAP_PA_TIME);
}
if((event & mtex->pmapto) & MAP_PA_LIFE)
- ptex->life= texture_value_blend(mtex->def_var,ptex->life,value,var,blend,neg & MAP_PA_LIFE);
+ ptex->life= texture_value_blend(def,ptex->life,value,var,blend,neg & MAP_PA_LIFE);
if((event & mtex->pmapto) & MAP_PA_DENS)
- ptex->exist= texture_value_blend(mtex->def_var,ptex->exist,value,var,blend,neg & MAP_PA_DENS);
+ ptex->exist= texture_value_blend(def,ptex->exist,value,var,blend,neg & MAP_PA_DENS);
if((event & mtex->pmapto) & MAP_PA_SIZE)
- ptex->size= texture_value_blend(mtex->def_var,ptex->size,value,var,blend,neg & MAP_PA_SIZE);
+ ptex->size= texture_value_blend(def,ptex->size,value,var,blend,neg & MAP_PA_SIZE);
if((event & mtex->pmapto) & MAP_PA_IVEL)
- ptex->ivel= texture_value_blend(mtex->def_var,ptex->ivel,value,var,blend,neg & MAP_PA_IVEL);
+ ptex->ivel= texture_value_blend(def,ptex->ivel,value,var,blend,neg & MAP_PA_IVEL);
if((event & mtex->pmapto) & MAP_PA_PVEL)
texture_rgb_blend(ptex->pvel,rgba,ptex->pvel,value,var,blend);
if((event & mtex->pmapto) & MAP_PA_LENGTH)
- ptex->length= texture_value_blend(mtex->def_var,ptex->length,value,var,blend,neg & MAP_PA_LENGTH);
+ ptex->length= texture_value_blend(def,ptex->length,value,var,blend,neg & MAP_PA_LENGTH);
if((event & mtex->pmapto) & MAP_PA_CLUMP)
- ptex->clump= texture_value_blend(mtex->def_var,ptex->clump,value,var,blend,neg & MAP_PA_CLUMP);
+ ptex->clump= texture_value_blend(def,ptex->clump,value,var,blend,neg & MAP_PA_CLUMP);
if((event & mtex->pmapto) & MAP_PA_KINK)
- ptex->kink= texture_value_blend(mtex->def_var,ptex->kink,value,var,blend,neg & MAP_PA_CLUMP);
+ ptex->kink= texture_value_blend(def,ptex->kink,value,var,blend,neg & MAP_PA_CLUMP);
}
}
if(event & MAP_PA_TIME) { CLAMP(ptex->time,0.0,1.0); }
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index e4a271ffc28..4ff6ff7b7d9 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -3167,7 +3167,7 @@ void do_matbuts(unsigned short event)
ob=base->object;
for(psys=ob->particlesystem.first; psys; psys=psys->next) {
if(psys && ma==give_current_material(ob,psys->part->omat)) {
- psys->recalc |= PSYS_INIT;
+ psys->recalc |= PSYS_INIT | PSYS_RECALC_HAIR;
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
}
@@ -3193,7 +3193,7 @@ static void particle_recalc_material(void *ma_v, void *arg2)
ob=base->object;
for(psys=ob->particlesystem.first; psys; psys=psys->next){
if(psys && ma==give_current_material(ob,psys->part->omat)){
- psys->recalc |= PSYS_INIT;
+ psys->recalc |= PSYS_INIT | PSYS_RECALC_HAIR;
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
}
@@ -3249,16 +3249,18 @@ static void material_panel_map_to(Object *ob, Material *ma, int from_nodes)
uiDefButF(block, NUMSLI, B_MATPRV, "B ", 10,40,135,19, &(mtex->b), 0.0, 1.0, B_MTEXCOL, 0, "The default color for textures that don't return RGB");
}
uiBlockEndAlign(block);
-
- uiDefButF(block, NUMSLI, B_MATPRV, "DVar ", 10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
-
- /* MAP TO */
- uiBlockBeginAlign(block);
/*check if material is being used by particles*/
for(psys=ob->particlesystem.first; psys; psys=psys->next)
if(psys->part->omat==ob->actcol)
psys_mapto=1;
+
+ but = uiDefButF(block, NUMSLI, B_MATPRV, "DVar ", 10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
+ if(psys_mapto && mtex->pmapto & MAP_PA_INIT)
+ uiButSetFunc(but, particle_recalc_material, ma, NULL);
+
+ /* MAP TO */
+ uiBlockBeginAlign(block);
if(psys_mapto && pattr) {
but=uiDefButBitS(block, TOG3, MAP_PA_TIME, B_MAT_PARTICLE, "Time", 10,180,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the emission time of particles");