From 7bf5d9449c615120169eb290a3a8f46e53157340 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Mon, 13 Dec 2010 10:45:24 +0000 Subject: [PATCH] "Fix" for [#25184] Forces for growing hair - update inconsistency - as discussed with Jahka on Saturday on IRC * New option to "Regrow hair" for each frame. * This was perhaps more a feature request, but there was a similar useful feature called "animated hair" in particles at some point. * The previous behavior for hair growing was inconsistent to say the least, so this is a nice option to have. --- release/scripts/ui/properties_particle.py | 4 +++- source/blender/blenkernel/intern/particle.c | 2 +- source/blender/blenkernel/intern/particle_system.c | 2 +- source/blender/blenloader/intern/readfile.c | 2 ++ source/blender/makesdna/DNA_particle_types.h | 2 +- source/blender/makesrna/intern/rna_particle.c | 5 +++++ 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py index 1565ece3b40..af60c5fd784 100644 --- a/release/scripts/ui/properties_particle.py +++ b/release/scripts/ui/properties_particle.py @@ -125,7 +125,9 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel): if psys.is_edited: split.operator("particle.edited_clear", text="Free Edit") else: - split.label(text="") + row = split.row() + row.enabled = particle_panel_enabled(context, psys) + row.prop(part, "regrow_hair") row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(part, "hair_step") diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index a81406f0af1..2ec90eb29db 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3473,7 +3473,7 @@ static void default_particle_settings(ParticleSettings *part) part->bb_uv_split=1; part->bb_align=PART_BB_VIEW; part->bb_split_offset=PART_BB_OFF_LINEAR; - part->flag=PART_REACT_MULTIPLE|PART_HAIR_GEOMETRY|PART_EDISTR|PART_TRAND; + part->flag=PART_EDISTR|PART_TRAND; part->sta= 1.0; part->end= 200.0; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 60f54cfebf2..c7a65b8a5ee 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -4006,7 +4006,7 @@ static void psys_prepare_physics(ParticleSimulationData *sim) static int hair_needs_recalc(ParticleSystem *psys) { if(!(psys->flag & PSYS_EDITED) && (!psys->edit || !psys->edit->edited) && - ((psys->flag & PSYS_HAIR_DONE)==0 || psys->recalc & PSYS_RECALC_RESET)) { + ((psys->flag & PSYS_HAIR_DONE)==0 || psys->recalc & PSYS_RECALC_RESET || (psys->part->flag & PART_HAIR_REGROW && !psys->edit))) { return 1; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 44fbf9ef317..2661f046178 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -11173,6 +11173,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for(part = main->particle.first; part; part = part->id.next) { if(part->boids) part->boids->pitch = 1.0f; + + part->flag &= ~PART_HAIR_REGROW; /* this was a deprecated flag before */ } for (sc= main->screen.first; sc; sc= sc->id.next) { diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 105fa6d5289..e336d3056ea 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -273,7 +273,7 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in /* for dopesheet */ #define PART_DS_EXPAND 8 -#define PART_HAIR_GEOMETRY 16 +#define PART_HAIR_REGROW 16 /* regrow hair for each frame */ #define PART_UNBORN 32 /*show unborn particles*/ #define PART_DIED 64 /*show died particles*/ diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 649ba0f3a1d..90aeba65118 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1183,6 +1183,11 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Multi React", "React multiple times"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "regrow_hair", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW); + RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + prop= RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN); RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");