From 371732154b39413db0b24a006ae62f5f22e1f39a Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Mon, 22 Mar 2010 19:38:40 +0000 Subject: [PATCH] Fix for child drawing bug reported in the comments of [#21103] Updating bugs in Particle Mode --- release/scripts/ui/space_view3d_toolbar.py | 15 +++++++++------ source/blender/blenkernel/intern/particle.c | 17 ++++++++++++++--- .../blender/makesrna/intern/rna_sculpt_paint.c | 2 +- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index 829d3512526..603ed93efed 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -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 = [ diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 48a5c956cc3..bd9e041dab4 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -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; iflag |= 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; ipoints; itotcached && !(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; iflag &= ~PEP_EDIT_RECALC; + } } /************************************************/ /* Particle Key handling */ diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index aa85acbdfd8..c5f4841012e 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -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);