This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/sequencer/SEQ_transform.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

143 lines
5.9 KiB
C++
Raw Normal View History

/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2004 Blender Foundation. All rights reserved. */
2020-12-19 06:44:57 +01:00
#pragma once
/** \file
* \ingroup sequencer
*/
#ifdef __cplusplus
extern "C" {
#endif
struct Editing;
2021-01-04 12:03:34 +11:00
struct ListBase;
2020-12-19 06:44:57 +01:00
struct Scene;
struct SeqCollection;
2021-07-16 11:48:54 +10:00
struct Sequence;
2020-12-19 06:44:57 +01:00
bool SEQ_transform_sequence_can_be_translated(struct Sequence *seq);
/**
* Used so we can do a quick check for single image seq
* since they work a bit differently to normal image seq's (during transform).
*/
2020-12-19 06:44:57 +01:00
bool SEQ_transform_single_image_check(struct Sequence *seq);
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 01:39:40 +02:00
void SEQ_transform_fix_single_image_seq_offsets(const struct Scene *scene, struct Sequence *seq);
bool SEQ_transform_test_overlap(const struct Scene *scene,
struct ListBase *seqbasep,
struct Sequence *test);
bool SEQ_transform_test_overlap_seq_seq(const struct Scene *scene,
struct Sequence *seq1,
struct Sequence *seq2);
2020-12-19 06:44:57 +01:00
void SEQ_transform_translate_sequence(struct Scene *scene, struct Sequence *seq, int delta);
/**
* \return 0 if there weren't enough space.
*/
2020-12-19 06:44:57 +01:00
bool SEQ_transform_seqbase_shuffle_ex(struct ListBase *seqbasep,
struct Sequence *test,
struct Scene *evil_scene,
int channel_delta);
bool SEQ_transform_seqbase_shuffle(struct ListBase *seqbasep,
struct Sequence *test,
struct Scene *evil_scene);
bool SEQ_transform_seqbase_shuffle_time(struct SeqCollection *strips_to_shuffle,
struct SeqCollection *time_dependent_strips,
struct ListBase *seqbasep,
2020-12-19 06:44:57 +01:00
struct Scene *evil_scene,
struct ListBase *markers,
bool use_sync_markers);
void SEQ_transform_handle_overlap(struct Scene *scene,
struct ListBase *seqbasep,
struct SeqCollection *transformed_strips,
struct SeqCollection *time_dependent_strips,
bool use_sync_markers);
/**
* Check if the selected seq's reference unselected seq's.
*/
2020-12-19 06:44:57 +01:00
bool SEQ_transform_seqbase_isolated_sel_check(struct ListBase *seqbase);
/**
* Move strips and markers (if not locked) that start after timeline_frame by delta frames
*
* \param scene: Scene in which strips are located
* \param seqbase: ListBase in which strips are located
* \param delta: offset in frames to be applied
* \param timeline_frame: frame on timeline from where strips are moved
*/
2020-12-19 06:44:57 +01:00
void SEQ_transform_offset_after_frame(struct Scene *scene,
struct ListBase *seqbase,
int delta,
int timeline_frame);
2020-12-19 06:44:57 +01:00
/**
* Check if `seq` can be moved.
* This function also checks `SeqTimelineChannel` flag.
*/
bool SEQ_transform_is_locked(struct ListBase *channels, struct Sequence *seq);
/* Image transformation. */
void SEQ_image_transform_mirror_factor_get(const struct Sequence *seq, float r_mirror[2]);
/**
* Get strip transform origin offset from image center
* NOTE: This function does not apply axis mirror.
*
* \param scene: Scene in which strips are located
* \param seq: Sequence to calculate image transform origin
* \param r_origin: return value
*/
void SEQ_image_transform_origin_offset_pixelspace_get(const struct Scene *scene,
const struct Sequence *seq,
float r_origin[2]);
/**
* Get 4 corner points of strip image, optionally without rotation component applied.
* Corner vectors are in viewport space.
*
* \param scene: Scene in which strips are located
* \param seq: Sequence to calculate transformed image quad
* \param apply_rotation: Apply sequence rotation transform to the quad
* \param r_quad: array of 4 2D vectors
*/
void SEQ_image_transform_quad_get(const struct Scene *scene,
const struct Sequence *seq,
bool apply_rotation,
float r_quad[4][2]);
/**
* Get 4 corner points of strip image. Corner vectors are in viewport space.
*
* \param scene: Scene in which strips are located
* \param seq: Sequence to calculate transformed image quad
* \param r_quad: array of 4 2D vectors
*/
void SEQ_image_transform_final_quad_get(const struct Scene *scene,
const struct Sequence *seq,
float r_quad[4][2]);
void SEQ_image_preview_unit_to_px(const struct Scene *scene,
const float co_src[2],
float co_dst[2]);
void SEQ_image_preview_unit_from_px(const struct Scene *scene,
const float co_src[2],
float co_dst[2]);
/**
* Get viewport axis aligned bounding box from a collection of sequences.
* The collection must have one or more strips
*
* \param scene: Scene in which strips are located
* \param strips: Collection of strips to get the bounding box from
* \param apply_rotation: Include sequence rotation transform in the bounding box calculation
* \param r_min: Minimum x and y values
* \param r_max: Maximum x and y values
*/
void SEQ_image_transform_bounding_box_from_collection(struct Scene *scene,
struct SeqCollection *strips,
bool apply_rotation,
float r_min[2],
float r_max[2]);
2020-12-19 06:44:57 +01:00
#ifdef __cplusplus
}
#endif