Fix for [#24031] Baked Physics with Phsics set to NO can't be freed

* Should fix the cause ("no physics" gets baked) and old files that are effected (ui allows freeing if cache isn't really used)
This commit is contained in:
Janne Karhu 2010-09-28 08:47:59 +00:00
parent 8a68326f81
commit 12be522cbe
2 changed files with 23 additions and 6 deletions

@ -27,7 +27,13 @@ from properties_physics_common import basic_force_field_falloff_ui
def particle_panel_enabled(context, psys):
return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
phystype = psys.settings.physics_type
if phystype == 'NO' or phystype == 'KEYED':
return True
if psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.use_hair_dynamics):
return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
else:
return True
def particle_panel_poll(cls, context):

@ -1008,11 +1008,22 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
}
for(psys=ob->particlesystem.first; psys; psys=psys->next) {
if(psys->part) {
pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
BKE_ptcache_id_from_particles(pid, ob, psys);
BLI_addtail(lb, pid);
}
if(psys->part==NULL)
continue;
/* check to make sure point cache is actually used by the particles */
if(ELEM(psys->part->phystype, PART_PHYS_NO, PART_PHYS_KEYED))
continue;
if(psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0)
continue;
if(psys->part->type == PART_FLUID)
continue;
pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
BKE_ptcache_id_from_particles(pid, ob, psys);
BLI_addtail(lb, pid);
}
for(md=ob->modifiers.first; md; md=md->next) {