Files
test/source/blender/sequencer/SEQ_time.h
Richard Antalik 7afcfe111a VSE: Make time operations self-contained
This patch makes it possible to manipulate strips without need to use
update functions to recalculate effect and meta strips.

Prior to this change function `SEQ_time_update_sequence` had to be used
to update mainly effects and meta strips. This was implemented in a way
that relied on sorted list of strips, which can't always be done and in
rare cases this approach failed.

In case of meta strips, `seqbase` had to be passed and compared with
"active" one to determine whether meta strip should be updated or not.
This is especially weak system that is prone to bugs when functions are
used by python API functions.

Finally, other strip types had startdisp` and `enddisp` fields updated
by this function and a lot of code relied on these fields even if strip
start, length and offsets are available. This is completely
unnecessary.

Implemented changes:
All effects and meta strips are updated when strip handles are moved or
strip is translated, without need to call any update function.

Function `SEQ_time_update_sequence` has been split to
`SEQ_time_update_meta_strip_range` and
`seq_time_update_effects_strip_range`. These functions should be only
used within sequencer module code. Meta update is used for versioning,
which is only reason for it not being declared internally.

Sequence fields `startdisp` and `enddisp` are now only used for
effects to store strip start and end points. These fields should be
used only internally within sequencer module code.
Use function `SEQ_time_*_handle_frame_get` to get strip start and end
points.

To update effects and meta strips with reasonable performance, cache
for "parent" meta strip and attached effects is added to
`SequenceLookup` cache, so it shares invalidation mechanisms.
All caches are populated during single iteration.

There should be no functional changes.

Differential Revision: https://developer.blender.org/D14990
2022-06-02 03:16:20 +02:00

73 lines
2.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2004 Blender Foundation. All rights reserved. */
#pragma once
/** \file
* \ingroup sequencer
*/
#ifdef __cplusplus
extern "C" {
#endif
struct ListBase;
struct Scene;
struct Sequence;
struct rctf;
/**
* Initialize given rectangle with the Scene's timeline boundaries.
*
* \param scene: the Scene instance whose timeline boundaries are extracted from
* \param rect: output parameter to be filled with timeline boundaries
*/
void SEQ_timeline_init_boundbox(const struct Scene *scene, struct rctf *rect);
/**
* Stretch the given rectangle to include the given strips boundaries
*
* \param seqbase: ListBase in which strips are located
* \param rect: output parameter to be filled with strips' boundaries
*/
void SEQ_timeline_expand_boundbox(const struct ListBase *seqbase, struct rctf *rect);
/**
* Define boundary rectangle of sequencer timeline and fill in rect data
*
* \param scene: Scene in which strips are located
* \param seqbase: ListBase in which strips are located
* \param rect: data structure describing rectangle, that will be filled in by this function
*/
void SEQ_timeline_boundbox(const struct Scene *scene,
const struct ListBase *seqbase,
struct rctf *rect);
float SEQ_time_sequence_get_fps(struct Scene *scene, struct Sequence *seq);
int SEQ_time_find_next_prev_edit(struct Scene *scene,
int timeline_frame,
short side,
bool do_skip_mute,
bool do_center,
bool do_unselected);
/**
* Test if strip intersects with timeline frame.
* \note This checks if strip would be rendered at this frame. For rendering it is assumed, that
* timeline frame has width of 1 frame and therefore ends at timeline_frame + 1
*
* \param seq: Sequence to be checked
* \param timeline_frame: absolute frame position
* \return true if strip intersects with timeline frame.
*/
bool SEQ_time_strip_intersects_frame(const struct Sequence *seq, int timeline_frame);
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);
int SEQ_time_left_handle_frame_get(const struct Sequence *seq);
int SEQ_time_right_handle_frame_get(const struct Sequence *seq);
void SEQ_time_left_handle_frame_set(const struct Scene *scene, struct Sequence *seq, int val);
void SEQ_time_right_handle_frame_set(const struct Scene *scene, struct Sequence *seq, int val);
void SEQ_time_update_meta_strip_range(const struct Scene *scene, struct Sequence *seq_meta);
#ifdef __cplusplus
}
#endif