Hairdresser request;
"Additive" Guides. See also: http://www.blender3d.org/cms/New_Particle_options_a.721.0.html This Guide type uses the falloff distance to also define how much the particle (or hair strand) goes over the path, allowing to create local extremes, or only local particle generating or hairgrowth. Nice for spiky haircuts!
This commit is contained in:
@@ -342,11 +342,13 @@ ListBase *pdInitEffectors(unsigned int layer)
|
|||||||
|
|
||||||
if(cu->path==NULL || cu->path->data==NULL)
|
if(cu->path==NULL || cu->path->data==NULL)
|
||||||
makeDispListCurveTypes(ob, 0);
|
makeDispListCurveTypes(ob, 0);
|
||||||
|
if(cu->path && cu->path->data) {
|
||||||
ec->ob= ob;
|
ec->ob= ob;
|
||||||
BLI_addtail(&listb, ec);
|
BLI_addtail(&listb, ec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if(pd->forcefield) {
|
else if(pd->forcefield) {
|
||||||
pEffectorCache *ec= MEM_callocN(sizeof(pEffectorCache), "effector cache");
|
pEffectorCache *ec= MEM_callocN(sizeof(pEffectorCache), "effector cache");
|
||||||
ec->ob= ob;
|
ec->ob= ob;
|
||||||
@@ -562,19 +564,6 @@ void pdDoEffectors(ListBase *lb, float *opco, float *force, float *speed, float
|
|||||||
/* WARNING: bails out with continue here */
|
/* WARNING: bails out with continue here */
|
||||||
if((pd->flag & PFIELD_USEMAX) && distance>pd->maxdist) continue;
|
if((pd->flag & PFIELD_USEMAX) && distance>pd->maxdist) continue;
|
||||||
|
|
||||||
/* derive path point from loc_time */
|
|
||||||
where_on_path(ob, loc_time*ec->time_scale, guidevec, guidedir);
|
|
||||||
VECSUB(guidedir, guidevec, ec->oldloc);
|
|
||||||
VECCOPY(ec->oldloc, guidevec);
|
|
||||||
|
|
||||||
Mat4Mul3Vecfl(ob->obmat, guidedir);
|
|
||||||
VecMulf(guidedir, ec->scale); /* correction for lifetime and speed */
|
|
||||||
|
|
||||||
/* we subtract the speed we gave it previous step */
|
|
||||||
VECCOPY(guidevec, guidedir);
|
|
||||||
VECSUB(guidedir, guidedir, ec->oldspeed);
|
|
||||||
VECCOPY(ec->oldspeed, guidevec);
|
|
||||||
|
|
||||||
/* calculate contribution factor for this guide */
|
/* calculate contribution factor for this guide */
|
||||||
if(distance<=mindist) f_force= 1.0f;
|
if(distance<=mindist) f_force= 1.0f;
|
||||||
else if(pd->flag & PFIELD_USEMAX) {
|
else if(pd->flag & PFIELD_USEMAX) {
|
||||||
@@ -591,6 +580,22 @@ void pdDoEffectors(ListBase *lb, float *opco, float *force, float *speed, float
|
|||||||
f_force = (float)pow(f_force, ffall_val+1.0);
|
f_force = (float)pow(f_force, ffall_val+1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* now derive path point from loc_time */
|
||||||
|
if(pd->flag & PFIELD_GUIDE_PATH_ADD)
|
||||||
|
where_on_path(ob, f_force*loc_time*ec->time_scale, guidevec, guidedir);
|
||||||
|
else
|
||||||
|
where_on_path(ob, loc_time*ec->time_scale, guidevec, guidedir);
|
||||||
|
VECSUB(guidedir, guidevec, ec->oldloc);
|
||||||
|
VECCOPY(ec->oldloc, guidevec);
|
||||||
|
|
||||||
|
Mat4Mul3Vecfl(ob->obmat, guidedir);
|
||||||
|
VecMulf(guidedir, ec->scale); /* correction for lifetime and speed */
|
||||||
|
|
||||||
|
/* we subtract the speed we gave it previous step */
|
||||||
|
VECCOPY(guidevec, guidedir);
|
||||||
|
VECSUB(guidedir, guidedir, ec->oldspeed);
|
||||||
|
VECCOPY(ec->oldspeed, guidevec);
|
||||||
|
|
||||||
/* if it fully contributes, we stop */
|
/* if it fully contributes, we stop */
|
||||||
if(f_force==1.0) {
|
if(f_force==1.0) {
|
||||||
VECCOPY(guidecollect, guidedir);
|
VECCOPY(guidecollect, guidedir);
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ typedef struct SoftBody {
|
|||||||
/* pd->flag: various settings */
|
/* pd->flag: various settings */
|
||||||
#define PFIELD_USEMAX 1
|
#define PFIELD_USEMAX 1
|
||||||
#define PDEFLE_DEFORM 2
|
#define PDEFLE_DEFORM 2
|
||||||
|
#define PFIELD_GUIDE_PATH_ADD 4
|
||||||
|
|
||||||
/* ob->softflag */
|
/* ob->softflag */
|
||||||
#define OB_SB_ENABLE 1
|
#define OB_SB_ENABLE 1
|
||||||
|
|||||||
@@ -1745,6 +1745,10 @@ static void object_panel_fields(Object *ob)
|
|||||||
uiDefButBitS(block, TOG, PFIELD_USEMAX, B_FIELD_CHANGE, "Use MaxDist", 10,60,140,20, &pd->flag, 0.0, 0, 0, 0, "Use a maximum distance for the field to work");
|
uiDefButBitS(block, TOG, PFIELD_USEMAX, B_FIELD_CHANGE, "Use MaxDist", 10,60,140,20, &pd->flag, 0.0, 0, 0, 0, "Use a maximum distance for the field to work");
|
||||||
uiDefButF(block, NUM, B_FIELD_CHANGE, "MaxDist: ", 10,40,140,20, &pd->maxdist, 0, 1000.0, 10, 0, "Maximum distance for the field to work");
|
uiDefButF(block, NUM, B_FIELD_CHANGE, "MaxDist: ", 10,40,140,20, &pd->maxdist, 0, 1000.0, 10, 0, "Maximum distance for the field to work");
|
||||||
uiBlockEndAlign(block);
|
uiBlockEndAlign(block);
|
||||||
|
|
||||||
|
if(pd->forcefield == PFIELD_GUIDE)
|
||||||
|
uiDefButBitS(block, TOG, PFIELD_GUIDE_PATH_ADD, B_FIELD_CHANGE, "Additive", 10,10,140,20, &pd->flag, 0.0, 0, 0, 0, "Based on distance/falloff it adds a portion of the entire path");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uiDefBut(block, LABEL, 0, "Deflection", 160,180,140,20, NULL, 0.0, 0, 0, 0, "");
|
uiDefBut(block, LABEL, 0, "Deflection", 160,180,140,20, NULL, 0.0, 0, 0, 0, "");
|
||||||
|
|||||||
Reference in New Issue
Block a user