From 70942f9a8321e27d5c7dc2036301989364f9a5aa Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Jan 2010 13:40:29 +0000 Subject: last commit was no good since pe_get_current was running recalc_emitter_field on mousemove and poll() functions. run on entering particle editmode only. --- source/blender/blenkernel/BKE_pointcache.h | 2 +- source/blender/editors/physics/particle_edit.c | 20 ++++++++++++-------- source/blender/makesrna/intern/rna_particle.c | 3 ++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 4b26eaa6d76..6686d10bb31 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -213,7 +213,7 @@ typedef struct PTCacheEdit { struct ParticleSystem *psys; struct ParticleData *particles; struct KDTree *emitter_field; - float *emitter_cosnos; + float *emitter_cosnos; /* localspace face centers and normals (average of its verts), from the derived mesh */ int *mirror_cache; struct ParticleCacheKey **pathcache; /* path cache (runtime) */ diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index c1846c6a493..400bb05d2b4 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -194,7 +194,10 @@ ParticleEditSettings *PE_settings(Scene *scene) return &scene->toolsettings->particle; } -/* always gets atleast the first particlesystem even if PSYS_CURRENT flag is not set */ +/* always gets atleast the first particlesystem even if PSYS_CURRENT flag is not set + * + * note: this function runs on poll, therefor it can runs many times a second + * keep it fast! */ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create) { ParticleEditSettings *pset= PE_settings(scene); @@ -266,13 +269,8 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create) } } - if(edit) { + if(edit) edit->pid = *pid; - - /* mesh may have changed since last entering editmode. - * note, this may have run before if the edit data was just created, so could avoid this and speed up a little */ - recalc_emitter_field(ob, edit->psys); - } BLI_freelistN(&pidlist); @@ -3909,8 +3907,14 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op) Object *ob= CTX_data_active_object(C); if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) { + PTCacheEdit *edit; ob->mode |= OB_MODE_PARTICLE_EDIT; - PE_create_current(scene, ob); + edit= PE_create_current(scene, ob); + + /* mesh may have changed since last entering editmode. + * note, this may have run before if the edit data was just created, so could avoid this and speed up a little */ + recalc_emitter_field(ob, edit->psys); + toggle_particle_cursor(C, 1); WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_PARTICLE, NULL); } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 543965a337e..344ba7ef064 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -658,7 +658,8 @@ static void rna_def_particle_hair_key(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length."); prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED); - RNA_def_property_ui_text(prop, "Weight", "Weight for softbody simulation."); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation."); } static void rna_def_particle_key(BlenderRNA *brna) -- cgit v1.2.3