Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2009-07-23 04:19:01 +0400
committerJanne Karhu <jhkarh@gmail.com>2009-07-23 04:19:01 +0400
commit17a9b3e44ca0e48ef0244df19f2f252198a56919 (patch)
tree80d0472faaba16c55a3f4bfc9bc8227f1cea5cd6 /source/blender/makesrna/intern/rna_object_force.c
parentb6db4f8e17d9005901d82105d1c35b4959ca5527 (diff)
External cache
Particle point cache can now be loaded from external files. - Activated by "external" checkbox in cache panel and giving proper folder path and file name identifier. - External cache panel has controls for particle emission start, end, lifetime and random lifetime. These should be set according to the external data for correct playback. - External files should be named "identifier_frame_index.bphys" or "identifier_frame.bphys" where: * "identifier" is a freely choseable name. * "frame" is the cached frame number. ** Six digits padded with zeros!, for example "000024". * "index" can be used to tell caches with the same identifier apart. ** Two digits starting from zero. ** The index and the underscore before are optional. If no index is present the index number in ui should be set to -1. - Cache file format is pure floating point numbers (in binary, not text!) with each particle's data one after the other with the following data members: * 3 floats: particle's location vector * 3 floats: particle's velocity vector (per second) * 4 floats: particle's rotation quaternion * 3 floats: particle's angular velocity vector (per second) * 1 float: frame of the actual data (this can be non-integer for particles that are born or die between two integer frames, but otherwise should be the same as the "frame" in the file name) - Cache files don't have to exist for each frame. * Frames without actual data are interpolated from surrounding frames that have data (extrapolation is not supported). - Cache file formats with extended (or reduced even) data members are in future plans for easier usage. - Current code only does particles, don't yet know if it's applicable to cloth or sb. - Known issue: endianness can't yet be handled in any way. Other changes: New hard limits for many particle parameters. Some examples: - Maximum amount of particles: 10M particles :) And before you all go and crash your Blender trying this out remember that this limit is only for those freaks who really have the machine power to handle it. 10M particles alone take around 2.2 Gb of memory / disk space in saved file and each cached frame takes around 0.5 Gb of memory / disk space depending on cache mode. * Known issue: To actually use this many particles they most likely need to be allocated in parts as taking hold of a 2.2Gb chunk of memory at once is probably not ok with any operating system. - Maximum amount of children: 100k children/particle (1T childparticles here we come :D) - Kink frequency: -100k to 100k half-rotations (really strange the previous limit was only from zero upwards) - Path draw steps: 10 (power of 2 remember) - Path render steps: 20 (power of 2 also!! If over 1M segments doesn't get you smooth paths then I think nothing will!)
Diffstat (limited to 'source/blender/makesrna/intern/rna_object_force.c')
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c71
1 files changed, 52 insertions, 19 deletions
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 2ec8d9ea41e..965b70714dc 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -105,6 +105,7 @@ static void rna_Cache_toggle_disk_cache(bContext *C, PointerRNA *ptr)
static void rna_Cache_idname_change(bContext *C, PointerRNA *ptr)
{
+ Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
PointCache *cache = (PointCache*)ptr->data;
PTCacheID *pid = NULL, *pid2= NULL;
@@ -119,33 +120,50 @@ static void rna_Cache_idname_change(bContext *C, PointerRNA *ptr)
BKE_ptcache_ids_from_object(&pidlist, ob);
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pid->cache==cache)
- pid2 = pid;
- else if(strcmp(cache->name, "") && strcmp(cache->name,pid->cache->name)==0) {
- /*TODO: report "name exists" to user */
- strcpy(cache->name, cache->prev_name);
- new_name = 0;
+ if(cache->flag & PTCACHE_EXTERNAL) {
+ for(pid=pidlist.first; pid; pid=pid->next) {
+ if(pid->cache==cache)
+ break;
}
+
+ if(!pid)
+ return;
+
+ cache->flag |= (PTCACHE_BAKED|PTCACHE_DISK_CACHE|PTCACHE_SIMULATION_VALID);
+ cache->flag &= ~(PTCACHE_OUTDATED|PTCACHE_FRAMES_SKIPPED);
+
+ BKE_ptcache_load_external(pid);
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
}
+ else {
+ for(pid=pidlist.first; pid; pid=pid->next) {
+ if(pid->cache==cache)
+ pid2 = pid;
+ else if(strcmp(cache->name, "") && strcmp(cache->name,pid->cache->name)==0) {
+ /*TODO: report "name exists" to user */
+ strcpy(cache->name, cache->prev_name);
+ new_name = 0;
+ }
+ }
- if(new_name) {
- if(pid2 && cache->flag & PTCACHE_DISK_CACHE) {
- strcpy(name, cache->name);
- strcpy(cache->name, cache->prev_name);
+ if(new_name) {
+ if(pid2 && cache->flag & PTCACHE_DISK_CACHE) {
+ strcpy(name, cache->name);
+ strcpy(cache->name, cache->prev_name);
- cache->flag &= ~PTCACHE_DISK_CACHE;
+ cache->flag &= ~PTCACHE_DISK_CACHE;
- BKE_ptcache_toggle_disk_cache(pid2);
+ BKE_ptcache_toggle_disk_cache(pid2);
- strcpy(cache->name, name);
+ strcpy(cache->name, name);
- cache->flag |= PTCACHE_DISK_CACHE;
+ cache->flag |= PTCACHE_DISK_CACHE;
- BKE_ptcache_toggle_disk_cache(pid2);
- }
+ BKE_ptcache_toggle_disk_cache(pid2);
+ }
- strcpy(cache->prev_name, cache->name);
+ strcpy(cache->prev_name, cache->name);
+ }
}
BLI_freelistN(&pidlist);
@@ -365,11 +383,16 @@ static void rna_def_pointcache(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops.");
prop= RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "step");
RNA_def_property_range(prop, 1, 20);
RNA_def_property_ui_text(prop, "Cache Step", "Number of frames between cached frames.");
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+ prop= RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "index");
+ RNA_def_property_range(prop, -1, 100);
+ RNA_def_property_ui_text(prop, "Cache Index", "Index number of cache files.");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+
/* flags */
prop= RNA_def_property(srna, "baked", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED);
@@ -398,6 +421,11 @@ static void rna_def_pointcache(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Name", "Cache name");
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+ prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "path");
+ RNA_def_property_ui_text(prop, "File Path", "Cache file path.");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+
prop= RNA_def_property(srna, "quick_cache", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_QUICK_CACHE);
RNA_def_property_ui_text(prop, "Quick Cache", "Update simulation with cache steps");
@@ -407,6 +435,11 @@ static void rna_def_pointcache(BlenderRNA *brna)
RNA_def_property_string_sdna(prop, NULL, "info");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Cache Info", "Info on current cache status.");
+
+ prop= RNA_def_property(srna, "external", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_EXTERNAL);
+ RNA_def_property_ui_text(prop, "External", "Read cache from an external location");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
}
static void rna_def_collision(BlenderRNA *brna)