[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22412] branches/blender2.5/blender/source /blender: Various fixes:

Janne Karhu jhkarh at utu.fi
Wed Aug 12 19:39:11 CEST 2009


Revision: 22412
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22412
Author:   jhk
Date:     2009-08-12 19:39:11 +0200 (Wed, 12 Aug 2009)

Log Message:
-----------
Various fixes:
- Correct fix for file loading crash introduced by earlier point cache commit.
- Simulations are no longer calculated to current frame at render time automatically.
	* This has to be thought through more carefully at some point, perhaps through render profiles.
	* All simulations can be updated manually to current frame from any cache panel with the "update all to current frame" button.
- Some explanatory comments added for BKE_pointcache.h.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/BKE_pointcache.h
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/render/intern/source/pipeline.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_pointcache.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_pointcache.h	2009-08-12 17:32:02 UTC (rev 22411)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_pointcache.h	2009-08-12 17:39:11 UTC (rev 22412)
@@ -105,19 +105,27 @@
 	void *calldata;
 	int type;
 	int stack_index;
+
+	/* flags defined in DNA_object_force.h */
 	unsigned int data_types, info_types;
 
+	/* copies point data to cache data */
 	int (*write_elem)(int index, void *calldata, void **data);
+	/* copies cache cata to point data */
 	void (*read_elem)(int index, void *calldata, void **data, float frs_sec, float cfra, float *old_data);
+	/* interpolated between previously read point data and cache data */
 	void (*interpolate_elem)(int index, void *calldata, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data);
 
+	/* total number of simulated points */
 	int (*totpoint)(void *calldata);
+	/* number of points written for current cache frame (currently not used) */
 	int (*totwrite)(void *calldata);
 
 	int (*write_header)(PTCacheFile *pf);
 	int (*read_header)(PTCacheFile *pf);
 
 	struct PointCache *cache;
+	/* used for setting the current cache from ptcaches list */
 	struct PointCache **cache_ptr;
 	struct ListBase *ptcaches;
 } PTCacheID;
@@ -138,17 +146,17 @@
 /* Particle functions */
 void BKE_ptcache_make_particle_key(struct ParticleKey *key, int index, void **data, float time);
 
-/* Creating ID's */
+/**************** Creating ID's ****************************/
 void BKE_ptcache_id_from_softbody(PTCacheID *pid, struct Object *ob, struct SoftBody *sb);
 void BKE_ptcache_id_from_particles(PTCacheID *pid, struct Object *ob, struct ParticleSystem *psys);
 void BKE_ptcache_id_from_cloth(PTCacheID *pid, struct Object *ob, struct ClothModifierData *clmd);
 
 void BKE_ptcache_ids_from_object(struct ListBase *lb, struct Object *ob);
 
-/* Global funcs */
+/***************** Global funcs ****************************/
 void BKE_ptcache_remove(void);
 
-/* ID specific functions */
+/************ ID specific functions ************************/
 void	BKE_ptcache_id_clear(PTCacheID *id, int mode, int cfra);
 int		BKE_ptcache_id_exist(PTCacheID *id, int cfra);
 int		BKE_ptcache_id_reset(struct Scene *scene, PTCacheID *id, int mode);
@@ -157,30 +165,52 @@
 
 void BKE_ptcache_update_info(PTCacheID *pid);
 
-/* General cache reading/writing */
+/*********** General cache reading/writing ******************/
+
+/* Size of cache data type. */
 int		BKE_ptcache_data_size(int data_type);
+
+/* Copy a specific data type from cache data to point data. */
 void	BKE_ptcache_data_get(void **data, int type, int index, void *to);
+
+/* Copy a specific data type from point data to cache data. */
 void	BKE_ptcache_data_set(void **data, int type, void *from);
+
+/* Main cache reading call. */
 int		BKE_ptcache_read_cache(PTCacheID *pid, float cfra, float frs_sec);
