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:
authorRichard Antalik <richardantalik@gmail.com>2020-03-19 02:05:18 +0300
committerRichard Antalik <richardantalik@gmail.com>2020-03-19 02:07:30 +0300
commit348d2fa09e0c01d62372f5999b62d06ac3b810f9 (patch)
tree36186498cb951601478819b8aceb01fbb7c9b879 /source/blender/makesrna/intern/rna_userdef.c
parentc8b4b4c0fa3b1255a79b90393ee9f5ddb2ec35e9 (diff)
VSE: Disk cache
This patch implements dumping images from cache to HDD. The main goal of this system is to provide a means to achieve consistent playback speed mainly for strips that are not possible to preview in real time. How to use: Disk cache has own settings in user preferences for path to storage, size limit and compression level. To use disk cache, you need to check `Use Disk Cache` box, set `Disk Cache Directory`, `Disk Cache Limit` and save or open existing .blend file. By default sequencer output will be cached only. Manual setting is possible in cache panel. Uses: - Replacement or alternative for proxies. Disk cache will work with any strip type, supports float images as well. - Storage for strip thumbnails. - Less RAM needs to be allocated for preview cache How it works: Disk cache is extension of RAM cache. Every image, that is stored or deleted in RAM will be stored or deleted on HDD as well. Images can be compressed to save space and for use on slower drives. Compressed images are slower to write and read though. Images are stored in bulk of 100 rendered frames per one file. This is to overcome slow file access time for large amount of files. Drawback is, that if one frame needs to be redrawn, all 100 frames are deleted. Reviewed By: sergey Differential Revision: https://developer.blender.org/D5524
Diffstat (limited to 'source/blender/makesrna/intern/rna_userdef.c')
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 1557cd3d4b1..cada2cb13a9 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -192,6 +192,8 @@ static const EnumPropertyItem rna_enum_userdef_viewport_aa_items[] = {
# include "BLF_api.h"
+# include "BLI_path_util.h"
+
# include "MEM_guardedalloc.h"
# include "MEM_CacheLimiterC-Api.h"
@@ -536,6 +538,19 @@ static void rna_Userdef_memcache_update(Main *UNUSED(bmain),
USERDEF_TAG_DIRTY;
}
+static void rna_Userdef_disk_cache_dir_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
+{
+ if (U.sequencer_disk_cache_dir[0] != '\0') {
+ BLI_path_abs(U.sequencer_disk_cache_dir, BKE_main_blendfile_path_from_global());
+ BLI_add_slash(U.sequencer_disk_cache_dir);
+ BLI_path_make_safe(U.sequencer_disk_cache_dir);
+ }
+
+ USERDEF_TAG_DIRTY;
+}
+
static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob;
@@ -5126,6 +5141,25 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
+ static const EnumPropertyItem seq_disk_cache_compression_levels[] = {
+ {USER_SEQ_DISK_CACHE_COMPRESSION_NONE,
+ "NONE",
+ 0,
+ "None",
+ "Requires fast storage, but uses minimum CPU resources"},
+ {USER_SEQ_DISK_CACHE_COMPRESSION_LOW,
+ "LOW",
+ 0,
+ "Low",
+ "Doesn't require fast storage and uses less CPU resources"},
+ {USER_SEQ_DISK_CACHE_COMPRESSION_HIGH,
+ "HIGH",
+ 0,
+ "High",
+ "Works on slower storage devices and uses most CPU resources"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
srna = RNA_def_struct(brna, "PreferencesSystem", NULL);
RNA_def_struct_sdna(srna, "UserDef");
RNA_def_struct_nested(brna, srna, "Preferences");
@@ -5168,6 +5202,31 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Memory Cache Limit", "Memory cache limit (in megabytes)");
RNA_def_property_update(prop, 0, "rna_Userdef_memcache_update");
+ /* Sequencer disk cache */
+
+ prop = RNA_def_property(srna, "use_sequencer_disk_cache", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "sequencer_disk_cache_flag", SEQ_CACHE_DISK_CACHE_ENABLE);
+ RNA_def_property_ui_text(prop, "Use Disk Cache", "Store cached images to disk");
+
+ prop = RNA_def_property(srna, "sequencer_disk_cache_dir", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "sequencer_disk_cache_dir");
+ RNA_def_property_update(prop, 0, "rna_Userdef_disk_cache_dir_update");
+ RNA_def_property_ui_text(prop, "Disk Cache Directory", "Override default directory");
+
+ prop = RNA_def_property(srna, "sequencer_disk_cache_size_limit", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "sequencer_disk_cache_size_limit");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "Disk Cache Limit", "Disk cache limit (in gigabytes)");
+
+ prop = RNA_def_property(srna, "sequencer_disk_cache_compression", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, seq_disk_cache_compression_levels);
+ RNA_def_property_enum_sdna(prop, NULL, "sequencer_disk_cache_compression");
+ RNA_def_property_ui_text(
+ prop,
+ "Disk Cache Compression Level",
+ "Smaller compression will result in larger files, but less decoding overhead");
+
prop = RNA_def_property(srna, "scrollback", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "scrollback");
RNA_def_property_range(prop, 32, 32768);