diff options
author | Richard Antalik <richardantalik@gmail.com> | 2021-05-12 21:25:16 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2021-05-12 21:25:16 +0300 |
commit | fa472d46fc260517032dcb3c9e626bf3dd51b3d2 (patch) | |
tree | 36099c570a443f572cba899adab71273175b005c /source/blender/sequencer | |
parent | 1a94ae9e4757bfb326a855eeede10196d8f1ffc5 (diff) | |
parent | 5368859a669d8cd606a6ae6948f9c927ff8faf4d (diff) |
Merge branch 'blender-v2.93-release'
Diffstat (limited to 'source/blender/sequencer')
-rw-r--r-- | source/blender/sequencer/intern/image_cache.c | 13 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_time.c | 41 |
2 files changed, 49 insertions, 5 deletions
diff --git a/source/blender/sequencer/intern/image_cache.c b/source/blender/sequencer/intern/image_cache.c index 089bb5a6bec..7b873d5c66e 100644 --- a/source/blender/sequencer/intern/image_cache.c +++ b/source/blender/sequencer/intern/image_cache.c @@ -352,15 +352,18 @@ static void seq_disk_cache_update_file(SeqDiskCache *disk_cache, char *path) } /* Path format: - * <cache dir>/<project name>/<scene name>-<timestamp>/<seq name>/DCACHE_FNAME_FORMAT + * <cache dir>/<project name>_seq_cache/<scene name>-<timestamp>/<seq name>/DCACHE_FNAME_FORMAT */ static void seq_disk_cache_get_project_dir(SeqDiskCache *disk_cache, char *path, size_t path_len) { - char main_name[FILE_MAX]; - BLI_split_file_part(BKE_main_blendfile_path(disk_cache->bmain), main_name, sizeof(main_name)); + char cache_dir[FILE_MAX]; + BLI_split_file_part(BKE_main_blendfile_path(disk_cache->bmain), cache_dir, sizeof(cache_dir)); + /* Use suffix, so that the cache directory name does not conflict with the bmain's blend file. */ + const char *suffix = "_seq_cache"; + strncat(cache_dir, suffix, sizeof(cache_dir) - strlen(cache_dir)); BLI_strncpy(path, seq_disk_cache_base_dir(), path_len); - BLI_path_append(path, path_len, main_name); + BLI_path_append(path, path_len, cache_dir); } static void seq_disk_cache_get_dir( @@ -421,7 +424,7 @@ static void seq_disk_cache_handle_versioning(SeqDiskCache *disk_cache) BLI_strncpy(path_version_file, path, sizeof(path_version_file)); BLI_path_append(path_version_file, sizeof(path_version_file), "cache_version"); - if (BLI_exists(path)) { + if (BLI_exists(path) && BLI_is_dir(path)) { FILE *file = BLI_fopen(path_version_file, "r"); if (file) { diff --git a/source/blender/sequencer/intern/strip_time.c b/source/blender/sequencer/intern/strip_time.c index 21dc9aa2cdd..4a01b0e1938 100644 --- a/source/blender/sequencer/intern/strip_time.c +++ b/source/blender/sequencer/intern/strip_time.c @@ -39,6 +39,7 @@ #include "SEQ_render.h" #include "SEQ_sequencer.h" #include "SEQ_time.h" +#include "SEQ_transform.h" #include "strip_time.h" #include "utils.h" @@ -161,6 +162,36 @@ void SEQ_time_update_sequence_bounds(Scene *scene, Sequence *seq) } } +static void seq_time_update_meta_strip(Scene *scene, Sequence *seq_meta) +{ + if (BLI_listbase_is_empty(&seq_meta->seqbase)) { + return; + } + + int min = MAXFRAME * 2; + int max = -MAXFRAME * 2; + LISTBASE_FOREACH (Sequence *, seq, &seq_meta->seqbase) { + min = min_ii(seq->startdisp, min); + max = max_ii(seq->enddisp, max); + } + + seq_meta->start = min + seq_meta->anim_startofs; + seq_meta->len = max - min; + seq_meta->len -= seq_meta->anim_startofs; + seq_meta->len -= seq_meta->anim_endofs; + + seq_update_sound_bounds_recursive(scene, seq_meta); +} + +static void seq_time_update_meta_strip_range(Scene *scene, Sequence *seq_meta) +{ + seq_time_update_meta_strip(scene, seq_meta); + + /* Prevent metastrip to move in timeline. */ + SEQ_transform_set_left_handle_frame(seq_meta, seq_meta->startdisp); + SEQ_transform_set_right_handle_frame(seq_meta, seq_meta->enddisp); +} + void SEQ_time_update_sequence(Scene *scene, Sequence *seq) { Sequence *seqm; @@ -211,6 +242,16 @@ void SEQ_time_update_sequence(Scene *scene, Sequence *seq) } } else { + if (seq->type == SEQ_TYPE_META) { + seq_time_update_meta_strip(scene, seq); + } + + Editing *ed = SEQ_editing_get(scene, false); + MetaStack *ms = SEQ_meta_stack_active_get(ed); + if (ms != NULL) { + seq_time_update_meta_strip_range(scene, ms->parseq); + } + SEQ_time_update_sequence_bounds(scene, seq); } } |