diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-12 16:40:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-12 16:40:29 +0300 |
commit | 70942f9a8321e27d5c7dc2036301989364f9a5aa (patch) | |
tree | 8d62610aad63da64fd0e3b74b1373f2234ec3c33 /source/blender/editors | |
parent | f1a542b6b80b8a7dcce0484dd4146d2ede72831d (diff) |
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 20 |
1 files changed, 12 insertions, 8 deletions
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); } |