+
+/* Main cache writing call. */
 int		BKE_ptcache_write_cache(PTCacheID *pid, int cfra);
 
-/* Continue physics */
+/****************** Continue physics ***************/
 void BKE_ptcache_set_continue_physics(struct Scene *scene, int enable);
 int BKE_ptcache_get_continue_physics(void);
 
-/* Point Cache */
+/******************* Allocate & free ***************/
 struct PointCache *BKE_ptcache_add(struct ListBase *ptcaches);
 void BKE_ptache_free_mem(struct PointCache *cache);
 void BKE_ptcache_free(struct PointCache *cache);
 void BKE_ptcache_free_list(struct ListBase *ptcaches);
 struct PointCache *BKE_ptcache_copy(struct PointCache *cache);
 
-/* Baking */
+/********************** Baking *********************/
+
+/* Bakes cache with cache_step sized jumps in time, not accurate but very fast. */
 void BKE_ptcache_quick_cache_all(struct Scene *scene);
+
+/* Bake cache or simulate to current frame with settings defined in the baker. */
 void BKE_ptcache_make_cache(struct PTCacheBaker* baker);
+
+/* Convert disk cache to memory cache. */
 void BKE_ptcache_disk_to_mem(struct PTCacheID *pid);
+
+/* Convert memory cache to disk cache. */
+void BKE_ptcache_mem_to_disk(struct PTCacheID *pid);
+
+/* Convert disk cache to memory cache and vice versa. Clears the cache that was converted. */
 void BKE_ptcache_toggle_disk_cache(struct PTCacheID *pid);
 
+/* Loads simulation from external (disk) cache files. */
 void BKE_ptcache_load_external(struct PTCacheID *pid);
 
 #endif

Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-08-12 17:32:02 UTC (rev 22411)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-08-12 17:39:11 UTC (rev 22412)
@@ -2964,9 +2964,11 @@
 		*ocache = newdataadr(fd, *ocache);
 	}
 	else if(*ocache) {
-		/* old "single" caches need to be linked too for do-versions */
+		/* old "single" caches need to be linked too */
 		*ocache = newdataadr(fd, *ocache);
 		direct_link_pointcache(fd, *ocache);
+
+		ptcaches->first = ptcaches->last = *ocache;
 	}
 }
 
@@ -3650,7 +3652,6 @@
 			
 			clmd->sim_parms= newdataadr(fd, clmd->sim_parms);
 			clmd->coll_parms= newdataadr(fd, clmd->coll_parms);
-			clmd->point_cache= newdataadr(fd, clmd->point_cache);
 
 			direct_link_pointcache_list(fd, &clmd->ptcaches, &clmd->point_cache);
 			
@@ -3907,9 +3908,7 @@
 			}
 		}
 
-		sb->pointcache= newdataadr(fd, sb->pointcache);
-		if(sb->pointcache)
-			direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache);
+		direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache);
 	}
 	ob->bsoft= newdataadr(fd, ob->bsoft);
 	ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */

Modified: branches/blender2.5/blender/source/blender/render/intern/source/pipeline.c
===================================================================
--- branches/blender2.5/blender/source/blender/render/intern/source/pipeline.c	2009-08-12 17:32:02 UTC (rev 22411)
+++ branches/blender2.5/blender/source/blender/render/intern/source/pipeline.c	2009-08-12 17:39:11 UTC (rev 22412)
@@ -2560,8 +2560,16 @@
 	/* check all scenes involved */
 	tag_scenes_for_render(re);
 
+#ifdef 0
+	/*
+	 * Disabled completely for now,
+	 * can be later set as render profile option
+	 * and default for background render.
+	*/
+
 	/* make sure dynamics are up to date */
 	update_physics_cache(re, scene, anim_init);
+#endif
 	
 	if(scene->r.scemode & R_SINGLE_LAYER)
 		push_render_result(re);





More information about the Bf-blender-cvs mailing list