Blender V5.0
vse_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
10
11#include "SEQ_channels.hh"
12#include "SEQ_relations.hh"
13#include "SEQ_render.hh"
14#include "SEQ_sequencer.hh"
15#include "SEQ_time.hh"
16#include "SEQ_utils.hh"
17
18#include "effects.hh"
19#include "render.hh"
20
21namespace blender::seq {
22
23/* No effect inputs for adjustment, we use #give_ibuf_seq. */
25{
26 return 0;
27}
28
29static StripEarlyOut early_out_adjustment(const Strip * /*strip*/, float /*fac*/)
30{
32}
33
34static ImBuf *do_adjustment_impl(const RenderData *context,
36 Strip *strip,
37 float timeline_frame)
38{
39 Editing *ed;
40 ImBuf *i = nullptr;
41
42 ed = context->scene->ed;
43
44 ListBase *seqbasep = get_seqbase_by_strip(context->scene, strip);
45 ListBase *channels = get_channels_by_strip(ed, strip);
46
47 /* Clamp timeline_frame to strip range so it behaves as if it had "still frame" offset (last
48 * frame is static after end of strip). This is how most strips behave. This way transition
49 * effects that doesn't overlap or speed effect can't fail rendering outside of strip range. */
50 timeline_frame = clamp_i(timeline_frame,
51 time_left_handle_frame_get(context->scene, strip),
52 time_right_handle_frame_get(context->scene, strip) - 1);
53
54 if (strip->channel > 1) {
56 context, state, timeline_frame, strip->channel - 1, channels, seqbasep);
57 }
58
59 /* Found nothing? so let's work the way up the meta-strip stack, so
60 * that it is possible to group a bunch of adjustment strips into
61 * a meta-strip and have that work on everything below the meta-strip. */
62
63 if (!i) {
64 Strip *meta;
65
66 meta = lookup_meta_by_strip(ed, strip);
67
68 if (meta) {
69 i = do_adjustment_impl(context, state, meta, timeline_frame);
70 }
71 }
72
73 return i;
74}
75
76static ImBuf *do_adjustment(const RenderData *context,
78 Strip *strip,
79 float timeline_frame,
80 float /*fac*/,
81 ImBuf * /*ibuf1*/,
82 ImBuf * /*ibuf2*/)
83{
84 ImBuf *out;
85 Editing *ed;
86
87 ed = context->scene->ed;
88
89 if (!ed || state->strips_rendering_seqbase.contains(strip)) {
90 return nullptr;
91 }
92
93 state->strips_rendering_seqbase.add(strip);
94 out = do_adjustment_impl(context, state, strip, timeline_frame);
95
96 return out;
97}
98
105
106} // namespace blender::seq
MINLINE int clamp_i(int value, int min, int max)
#define out
static ulong state[N]
Strip * lookup_meta_by_strip(Editing *ed, const Strip *key)
int time_right_handle_frame_get(const Scene *scene, const Strip *strip)
ImBuf * seq_render_give_ibuf_seqbase(const RenderData *context, SeqRenderState *state, float timeline_frame, int chan_shown, ListBase *channels, ListBase *seqbasep)
Definition render.cc:2089
static ImBuf * do_adjustment(const RenderData *context, SeqRenderState *state, Strip *strip, float timeline_frame, float, ImBuf *, ImBuf *)
ListBase * get_seqbase_by_strip(const Scene *scene, Strip *strip)
int time_left_handle_frame_get(const Scene *, const Strip *strip)
static ImBuf * do_adjustment_impl(const RenderData *context, SeqRenderState *state, Strip *strip, float timeline_frame)
static StripEarlyOut early_out_adjustment(const Strip *, float)
ListBase * get_channels_by_strip(Editing *ed, const Strip *strip)
Definition channels.cc:86
void adjustment_effect_get_handle(EffectHandle &rval)
static int num_inputs_adjustment()
ImBuf *(* execute)(const RenderData *context, SeqRenderState *state, Strip *strip, float timeline_frame, float fac, ImBuf *ibuf1, ImBuf *ibuf2)
StripEarlyOut(* early_out)(const Strip *strip, float fac)
i
Definition text_draw.cc:230