Fix for child drawing bug reported in the comments of [#21103] Updating bugs in Particle Mode

This commit is contained in:
Janne Karhu 2010-03-22 19:38:40 +00:00
parent a2778a262b
commit 371732154b
3 changed files with 24 additions and 10 deletions

@ -1018,12 +1018,15 @@ class VIEW3D_PT_tools_particlemode(View3DPanel):
col.active = pe.editable
col.label(text="Draw:")
col.prop(pe, "draw_step", text="Path Steps")
if pe.type == 'PARTICLES':
col.prop(pe, "draw_particles", text="Particles")
col.prop(pe, "fade_time")
sub = col.row()
sub.active = pe.fade_time
sub.prop(pe, "fade_frames", slider=True)
if pe.hair:
col.prop(pe, "draw_particles", text="Children")
else:
if pe.type == 'PARTICLES':
col.prop(pe, "draw_particles", text="Particles")
col.prop(pe, "fade_time")
sub = col.row()
sub.active = pe.fade_time
sub.prop(pe, "fade_frames", slider=True)
classes = [

@ -2926,7 +2926,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
ParticleCacheKey *ca, **cache= edit->pathcache;
ParticleEditSettings *pset = &scene->toolsettings->particle;
PTCacheEditPoint *point = edit->points;
PTCacheEditPoint *point = NULL;
PTCacheEditKey *ekey = NULL;
ParticleSystem *psys = edit->psys;
@ -2941,7 +2941,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
float hairmat[4][4], rotmat[3][3], prev_tangent[3];
int k,i;
int steps = (int)pow(2.0, (double)pset->draw_step);
int totpart = edit->totpoint;
int totpart = edit->totpoint, recalc_set=0;
float sel_col[3];
float nosel_col[3];
@ -2951,6 +2951,11 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
/* clear out old and create new empty path cache */
psys_free_path_cache(edit->psys, edit);
cache= edit->pathcache= psys_alloc_path_cache_buffers(&edit->pathcachebufs, totpart, steps+1);
/* set flag for update (child particles check this too) */
for(i=0, point=edit->points; i<totpart; i++, point++)
point->flag |= PEP_EDIT_RECALC;
recalc_set = 1;
}
frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f;
@ -2972,7 +2977,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
}
/*---first main loop: create all actual particles' paths---*/
for(i=0; i<totpart; i++, pa+=pa?1:0, point++){
for(i=0, point=edit->points; i<totpart; i++, pa+=pa?1:0, point++){
if(edit->totcached && !(point->flag & PEP_EDIT_RECALC))
continue;
@ -3124,6 +3129,12 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
ParticleSimulationData sim = {scene, ob, psys, psys_get_modifier(ob, psys), NULL};
psys_cache_child_paths(&sim, cfra, 1);
}
/* clear recalc flag if set here */
if(recalc_set) {
for(i=0, point=edit->points; i<totpart; i++, point++)
point->flag &= ~PEP_EDIT_RECALC;
}
}
/************************************************/
/* Particle Key handling */

@ -460,7 +460,7 @@ static void rna_def_particle_edit(BlenderRNA *brna)
prop= RNA_def_property(srna, "draw_particles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART);
RNA_def_property_ui_text(prop, "Draw Particles", "Draw actual particles");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo");
prop= RNA_def_property(srna, "add_interpolate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED);