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>2022-05-18 22:26:47 +0300
committerRichard Antalik <richardantalik@gmail.com>2022-05-18 22:26:47 +0300
commit8ca9ce09865e6a617d6c2f78f3483ba1fd5d6aef (patch)
tree371395186f59292cf0d7b94a055da690696336ef /source/blender/sequencer
parent47dbdf8dd5744bc61f2e16f8d5c5eb4203ce0c48 (diff)
VSE: Remove still frame offsets
To clarify term still frame: This is portion of strip that displays static image. This area can exist before or after strip movie content. Still frames were implemented as strip property, but this was never displayed in panel. Only way to set still frames was to drag strip handle with mouse or using python API. This would set either `seq->*still` or `seq->*ofs` where * stands for `start` or `end`. When strip had offset, it can't have still frames and vice versa, but this had to be enforced in RNA functions and everywhere in code where these fields are set directly. Strip can not have negative offset or negative number of still frames. This is not very practical approach and still frames can be simply implemented as applying negative offset. Merging these offsets would simplify offset calculations for example in D14962 and could make it easier to also deprecate usage `seq->*disp` and necessity to call update functions to recalculate strip boundaries. For users only functional change is ability to set negative strip offset using property in side panel. Reviewed By: sergey Differential Revision: https://developer.blender.org/D14976
Diffstat (limited to 'source/blender/sequencer')
-rw-r--r--source/blender/sequencer/SEQ_time.h3
-rw-r--r--source/blender/sequencer/intern/proxy.c7
-rw-r--r--source/blender/sequencer/intern/render.c7
-rw-r--r--source/blender/sequencer/intern/strip_edit.c58
-rw-r--r--source/blender/sequencer/intern/strip_time.c28
-rw-r--r--source/blender/sequencer/intern/strip_transform.c26
6 files changed, 59 insertions, 70 deletions
diff --git a/source/blender/sequencer/SEQ_time.h b/source/blender/sequencer/SEQ_time.h
index b4adc950d6b..96c730028d5 100644
--- a/source/blender/sequencer/SEQ_time.h
+++ b/source/blender/sequencer/SEQ_time.h
@@ -60,6 +60,9 @@ void SEQ_time_update_recursive(struct Scene *scene, struct Sequence *changed_seq
*/
bool SEQ_time_strip_intersects_frame(const struct Sequence *seq, int timeline_frame);
void SEQ_time_update_meta_strip_range(struct Scene *scene, struct Sequence *seq_meta);
+bool SEQ_time_has_still_frames(const struct Sequence *seq);
+bool SEQ_time_has_left_still_frames(const struct Sequence *seq);
+bool SEQ_time_has_right_still_frames(const struct Sequence *seq);
#ifdef __cplusplus
}
diff --git a/source/blender/sequencer/intern/proxy.c b/source/blender/sequencer/intern/proxy.c
index 91b69bfe01f..59b4c6de1ef 100644
--- a/source/blender/sequencer/intern/proxy.c
+++ b/source/blender/sequencer/intern/proxy.c
@@ -523,9 +523,7 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context,
SeqRenderState state;
seq_render_state_init(&state);
- for (timeline_frame = seq->startdisp + seq->startstill;
- timeline_frame < seq->enddisp - seq->endstill;
- timeline_frame++) {
+ for (timeline_frame = seq->startdisp; timeline_frame < seq->enddisp; timeline_frame++) {
if (context->size_flags & IMB_PROXY_25) {
seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 25, overwrite);
}
@@ -539,8 +537,7 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context,
seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 100, overwrite);
}
- *progress = (float)(timeline_frame - seq->startdisp - seq->startstill) /
- (seq->enddisp - seq->endstill - seq->startdisp - seq->startstill);
+ *progress = (float)(timeline_frame - seq->startdisp) / (seq->enddisp - seq->startdisp);
*do_update = true;
if (*stop || G.is_break) {
diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c
index 1b9e89a35d5..b0898be3765 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2088,7 +2088,8 @@ void SEQ_render_thumbnails(const SeqRenderData *context,
/* Adding the hold offset value (seq->anim_startofs) to the start frame. Position of image not
* affected, but frame loaded affected. */
- float upper_thumb_bound = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp;
+ float upper_thumb_bound = SEQ_time_has_right_still_frames(seq) ? (seq->start + seq->len) :
+ seq->enddisp;
upper_thumb_bound = (upper_thumb_bound > view_area->xmax) ? view_area->xmax + frame_step :
upper_thumb_bound;
@@ -2121,7 +2122,9 @@ void SEQ_render_thumbnails(const SeqRenderData *context,
int SEQ_render_thumbnails_guaranteed_set_frame_step_get(const Sequence *seq)
{
- const int content_len = (seq->enddisp - seq->startdisp - seq->startstill - seq->endstill);
+ const int content_start = max_ii(seq->startdisp, seq->start);
+ const int content_end = min_ii(seq->enddisp, seq->start + seq->len);
+ const int content_len = content_end - content_start;
/* Arbitrary, but due to performance reasons should be as low as possible. */
const int thumbnails_base_set_count = min_ii(content_len / 100, 30);
diff --git a/source/blender/sequencer/intern/strip_edit.c b/source/blender/sequencer/intern/strip_edit.c
index 6c7bb71cb75..361230140f7 100644
--- a/source/blender/sequencer/intern/strip_edit.c
+++ b/source/blender/sequencer/intern/strip_edit.c
@@ -83,8 +83,6 @@ int SEQ_edit_sequence_swap(Sequence *seq_a, Sequence *seq_b, const char **error_
SWAP(int, seq_a->start, seq_b->start);
SWAP(int, seq_a->startofs, seq_b->startofs);
SWAP(int, seq_a->endofs, seq_b->endofs);
- SWAP(int, seq_a->startstill, seq_b->startstill);
- SWAP(int, seq_a->endstill, seq_b->endstill);
SWAP(int, seq_a->machine, seq_b->machine);
SWAP(int, seq_a->startdisp, seq_b->startdisp);
SWAP(int, seq_a->enddisp, seq_b->enddisp);
@@ -278,20 +276,22 @@ static void seq_split_set_left_hold_offset(Sequence *seq, int timeline_frame)
{
/* Adjust within range of extended stillframes before strip. */
if (timeline_frame < seq->start) {
- seq->start = timeline_frame - 1;
- seq->anim_endofs += seq->len - 1;
- seq->startstill = timeline_frame - seq->startdisp - 1;
- seq->endstill = 0;
+ SEQ_transform_set_left_handle_frame(seq, timeline_frame);
}
/* Adjust within range of strip contents. */
else if ((timeline_frame >= seq->start) && (timeline_frame <= (seq->start + seq->len))) {
- seq->endofs = 0;
- seq->endstill = 0;
- seq->anim_endofs += (seq->start + seq->len) - timeline_frame;
+ seq->anim_startofs += timeline_frame - seq->start;
+ seq->start = timeline_frame;
+ seq->startofs = 0;
}
/* Adjust within range of extended stillframes after strip. */
else if ((seq->start + seq->len) < timeline_frame) {
- seq->endstill = timeline_frame - seq->start - seq->len;
+ const int right_handle_backup = SEQ_transform_get_right_handle_frame(seq);
+ seq->start += timeline_frame - seq->start;
+ seq->anim_startofs += seq->len - 1;
+ seq->len = 1;
+ SEQ_transform_set_left_handle_frame(seq, timeline_frame);
+ SEQ_transform_set_right_handle_frame(seq, right_handle_backup);
}
}
@@ -299,22 +299,19 @@ static void seq_split_set_right_hold_offset(Sequence *seq, int timeline_frame)
{
/* Adjust within range of extended stillframes before strip. */
if (timeline_frame < seq->start) {
- seq->startstill = seq->start - timeline_frame;
+ const int left_handle_backup = SEQ_transform_get_left_handle_frame(seq);
+ seq->start = timeline_frame - 1;
+ SEQ_transform_set_left_handle_frame(seq, left_handle_backup);
+ SEQ_transform_set_right_handle_frame(seq, timeline_frame);
}
/* Adjust within range of strip contents. */
else if ((timeline_frame >= seq->start) && (timeline_frame <= (seq->start + seq->len))) {
- seq->anim_startofs += timeline_frame - seq->start;
- seq->start = timeline_frame;
- seq->startstill = 0;
- seq->startofs = 0;
+ seq->anim_endofs += seq->start + seq->len - timeline_frame;
+ seq->endofs = 0;
}
/* Adjust within range of extended stillframes after strip. */
else if ((seq->start + seq->len) < timeline_frame) {
- seq->start = timeline_frame;
- seq->startofs = 0;
- seq->anim_startofs += seq->len - 1;
- seq->endstill = seq->enddisp - timeline_frame - 1;
- seq->startstill = 0;
+ SEQ_transform_set_right_handle_frame(seq, timeline_frame);
}
}
@@ -322,28 +319,23 @@ static void seq_split_set_right_offset(Sequence *seq, int timeline_frame)
{
/* Adjust within range of extended stillframes before strip. */
if (timeline_frame < seq->start) {
+ const int content_offset = seq->start - timeline_frame + 1;
seq->start = timeline_frame - 1;
- seq->startstill = timeline_frame - seq->startdisp - 1;
- seq->endofs = seq->len - 1;
- }
- /* Adjust within range of extended stillframes after strip. */
- else if ((seq->start + seq->len) < timeline_frame) {
- seq->endstill -= seq->enddisp - timeline_frame;
+ seq->startofs += content_offset;
}
+
SEQ_transform_set_right_handle_frame(seq, timeline_frame);
}
static void seq_split_set_left_offset(Sequence *seq, int timeline_frame)
{
- /* Adjust within range of extended stillframes before strip. */
- if (timeline_frame < seq->start) {
- seq->startstill = seq->start - timeline_frame;
- }
/* Adjust within range of extended stillframes after strip. */
- if ((seq->start + seq->len) < timeline_frame) {
- seq->start = timeline_frame - seq->len + 1;
- seq->endstill = seq->enddisp - timeline_frame - 1;
+ if (timeline_frame > seq->start + seq->len) {
+ const int content_offset = timeline_frame - (seq->start + seq->len) + 1;
+ seq->start += content_offset;
+ seq->endofs += content_offset;
}
+
SEQ_transform_set_left_handle_frame(seq, timeline_frame);
}
diff --git a/source/blender/sequencer/intern/strip_time.c b/source/blender/sequencer/intern/strip_time.c
index a5341dbc528..e18527f68b3 100644
--- a/source/blender/sequencer/intern/strip_time.c
+++ b/source/blender/sequencer/intern/strip_time.c
@@ -139,15 +139,8 @@ void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
static void seq_time_update_sequence_bounds(Scene *scene, Sequence *seq)
{
- if (seq->startofs && seq->startstill) {
- seq->startstill = 0;
- }
- if (seq->endofs && seq->endstill) {
- seq->endstill = 0;
- }
-
- seq->startdisp = seq->start + seq->startofs - seq->startstill;
- seq->enddisp = seq->start + seq->len - seq->endofs + seq->endstill;
+ seq->startdisp = seq->start + seq->startofs;
+ seq->enddisp = seq->start + seq->len - seq->endofs;
if (seq->type == SEQ_TYPE_META) {
seq_update_sound_bounds_recursive(scene, seq);
@@ -204,7 +197,7 @@ void SEQ_time_update_sequence(Scene *scene, ListBase *seqbase, Sequence *seq)
/* effects and meta: automatic start and end */
if (seq->type & SEQ_TYPE_EFFECT) {
if (seq->seq1) {
- seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0;
+ seq->startofs = seq->endofs = 0;
if (seq->seq3) {
seq->start = seq->startdisp = max_iii(
seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp);
@@ -516,3 +509,18 @@ bool SEQ_time_strip_intersects_frame(const Sequence *seq, const int timeline_fra
{
return (seq->startdisp <= timeline_frame) && (seq->enddisp > timeline_frame);
}
+
+bool SEQ_time_has_left_still_frames(const Sequence *seq)
+{
+ return seq->startofs < 0;
+}
+
+bool SEQ_time_has_right_still_frames(const Sequence *seq)
+{
+ return seq->endofs < 0;
+}
+
+bool SEQ_time_has_still_frames(const Sequence *seq)
+{
+ return SEQ_time_has_right_still_frames(seq) || SEQ_time_has_left_still_frames(seq);
+}
diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c
index 2c9ab0a3335..4def31f87e5 100644
--- a/source/blender/sequencer/intern/strip_transform.c
+++ b/source/blender/sequencer/intern/strip_transform.c
@@ -40,35 +40,21 @@ static int seq_tx_get_end(Sequence *seq)
int SEQ_transform_get_left_handle_frame(Sequence *seq)
{
- return (seq->start - seq->startstill) + seq->startofs;
+ return seq->start + seq->startofs;
}
int SEQ_transform_get_right_handle_frame(Sequence *seq)
{
- return ((seq->start + seq->len) + seq->endstill) - seq->endofs;
+ return seq->start + seq->len - seq->endofs;
}
void SEQ_transform_set_left_handle_frame(Sequence *seq, int val)
{
- if (val < (seq)->start) {
- seq->startstill = abs(val - (seq)->start);
- seq->startofs = 0;
- }
- else {
- seq->startofs = abs(val - (seq)->start);
- seq->startstill = 0;
- }
+ seq->startofs = val - seq->start;
}
void SEQ_transform_set_right_handle_frame(Sequence *seq, int val)
{
- if (val > (seq)->start + (seq)->len) {
- seq->endstill = abs(val - (seq->start + (seq)->len));
- seq->endofs = 0;
- }
- else {
- seq->endofs = abs(val - ((seq)->start + (seq)->len));
- seq->endstill = 0;
- }
+ seq->endofs = seq->start + seq->len - val;
}
bool SEQ_transform_single_image_check(Sequence *seq)
@@ -157,8 +143,8 @@ void SEQ_transform_handle_xlimits(Sequence *seq, int leftflag, int rightflag)
/* sounds cannot be extended past their endpoints */
if (seq->type == SEQ_TYPE_SOUND_RAM) {
- seq->startstill = 0;
- seq->endstill = 0;
+ CLAMP(seq->startofs, 0, MAXFRAME);
+ CLAMP(seq->endofs, 0, MAXFRAME);
}
}