[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32168] trunk/blender: Fix for [#24031] Baked Physics with Phsics set to NO can't be freed

Janne Karhu jhkarh at gmail.com
Tue Sep 28 10:47:59 CEST 2010


Revision: 32168
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32168
Author:   jhk
Date:     2010-09-28 10:47:59 +0200 (Tue, 28 Sep 2010)

Log Message:
-----------
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)

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_particle.py
    trunk/blender/source/blender/blenkernel/intern/pointcache.c

Modified: trunk/blender/release/scripts/ui/properties_particle.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_particle.py	2010-09-28 08:01:20 UTC (rev 32167)
+++ trunk/blender/release/scripts/ui/properties_particle.py	2010-09-28 08:47:59 UTC (rev 32168)
@@ -27,7 +27,13 @@
 
 
 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):

Modified: trunk/blender/source/blender/blenkernel/intern/pointcache.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/pointcache.c	2010-09-28 08:01:20 UTC (rev 32167)
+++ trunk/blender/source/blender/blenkernel/intern/pointcache.c	2010-09-28 08:47:59 UTC (rev 32168)
@@ -1008,11 +1008,22 @@
 	}
 
 	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) {





More information about the Bf-blender-cvs mailing list