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:
Diffstat (limited to 'source/blender/sequencer/intern')
-rw-r--r--source/blender/sequencer/intern/channels.c16
-rw-r--r--source/blender/sequencer/intern/effects.c11
-rw-r--r--source/blender/sequencer/intern/iterator.c13
-rw-r--r--source/blender/sequencer/intern/render.c41
-rw-r--r--source/blender/sequencer/intern/strip_edit.c3
-rw-r--r--source/blender/sequencer/intern/strip_relations.c7
-rw-r--r--source/blender/sequencer/intern/strip_transform.c18
7 files changed, 82 insertions, 27 deletions
diff --git a/source/blender/sequencer/intern/channels.c b/source/blender/sequencer/intern/channels.c
index e8e82af03f5..21e3461c7d0 100644
--- a/source/blender/sequencer/intern/channels.c
+++ b/source/blender/sequencer/intern/channels.c
@@ -81,3 +81,19 @@ bool SEQ_channel_is_muted(const SeqTimelineChannel *channel)
{
return (channel->flag & SEQ_CHANNEL_MUTE) != 0;
}
+
+ListBase *SEQ_get_channels_by_seq(ListBase *seqbase, const Sequence *seq)
+{
+ ListBase *lb = NULL;
+
+ LISTBASE_FOREACH (Sequence *, iseq, seqbase) {
+ if (seq == iseq) {
+ return seqbase;
+ }
+ if ((lb = SEQ_get_channels_by_seq(&iseq->seqbase, seq))) {
+ return lb;
+ }
+ }
+
+ return NULL;
+}
diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c
index 0192f4f625c..f4fc79a6572 100644
--- a/source/blender/sequencer/intern/effects.c
+++ b/source/blender/sequencer/intern/effects.c
@@ -44,6 +44,7 @@
#include "RE_pipeline.h"
+#include "SEQ_channels.h"
#include "SEQ_effects.h"
#include "SEQ_proxy.h"
#include "SEQ_relations.h"
@@ -2421,8 +2422,6 @@ static ImBuf *do_multicam(const SeqRenderData *context,
{
ImBuf *out;
Editing *ed;
- ListBase *seqbasep;
- ListBase *channels = &seq->channels;
if (seq->multicam_source == 0 || seq->multicam_source >= seq->machine) {
return NULL;
@@ -2432,7 +2431,8 @@ static ImBuf *do_multicam(const SeqRenderData *context,
if (!ed) {
return NULL;
}
- seqbasep = SEQ_get_seqbase_by_seq(&ed->seqbase, seq);
+ ListBase *seqbasep = SEQ_get_seqbase_by_seq(&ed->seqbase, seq);
+ ListBase *channels = SEQ_get_channels_by_seq(&ed->seqbase, seq);
if (!seqbasep) {
return NULL;
}
@@ -2463,13 +2463,12 @@ static int early_out_adjustment(Sequence *UNUSED(seq), float UNUSED(fac))
static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, float timeline_frame)
{
Editing *ed;
- ListBase *seqbasep;
- ListBase *channels = &seq->channels;
ImBuf *i = NULL;
ed = context->scene->ed;
- seqbasep = SEQ_get_seqbase_by_seq(&ed->seqbase, seq);
+ ListBase *seqbasep = SEQ_get_seqbase_by_seq(&ed->seqbase, seq);
+ ListBase *channels = SEQ_get_channels_by_seq(&ed->seqbase, seq);
/* Clamp timeline_frame to strip range so it behaves as if it had "still frame" offset (last
* frame is static after end of strip). This is how most strips behave. This way transition
diff --git a/source/blender/sequencer/intern/iterator.c b/source/blender/sequencer/intern/iterator.c
index a4d8cf79d1f..2710edd6e80 100644
--- a/source/blender/sequencer/intern/iterator.c
+++ b/source/blender/sequencer/intern/iterator.c
@@ -20,6 +20,7 @@
#include "BKE_scene.h"
#include "SEQ_iterator.h"
+#include "SEQ_relations.h"
#include "SEQ_render.h"
#include "SEQ_time.h"
#include "render.h"
@@ -241,15 +242,6 @@ static void collection_filter_channel_up_to_incl(SeqCollection *collection, cons
}
}
-static bool seq_is_effect_of(const Sequence *seq_effect, const Sequence *possibly_input)
-{
- if (seq_effect->seq1 == possibly_input || seq_effect->seq2 == possibly_input ||
- seq_effect->seq3 == possibly_input) {
- return true;
- }
- return false;
-}
-
/* Check if seq must be rendered. This depends on whole stack in some cases, not only seq itself.
* Order of applying these conditions is important. */
static bool must_render_strip(const Sequence *seq, SeqCollection *strips_at_timeline_frame)
@@ -262,7 +254,8 @@ static bool must_render_strip(const Sequence *seq, SeqCollection *strips_at_time
return false;
}
- if ((seq_iter->type & SEQ_TYPE_EFFECT) != 0 && seq_is_effect_of(seq_iter, seq)) {
+ if ((seq_iter->type & SEQ_TYPE_EFFECT) != 0 &&
+ SEQ_relation_is_effect_of_strip(seq_iter, seq)) {
/* Strips in same channel or higher than its effect are rendered. */
if (seq->machine >= seq_iter->machine) {
return true;
diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c
index 18b0794dc72..8d8a13be09e 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -1992,6 +1992,32 @@ ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context,
return ibuf;
}
+float SEQ_render_thumbnail_first_frame_get(Sequence *seq, float frame_step, rctf *view_area)
+{
+ int first_drawable_frame = max_iii(seq->startdisp, seq->start, view_area->xmin);
+
+ /* First frame should correspond to handle position. */
+ if (first_drawable_frame == seq->startdisp) {
+ return seq->startdisp;
+ }
+
+ float aligned_frame_offset = (int)((first_drawable_frame - seq->start) / frame_step) *
+ frame_step;
+ return seq->start + aligned_frame_offset;
+}
+
+float SEQ_render_thumbnail_next_frame_get(Sequence *seq, float last_frame, float frame_step)
+{
+ float next_frame = last_frame + frame_step;
+
+ /* If handle position was displayed, align next frame with `seq->start`. */
+ if (last_frame == seq->startdisp) {
+ next_frame = seq->start + ((int)((last_frame - seq->start) / frame_step) + 1) * frame_step;
+ }
+
+ return next_frame;
+}
+
/* Gets the direct image from source and scales to thumbnail size. */
static ImBuf *seq_get_uncached_thumbnail(const SeqRenderData *context,
SeqRenderState *state,
@@ -2053,7 +2079,6 @@ ImBuf *SEQ_get_thumbnail(
void SEQ_render_thumbnails(const SeqRenderData *context,
Sequence *seq,
Sequence *seq_orig,
- float start_frame,
float frame_step,
rctf *view_area,
const short *stop)
@@ -2063,24 +2088,24 @@ 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. */
- start_frame = start_frame - frame_step;
float upper_thumb_bound = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp;
upper_thumb_bound = (upper_thumb_bound > view_area->xmax) ? view_area->xmax + frame_step :
upper_thumb_bound;
- while ((start_frame < upper_thumb_bound) & !*stop) {
+ float timeline_frame = SEQ_render_thumbnail_first_frame_get(seq, frame_step, view_area);
+ while ((timeline_frame < upper_thumb_bound) & !*stop) {
ImBuf *ibuf = seq_cache_get(
- context, seq_orig, round_fl_to_int(start_frame), SEQ_CACHE_STORE_THUMBNAIL);
+ context, seq_orig, round_fl_to_int(timeline_frame), SEQ_CACHE_STORE_THUMBNAIL);
if (ibuf) {
IMB_freeImBuf(ibuf);
- start_frame += frame_step;
+ timeline_frame = SEQ_render_thumbnail_next_frame_get(seq, timeline_frame, frame_step);
continue;
}
- ibuf = seq_get_uncached_thumbnail(context, &state, seq, round_fl_to_int(start_frame));
+ ibuf = seq_get_uncached_thumbnail(context, &state, seq, round_fl_to_int(timeline_frame));
if (ibuf) {
- seq_cache_thumbnail_put(context, seq_orig, round_fl_to_int(start_frame), ibuf, view_area);
+ seq_cache_thumbnail_put(context, seq_orig, round_fl_to_int(timeline_frame), ibuf, view_area);
IMB_freeImBuf(ibuf);
seq_orig->flag &= ~SEQ_FLAG_SKIP_THUMBNAILS;
}
@@ -2090,7 +2115,7 @@ void SEQ_render_thumbnails(const SeqRenderData *context,
return;
}
- start_frame += frame_step;
+ timeline_frame = SEQ_render_thumbnail_next_frame_get(seq, timeline_frame, frame_step);
}
}
diff --git a/source/blender/sequencer/intern/strip_edit.c b/source/blender/sequencer/intern/strip_edit.c
index 7aa81f5ae8a..6c7bb71cb75 100644
--- a/source/blender/sequencer/intern/strip_edit.c
+++ b/source/blender/sequencer/intern/strip_edit.c
@@ -154,8 +154,7 @@ static void sequencer_flag_users_for_removal(Scene *scene, ListBase *seqbase, Se
}
/* Remove effects, that use seq. */
- if ((user_seq->seq1 && user_seq->seq1 == seq) || (user_seq->seq2 && user_seq->seq2 == seq) ||
- (user_seq->seq3 && user_seq->seq3 == seq)) {
+ if (SEQ_relation_is_effect_of_strip(user_seq, seq)) {
user_seq->flag |= SEQ_FLAG_DELETE;
/* Strips can be used as mask even if not in same seqbase. */
sequencer_flag_users_for_removal(scene, &scene->ed->seqbase, user_seq);
diff --git a/source/blender/sequencer/intern/strip_relations.c b/source/blender/sequencer/intern/strip_relations.c
index a65a331c650..1899cc99263 100644
--- a/source/blender/sequencer/intern/strip_relations.c
+++ b/source/blender/sequencer/intern/strip_relations.c
@@ -34,10 +34,15 @@
#include "image_cache.h"
#include "utils.h"
+bool SEQ_relation_is_effect_of_strip(const Sequence *effect, const Sequence *input)
+{
+ return ELEM(input, effect->seq1, effect->seq2);
+}
+
/* check whether sequence cur depends on seq */
static bool seq_relations_check_depend(Sequence *seq, Sequence *cur)
{
- if (cur->seq1 == seq || cur->seq2 == seq || cur->seq3 == seq) {
+ if (SEQ_relation_is_effect_of_strip(cur, seq)) {
return true;
}
diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c
index 087e2610bd6..2c9ab0a3335 100644
--- a/source/blender/sequencer/intern/strip_transform.c
+++ b/source/blender/sequencer/intern/strip_transform.c
@@ -297,6 +297,9 @@ static int shuffle_seq_time_offset_test(SeqCollection *strips_to_shuffle,
if (!SEQ_transform_test_overlap_seq_seq(seq, seq_other)) {
continue;
}
+ if (SEQ_relation_is_effect_of_strip(seq_other, seq)) {
+ continue;
+ }
if (UNLIKELY(SEQ_collection_has_strip(seq_other, strips_to_shuffle))) {
CLOG_WARN(&LOG,
"Strip overlaps with itself or another strip, that is to be shuffled. "
@@ -517,3 +520,18 @@ void SEQ_image_preview_unit_from_px(const Scene *scene, const float co_src[2], f
co_dst[0] = co_src[0] / scene->r.xsch;
co_dst[1] = co_src[1] / scene->r.ysch;
}
+
+void SEQ_image_transform_bounding_box_from_collection(
+ Scene *scene, SeqCollection *strips, bool apply_rotation, float r_min[2], float r_max[2])
+{
+ Sequence *seq;
+
+ INIT_MINMAX2(r_min, r_max);
+ SEQ_ITERATOR_FOREACH (seq, strips) {
+ float quad[4][2];
+ SEQ_image_transform_quad_get(scene, seq, apply_rotation, quad);
+ for (int i = 0; i < 4; i++) {
+ minmax_v2v2_v2(r_min, r_max, quad[i]);
+ }
+ }
+}