forked from bartvdbraak/blender
2.5:
* Fix crash entering particle mode, and particles not showing. Janne, please check the changes I made in psys_cache_paths, I'm not confident they are correct. * Fix some warnings
This commit is contained in:
parent
c543eca36e
commit
580d000f8f
@ -399,7 +399,7 @@ static int rule_flock(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
|
||||
KDTreeNearest ptn[11];
|
||||
float vec[3] = {0.0f, 0.0f, 0.0f}, loc[3] = {0.0f, 0.0f, 0.0f};
|
||||
int neighbors = BLI_kdtree_find_n_nearest(bbd->psys->tree, 11, pa->state.co, pa->prev_state.ave, ptn);
|
||||
int n, nearest = 1;
|
||||
int n;
|
||||
int ret = 0;
|
||||
|
||||
if(neighbors > 1) {
|
||||
@ -898,8 +898,6 @@ static BoidState *get_boid_state(BoidSettings *boids, ParticleData *pa) {
|
||||
/* determines the velocity the boid wants to have */
|
||||
void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
|
||||
{
|
||||
ParticleData *pars=bbd->psys->particles;
|
||||
ParticleEffectorCache *ec=0;
|
||||
BoidRule *rule;
|
||||
BoidSettings *boids = bbd->part->boids;
|
||||
BoidValues val;
|
||||
@ -1259,7 +1257,6 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
|
||||
}
|
||||
case eBoidMode_Falling:
|
||||
{
|
||||
float zvec[3] = {0.0f,0.0f,1.0f};
|
||||
float grav[3] = {0.0f, 0.0f, bbd->part->acc[2] < 0.0f ? -1.0f : 0.0f};
|
||||
|
||||
/* gather apparent gravity to r_ve */
|
||||
@ -1523,4 +1520,5 @@ BoidState *boid_get_current_state(BoidSettings *boids)
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2568,8 +2568,7 @@ void psys_cache_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra
|
||||
ParticleSettings *part = psys->part;
|
||||
|
||||
ParticleData *pa;
|
||||
ParticleKey result, *kkey[2] = {NULL, NULL};
|
||||
HairKey *hkey[2] = {NULL, NULL};
|
||||
ParticleKey result;
|
||||
|
||||
ParticleEdit *edit = 0;
|
||||
ParticleEditKey *ekey = 0;
|
||||
@ -2709,6 +2708,10 @@ void psys_cache_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra
|
||||
|
||||
dietime = birthtime + pa_length * (dietime - birthtime);
|
||||
}
|
||||
else
|
||||
/* XXX brecht: don't know if this code from 2.4 is correct
|
||||
* still, but makes hair appear again in particle mode */
|
||||
dietime= pind.hkey[0][pa->totkey-1].time;
|
||||
|
||||
/*--interpolate actual path from data points--*/
|
||||
for(k=0, ca=cache[i]; k<=steps; k++, ca++){
|
||||
@ -2731,14 +2734,14 @@ void psys_cache_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra
|
||||
if(edit){
|
||||
if(pset->brushtype==PE_BRUSH_WEIGHT){
|
||||
if(k==steps)
|
||||
VecLerpf(ca->col, nosel_col, sel_col, hkey[0]->weight);
|
||||
VecLerpf(ca->col, nosel_col, sel_col, pind.hkey[0]->weight);
|
||||
else
|
||||
VecLerpf(ca->col, nosel_col, sel_col,
|
||||
(1.0f - keytime) * hkey[0]->weight + keytime * hkey[1]->weight);
|
||||
(1.0f - keytime) * pind.hkey[0]->weight + keytime * pind.hkey[1]->weight);
|
||||
}
|
||||
else{
|
||||
if((ekey + (hkey[0] - pa->hair))->flag & PEK_SELECT){
|
||||
if((ekey + (hkey[1] - pa->hair))->flag & PEK_SELECT){
|
||||
if((ekey + (pind.hkey[0] - pa->hair))->flag & PEK_SELECT){
|
||||
if((ekey + (pind.hkey[1] - pa->hair))->flag & PEK_SELECT){
|
||||
VECCOPY(ca->col, sel_col);
|
||||
}
|
||||
else{
|
||||
@ -2746,7 +2749,7 @@ void psys_cache_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra
|
||||
}
|
||||
}
|
||||
else{
|
||||
if((ekey + (hkey[1] - pa->hair))->flag & PEK_SELECT){
|
||||
if((ekey + (pind.hkey[1] - pa->hair))->flag & PEK_SELECT){
|
||||
VecLerpf(ca->col, nosel_col, sel_col, keytime);
|
||||
}
|
||||
else{
|
||||
@ -3627,8 +3630,6 @@ void psys_get_particle_on_path(Scene *scene, Object *ob, ParticleSystem *psys, i
|
||||
ParticleData *pa;
|
||||
ChildParticle *cpa;
|
||||
ParticleTexture ptex;
|
||||
ParticleKey *kkey[2] = {NULL, NULL};
|
||||
HairKey *hkey[2] = {NULL, NULL};
|
||||
ParticleKey *par=0, keys[4], tstate;
|
||||
ParticleThreadContext ctx; /* fake thread context for child modifiers */
|
||||
ParticleInterpolationData pind;
|
||||
|
@ -2065,7 +2065,6 @@ void psys_count_keyed_targets(Object *ob, ParticleSystem *psys)
|
||||
{
|
||||
ParticleSystem *kpsys;
|
||||
ParticleTarget *pt = psys->targets.first;
|
||||
int psys_num = BLI_findindex(&ob->particlesystem, psys);
|
||||
int keys_valid = 1;
|
||||
psys->totkeyed = 0;
|
||||
|
||||
@ -2087,7 +2086,6 @@ void psys_count_keyed_targets(Object *ob, ParticleSystem *psys)
|
||||
|
||||
static void set_keyed_keys(Scene *scene, Object *ob, ParticleSystem *psys)
|
||||
{
|
||||
Object *kob = ob;
|
||||
ParticleSystem *kpsys = psys;
|
||||
ParticleTarget *pt;
|
||||
ParticleData *pa;
|
||||
@ -2143,7 +2141,7 @@ static void set_keyed_keys(Scene *scene, Object *ob, ParticleSystem *psys)
|
||||
if(psys->flag & PSYS_KEYED_TIMING && pt->duration!=0.0f)
|
||||
k++;
|
||||
|
||||
pt = (pt->next && pt->next->flag & PTARGET_VALID) ? pt = pt->next : psys->targets.first;
|
||||
pt = (pt->next && pt->next->flag & PTARGET_VALID)? pt->next : psys->targets.first;
|
||||
}
|
||||
|
||||
psys->flag |= PSYS_KEYED;
|
||||
|
@ -52,7 +52,7 @@ void BLI_kdtree_balance(KDTree *tree);
|
||||
|
||||
/* Find nearest returns index, and -1 if no node is found.
|
||||
* Find n nearest returns number of points found, with results in nearest.
|
||||
/* Normal is optional, but if given will limit results to points in normal direction from co. */
|
||||
* Normal is optional, but if given will limit results to points in normal direction from co. */
|
||||
int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *nearest);
|
||||
int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTreeNearest *nearest);
|
||||
|
||||
|
@ -280,7 +280,7 @@ static void view3d_modal_keymaps(wmWindowManager *wm, ARegion *ar, int stype)
|
||||
|
||||
/* copy last mode, then we can re-init the region maps */
|
||||
rv3d->lastmode= stype;
|
||||
|
||||
|
||||
keymap= WM_keymap_listbase(wm, "Object Mode", 0, 0);
|
||||
if(ELEM(stype, 0, NS_MODE_OBJECT))
|
||||
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
||||
|
Loading…
Reference in New Issue
Block a user