- removing the last particle system now exits particle edit mode.

- py UI script used an undeclared variable
This commit is contained in:
2009-11-06 12:27:28 +00:00
parent 5a12b7d159
commit aa7374e471
3 changed files with 15 additions and 2 deletions

View File

@@ -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:

View File

@@ -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);

View File

@@ -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;