From 7869c7ee85aa48d4f4702c6e2e8812c55187d63a Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Mon, 25 Oct 2010 17:20:12 +0000 Subject: Fix for [#24383] Particles using "circle" as display, are disabled on opening file --- source/blender/editors/space_view3d/drawobject.c | 37 ++++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index bc340ef5b4b..d2285371667 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3255,16 +3255,22 @@ static void draw_particle_arrays(int draw_as, int totpoint, int ob_dt, int selec static void draw_particle(ParticleKey *state, int draw_as, short draw, float pixsize, float imat[4][4], float *draw_line, ParticleBillboardData *bb, ParticleDrawData *pdd) { float vec[3], vec2[3]; - float *vd = pdd->vd; - float *cd = pdd->cd; + float *vd = NULL; + float *cd = NULL; float ma_r=0.0f; float ma_g=0.0f; float ma_b=0.0f; - if(pdd->ma_r) { - ma_r = *pdd->ma_r; - ma_g = *pdd->ma_g; - ma_b = *pdd->ma_b; + /* null only for PART_DRAW_CIRC */ + if(pdd) { + vd = pdd->vd; + cd = pdd->cd; + + if(pdd->ma_r) { + ma_r = *pdd->ma_r; + ma_g = *pdd->ma_g; + ma_b = *pdd->ma_b; + } } switch(draw_as){ @@ -3356,8 +3362,6 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix } case PART_DRAW_CIRC: { - if(pdd->ma_r) - glColor3f(ma_r,ma_g,ma_b); drawcircball(GL_LINE_LOOP, state->co, pixsize, imat); break; } @@ -3491,12 +3495,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv else cpack(0); - if(pdd) { - pdd->ma_r = &ma_r; - pdd->ma_g = &ma_g; - pdd->ma_b = &ma_b; - } - timestep= psys_get_timestep(&sim); if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) { @@ -3650,11 +3648,18 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv pdd->tot_vec_size= tot_vec_size; } + if(pdd) { + pdd->ma_r = &ma_r; + pdd->ma_g = &ma_g; + pdd->ma_b = &ma_b; + } + psys->lattice= psys_get_lattice(&sim); - if(pdd && draw_as!=PART_DRAW_PATH){ + /* circles don't use drawdata, so have to add a special case here */ + if((pdd || draw_as==PART_DRAW_CIRC) && draw_as!=PART_DRAW_PATH){ /* 5. */ - if((pdd->flag & PARTICLE_DRAW_DATA_UPDATED) + if(pdd && (pdd->flag & PARTICLE_DRAW_DATA_UPDATED) && (pdd->vedata || part->draw & (PART_DRAW_SIZE|PART_DRAW_NUM|PART_DRAW_HEALTH))==0) { totpoint = pdd->totpoint; /* draw data is up to date */ } -- cgit v1.2.3