Blender V4.5
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, Strip *strip, float timeline_frame)
35{
36 Editing *ed;
37 ImBuf *i = nullptr;
38
39 ed = context->scene->ed;
40
41 ListBase *seqbasep = get_seqbase_by_strip(context->scene, strip);
42 ListBase *channels = get_channels_by_strip(ed, strip);
43
44 /* Clamp timeline_frame to strip range so it behaves as if it had "still frame" offset (last
45 * frame is static after end of strip). This is how most strips behave. This way transition
46 * effects that doesn't overlap or speed effect can't fail rendering outside of strip range. */
47 timeline_frame = clamp_i(timeline_frame,
48 time_left_handle_frame_get(context->scene, strip),
49 time_right_handle_frame_get(context->scene, strip) - 1);
50
51 if (strip->channel > 1) {
53 context, timeline_frame, strip->channel - 1, channels, seqbasep);
54 }
55
56 /* Found nothing? so let's work the way up the meta-strip stack, so
57 * that it is possible to group a bunch of adjustment strips into
58 * a meta-strip and have that work on everything below the meta-strip. */
59
60 if (!i) {
61 Strip *meta;
62
63 meta = lookup_meta_by_strip(ed, strip);
64
65 if (meta) {
66 i = do_adjustment_impl(context, meta, timeline_frame);
67 }
68 }
69
70 return i;
71}
72
73static ImBuf *do_adjustment(const RenderData *context,
74 Strip *strip,
75 float timeline_frame,
76 float /*fac*/,
77 ImBuf * /*ibuf1*/,
78 ImBuf * /*ibuf2*/)
79{
80 ImBuf *out;
81 Editing *ed;
82
83 ed = context->scene->ed;
84
85 if (!ed) {
86 return nullptr;
87 }
88
89 out = do_adjustment_impl(context, strip, timeline_frame);
90
91 return out;
92}
93
100
101} // namespace blender::seq
MINLINE int clamp_i(int value, int min, int max)
#define out
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, float timeline_frame, int chan_shown, ListBase *channels, ListBase *seqbasep)
Definition render.cc:2060
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, 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:91
void adjustment_effect_get_handle(EffectHandle &rval)
static ImBuf * do_adjustment(const RenderData *context, Strip *strip, float timeline_frame, float, ImBuf *, ImBuf *)
static int num_inputs_adjustment()
ImBuf *(* execute)(const RenderData *context, 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