Implements the proposed design (with some modifications) in #135058. ## Sequencer Scene This adds a new property called `sequencer_scene` to workspaces. This scene is used by the video sequence editors in the current workspace for their context. This is a first step towards "detaching" the VSE from the active scene in the window. Each sequencer timeline editor shows the sequencer scene that is being used. By default, when no sequencer scene is selected, the timeline and preview are empty. Pressing the "new" button will add a new scene and assign it to the sequencer scene for the current workspace. ## Contextual Playback Pressing `Space` (by default) for starting the animation playback is now contextual: depending on the context (where your mouse cursor is), the scene that is played back might be different. E.g. with a 3D Viewport and a Sequencer open, pressing "play" in the 3D Viewport will play the _active scene_ of the window, while pressing "play" in the sequencer will play the _sequencer scene_. ## Time & Scene Synchronization Additionally, this adds a toggle called "Sync Active Scene". With the property turned on, the active scene & scene time in the window will be synced with the time & scene of the current scene strip in the sequencer. Note that this is _not_ bi-directional. The sequencer can change the active scene and map time, but it's not possible the other way around since it one can have multiple strips using the same scene (+camera, and even time!). Currently this setting is exposed in the footer of the sequencer timeline as well as in the workspace settings. This allows for one of the core concepts that the story tools projects aims at: Working in a scene (e.g. in the 3D viewport) while also working with the edit (in the sequencer timeline). ## Some technical notes * Undoing while playback is running will now cancel playback. This is to avoid the timer, that points to the scene and viewlayer that are playing, to get de-synced after loading the memfile undo step. * When the sequencer scene is not the same as the active scene, we ensure it has a depsgraph. * Normally, when a `NC_SCENE` notifier points to a specific scene, the notifier is dropped if that scene doesn't match the active one in the window. We now also check that it doesn't match the sequencer scene in the active workspace. * When loading older files, we need to make sure that the active workspace in a window uses the active scene as the sequencer scene. This is to make sure that the file opens with the same sequences open. * Tool settings are stored per scene. To make sure the sequencer uses the tool settings for the sequencer scene, the "context.tool_settings" and `CTX_data_tool_settings` members are overridden in the sequence editors. Pull Request: https://projects.blender.org/blender/blender/pulls/140271
152 lines
5.6 KiB
C++
152 lines
5.6 KiB
C++
/* SPDX-FileCopyrightText: 2004 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
/** \file
|
|
* \ingroup sequencer
|
|
*/
|
|
|
|
#include "BLI_function_ref.hh"
|
|
#include "BLI_vector_set.hh"
|
|
|
|
struct ListBase;
|
|
struct Scene;
|
|
struct Strip;
|
|
|
|
namespace blender::seq {
|
|
|
|
/**
|
|
* Callback format for the for_each function below.
|
|
*/
|
|
using ForEachFunc = bool (*)(Strip *strip, void *user_data);
|
|
|
|
/**
|
|
* Utility function to recursively iterate through all sequence strips in a `seqbase` list.
|
|
* Uses callback to do operations on each element.
|
|
* The callback can stop the iteration if needed.
|
|
*
|
|
* \param seqbase: #ListBase of sequences to be iterated over.
|
|
* \param callback: query function callback, returns false if iteration should stop.
|
|
* \param user_data: pointer to user data that can be used in the callback function.
|
|
*/
|
|
void for_each_callback(ListBase *seqbase, ForEachFunc callback, void *user_data);
|
|
|
|
/** Same as above, but using a more modern FunctionRef as callback. */
|
|
void for_each_callback(ListBase *seqbase, blender::FunctionRef<bool(Strip *)> callback);
|
|
|
|
/**
|
|
* Expand set by running `strip_query_func()` for each strip, which will be used as reference.
|
|
* Results of these queries will be merged into provided collection.
|
|
*
|
|
* \param seqbase: ListBase in which strips are queried
|
|
* \param strips: set of strips to be expanded
|
|
* \param strip_query_func: query function callback
|
|
*/
|
|
void iterator_set_expand(const Scene *scene,
|
|
ListBase *seqbase,
|
|
blender::VectorSet<Strip *> &strips,
|
|
void strip_query_func(const Scene *scene,
|
|
Strip *strip_reference,
|
|
ListBase *seqbase,
|
|
blender::VectorSet<Strip *> &strips));
|
|
/**
|
|
* Query strips from seqbase. strip_reference is used by query function as filter condition.
|
|
*
|
|
* \param strip_reference: reference strip for query function
|
|
* \param seqbase: ListBase in which strips are queried
|
|
* \param strip_query_func: query function callback
|
|
* \return set of strips
|
|
*/
|
|
blender::VectorSet<Strip *> query_by_reference(
|
|
Strip *strip_reference,
|
|
const Scene *scene,
|
|
ListBase *seqbase,
|
|
void strip_query_func(const Scene *scene,
|
|
Strip *strip_reference,
|
|
ListBase *seqbase,
|
|
blender::VectorSet<Strip *> &strips));
|
|
/**
|
|
* Query all selected strips in seqbase.
|
|
*
|
|
* \param seqbase: ListBase in which strips are queried
|
|
* \return set of strips
|
|
*/
|
|
blender::VectorSet<Strip *> query_selected_strips(ListBase *seqbase);
|
|
/**
|
|
* Query all unselected strips in seqbase.
|
|
*
|
|
* \param seqbase: ListBase in which strips are queried
|
|
* \return set of strips
|
|
*/
|
|
blender::VectorSet<Strip *> query_unselected_strips(ListBase *seqbase);
|
|
/**
|
|
* Query all strips in seqbase. This does not include strips nested in meta strips.
|
|
*
|
|
* \param seqbase: ListBase in which strips are queried
|
|
* \return set of strips
|
|
*/
|
|
blender::VectorSet<Strip *> query_all_strips(ListBase *seqbase);
|
|
/**
|
|
* Query all strips in seqbase and nested meta strips.
|
|
*
|
|
* \param seqbase: ListBase in which strips are queried
|
|
* \return set of strips
|
|
*/
|
|
blender::VectorSet<Strip *> query_all_strips_recursive(const ListBase *seqbase);
|
|
|
|
/**
|
|
* Query strips at \a timeline_frame in seqbase and nested meta strips.
|
|
*
|
|
* \param seqbase: ListBase in which strips are queried
|
|
* \param timeline_frame: viewed frame
|
|
* \return set of strips
|
|
*/
|
|
blender::VectorSet<Strip *> query_strips_recursive_at_frame(const Scene *scene,
|
|
const ListBase *seqbase,
|
|
int timeline_frame);
|
|
|
|
/**
|
|
* Query all effect strips that are directly or indirectly connected to strip_reference.
|
|
* This includes all effects of strip_reference, strips used by another inputs and their effects,
|
|
* so that whole chain is fully independent of other strips.
|
|
*
|
|
* \param strip_reference: reference strip
|
|
* \param seqbase: ListBase in which strips are queried
|
|
* \param strips: set of strips to be filled
|
|
*/
|
|
void query_strip_effect_chain(const Scene *scene,
|
|
Strip *reference_strip,
|
|
ListBase *seqbase,
|
|
blender::VectorSet<Strip *> &r_strips);
|
|
|
|
/**
|
|
* Query all connected strips, as well as all effect strips directly or indirectly connected to
|
|
* those connected strips. These steps repeat until there are no new strips to process.
|
|
*
|
|
* \param strip_reference: reference strip
|
|
* \param seqbase: ListBase in which strips are queried
|
|
* \param strips: set of strips to be filled
|
|
*/
|
|
void query_strip_connected_and_effect_chain(const Scene *scene,
|
|
Strip *reference_strip,
|
|
ListBase *seqbase,
|
|
blender::VectorSet<Strip *> &r_strips);
|
|
|
|
/**
|
|
* Query strips that are rendered at \a timeline_frame when \a displayed channel is viewed
|
|
*
|
|
* \param seqbase: ListBase in which strips are queried
|
|
* \param timeline_frame: viewed frame
|
|
* \param displayed_channel: viewed channel. when set to 0, no channel filter is applied
|
|
* \return set of strips
|
|
*/
|
|
blender::VectorSet<Strip *> query_rendered_strips(const Scene *scene,
|
|
ListBase *channels,
|
|
ListBase *seqbase,
|
|
int timeline_frame,
|
|
int displayed_channel);
|
|
|
|
} // namespace blender::seq
|