}
}
}
+
void PE_update_object(Scene *scene, Object *ob, int useflag)
{
+ /* use this to do partial particle updates, not usable when adding or
+ removing, then a full redo is necessary and calling this may crash */
ParticleEditSettings *pset= PE_settings(scene);
PTCacheEdit *edit = PE_get_current(scene, ob);
POINT_P;
edit->mirror_cache= NULL;
}
+ if(psys->child) {
+ MEM_freeN(psys->child);
+ psys->child= NULL;
+ psys->totchild=0;
+ }
+
edit->totpoint= psys->totpart= new_totpart;
}
BKE_reportf(op->reports, RPT_INFO, "Remove %d double particles.", totremoved);
- PE_update_object(scene, ob, 0);
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, ob);
recalc_lengths(data.edit);
}
- PE_update_object(data.scene, data.ob, 0);
DAG_id_flush_update(&data.ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, data.ob);
}
}
- PE_update_object(scene, OBACT, 0);
DAG_id_flush_update(&OBACT->id, OB_RECALC_DATA);
}
wmLoadMatrix(rv3d->viewmat);
}
+static void draw_update_ptcache_edit(Scene *scene, Object *ob, PTCacheEdit *edit)
+{
+ if(edit->psys && edit->psys->flag & PSYS_HAIR_UPDATED)
+ PE_update_object(scene, ob, 0);
+
+ /* create path and child path cache if it doesn't exist already */
+ if(edit->pathcache==0)
+ psys_cache_edit_paths(scene, ob, edit, CFRA);
+}
+
static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, PTCacheEdit *edit, int dt)
{
ParticleCacheKey **cache, *path, *pkey;
float nosel_col[3];
float *pathcol = NULL, *pcol;
-
- if(edit->psys && edit->psys->flag & PSYS_HAIR_UPDATED)
- PE_update_object(scene, ob, 0);
-
- /* create path and child path cache if it doesn't exist already */
- if(edit->pathcache==0)
- psys_cache_edit_paths(scene, ob, edit, CFRA);
-
if(edit->pathcache==0)
return;
if(ob->pd && ob->pd->forcefield) draw_forcefield(scene, ob);
- /* particle mode has to be drawn first so that possible child particles get cached in edit mode */
- if( (warning_recursive==0) &&
- (flag & DRAW_PICKING)==0 &&
- (!scene->obedit)
- ) {
-
- if(ob->mode & OB_MODE_PARTICLE_EDIT && ob==OBACT) {
- PTCacheEdit *edit = PE_get_current(scene, ob);
- if(edit) {
- wmLoadMatrix(rv3d->viewmat);
- draw_ptcache_edit(scene, v3d, rv3d, ob, edit, dt);
- wmMultMatrix(ob->obmat);
- }
- }
- }
-
/* code for new particle system */
if( (warning_recursive==0) &&
(ob->particlesystem.first) &&
(ob!=scene->obedit)
) {
ParticleSystem *psys;
+ PTCacheEdit *edit = PE_get_current(scene, ob);
+
if(col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */
//glDepthMask(GL_FALSE);
view3d_cached_text_draw_begin();
- for(psys=ob->particlesystem.first; psys; psys=psys->next)
+ for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+ /* run this so that possible child particles get cached */
+ if(edit && edit->psys == psys)
+ draw_update_ptcache_edit(scene, ob, edit);
+
draw_new_particle_system(scene, v3d, rv3d, base, psys, dt);
+ }
view3d_cached_text_draw_end(v3d, ar, 0, NULL);
if(col) cpack(col);
}
+ /* draw edit particles last so that they can draw over child particles */
+ if( (warning_recursive==0) &&
+ (flag & DRAW_PICKING)==0 &&
+ (!scene->obedit)
+ ) {
+
+ if(ob->mode & OB_MODE_PARTICLE_EDIT && ob==OBACT) {
+ PTCacheEdit *edit = PE_get_current(scene, ob);
+ if(edit) {
+ wmLoadMatrix(rv3d->viewmat);
+ draw_ptcache_edit(scene, v3d, rv3d, ob, edit, dt);
+ wmMultMatrix(ob->obmat);
+ }
+ }
+ }
+
/* draw code for smoke */
if((md = modifiers_findByType(ob, eModifierType_Smoke)))
{