[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35124] trunk/blender/source/blender: Fix for [#26197] High resolution smoke cache not available due to pointcache update.

Janne Karhu jhkarh at gmail.com
Thu Feb 24 14:37:54 CET 2011


Revision: 35124
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35124
Author:   jhk
Date:     2011-02-24 13:37:53 +0000 (Thu, 24 Feb 2011)
Log Message:
-----------
Fix for [#26197] High resolution smoke cache not available due to pointcache update. Please reset the simulation.
* Backwards compatibility code wasn't forwards compatible :)

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/blenloader/intern/writefile.c
    trunk/blender/source/blender/makesdna/DNA_object_force.h

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2011-02-24 12:25:56 UTC (rev 35123)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2011-02-24 13:37:53 UTC (rev 35124)
@@ -3963,7 +3963,14 @@
 
 				/* Smoke uses only one cache from now on, so store pointer convert */
 				if(smd->domain->ptcaches[1].first || smd->domain->point_cache[1]) {
-					printf("High resolution smoke cache not available due to pointcache update. Please reset the simulation.\n");
+					if(smd->domain->point_cache[1]) {
+						PointCache *cache = newdataadr(fd, smd->domain->point_cache[1]);
+						if(cache->flag & PTCACHE_FAKE_SMOKE)
+							; /* Smoke was already saved in "new format" and this cache is a fake one. */
+						else
+							printf("High resolution smoke cache not available due to pointcache update. Please reset the simulation.\n");
+						BKE_ptcache_free(cache);
+					}
 					smd->domain->ptcaches[1].first = NULL;
 					smd->domain->ptcaches[1].last = NULL;
 					smd->domain->point_cache[1] = NULL;

Modified: trunk/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/writefile.c	2011-02-24 12:25:56 UTC (rev 35123)
+++ trunk/blender/source/blender/blenloader/intern/writefile.c	2011-02-24 13:37:53 UTC (rev 35124)
@@ -1220,7 +1220,7 @@
 
 					/* create fake pointcache so that old blender versions can read it */
 					smd->domain->point_cache[1] = BKE_ptcache_add(&smd->domain->ptcaches[1]);
-					smd->domain->point_cache[1]->flag |= PTCACHE_DISK_CACHE;
+					smd->domain->point_cache[1]->flag |= PTCACHE_DISK_CACHE|PTCACHE_FAKE_SMOKE;
 					smd->domain->point_cache[1]->step = 1;
 
 					write_pointcaches(wd, &(smd->domain->ptcaches[1]));

Modified: trunk/blender/source/blender/makesdna/DNA_object_force.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_object_force.h	2011-02-24 12:25:56 UTC (rev 35123)
+++ trunk/blender/source/blender/makesdna/DNA_object_force.h	2011-02-24 13:37:53 UTC (rev 35124)
@@ -397,6 +397,8 @@
 #define PTCACHE_READ_INFO			1024
 /* dont use the filename of the blendfile the data is linked from (write a local cache) */
 #define PTCACHE_IGNORE_LIBPATH		2048
+/* high resolution cache is saved for smoke for backwards compatibility, so set this flag to know it's a "fake" cache */
+#define PTCACHE_FAKE_SMOKE			(1<<12)
 
 /* PTCACHE_OUTDATED + PTCACHE_FRAMES_SKIPPED */
 #define PTCACHE_REDO_NEEDED			258




More information about the Bf-blender-cvs mailing list