forked from bartvdbraak/blender
Fix T46249: Boid goal object that has a force field set to 'Every Point' shape causes crash.
This is a mere bandage, that whole area is known broken anyway, but at least it should prevent the crash. Note that that kind of stuff (the efd->index being a pointer) is really bad practice imho... Should be backported to final 2.76.
This commit is contained in:
parent
a4a6e9b3f5
commit
cf12e51eba
@ -80,6 +80,9 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
|
|||||||
float priority = 0.0f, len = 0.0f;
|
float priority = 0.0f, len = 0.0f;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
int p = 0;
|
||||||
|
efd.index = cur_efd.index = &p;
|
||||||
|
|
||||||
pd_point_from_particle(bbd->sim, pa, &pa->state, &epoint);
|
pd_point_from_particle(bbd->sim, pa, &pa->state, &epoint);
|
||||||
|
|
||||||
/* first find out goal/predator with highest priority */
|
/* first find out goal/predator with highest priority */
|
||||||
|
@ -687,10 +687,10 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
|
|||||||
}
|
}
|
||||||
static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step)
|
static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step)
|
||||||
{
|
{
|
||||||
if (eff->pd->shape == PFIELD_SHAPE_POINTS) {
|
*p = 0;
|
||||||
efd->index = p;
|
efd->index = p;
|
||||||
|
|
||||||
*p = 0;
|
if (eff->pd->shape == PFIELD_SHAPE_POINTS) {
|
||||||
*tot = eff->ob->derivedFinal ? eff->ob->derivedFinal->numVertData : 1;
|
*tot = eff->ob->derivedFinal ? eff->ob->derivedFinal->numVertData : 1;
|
||||||
|
|
||||||
if (*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) {
|
if (*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) {
|
||||||
@ -699,9 +699,6 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (eff->psys) {
|
else if (eff->psys) {
|
||||||
efd->index = p;
|
|
||||||
|
|
||||||
*p = 0;
|
|
||||||
*tot = eff->psys->totpart;
|
*tot = eff->psys->totpart;
|
||||||
|
|
||||||
if (eff->pd->forcefield == PFIELD_CHARGE) {
|
if (eff->pd->forcefield == PFIELD_CHARGE) {
|
||||||
@ -727,7 +724,6 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*p = 0;
|
|
||||||
*tot = 1;
|
*tot = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user