diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-06 15:27:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-06 15:27:28 +0300 |
commit | aa7374e471bfb89242cfac855505269d0e728ea5 (patch) | |
tree | aa5eaf8d8092df7ab31698b68d6826b38045be97 | |
parent | 5a12b7d159371709580cf8fb07fd10d3c3bfdff3 (diff) |
- removing the last particle system now exits particle edit mode.
- py UI script used an undeclared variable
-rw-r--r-- | release/scripts/ui/space_view3d_toolbar.py | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 4 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_object.c | 11 |
3 files changed, 15 insertions, 2 deletions
diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index 53dbef20020..49c28427724 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -830,6 +830,8 @@ class VIEW3D_PT_tools_particlemode(View3DPanel): layout.itemR(pe, "type", text="") + ptcache = None + if pe.type == 'PARTICLES': if ob.particle_systems: if len(ob.particle_systems) > 1: diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 43a624b3013..24d6b229297 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2276,7 +2276,7 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c /* Object *ob= ctx->sim.ob; */ ParticleSystem *psys= ctx->sim.psys; ParticleSettings *part = psys->part; - ParticleEditSettings *pset = &scene->toolsettings->particle; +/* ParticleEditSettings *pset = &scene->toolsettings->particle; */ int totparent=0, between=0; int steps = (int)pow(2.0, (double)part->draw_step); int totchild = psys->totchild; @@ -3334,6 +3334,8 @@ void object_remove_particle_system(Scene *scene, Object *ob) if(ob->particlesystem.first) ((ParticleSystem *) ob->particlesystem.first)->flag |= PSYS_CURRENT; + else + ob->mode &= ~OB_MODE_PARTICLE_EDIT; DAG_scene_sort(scene); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index d227591739b..d763c0500d2 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -93,11 +93,20 @@ static int particle_system_remove_exec(bContext *C, wmOperator *op) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Scene *scene = CTX_data_scene(C); - + int mode_orig = ob->mode; if(!scene || !ob) return OPERATOR_CANCELLED; object_remove_particle_system(scene, ob); + + /* possible this isn't the active object + * object_remove_particle_system() clears the mode on the last psys + * */ + if(mode_orig & OB_MODE_PARTICLE_EDIT) + if((ob->mode & OB_MODE_PARTICLE_EDIT)==0) + if(scene->basact && scene->basact->object==ob) + WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); return OPERATOR_FINISHED; |