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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-26 02:20:26 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-26 02:20:26 +0400
commit580d000f8fa6d65bfbab348aeee1719cffebf8cb (patch)
treea3daae581ea08843ed53e1e2144e428c6d91142a
parentc543eca36e9bc568dcfaa8fb6aa039ed6726a7d6 (diff)
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
-rw-r--r--source/blender/blenkernel/intern/boids.c8
-rw-r--r--source/blender/blenkernel/intern/particle.c19
-rw-r--r--source/blender/blenkernel/intern/particle_system.c4
-rw-r--r--source/blender/blenlib/BLI_kdtree.h2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c2
5 files changed, 16 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 931ad0b3043..d8926fc5753 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -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;
-} \ No newline at end of file
+}
+
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 6e8f9ee213c..e4f8a484061 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -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;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 43174343302..b5d58e9db8c 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -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;
diff --git a/source/blender/blenlib/BLI_kdtree.h b/source/blender/blenlib/BLI_kdtree.h
index 585107b0c4a..3b1947cf0c9 100644
--- a/source/blender/blenlib/BLI_kdtree.h
+++ b/source/blender/blenlib/BLI_kdtree.h
@@ -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);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 2b162f9574d..a99c227ae1f 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -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);