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
88 lines
2.4 KiB
C++
88 lines
2.4 KiB
C++
/* SPDX-FileCopyrightText: 2009 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup editors
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "BLI_vector_set.hh"
|
|
|
|
struct Scene;
|
|
struct Strip;
|
|
struct SpaceSeq;
|
|
struct bContext;
|
|
struct View2D;
|
|
|
|
namespace blender::ed::vse {
|
|
|
|
enum eStripHandle {
|
|
STRIP_HANDLE_NONE,
|
|
STRIP_HANDLE_LEFT,
|
|
STRIP_HANDLE_RIGHT,
|
|
};
|
|
|
|
struct StripSelection {
|
|
/** Closest strip in the selection to the mouse cursor. */
|
|
Strip *strip1 = nullptr;
|
|
/** Farthest strip in the selection from the mouse cursor. */
|
|
Strip *strip2 = nullptr;
|
|
/** Handle of `strip1`. */
|
|
eStripHandle handle = STRIP_HANDLE_NONE;
|
|
};
|
|
|
|
void select_strip_single(Scene *scene, Strip *strip, bool deselect_all);
|
|
/**
|
|
* Iterates over a scene's strips and deselects all of them.
|
|
*
|
|
* \param scene: scene containing strips to be deselected.
|
|
* \return true if any strips were deselected; false otherwise.
|
|
*/
|
|
bool deselect_all_strips(const Scene *scene);
|
|
|
|
bool maskedit_mask_poll(bContext *C);
|
|
bool check_show_maskedit(SpaceSeq *sseq, Scene *scene);
|
|
bool maskedit_poll(bContext *C);
|
|
|
|
/**
|
|
* Are we displaying the seq output (not channels or histogram).
|
|
*/
|
|
bool check_show_imbuf(const SpaceSeq &sseq);
|
|
|
|
bool check_show_strip(const SpaceSeq &sseq);
|
|
/**
|
|
* Check if there is animation shown during playback.
|
|
*
|
|
* - Colors of color strips are displayed on the strip itself.
|
|
* - Backdrop is drawn.
|
|
*/
|
|
bool has_playback_animation(const Scene *scene);
|
|
|
|
void ED_operatormacros_sequencer();
|
|
|
|
Strip *special_preview_get();
|
|
void special_preview_set(bContext *C, const int mval[2]);
|
|
void special_preview_clear();
|
|
bool sequencer_retiming_mode_is_active(const bContext *C);
|
|
/**
|
|
* Returns collection with selected strips presented to user. If operation is done in preview,
|
|
* collection is limited to selected presented strips, that can produce image output at current
|
|
* frame.
|
|
*
|
|
* \param C: context
|
|
* \return collection of strips (`Strip`)
|
|
*/
|
|
blender::VectorSet<Strip *> selected_strips_from_context(bContext *C);
|
|
StripSelection pick_strip_and_handle(const struct Scene *scene,
|
|
const View2D *v2d,
|
|
float mouse_co[2]);
|
|
bool can_select_handle(const Scene *scene, const Strip *strip, const View2D *v2d);
|
|
bool handle_is_selected(const Strip *strip, eStripHandle handle);
|
|
|
|
bool is_scene_time_sync_needed(const bContext &C);
|
|
void sync_active_scene_and_time_with_scene_strip(bContext &C);
|
|
|
|
} // namespace blender::ed::vse
|