Blender V5.3
effect_adjustment.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "PRF_profile.hh"
10
11#include "DNA_sequence_types.h"
12
13#include "SEQ_channels.hh"
14#include "SEQ_render.hh"
15#include "SEQ_sequencer.hh"
16#include "SEQ_utils.hh"
17
18#include "effects.hh"
19#include "render.hh"
20
21namespace blender::seq {
22
23static StripEarlyOut early_out_adjustment(const Strip * /*strip*/, float /*fac*/)
24{
26}
27
30 Strip *strip,
31 float timeline_frame)
32{
34 Editing *ed = context->scene->ed;
35
36 ListBaseT<Strip> *seqbasep = get_seqbase_by_strip(context->scene, strip);
37 ListBaseT<SeqTimelineChannel> *channels = get_channels_by_strip(ed, strip);
38
39 /* Clamp timeline_frame to strip range so it behaves as if it had "still frame" offset (last
40 * frame is static after end of strip). This is how most strips behave. This way transition
41 * effects that doesn't overlap or speed effect can't fail rendering outside of strip range. */
42 timeline_frame = clamp_i(
43 timeline_frame, strip->left_handle(), strip->right_handle(context->scene) - 1);
44
45 if (strip->channel > 1) {
47 context, state, timeline_frame, strip->channel - 1, channels, seqbasep);
48 }
49
50 /* Found nothing? Then work our way up the meta-strip stack, as this adjustment strip might be
51 * inside a nested meta-strip and affect strips below that meta-strip.
52 *
53 * NOTE: we should NOT walk past the stack level that the user is currently tabbed into,
54 * otherwise the adjustment layer can leak content from outside the meta context. */
55
56 if (!out.is_valid()) {
57 Strip *meta = lookup_meta_by_strip(ed, strip);
58 if (meta && meta != ed->current_meta_strip) {
59 out = do_adjustment_impl(context, state, meta, timeline_frame);
60 }
61 }
62
63 return out;
64}
65
66static SeqResult do_adjustment(const RenderData *context,
68 Strip *strip,
69 float timeline_frame,
70 float /*fac*/,
71 const SeqResult & /*ibuf1*/,
72 const SeqResult & /*ibuf2*/)
73{
75 Editing *ed = context->scene->ed;
76 if (!ed || state->strips_in_progress.contains(strip)) {
77 return {};
78 }
79
80 state->strips_in_progress.add(strip);
81 SeqResult out = do_adjustment_impl(context, state, strip, timeline_frame);
82 state->strips_in_progress.remove(strip);
83 return out;
84}
85
91
92} // namespace blender::seq
#define PRF_scope_with_name(ui_name, category)
const int state
Strip * lookup_meta_by_strip(Editing *ed, const Strip *key)
static SeqResult do_adjustment_impl(const RenderData *context, SeqRenderState *state, Strip *strip, float timeline_frame)
ListBaseT< Strip > * get_seqbase_by_strip(const Scene *scene, Strip *strip)
SeqResult seq_render_give_ibuf_seqbase(const RenderData *context, SeqRenderState *state, float timeline_frame, int chan_shown, ListBaseT< SeqTimelineChannel > *channels, ListBaseT< Strip > *seqbasep)
Definition render.cc:2213
static StripEarlyOut early_out_adjustment(const Strip *, float)
static SeqResult do_adjustment(const RenderData *context, SeqRenderState *state, Strip *strip, float timeline_frame, float, const SeqResult &, const SeqResult &)
void adjustment_effect_get_handle(EffectHandle &rval)
ListBaseT< SeqTimelineChannel > * get_channels_by_strip(Editing *ed, const Strip *strip)
Definition channels.cc:65
MINLINE int clamp_i(int value, int min, int max)
StripEarlyOut(*) early_out(const Strip *strip, float fac)
Definition effects.hh:49
SeqResult(*) execute(const RenderData *context, SeqRenderState *state, Strip *strip, float timeline_frame, float fac, const SeqResult &input1, const SeqResult &input2)
Definition effects.hh:52