diff options
author | Janne Karhu <jhkarh@gmail.com> | 2009-08-12 21:39:11 +0400 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2009-08-12 21:39:11 +0400 |
commit | bba9c797b542a94d2ae1830135c77b8f56825f32 (patch) | |
tree | 74bc4e679face4765c5e96d5c2bc315bf9d73385 | |
parent | fb7c9d5a0d049651aab759e09338d774d1ce258b (diff) |
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.
-rw-r--r-- | source/blender/blenkernel/BKE_pointcache.h | 44 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 9 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 8 |
3 files changed, 49 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index a719ab92a80..011cde9f297 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -105,19 +105,27 @@ typedef struct PTCacheID { 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 @@ typedef struct PTCacheBaker { /* 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 @@ int BKE_ptcache_object_reset(struct Scene *scene, struct Object *ob, int mode); 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 diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3b53e5b32cb..4515032218e 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2964,9 +2964,11 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC *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 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) 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 @@ static void direct_link_object(FileData *fd, Object *ob) } } - 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 */ diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 4744288f3a9..9e0d0e9efa7 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2560,8 +2560,16 @@ static int render_initialize_from_scene(Render *re, Scene *scene, int anim, int /* 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); |