2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
2023-08-16 00:20:26 +10:00
|
|
|
* SPDX-FileCopyrightText: 2003-2009 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
* SPDX-FileCopyrightText: 2005-2006 Peter Schlaile <peter [at] schlaile [dot] de>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2008-12-15 05:21:44 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup bke
|
2011-02-27 20:40:57 +00:00
|
|
|
*/
|
|
|
|
|
|
2024-10-08 22:28:36 +02:00
|
|
|
#include "BKE_duplilist.hh"
|
|
|
|
|
#include "BLI_assert.h"
|
|
|
|
|
#include "BLI_map.hh"
|
|
|
|
|
#include "DNA_listBase.h"
|
|
|
|
|
#include <cstddef>
|
2021-08-20 16:30:34 +02:00
|
|
|
#define DNA_DEPRECATED_ALLOW
|
|
|
|
|
|
2008-12-15 05:21:44 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2009-11-22 20:22:35 +00:00
|
|
|
#include "DNA_anim_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
#include "DNA_sequence_types.h"
|
2021-08-20 16:30:34 +02:00
|
|
|
#include "DNA_sound_types.h"
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_listbase.h"
|
2024-09-26 21:13:39 +10:00
|
|
|
#include "BLI_path_utils.hh"
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2024-03-05 18:39:08 +01:00
|
|
|
#include "BKE_fcurve.hh"
|
2024-03-26 12:57:30 -04:00
|
|
|
#include "BKE_idprop.hh"
|
2024-01-15 12:44:04 -05:00
|
|
|
#include "BKE_lib_id.hh"
|
2023-12-01 19:43:16 +01:00
|
|
|
#include "BKE_main.hh"
|
2024-02-10 19:16:25 +01:00
|
|
|
#include "BKE_scene.hh"
|
2020-11-16 05:02:30 +01:00
|
|
|
#include "BKE_sound.h"
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2023-09-22 03:18:17 +02:00
|
|
|
#include "DEG_depsgraph.hh"
|
2008-12-15 05:21:44 +00:00
|
|
|
|
2024-01-18 22:50:23 +02:00
|
|
|
#include "IMB_imbuf.hh"
|
2011-06-23 09:27:56 +00:00
|
|
|
|
2023-11-02 01:05:06 +01:00
|
|
|
#include "SEQ_channels.hh"
|
2024-08-22 14:54:42 +02:00
|
|
|
#include "SEQ_connect.hh"
|
2023-11-02 01:05:06 +01:00
|
|
|
#include "SEQ_edit.hh"
|
|
|
|
|
#include "SEQ_effects.hh"
|
|
|
|
|
#include "SEQ_iterator.hh"
|
|
|
|
|
#include "SEQ_modifier.hh"
|
|
|
|
|
#include "SEQ_proxy.hh"
|
|
|
|
|
#include "SEQ_relations.hh"
|
VSE: Improve retiming UI
Currently retiming is quite awkward, when you need to retime multiple
strips strips in sync. It is possible to use meta strips, but this is
still not great. This is resolved by implementing selection.
General changes:
Gizmos are removed, since they are designed to operate only on active
strip and don't support selection.
Transform operator code is implemented for retiming data, which allows
more sophisticated manipulation.
Instead of drawing marker-like symbols, keyframes are drawn to
represent retiming data. Retiming handles are now called keys. To have
consistent names, DNA structures have been renamed.
Retiming data is drawn on strip as overlay.
UI changes:
Retiming tool is removed. To edit retiming data, press Ctrl + R, select
a key and move it. When retiming is edited, retiming menu and
context menu shows more relevant features, like making transitions.
Strip and retiming key selection can not be combined. It is possible to
use box select operator to select keys, if any key is selected.
Otherwise strips are selected.
Adding retiming keys is possible with I shortcut or from menu.
Retiming keys are always drawn at strip left and right boundary. These
keys do not really exist until they are selected. This is to simplify
retiming of strips that are resized. These keys are called "fake keys"
in code.
API changes:
Functions, properties and types related to retiming handles are renamed
to retiming keys:
retiming_handle_add() -> retiming_key_add()
retiming_handle_move() -> retiming_key_move()
retiming_handle_remove() -> retiming_key_remove()
retiming_handles -> retiming_keys
RetimingHandle -> RetimingKey
Retiming editing "mode" is activated by setting `Sequence.show_retiming_keys`.
Pull Request: https://projects.blender.org/blender/blender/pulls/109044
2023-09-27 01:45:59 +02:00
|
|
|
#include "SEQ_retiming.hh"
|
2023-11-02 01:05:06 +01:00
|
|
|
#include "SEQ_select.hh"
|
|
|
|
|
#include "SEQ_sequencer.hh"
|
|
|
|
|
#include "SEQ_sound.hh"
|
VSE: Faster and more consistent thumbnails
Implementing part of design outlined in #126087.
- VSE thumbnail cache has a new implementation, hopefully simpler
and easier to understand.
- Instead of cache key being a VSE strip, frame index, plus
complicated logic for cache items linking etc.,
- The cache is keyed by media file path (if multiple strips
use the same input file, they will share cache entries), frame
index within media file, and any extra data (e.g. steam index
for multi-steam videos)
- Much reduced cache flickering and strange/weird thumbnail choices.
- Likewise, thumbnails no longer disappear-and-reload on operations
like Undo, dragging new video strip into timeline, or F12 render.
- Thumbnails now load faster.
- Images use dedicated/faster thumbnail loading routines when a
format can do that (e.g. JPG and EXR can).
- Movies reuse ffmpeg decoding context for neighboring strips
that use the same file (as often happens when cutting footage)
- Thumbnail requests are processed on several threads now too.
Images and more detail in PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/126405
2024-08-29 08:27:12 +02:00
|
|
|
#include "SEQ_thumbnail_cache.hh"
|
2023-11-02 01:05:06 +01:00
|
|
|
#include "SEQ_time.hh"
|
|
|
|
|
#include "SEQ_utils.hh"
|
2017-10-25 11:02:52 -02:00
|
|
|
|
2023-08-28 15:01:05 +02:00
|
|
|
#include "BLO_read_write.hh"
|
2021-08-20 16:30:34 +02:00
|
|
|
|
2023-11-02 01:05:06 +01:00
|
|
|
#include "image_cache.hh"
|
|
|
|
|
#include "prefetch.hh"
|
|
|
|
|
#include "sequencer.hh"
|
|
|
|
|
#include "utils.hh"
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2020-11-16 05:02:30 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
2020-11-16 16:48:41 +11:00
|
|
|
/** \name Allocate / Free Functions
|
2020-11-16 05:02:30 +01:00
|
|
|
* \{ */
|
2009-12-18 13:28:03 +00:00
|
|
|
|
2023-07-20 20:11:08 +10:00
|
|
|
StripProxy *seq_strip_proxy_alloc()
|
2022-01-25 17:05:33 +01:00
|
|
|
{
|
2023-07-20 09:46:24 +02:00
|
|
|
StripProxy *strip_proxy = static_cast<StripProxy *>(
|
|
|
|
|
MEM_callocN(sizeof(StripProxy), "StripProxy"));
|
2022-01-25 17:05:33 +01:00
|
|
|
strip_proxy->quality = 50;
|
2024-05-06 17:56:56 +02:00
|
|
|
strip_proxy->build_tc_flags = SEQ_PROXY_TC_RECORD_RUN | SEQ_PROXY_TC_RECORD_RUN_NO_GAPS;
|
2022-01-25 17:05:33 +01:00
|
|
|
strip_proxy->tc = SEQ_PROXY_TC_RECORD_RUN;
|
|
|
|
|
return strip_proxy;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-16 05:02:30 +01:00
|
|
|
static Strip *seq_strip_alloc(int type)
|
2009-12-18 13:28:03 +00:00
|
|
|
{
|
2023-07-20 09:46:24 +02:00
|
|
|
Strip *strip = static_cast<Strip *>(MEM_callocN(sizeof(Strip), "strip"));
|
2010-07-06 16:44:05 +00:00
|
|
|
|
2023-08-15 14:49:11 +02:00
|
|
|
if (type != SEQ_TYPE_SOUND_RAM) {
|
2023-07-20 09:46:24 +02:00
|
|
|
strip->transform = static_cast<StripTransform *>(
|
|
|
|
|
MEM_callocN(sizeof(StripTransform), "StripTransform"));
|
2020-11-16 05:02:30 +01:00
|
|
|
strip->transform->scale_x = 1;
|
|
|
|
|
strip->transform->scale_y = 1;
|
2021-09-21 09:38:30 +02:00
|
|
|
strip->transform->origin[0] = 0.5f;
|
|
|
|
|
strip->transform->origin[1] = 0.5f;
|
VSE: default to new "Auto" image filter for strips
Part of "improve filtering situation" (#116980), now strip scaling filter defaults to "Auto" which has logic like:
- No scale, no rotation, integer positions: Nearest (fastest)
- Scaling up by more than 2x: Cubic Mitchell, so you get nicer blending between pixels than with bilinear,
- Scaling down by more than 2x: Box, so that many pixels are averaged properly without too much aliasing,
- Otherwise: Bilinear
Existing strips that use Bilinear (which is default) get switched to Auto when loading older files.
All of this has an advantage that unless you have some special needs for your look, you can leave it at default and it will look decently good at either large up-scaling or large down-scaling, but not waste performance if you don't use any scaling at all. Previously none of the choices were good in "all cases": box (née subsampled3x3) only looks good when scaling down, cubic only looks good when scaling up, default bilinear leaves performance on the table when you don't use any scale/rotation, etc.
On something like Gold movie current edit, most of the strips effectively use Nearest now, except some that are translated into non-integer pixel positions; those stay effectively Bilinear.
Pull Request: https://projects.blender.org/blender/blender/pulls/117853
2024-02-05 20:09:29 +01:00
|
|
|
strip->transform->filter = SEQ_TRANSFORM_FILTER_AUTO;
|
2023-07-20 09:46:24 +02:00
|
|
|
strip->crop = static_cast<StripCrop *>(MEM_callocN(sizeof(StripCrop), "StripCrop"));
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2010-07-06 16:44:05 +00:00
|
|
|
|
2020-11-16 05:02:30 +01:00
|
|
|
strip->us = 1;
|
|
|
|
|
return strip;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2012-08-08 11:15:32 +00:00
|
|
|
static void seq_free_strip(Strip *strip)
|
2008-12-15 05:21:44 +00:00
|
|
|
{
|
|
|
|
|
strip->us--;
|
2019-04-22 09:39:35 +10:00
|
|
|
if (strip->us > 0) {
|
2012-08-08 11:15:36 +00:00
|
|
|
return;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2012-03-29 22:26:11 +00:00
|
|
|
if (strip->us < 0) {
|
2008-12-15 05:21:44 +00:00
|
|
|
printf("error: negative users in strip\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strip->stripdata) {
|
|
|
|
|
MEM_freeN(strip->stripdata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strip->proxy) {
|
2009-06-08 20:08:19 +00:00
|
|
|
if (strip->proxy->anim) {
|
|
|
|
|
IMB_free_anim(strip->proxy->anim);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-15 05:21:44 +00:00
|
|
|
MEM_freeN(strip->proxy);
|
|
|
|
|
}
|
|
|
|
|
if (strip->crop) {
|
|
|
|
|
MEM_freeN(strip->crop);
|
|
|
|
|
}
|
|
|
|
|
if (strip->transform) {
|
|
|
|
|
MEM_freeN(strip->transform);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MEM_freeN(strip);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
Sequence *SEQ_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int type)
|
2020-11-16 05:02:30 +01:00
|
|
|
{
|
|
|
|
|
Sequence *seq;
|
|
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
seq = static_cast<Sequence *>(MEM_callocN(sizeof(Sequence), "addseq"));
|
2020-11-16 05:02:30 +01:00
|
|
|
BLI_addtail(lb, seq);
|
|
|
|
|
|
|
|
|
|
*((short *)seq->name) = ID_SEQ;
|
|
|
|
|
seq->name[2] = 0;
|
|
|
|
|
|
|
|
|
|
seq->flag = SELECT;
|
|
|
|
|
seq->start = timeline_frame;
|
|
|
|
|
seq->machine = machine;
|
|
|
|
|
seq->sat = 1.0;
|
|
|
|
|
seq->mul = 1.0;
|
|
|
|
|
seq->blend_opacity = 100.0;
|
|
|
|
|
seq->volume = 1.0f;
|
2023-07-20 09:46:24 +02:00
|
|
|
seq->scene_sound = nullptr;
|
2020-11-16 05:02:30 +01:00
|
|
|
seq->type = type;
|
2022-06-29 12:45:59 +02:00
|
|
|
seq->media_playback_rate = 0.0f;
|
|
|
|
|
seq->speed_factor = 1.0f;
|
2022-05-23 23:05:54 +02:00
|
|
|
|
|
|
|
|
if (seq->type == SEQ_TYPE_ADJUSTMENT) {
|
|
|
|
|
seq->blend_mode = SEQ_TYPE_CROSS;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
seq->blend_mode = SEQ_TYPE_ALPHAOVER;
|
|
|
|
|
}
|
2020-11-16 05:02:30 +01:00
|
|
|
|
|
|
|
|
seq->strip = seq_strip_alloc(type);
|
2023-07-20 09:46:24 +02:00
|
|
|
seq->stereo3d_format = static_cast<Stereo3dFormat *>(
|
|
|
|
|
MEM_callocN(sizeof(Stereo3dFormat), "Sequence Stereo Format"));
|
2020-11-16 05:02:30 +01:00
|
|
|
|
2021-09-29 14:29:32 +02:00
|
|
|
seq->color_tag = SEQUENCE_COLOR_NONE;
|
|
|
|
|
|
2022-04-04 12:52:48 +02:00
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
|
|
|
|
SEQ_channels_ensure(&seq->channels);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-22 13:47:13 +01:00
|
|
|
SEQ_relations_session_uid_generate(seq);
|
2020-11-16 05:02:30 +01:00
|
|
|
|
|
|
|
|
return seq;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-06 09:23:38 +00:00
|
|
|
/* only give option to skip cache locally (static func) */
|
2020-12-19 05:57:27 +01:00
|
|
|
static void seq_sequence_free_ex(Scene *scene,
|
2018-05-11 11:21:30 +02:00
|
|
|
Sequence *seq,
|
|
|
|
|
const bool do_cache,
|
2022-01-19 14:12:23 +01:00
|
|
|
const bool do_id_user)
|
2008-12-15 05:21:44 +00:00
|
|
|
{
|
2019-04-22 09:39:35 +10:00
|
|
|
if (seq->strip) {
|
2012-08-08 11:15:36 +00:00
|
|
|
seq_free_strip(seq->strip);
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2008-12-15 05:21:44 +00:00
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_relations_sequence_free_anim(seq);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type & SEQ_TYPE_EFFECT) {
|
2023-07-20 20:11:08 +10:00
|
|
|
SeqEffectHandle sh = SEQ_effect_handle_get(seq);
|
2018-12-28 13:37:51 +01:00
|
|
|
sh.free(seq, do_id_user);
|
2009-07-08 17:41:45 +00:00
|
|
|
}
|
2008-12-15 05:21:44 +00:00
|
|
|
|
2018-05-11 11:21:30 +02:00
|
|
|
if (seq->sound && do_id_user) {
|
2022-09-25 15:14:13 +10:00
|
|
|
id_us_min((ID *)seq->sound);
|
2011-05-16 17:14:47 +00:00
|
|
|
}
|
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
if (seq->stereo3d_format) {
|
|
|
|
|
MEM_freeN(seq->stereo3d_format);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-17 08:45:44 +00:00
|
|
|
/* clipboard has no scene and will never have a sound handle or be active
|
|
|
|
|
* same goes to sequences copy for proxy rebuild job
|
|
|
|
|
*/
|
2012-03-24 06:18:31 +00:00
|
|
|
if (scene) {
|
2009-12-17 16:28:45 +00:00
|
|
|
Editing *ed = scene->ed;
|
|
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if (ed->act_seq == seq) {
|
2023-07-20 09:46:24 +02:00
|
|
|
ed->act_seq = nullptr;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2009-12-17 16:28:45 +00:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if (seq->scene_sound && ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) {
|
2015-03-26 11:35:41 +01:00
|
|
|
BKE_sound_remove_scene_sound(scene, seq->scene_sound);
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2010-07-13 09:31:28 +00:00
|
|
|
}
|
2010-07-03 21:13:08 +00:00
|
|
|
|
2015-04-02 21:05:12 +11:00
|
|
|
if (seq->prop) {
|
2019-05-16 14:17:11 +02:00
|
|
|
IDP_FreePropertyContent_ex(seq->prop, do_id_user);
|
2015-04-02 21:05:12 +11:00
|
|
|
MEM_freeN(seq->prop);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-19 15:41:56 +00:00
|
|
|
/* free modifiers */
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_modifier_clear(seq);
|
2012-08-19 15:41:56 +00:00
|
|
|
|
2024-08-22 14:54:42 +02:00
|
|
|
if (SEQ_is_strip_connected(seq)) {
|
|
|
|
|
SEQ_disconnect(seq);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-27 09:01:36 +00:00
|
|
|
/* free cached data used by this strip,
|
|
|
|
|
* also invalidate cache for all dependent sequences
|
2012-09-06 04:45:25 +00:00
|
|
|
*
|
|
|
|
|
* be _very_ careful here, invalidating cache loops over the scene sequences and
|
2019-04-27 12:07:07 +10:00
|
|
|
* assumes the listbase is valid for all strips,
|
|
|
|
|
* this may not be the case if lists are being freed.
|
2020-12-19 05:57:27 +01:00
|
|
|
* this is optional SEQ_relations_invalidate_cache
|
2012-08-27 09:01:36 +00:00
|
|
|
*/
|
2012-09-06 04:45:25 +00:00
|
|
|
if (do_cache) {
|
|
|
|
|
if (scene) {
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_relations_invalidate_cache_raw(scene, seq);
|
2012-09-06 04:45:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
2022-04-04 12:52:48 +02:00
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
|
|
|
|
SEQ_channels_free(&seq->channels);
|
|
|
|
|
}
|
2012-08-12 18:24:01 +00:00
|
|
|
|
VSE: Improve retiming UI
Currently retiming is quite awkward, when you need to retime multiple
strips strips in sync. It is possible to use meta strips, but this is
still not great. This is resolved by implementing selection.
General changes:
Gizmos are removed, since they are designed to operate only on active
strip and don't support selection.
Transform operator code is implemented for retiming data, which allows
more sophisticated manipulation.
Instead of drawing marker-like symbols, keyframes are drawn to
represent retiming data. Retiming handles are now called keys. To have
consistent names, DNA structures have been renamed.
Retiming data is drawn on strip as overlay.
UI changes:
Retiming tool is removed. To edit retiming data, press Ctrl + R, select
a key and move it. When retiming is edited, retiming menu and
context menu shows more relevant features, like making transitions.
Strip and retiming key selection can not be combined. It is possible to
use box select operator to select keys, if any key is selected.
Otherwise strips are selected.
Adding retiming keys is possible with I shortcut or from menu.
Retiming keys are always drawn at strip left and right boundary. These
keys do not really exist until they are selected. This is to simplify
retiming of strips that are resized. These keys are called "fake keys"
in code.
API changes:
Functions, properties and types related to retiming handles are renamed
to retiming keys:
retiming_handle_add() -> retiming_key_add()
retiming_handle_move() -> retiming_key_move()
retiming_handle_remove() -> retiming_key_remove()
retiming_handles -> retiming_keys
RetimingHandle -> RetimingKey
Retiming editing "mode" is activated by setting `Sequence.show_retiming_keys`.
Pull Request: https://projects.blender.org/blender/blender/pulls/109044
2023-09-27 01:45:59 +02:00
|
|
|
if (seq->retiming_keys != nullptr) {
|
|
|
|
|
MEM_freeN(seq->retiming_keys);
|
|
|
|
|
seq->retiming_keys = nullptr;
|
|
|
|
|
seq->retiming_keys_num = 0;
|
2023-06-14 04:47:53 +02:00
|
|
|
}
|
|
|
|
|
|
2008-12-15 05:21:44 +00:00
|
|
|
MEM_freeN(seq);
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-19 14:12:23 +01:00
|
|
|
void SEQ_sequence_free(Scene *scene, Sequence *seq)
|
2012-09-06 09:23:38 +00:00
|
|
|
{
|
2022-01-19 14:12:23 +01:00
|
|
|
seq_sequence_free_ex(scene, seq, true, true);
|
2012-09-06 09:23:38 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-19 14:12:23 +01:00
|
|
|
void seq_free_sequence_recurse(Scene *scene, Sequence *seq, const bool do_id_user)
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
{
|
2012-09-06 04:45:25 +00:00
|
|
|
Sequence *iseq, *iseq_next;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
for (iseq = static_cast<Sequence *>(seq->seqbase.first); iseq; iseq = iseq_next) {
|
2020-11-16 05:02:30 +01:00
|
|
|
iseq_next = iseq->next;
|
2022-01-19 14:12:23 +01:00
|
|
|
seq_free_sequence_recurse(scene, iseq, do_id_user);
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
|
2022-01-19 14:12:23 +01:00
|
|
|
seq_sequence_free_ex(scene, seq, false, do_id_user);
|
2020-11-16 05:02:30 +01:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2021-09-02 11:29:32 +10:00
|
|
|
Editing *SEQ_editing_get(const Scene *scene)
|
2020-11-16 05:02:30 +01:00
|
|
|
{
|
|
|
|
|
return scene->ed;
|
|
|
|
|
}
|
2019-09-29 16:17:48 -07:00
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
Editing *SEQ_editing_ensure(Scene *scene)
|
2020-11-16 05:02:30 +01:00
|
|
|
{
|
2023-07-20 09:46:24 +02:00
|
|
|
if (scene->ed == nullptr) {
|
2020-11-16 05:02:30 +01:00
|
|
|
Editing *ed;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
ed = scene->ed = static_cast<Editing *>(MEM_callocN(sizeof(Editing), "addseq"));
|
2020-11-16 05:02:30 +01:00
|
|
|
ed->seqbasep = &ed->seqbase;
|
2023-07-20 09:46:24 +02:00
|
|
|
ed->cache = nullptr;
|
2024-05-02 16:36:11 +02:00
|
|
|
ed->cache_flag = (SEQ_CACHE_STORE_FINAL_OUT | SEQ_CACHE_STORE_RAW);
|
2024-04-24 19:54:44 +02:00
|
|
|
ed->show_missing_media_flag = SEQ_EDIT_SHOW_MISSING_MEDIA;
|
2022-04-04 16:27:37 +02:00
|
|
|
ed->displayed_channels = &ed->channels;
|
|
|
|
|
SEQ_channels_ensure(ed->displayed_channels);
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-16 05:02:30 +01:00
|
|
|
return scene->ed;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
void SEQ_editing_free(Scene *scene, const bool do_id_user)
|
2020-11-16 05:02:30 +01:00
|
|
|
{
|
|
|
|
|
Editing *ed = scene->ed;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
if (ed == nullptr) {
|
2020-11-16 05:02:30 +01:00
|
|
|
return;
|
2016-01-08 18:30:26 +13:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
seq_prefetch_free(scene);
|
|
|
|
|
seq_cache_destruct(scene);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-08-20 16:30:34 +02:00
|
|
|
/* handle cache freeing above */
|
|
|
|
|
LISTBASE_FOREACH_MUTABLE (Sequence *, seq, &ed->seqbase) {
|
2022-01-19 14:12:23 +01:00
|
|
|
seq_free_sequence_recurse(scene, seq, do_id_user);
|
2020-11-16 05:02:30 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-16 05:02:30 +01:00
|
|
|
BLI_freelistN(&ed->metastack);
|
2021-06-16 00:29:17 +02:00
|
|
|
SEQ_sequence_lookup_free(scene);
|
2024-04-24 19:54:44 +02:00
|
|
|
blender::seq::media_presence_free(scene);
|
VSE: Faster and more consistent thumbnails
Implementing part of design outlined in #126087.
- VSE thumbnail cache has a new implementation, hopefully simpler
and easier to understand.
- Instead of cache key being a VSE strip, frame index, plus
complicated logic for cache items linking etc.,
- The cache is keyed by media file path (if multiple strips
use the same input file, they will share cache entries), frame
index within media file, and any extra data (e.g. steam index
for multi-steam videos)
- Much reduced cache flickering and strange/weird thumbnail choices.
- Likewise, thumbnails no longer disappear-and-reload on operations
like Undo, dragging new video strip into timeline, or F12 render.
- Thumbnails now load faster.
- Images use dedicated/faster thumbnail loading routines when a
format can do that (e.g. JPG and EXR can).
- Movies reuse ffmpeg decoding context for neighboring strips
that use the same file (as often happens when cutting footage)
- Thumbnail requests are processed on several threads now too.
Images and more detail in PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/126405
2024-08-29 08:27:12 +02:00
|
|
|
blender::seq::thumbnail_cache_destroy(scene);
|
2022-04-04 12:52:48 +02:00
|
|
|
SEQ_channels_free(&ed->channels);
|
VSE: Improve retiming UI
Currently retiming is quite awkward, when you need to retime multiple
strips strips in sync. It is possible to use meta strips, but this is
still not great. This is resolved by implementing selection.
General changes:
Gizmos are removed, since they are designed to operate only on active
strip and don't support selection.
Transform operator code is implemented for retiming data, which allows
more sophisticated manipulation.
Instead of drawing marker-like symbols, keyframes are drawn to
represent retiming data. Retiming handles are now called keys. To have
consistent names, DNA structures have been renamed.
Retiming data is drawn on strip as overlay.
UI changes:
Retiming tool is removed. To edit retiming data, press Ctrl + R, select
a key and move it. When retiming is edited, retiming menu and
context menu shows more relevant features, like making transitions.
Strip and retiming key selection can not be combined. It is possible to
use box select operator to select keys, if any key is selected.
Otherwise strips are selected.
Adding retiming keys is possible with I shortcut or from menu.
Retiming keys are always drawn at strip left and right boundary. These
keys do not really exist until they are selected. This is to simplify
retiming of strips that are resized. These keys are called "fake keys"
in code.
API changes:
Functions, properties and types related to retiming handles are renamed
to retiming keys:
retiming_handle_add() -> retiming_key_add()
retiming_handle_move() -> retiming_key_move()
retiming_handle_remove() -> retiming_key_remove()
retiming_handles -> retiming_keys
RetimingHandle -> RetimingKey
Retiming editing "mode" is activated by setting `Sequence.show_retiming_keys`.
Pull Request: https://projects.blender.org/blender/blender/pulls/109044
2023-09-27 01:45:59 +02:00
|
|
|
|
2020-11-16 05:02:30 +01:00
|
|
|
MEM_freeN(ed);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
scene->ed = nullptr;
|
2020-11-16 05:02:30 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-10-08 22:28:36 +02:00
|
|
|
static void seq_new_fix_links_recursive(Sequence *seq,
|
|
|
|
|
blender::Map<Sequence *, Sequence *> strip_map)
|
2020-11-16 05:02:30 +01:00
|
|
|
{
|
|
|
|
|
if (seq->type & SEQ_TYPE_EFFECT) {
|
2024-10-08 22:28:36 +02:00
|
|
|
seq->seq1 = strip_map.lookup_default(seq->seq1, seq->seq1);
|
|
|
|
|
seq->seq2 = strip_map.lookup_default(seq->seq2, seq->seq2);
|
2009-11-14 19:26:58 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-08-04 08:51:13 +10:00
|
|
|
LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) {
|
2024-10-08 22:28:36 +02:00
|
|
|
smd->mask_sequence = strip_map.lookup_default(smd->mask_sequence, smd->mask_sequence);
|
2020-11-16 05:02:30 +01:00
|
|
|
}
|
2024-08-22 14:54:42 +02:00
|
|
|
|
|
|
|
|
if (SEQ_is_strip_connected(seq)) {
|
|
|
|
|
LISTBASE_FOREACH (SeqConnection *, con, &seq->connections) {
|
2024-10-08 22:28:36 +02:00
|
|
|
con->seq_ref = strip_map.lookup_default(con->seq_ref, con->seq_ref);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
|
|
|
|
LISTBASE_FOREACH (Sequence *, seqn, &seq->seqbase) {
|
|
|
|
|
seq_new_fix_links_recursive(seqn, strip_map);
|
2024-08-22 14:54:42 +02:00
|
|
|
}
|
|
|
|
|
}
|
2009-11-14 19:26:58 +00:00
|
|
|
}
|
2020-12-16 20:34:26 +01:00
|
|
|
|
2023-07-20 20:11:08 +10:00
|
|
|
SequencerToolSettings *SEQ_tool_settings_init()
|
2020-12-16 20:34:26 +01:00
|
|
|
{
|
2023-07-20 09:46:24 +02:00
|
|
|
SequencerToolSettings *tool_settings = static_cast<SequencerToolSettings *>(
|
|
|
|
|
MEM_callocN(sizeof(SequencerToolSettings), "Sequencer tool settings"));
|
2020-12-16 20:34:26 +01:00
|
|
|
tool_settings->fit_method = SEQ_SCALE_TO_FIT;
|
2021-07-01 11:02:30 +10:00
|
|
|
tool_settings->snap_mode = SEQ_SNAP_TO_STRIPS | SEQ_SNAP_TO_CURRENT_FRAME |
|
2024-11-06 05:43:34 +01:00
|
|
|
SEQ_SNAP_TO_STRIP_HOLD | SEQ_SNAP_TO_MARKERS | SEQ_SNAP_TO_RETIMING |
|
2024-07-06 15:24:52 +02:00
|
|
|
SEQ_SNAP_TO_PREVIEW_BORDERS | SEQ_SNAP_TO_PREVIEW_CENTER |
|
|
|
|
|
SEQ_SNAP_TO_STRIPS_PREVIEW;
|
2021-06-29 20:12:19 +02:00
|
|
|
tool_settings->snap_distance = 15;
|
2021-08-27 12:59:46 +02:00
|
|
|
tool_settings->overlap_mode = SEQ_OVERLAP_SHUFFLE;
|
2021-09-21 09:38:30 +02:00
|
|
|
tool_settings->pivot_point = V3D_AROUND_LOCAL_ORIGINS;
|
2021-08-27 12:59:46 +02:00
|
|
|
|
2020-12-16 20:34:26 +01:00
|
|
|
return tool_settings;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-25 15:02:31 +02:00
|
|
|
SequencerToolSettings *SEQ_tool_settings_ensure(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
SequencerToolSettings *tool_settings = scene->toolsettings->sequencer_tool_settings;
|
2023-07-20 09:46:24 +02:00
|
|
|
if (tool_settings == nullptr) {
|
2021-05-25 15:02:31 +02:00
|
|
|
scene->toolsettings->sequencer_tool_settings = SEQ_tool_settings_init();
|
|
|
|
|
tool_settings = scene->toolsettings->sequencer_tool_settings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return tool_settings;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-16 20:34:26 +01:00
|
|
|
void SEQ_tool_settings_free(SequencerToolSettings *tool_settings)
|
|
|
|
|
{
|
|
|
|
|
MEM_freeN(tool_settings);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
eSeqImageFitMethod SEQ_tool_settings_fit_method_get(Scene *scene)
|
|
|
|
|
{
|
2021-05-25 15:02:31 +02:00
|
|
|
const SequencerToolSettings *tool_settings = SEQ_tool_settings_ensure(scene);
|
2023-07-20 09:46:24 +02:00
|
|
|
return eSeqImageFitMethod(tool_settings->fit_method);
|
2020-12-16 20:34:26 +01:00
|
|
|
}
|
|
|
|
|
|
2021-06-29 20:12:19 +02:00
|
|
|
short SEQ_tool_settings_snap_mode_get(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
const SequencerToolSettings *tool_settings = SEQ_tool_settings_ensure(scene);
|
|
|
|
|
return tool_settings->snap_mode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
short SEQ_tool_settings_snap_flag_get(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
const SequencerToolSettings *tool_settings = SEQ_tool_settings_ensure(scene);
|
|
|
|
|
return tool_settings->snap_flag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int SEQ_tool_settings_snap_distance_get(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
const SequencerToolSettings *tool_settings = SEQ_tool_settings_ensure(scene);
|
|
|
|
|
return tool_settings->snap_distance;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-16 20:34:26 +01:00
|
|
|
void SEQ_tool_settings_fit_method_set(Scene *scene, eSeqImageFitMethod fit_method)
|
|
|
|
|
{
|
2021-05-25 15:02:31 +02:00
|
|
|
SequencerToolSettings *tool_settings = SEQ_tool_settings_ensure(scene);
|
2020-12-16 20:34:26 +01:00
|
|
|
tool_settings->fit_method = fit_method;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-27 12:59:46 +02:00
|
|
|
eSeqOverlapMode SEQ_tool_settings_overlap_mode_get(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
const SequencerToolSettings *tool_settings = SEQ_tool_settings_ensure(scene);
|
2023-07-20 09:46:24 +02:00
|
|
|
return eSeqOverlapMode(tool_settings->overlap_mode);
|
2021-08-27 12:59:46 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-21 09:38:30 +02:00
|
|
|
int SEQ_tool_settings_pivot_point_get(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
const SequencerToolSettings *tool_settings = SEQ_tool_settings_ensure(scene);
|
|
|
|
|
return tool_settings->pivot_point;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-17 02:11:22 +01:00
|
|
|
ListBase *SEQ_active_seqbase_get(const Editing *ed)
|
|
|
|
|
{
|
2023-07-20 09:46:24 +02:00
|
|
|
if (ed == nullptr) {
|
|
|
|
|
return nullptr;
|
2020-12-17 02:11:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ed->seqbasep;
|
|
|
|
|
}
|
2021-03-02 12:34:03 +01:00
|
|
|
|
|
|
|
|
void SEQ_seqbase_active_set(Editing *ed, ListBase *seqbase)
|
|
|
|
|
{
|
|
|
|
|
ed->seqbasep = seqbase;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-27 19:29:41 +02:00
|
|
|
static MetaStack *seq_meta_stack_alloc(const Scene *scene, Sequence *seq_meta)
|
2021-03-02 12:34:03 +01:00
|
|
|
{
|
2022-06-27 19:29:41 +02:00
|
|
|
Editing *ed = SEQ_editing_get(scene);
|
|
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
MetaStack *ms = static_cast<MetaStack *>(MEM_mallocN(sizeof(MetaStack), "metastack"));
|
2022-06-27 19:29:41 +02:00
|
|
|
BLI_addhead(&ed->metastack, ms);
|
2021-03-02 12:34:03 +01:00
|
|
|
ms->parseq = seq_meta;
|
2022-06-27 19:29:41 +02:00
|
|
|
|
|
|
|
|
/* Reference to previously displayed timeline data. */
|
|
|
|
|
Sequence *higher_level_meta = seq_sequence_lookup_meta_by_seq(scene, seq_meta);
|
|
|
|
|
ms->oldbasep = higher_level_meta ? &higher_level_meta->seqbase : &ed->seqbase;
|
|
|
|
|
ms->old_channels = higher_level_meta ? &higher_level_meta->channels : &ed->channels;
|
|
|
|
|
|
2022-06-29 12:45:59 +02:00
|
|
|
ms->disp_range[0] = SEQ_time_left_handle_frame_get(scene, ms->parseq);
|
|
|
|
|
ms->disp_range[1] = SEQ_time_right_handle_frame_get(scene, ms->parseq);
|
2021-03-02 12:34:03 +01:00
|
|
|
return ms;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MetaStack *SEQ_meta_stack_active_get(const Editing *ed)
|
|
|
|
|
{
|
2023-07-20 09:46:24 +02:00
|
|
|
if (ed == nullptr) {
|
|
|
|
|
return nullptr;
|
2021-12-20 02:15:23 +01:00
|
|
|
}
|
|
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
return static_cast<MetaStack *>(ed->metastack.last);
|
2021-03-02 12:34:03 +01:00
|
|
|
}
|
|
|
|
|
|
2022-09-02 20:30:23 +02:00
|
|
|
void SEQ_meta_stack_set(const Scene *scene, Sequence *dst_seq)
|
2022-06-27 19:29:41 +02:00
|
|
|
{
|
|
|
|
|
Editing *ed = SEQ_editing_get(scene);
|
|
|
|
|
/* Clear metastack */
|
|
|
|
|
BLI_freelistN(&ed->metastack);
|
|
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
if (dst_seq != nullptr) {
|
2022-06-27 19:29:41 +02:00
|
|
|
/* Allocate meta stack in a way, that represents meta hierarchy in timeline. */
|
2022-09-02 20:30:23 +02:00
|
|
|
seq_meta_stack_alloc(scene, dst_seq);
|
|
|
|
|
Sequence *meta_parent = dst_seq;
|
2022-06-28 10:13:06 +10:00
|
|
|
while ((meta_parent = seq_sequence_lookup_meta_by_seq(scene, meta_parent))) {
|
2022-06-27 19:29:41 +02:00
|
|
|
seq_meta_stack_alloc(scene, meta_parent);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-02 20:30:23 +02:00
|
|
|
SEQ_seqbase_active_set(ed, &dst_seq->seqbase);
|
|
|
|
|
SEQ_channels_displayed_set(ed, &dst_seq->channels);
|
2022-06-27 19:29:41 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Go to top level, exiting meta strip. */
|
|
|
|
|
SEQ_seqbase_active_set(ed, &ed->seqbase);
|
|
|
|
|
SEQ_channels_displayed_set(ed, &ed->channels);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sequence *SEQ_meta_stack_pop(Editing *ed)
|
|
|
|
|
{
|
|
|
|
|
MetaStack *ms = SEQ_meta_stack_active_get(ed);
|
|
|
|
|
Sequence *meta_parent = ms->parseq;
|
|
|
|
|
SEQ_seqbase_active_set(ed, ms->oldbasep);
|
|
|
|
|
SEQ_channels_displayed_set(ed, ms->old_channels);
|
|
|
|
|
BLI_remlink(&ed->metastack, ms);
|
|
|
|
|
MEM_freeN(ms);
|
|
|
|
|
return meta_parent;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-16 05:02:30 +01:00
|
|
|
/** \} */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-16 05:02:30 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
2020-11-16 16:48:41 +11:00
|
|
|
/** \name Duplicate Functions
|
2020-11-16 05:02:30 +01:00
|
|
|
* \{ */
|
2021-12-14 15:49:31 +11:00
|
|
|
|
2019-01-11 19:48:56 +01:00
|
|
|
static Sequence *seq_dupli(const Scene *scene_src,
|
|
|
|
|
Scene *scene_dst,
|
|
|
|
|
ListBase *new_seq_list,
|
|
|
|
|
Sequence *seq,
|
|
|
|
|
int dupe_flag,
|
2024-10-08 22:28:36 +02:00
|
|
|
const int flag,
|
|
|
|
|
blender::Map<Sequence *, Sequence *> &strip_map)
|
2010-06-24 10:04:18 +00:00
|
|
|
{
|
2023-07-20 09:46:24 +02:00
|
|
|
Sequence *seqn = static_cast<Sequence *>(MEM_dupallocN(seq));
|
2024-10-08 22:28:36 +02:00
|
|
|
strip_map.add(seq, seqn);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-07-30 11:58:18 +02:00
|
|
|
if ((flag & LIB_ID_CREATE_NO_MAIN) == 0) {
|
2024-01-22 13:47:13 +01:00
|
|
|
SEQ_relations_session_uid_generate(seqn);
|
2020-07-30 11:58:18 +02:00
|
|
|
}
|
|
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
seqn->strip = static_cast<Strip *>(MEM_dupallocN(seq->strip));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
seqn->stereo3d_format = static_cast<Stereo3dFormat *>(MEM_dupallocN(seq->stereo3d_format));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-08-08 11:15:36 +00:00
|
|
|
/* XXX: add F-Curve duplication stuff? */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-06-24 10:04:18 +00:00
|
|
|
if (seq->strip->crop) {
|
2023-07-20 09:46:24 +02:00
|
|
|
seqn->strip->crop = static_cast<StripCrop *>(MEM_dupallocN(seq->strip->crop));
|
2010-06-24 10:04:18 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-06-24 10:04:18 +00:00
|
|
|
if (seq->strip->transform) {
|
2023-07-20 09:46:24 +02:00
|
|
|
seqn->strip->transform = static_cast<StripTransform *>(MEM_dupallocN(seq->strip->transform));
|
2010-06-24 10:04:18 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-06-24 10:04:18 +00:00
|
|
|
if (seq->strip->proxy) {
|
2023-07-20 09:46:24 +02:00
|
|
|
seqn->strip->proxy = static_cast<StripProxy *>(MEM_dupallocN(seq->strip->proxy));
|
|
|
|
|
seqn->strip->proxy->anim = nullptr;
|
2010-06-24 10:04:18 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-04-02 21:05:12 +11:00
|
|
|
if (seq->prop) {
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
seqn->prop = IDP_CopyProperty_ex(seq->prop, flag);
|
2015-04-02 21:05:12 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-08-19 15:41:56 +00:00
|
|
|
if (seqn->modifiers.first) {
|
2014-02-08 06:07:10 +11:00
|
|
|
BLI_listbase_clear(&seqn->modifiers);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_modifier_list_copy(seqn, seq);
|
2012-08-19 15:41:56 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-08-22 14:54:42 +02:00
|
|
|
if (SEQ_is_strip_connected(seq)) {
|
|
|
|
|
BLI_listbase_clear(&seqn->connections);
|
|
|
|
|
SEQ_connections_duplicate(&seqn->connections, &seq->connections);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
2023-07-20 09:46:24 +02:00
|
|
|
seqn->strip->stripdata = nullptr;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-02-08 06:07:10 +11:00
|
|
|
BLI_listbase_clear(&seqn->seqbase);
|
2022-04-04 12:52:48 +02:00
|
|
|
BLI_listbase_clear(&seqn->channels);
|
|
|
|
|
SEQ_channels_duplicate(&seqn->channels, &seq->channels);
|
2012-03-24 06:18:31 +00:00
|
|
|
}
|
2012-06-07 15:49:02 +00:00
|
|
|
else if (seq->type == SEQ_TYPE_SCENE) {
|
2023-07-20 09:46:24 +02:00
|
|
|
seqn->strip->stripdata = nullptr;
|
2019-04-22 09:39:35 +10:00
|
|
|
if (seq->scene_sound) {
|
2017-08-10 13:00:01 +02:00
|
|
|
seqn->scene_sound = BKE_sound_scene_add_scene_sound_defaults(scene_dst, seqn);
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2012-03-24 06:18:31 +00:00
|
|
|
}
|
2013-07-24 07:11:00 +00:00
|
|
|
else if (seq->type == SEQ_TYPE_MOVIECLIP) {
|
|
|
|
|
/* avoid assert */
|
|
|
|
|
}
|
|
|
|
|
else if (seq->type == SEQ_TYPE_MASK) {
|
|
|
|
|
/* avoid assert */
|
|
|
|
|
}
|
2012-06-07 15:49:02 +00:00
|
|
|
else if (seq->type == SEQ_TYPE_MOVIE) {
|
2023-07-20 09:46:24 +02:00
|
|
|
seqn->strip->stripdata = static_cast<StripElem *>(MEM_dupallocN(seq->strip->stripdata));
|
2015-04-06 10:40:12 -03:00
|
|
|
BLI_listbase_clear(&seqn->anims);
|
2012-03-24 06:18:31 +00:00
|
|
|
}
|
2012-06-07 15:49:02 +00:00
|
|
|
else if (seq->type == SEQ_TYPE_SOUND_RAM) {
|
2023-07-20 09:46:24 +02:00
|
|
|
seqn->strip->stripdata = static_cast<StripElem *>(MEM_dupallocN(seq->strip->stripdata));
|
|
|
|
|
seqn->scene_sound = nullptr;
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
|
|
|
|
|
id_us_plus((ID *)seqn->sound);
|
|
|
|
|
}
|
2012-03-24 06:18:31 +00:00
|
|
|
}
|
2012-06-07 15:49:02 +00:00
|
|
|
else if (seq->type == SEQ_TYPE_IMAGE) {
|
2023-07-20 09:46:24 +02:00
|
|
|
seqn->strip->stripdata = static_cast<StripElem *>(MEM_dupallocN(seq->strip->stripdata));
|
2012-03-24 06:18:31 +00:00
|
|
|
}
|
2015-07-01 17:32:56 +02:00
|
|
|
else if (seq->type & SEQ_TYPE_EFFECT) {
|
2023-07-20 20:11:08 +10:00
|
|
|
SeqEffectHandle sh;
|
2020-12-19 05:57:27 +01:00
|
|
|
sh = SEQ_effect_handle_get(seq);
|
2019-04-22 09:39:35 +10:00
|
|
|
if (sh.copy) {
|
2020-07-16 02:24:37 +02:00
|
|
|
sh.copy(seqn, seq, flag);
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
seqn->strip->stripdata = nullptr;
|
2012-03-24 06:18:31 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2013-07-24 07:11:00 +00:00
|
|
|
/* sequence type not handled in duplicate! Expect a crash now... */
|
2021-03-24 12:38:08 +11:00
|
|
|
BLI_assert_unreachable();
|
2010-06-24 10:04:18 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-05-24 11:21:18 +10:00
|
|
|
/* When using #SEQ_DUPE_UNIQUE_NAME, it is mandatory to add new sequences in relevant container
|
2019-01-11 19:48:56 +01:00
|
|
|
* (scene or meta's one), *before* checking for unique names. Otherwise the meta's list is empty
|
2023-05-24 11:21:18 +10:00
|
|
|
* and hence we miss all sequence-strips in that meta that have already been duplicated,
|
|
|
|
|
* (see #55668). Note that unique name check itself could be done at a later step in calling
|
|
|
|
|
* code, once all sequence-strips have bee duplicated (that was first, simpler solution),
|
|
|
|
|
* but then handling of animation data will be broken (see #60194). */
|
2023-07-20 09:46:24 +02:00
|
|
|
if (new_seq_list != nullptr) {
|
2019-01-11 19:48:56 +01:00
|
|
|
BLI_addtail(new_seq_list, seqn);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-08-10 13:00:01 +02:00
|
|
|
if (scene_src == scene_dst) {
|
2017-08-10 12:56:32 +02:00
|
|
|
if (dupe_flag & SEQ_DUPE_UNIQUE_NAME) {
|
2021-06-16 00:29:17 +02:00
|
|
|
SEQ_sequence_base_unique_name_recursive(scene_dst, &scene_dst->ed->seqbase, seqn);
|
2017-08-10 12:56:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
VSE: Improve retiming UI
Currently retiming is quite awkward, when you need to retime multiple
strips strips in sync. It is possible to use meta strips, but this is
still not great. This is resolved by implementing selection.
General changes:
Gizmos are removed, since they are designed to operate only on active
strip and don't support selection.
Transform operator code is implemented for retiming data, which allows
more sophisticated manipulation.
Instead of drawing marker-like symbols, keyframes are drawn to
represent retiming data. Retiming handles are now called keys. To have
consistent names, DNA structures have been renamed.
Retiming data is drawn on strip as overlay.
UI changes:
Retiming tool is removed. To edit retiming data, press Ctrl + R, select
a key and move it. When retiming is edited, retiming menu and
context menu shows more relevant features, like making transitions.
Strip and retiming key selection can not be combined. It is possible to
use box select operator to select keys, if any key is selected.
Otherwise strips are selected.
Adding retiming keys is possible with I shortcut or from menu.
Retiming keys are always drawn at strip left and right boundary. These
keys do not really exist until they are selected. This is to simplify
retiming of strips that are resized. These keys are called "fake keys"
in code.
API changes:
Functions, properties and types related to retiming handles are renamed
to retiming keys:
retiming_handle_add() -> retiming_key_add()
retiming_handle_move() -> retiming_key_move()
retiming_handle_remove() -> retiming_key_remove()
retiming_handles -> retiming_keys
RetimingHandle -> RetimingKey
Retiming editing "mode" is activated by setting `Sequence.show_retiming_keys`.
Pull Request: https://projects.blender.org/blender/blender/pulls/109044
2023-09-27 01:45:59 +02:00
|
|
|
if (seq->retiming_keys != nullptr) {
|
|
|
|
|
seqn->retiming_keys = static_cast<SeqRetimingKey *>(MEM_dupallocN(seq->retiming_keys));
|
|
|
|
|
seqn->retiming_keys_num = seq->retiming_keys_num;
|
2023-06-14 04:47:53 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-24 10:04:18 +00:00
|
|
|
return seqn;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-11 19:48:56 +01:00
|
|
|
static Sequence *sequence_dupli_recursive_do(const Scene *scene_src,
|
|
|
|
|
Scene *scene_dst,
|
|
|
|
|
ListBase *new_seq_list,
|
|
|
|
|
Sequence *seq,
|
2024-10-08 22:28:36 +02:00
|
|
|
const int dupe_flag,
|
|
|
|
|
blender::Map<Sequence *, Sequence *> &strip_map)
|
2010-06-24 10:04:18 +00:00
|
|
|
{
|
2024-10-08 22:28:36 +02:00
|
|
|
Sequence *seqn = seq_dupli(scene_src, scene_dst, new_seq_list, seq, dupe_flag, 0, strip_map);
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
2023-08-04 08:51:13 +10:00
|
|
|
LISTBASE_FOREACH (Sequence *, s, &seq->seqbase) {
|
2024-10-08 22:28:36 +02:00
|
|
|
sequence_dupli_recursive_do(scene_src, scene_dst, &seqn->seqbase, s, dupe_flag, strip_map);
|
2010-06-24 10:04:18 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2019-01-11 19:48:56 +01:00
|
|
|
return seqn;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
Sequence *SEQ_sequence_dupli_recursive(
|
2019-01-11 19:48:56 +01:00
|
|
|
const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, Sequence *seq, int dupe_flag)
|
|
|
|
|
{
|
2024-10-08 22:28:36 +02:00
|
|
|
blender::Map<Sequence *, Sequence *> strip_map;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-10-08 22:28:36 +02:00
|
|
|
Sequence *seqn = sequence_dupli_recursive_do(
|
|
|
|
|
scene_src, scene_dst, new_seq_list, seq, dupe_flag, strip_map);
|
|
|
|
|
|
|
|
|
|
seq_new_fix_links_recursive(seqn, strip_map);
|
2024-08-22 14:54:42 +02:00
|
|
|
if (SEQ_is_strip_connected(seqn)) {
|
|
|
|
|
SEQ_cut_one_way_connections(seqn);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-06-24 10:04:18 +00:00
|
|
|
return seqn;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-10-08 22:28:36 +02:00
|
|
|
static void seqbase_dupli_recursive(const Scene *scene_src,
|
|
|
|
|
Scene *scene_dst,
|
|
|
|
|
ListBase *nseqbase,
|
|
|
|
|
const ListBase *seqbase,
|
|
|
|
|
int dupe_flag,
|
|
|
|
|
const int flag,
|
|
|
|
|
blender::Map<Sequence *, Sequence *> &strip_map)
|
|
|
|
|
{
|
|
|
|
|
LISTBASE_FOREACH (Sequence *, seq, seqbase) {
|
|
|
|
|
if ((seq->flag & SELECT) == 0 && (dupe_flag & SEQ_DUPE_ALL) == 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sequence *seqn = seq_dupli(scene_src, scene_dst, nseqbase, seq, dupe_flag, flag, strip_map);
|
|
|
|
|
BLI_assert(seqn != nullptr);
|
|
|
|
|
|
|
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
|
|
|
|
/* Always include meta all strip children. */
|
|
|
|
|
int dupe_flag_recursive = dupe_flag | SEQ_DUPE_ALL;
|
|
|
|
|
seqbase_dupli_recursive(scene_src,
|
|
|
|
|
scene_dst,
|
|
|
|
|
&seqn->seqbase,
|
|
|
|
|
&seq->seqbase,
|
|
|
|
|
dupe_flag_recursive,
|
|
|
|
|
flag,
|
|
|
|
|
strip_map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
void SEQ_sequence_base_dupli_recursive(const Scene *scene_src,
|
2017-08-10 15:06:53 +02:00
|
|
|
Scene *scene_dst,
|
|
|
|
|
ListBase *nseqbase,
|
|
|
|
|
const ListBase *seqbase,
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
int dupe_flag,
|
|
|
|
|
const int flag)
|
2010-06-24 10:04:18 +00:00
|
|
|
{
|
2024-10-08 22:28:36 +02:00
|
|
|
blender::Map<Sequence *, Sequence *> strip_map;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-10-08 22:28:36 +02:00
|
|
|
seqbase_dupli_recursive(scene_src, scene_dst, nseqbase, seqbase, dupe_flag, flag, strip_map);
|
2020-04-26 23:35:56 +02:00
|
|
|
|
2024-08-22 14:54:42 +02:00
|
|
|
/* Fix effect, modifier, and connected strip links. */
|
2023-08-04 08:51:13 +10:00
|
|
|
LISTBASE_FOREACH (Sequence *, seq, nseqbase) {
|
2024-10-08 22:28:36 +02:00
|
|
|
seq_new_fix_links_recursive(seq, strip_map);
|
2015-04-20 11:51:43 +02:00
|
|
|
}
|
2024-08-22 14:54:42 +02:00
|
|
|
/* One-way connections cannot be cut until after all connections are resolved. */
|
|
|
|
|
LISTBASE_FOREACH (Sequence *, seq, nseqbase) {
|
|
|
|
|
if (SEQ_is_strip_connected(seq)) {
|
|
|
|
|
SEQ_cut_one_way_connections(seq);
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-06-24 10:04:18 +00:00
|
|
|
}
|
2021-09-28 10:33:42 +02:00
|
|
|
|
2024-09-23 15:43:45 +02:00
|
|
|
bool SEQ_is_valid_strip_channel(const Sequence *seq)
|
2021-09-28 10:33:42 +02:00
|
|
|
{
|
2024-09-23 15:43:45 +02:00
|
|
|
return seq->machine >= 1 && seq->machine <= SEQ_MAX_CHANNELS;
|
2021-09-28 10:33:42 +02:00
|
|
|
}
|
|
|
|
|
|
2020-12-16 20:34:26 +01:00
|
|
|
SequencerToolSettings *SEQ_tool_settings_copy(SequencerToolSettings *tool_settings)
|
|
|
|
|
{
|
2023-07-20 09:46:24 +02:00
|
|
|
SequencerToolSettings *tool_settings_copy = static_cast<SequencerToolSettings *>(
|
|
|
|
|
MEM_dupallocN(tool_settings));
|
2020-12-16 20:34:26 +01:00
|
|
|
return tool_settings_copy;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-16 05:02:30 +01:00
|
|
|
/** \} */
|
2021-08-20 16:30:34 +02:00
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
static bool seq_set_strip_done_cb(Sequence *seq, void * /*userdata*/)
|
2021-08-20 16:30:34 +02:00
|
|
|
{
|
|
|
|
|
if (seq->strip) {
|
|
|
|
|
seq->strip->done = false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool seq_write_data_cb(Sequence *seq, void *userdata)
|
|
|
|
|
{
|
|
|
|
|
BlendWriter *writer = (BlendWriter *)userdata;
|
|
|
|
|
BLO_write_struct(writer, Sequence, seq);
|
|
|
|
|
if (seq->strip && seq->strip->done == 0) {
|
2021-08-26 12:27:14 +10:00
|
|
|
/* Write strip with 'done' at 0 because read-file. */
|
2021-08-20 16:30:34 +02:00
|
|
|
|
2021-08-26 12:27:14 +10:00
|
|
|
/* TODO this doesn't depend on the `Strip` data to be present? */
|
2021-08-20 16:30:34 +02:00
|
|
|
if (seq->effectdata) {
|
|
|
|
|
switch (seq->type) {
|
|
|
|
|
case SEQ_TYPE_COLOR:
|
|
|
|
|
BLO_write_struct(writer, SolidColorVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_SPEED:
|
|
|
|
|
BLO_write_struct(writer, SpeedControlVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_WIPE:
|
|
|
|
|
BLO_write_struct(writer, WipeVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_GLOW:
|
|
|
|
|
BLO_write_struct(writer, GlowVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_TRANSFORM:
|
|
|
|
|
BLO_write_struct(writer, TransformVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_GAUSSIAN_BLUR:
|
|
|
|
|
BLO_write_struct(writer, GaussianBlurVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_TEXT:
|
|
|
|
|
BLO_write_struct(writer, TextVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_COLORMIX:
|
|
|
|
|
BLO_write_struct(writer, ColorMixVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLO_write_struct(writer, Stereo3dFormat, seq->stereo3d_format);
|
|
|
|
|
|
|
|
|
|
Strip *strip = seq->strip;
|
|
|
|
|
BLO_write_struct(writer, Strip, strip);
|
|
|
|
|
if (strip->crop) {
|
|
|
|
|
BLO_write_struct(writer, StripCrop, strip->crop);
|
|
|
|
|
}
|
|
|
|
|
if (strip->transform) {
|
|
|
|
|
BLO_write_struct(writer, StripTransform, strip->transform);
|
|
|
|
|
}
|
|
|
|
|
if (strip->proxy) {
|
|
|
|
|
BLO_write_struct(writer, StripProxy, strip->proxy);
|
|
|
|
|
}
|
|
|
|
|
if (seq->type == SEQ_TYPE_IMAGE) {
|
|
|
|
|
BLO_write_struct_array(writer,
|
|
|
|
|
StripElem,
|
2023-06-03 08:36:28 +10:00
|
|
|
MEM_allocN_len(strip->stripdata) / sizeof(StripElem),
|
2021-08-20 16:30:34 +02:00
|
|
|
strip->stripdata);
|
|
|
|
|
}
|
2023-08-15 14:49:11 +02:00
|
|
|
else if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM)) {
|
2021-08-20 16:30:34 +02:00
|
|
|
BLO_write_struct(writer, StripElem, strip->stripdata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strip->done = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (seq->prop) {
|
|
|
|
|
IDP_BlendWrite(writer, seq->prop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SEQ_modifier_blend_write(writer, &seq->modifiers);
|
2022-04-04 12:52:48 +02:00
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (SeqTimelineChannel *, channel, &seq->channels) {
|
|
|
|
|
BLO_write_struct(writer, SeqTimelineChannel, channel);
|
|
|
|
|
}
|
2023-06-14 04:47:53 +02:00
|
|
|
|
2024-08-22 14:54:42 +02:00
|
|
|
LISTBASE_FOREACH (SeqConnection *, con, &seq->connections) {
|
|
|
|
|
BLO_write_struct(writer, SeqConnection, con);
|
|
|
|
|
}
|
|
|
|
|
|
VSE: Improve retiming UI
Currently retiming is quite awkward, when you need to retime multiple
strips strips in sync. It is possible to use meta strips, but this is
still not great. This is resolved by implementing selection.
General changes:
Gizmos are removed, since they are designed to operate only on active
strip and don't support selection.
Transform operator code is implemented for retiming data, which allows
more sophisticated manipulation.
Instead of drawing marker-like symbols, keyframes are drawn to
represent retiming data. Retiming handles are now called keys. To have
consistent names, DNA structures have been renamed.
Retiming data is drawn on strip as overlay.
UI changes:
Retiming tool is removed. To edit retiming data, press Ctrl + R, select
a key and move it. When retiming is edited, retiming menu and
context menu shows more relevant features, like making transitions.
Strip and retiming key selection can not be combined. It is possible to
use box select operator to select keys, if any key is selected.
Otherwise strips are selected.
Adding retiming keys is possible with I shortcut or from menu.
Retiming keys are always drawn at strip left and right boundary. These
keys do not really exist until they are selected. This is to simplify
retiming of strips that are resized. These keys are called "fake keys"
in code.
API changes:
Functions, properties and types related to retiming handles are renamed
to retiming keys:
retiming_handle_add() -> retiming_key_add()
retiming_handle_move() -> retiming_key_move()
retiming_handle_remove() -> retiming_key_remove()
retiming_handles -> retiming_keys
RetimingHandle -> RetimingKey
Retiming editing "mode" is activated by setting `Sequence.show_retiming_keys`.
Pull Request: https://projects.blender.org/blender/blender/pulls/109044
2023-09-27 01:45:59 +02:00
|
|
|
if (seq->retiming_keys != nullptr) {
|
|
|
|
|
int size = SEQ_retiming_keys_count(seq);
|
|
|
|
|
BLO_write_struct_array(writer, SeqRetimingKey, size, seq->retiming_keys);
|
2023-06-14 04:47:53 +02:00
|
|
|
}
|
|
|
|
|
|
2021-08-20 16:30:34 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SEQ_blend_write(BlendWriter *writer, ListBase *seqbase)
|
|
|
|
|
{
|
|
|
|
|
/* reset write flags */
|
2023-07-20 09:46:24 +02:00
|
|
|
SEQ_for_each_callback(seqbase, seq_set_strip_done_cb, nullptr);
|
2021-08-20 16:30:34 +02:00
|
|
|
|
|
|
|
|
SEQ_for_each_callback(seqbase, seq_write_data_cb, writer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool seq_read_data_cb(Sequence *seq, void *user_data)
|
|
|
|
|
{
|
|
|
|
|
BlendDataReader *reader = (BlendDataReader *)user_data;
|
|
|
|
|
|
2023-08-15 14:49:11 +02:00
|
|
|
/* Runtime data cleanup. */
|
|
|
|
|
seq->scene_sound = nullptr;
|
|
|
|
|
BLI_listbase_clear(&seq->anims);
|
|
|
|
|
|
2024-01-22 13:47:13 +01:00
|
|
|
/* Do as early as possible, so that other parts of reading can rely on valid session UID. */
|
|
|
|
|
SEQ_relations_session_uid_generate(seq);
|
2021-08-20 16:30:34 +02:00
|
|
|
|
2024-04-24 17:01:22 +02:00
|
|
|
BLO_read_struct(reader, Sequence, &seq->seq1);
|
|
|
|
|
BLO_read_struct(reader, Sequence, &seq->seq2);
|
2021-08-20 16:30:34 +02:00
|
|
|
|
2024-07-31 19:22:50 +02:00
|
|
|
if (seq->effectdata) {
|
|
|
|
|
switch (seq->type) {
|
|
|
|
|
case SEQ_TYPE_COLOR:
|
|
|
|
|
BLO_read_struct(reader, SolidColorVars, &seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_SPEED:
|
|
|
|
|
BLO_read_struct(reader, SpeedControlVars, &seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_WIPE:
|
|
|
|
|
BLO_read_struct(reader, WipeVars, &seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_GLOW:
|
|
|
|
|
BLO_read_struct(reader, GlowVars, &seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_TRANSFORM:
|
|
|
|
|
BLO_read_struct(reader, TransformVars, &seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_GAUSSIAN_BLUR:
|
|
|
|
|
BLO_read_struct(reader, GaussianBlurVars, &seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_TEXT:
|
|
|
|
|
BLO_read_struct(reader, TextVars, &seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_COLORMIX:
|
|
|
|
|
BLO_read_struct(reader, ColorMixVars, &seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
BLI_assert_unreachable();
|
|
|
|
|
seq->effectdata = nullptr;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-24 17:01:22 +02:00
|
|
|
BLO_read_struct(reader, Stereo3dFormat, &seq->stereo3d_format);
|
2021-08-20 16:30:34 +02:00
|
|
|
|
|
|
|
|
if (seq->type & SEQ_TYPE_EFFECT) {
|
|
|
|
|
seq->flag |= SEQ_EFFECT_NOT_LOADED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (seq->type == SEQ_TYPE_TEXT) {
|
2023-07-20 09:46:24 +02:00
|
|
|
TextVars *t = static_cast<TextVars *>(seq->effectdata);
|
2021-08-20 16:30:34 +02:00
|
|
|
t->text_blf_id = SEQ_FONT_NOT_LOADED;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-24 17:01:22 +02:00
|
|
|
BLO_read_struct(reader, IDProperty, &seq->prop);
|
2021-08-20 16:30:34 +02:00
|
|
|
IDP_BlendDataRead(reader, &seq->prop);
|
|
|
|
|
|
2024-04-24 17:01:22 +02:00
|
|
|
BLO_read_struct(reader, Strip, &seq->strip);
|
2021-08-20 16:30:34 +02:00
|
|
|
if (seq->strip && seq->strip->done == 0) {
|
|
|
|
|
seq->strip->done = true;
|
|
|
|
|
|
2023-08-15 14:49:11 +02:00
|
|
|
/* `SEQ_TYPE_SOUND_HD` case needs to be kept here, for backward compatibility. */
|
2021-08-20 16:30:34 +02:00
|
|
|
if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) {
|
2024-07-31 19:22:50 +02:00
|
|
|
/* FIXME In #SEQ_TYPE_IMAGE case, there is currently no available information about the
|
2024-08-04 13:45:06 +10:00
|
|
|
* length of the stored array of #StripElem.
|
2024-07-31 19:22:50 +02:00
|
|
|
*
|
|
|
|
|
* This is 'not a problem' because the reading code only checks that the loaded buffer is at
|
|
|
|
|
* least large enough for the requested data (here a single #StripElem item), and always
|
|
|
|
|
* assign the whole read memory (without any truncating). But relying on this behavior is
|
|
|
|
|
* weak and should be addressed. */
|
|
|
|
|
BLO_read_struct(reader, StripElem, &seq->strip->stripdata);
|
2021-08-20 16:30:34 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2023-07-20 09:46:24 +02:00
|
|
|
seq->strip->stripdata = nullptr;
|
2021-08-20 16:30:34 +02:00
|
|
|
}
|
2024-04-24 17:01:22 +02:00
|
|
|
BLO_read_struct(reader, StripCrop, &seq->strip->crop);
|
|
|
|
|
BLO_read_struct(reader, StripTransform, &seq->strip->transform);
|
|
|
|
|
BLO_read_struct(reader, StripProxy, &seq->strip->proxy);
|
2021-08-20 16:30:34 +02:00
|
|
|
if (seq->strip->proxy) {
|
2023-07-20 09:46:24 +02:00
|
|
|
seq->strip->proxy->anim = nullptr;
|
2021-08-20 16:30:34 +02:00
|
|
|
}
|
|
|
|
|
else if (seq->flag & SEQ_USE_PROXY) {
|
|
|
|
|
SEQ_proxy_set(seq, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* need to load color balance to it could be converted to modifier */
|
2024-04-24 17:01:22 +02:00
|
|
|
BLO_read_struct(reader, StripColorBalance, &seq->strip->color_balance);
|
2021-08-20 16:30:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SEQ_modifier_blend_read_data(reader, &seq->modifiers);
|
2022-04-04 12:52:48 +02:00
|
|
|
|
2024-08-22 14:54:42 +02:00
|
|
|
BLO_read_struct_list(reader, SeqConnection, &seq->connections);
|
|
|
|
|
LISTBASE_FOREACH (SeqConnection *, con, &seq->connections) {
|
|
|
|
|
if (con->seq_ref) {
|
|
|
|
|
BLO_read_struct(reader, Sequence, &con->seq_ref);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-24 17:01:22 +02:00
|
|
|
BLO_read_struct_list(reader, SeqTimelineChannel, &seq->channels);
|
2023-06-14 04:47:53 +02:00
|
|
|
|
VSE: Improve retiming UI
Currently retiming is quite awkward, when you need to retime multiple
strips strips in sync. It is possible to use meta strips, but this is
still not great. This is resolved by implementing selection.
General changes:
Gizmos are removed, since they are designed to operate only on active
strip and don't support selection.
Transform operator code is implemented for retiming data, which allows
more sophisticated manipulation.
Instead of drawing marker-like symbols, keyframes are drawn to
represent retiming data. Retiming handles are now called keys. To have
consistent names, DNA structures have been renamed.
Retiming data is drawn on strip as overlay.
UI changes:
Retiming tool is removed. To edit retiming data, press Ctrl + R, select
a key and move it. When retiming is edited, retiming menu and
context menu shows more relevant features, like making transitions.
Strip and retiming key selection can not be combined. It is possible to
use box select operator to select keys, if any key is selected.
Otherwise strips are selected.
Adding retiming keys is possible with I shortcut or from menu.
Retiming keys are always drawn at strip left and right boundary. These
keys do not really exist until they are selected. This is to simplify
retiming of strips that are resized. These keys are called "fake keys"
in code.
API changes:
Functions, properties and types related to retiming handles are renamed
to retiming keys:
retiming_handle_add() -> retiming_key_add()
retiming_handle_move() -> retiming_key_move()
retiming_handle_remove() -> retiming_key_remove()
retiming_handles -> retiming_keys
RetimingHandle -> RetimingKey
Retiming editing "mode" is activated by setting `Sequence.show_retiming_keys`.
Pull Request: https://projects.blender.org/blender/blender/pulls/109044
2023-09-27 01:45:59 +02:00
|
|
|
if (seq->retiming_keys != nullptr) {
|
2024-04-24 17:01:22 +02:00
|
|
|
const int size = SEQ_retiming_keys_count(seq);
|
|
|
|
|
BLO_read_struct_array(reader, SeqRetimingKey, size, &seq->retiming_keys);
|
2023-06-14 04:47:53 +02:00
|
|
|
}
|
|
|
|
|
|
2021-08-20 16:30:34 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
void SEQ_blend_read(BlendDataReader *reader, ListBase *seqbase)
|
|
|
|
|
{
|
|
|
|
|
SEQ_for_each_callback(seqbase, seq_read_data_cb, reader);
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-15 14:49:11 +02:00
|
|
|
static bool seq_doversion_250_sound_proxy_update_cb(Sequence *seq, void *user_data)
|
|
|
|
|
{
|
|
|
|
|
Main *bmain = static_cast<Main *>(user_data);
|
|
|
|
|
if (seq->type == SEQ_TYPE_SOUND_HD) {
|
|
|
|
|
char filepath_abs[FILE_MAX];
|
|
|
|
|
BLI_path_join(
|
|
|
|
|
filepath_abs, sizeof(filepath_abs), seq->strip->dirpath, seq->strip->stripdata->filename);
|
|
|
|
|
BLI_path_abs(filepath_abs, BKE_main_blendfile_path(bmain));
|
|
|
|
|
seq->sound = BKE_sound_new_file(bmain, filepath_abs);
|
|
|
|
|
seq->type = SEQ_TYPE_SOUND_RAM;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SEQ_doversion_250_sound_proxy_update(Main *bmain, Editing *ed)
|
|
|
|
|
{
|
|
|
|
|
SEQ_for_each_callback(&ed->seqbase, seq_doversion_250_sound_proxy_update_cb, bmain);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-20 16:30:34 +02:00
|
|
|
/* Depsgraph update functions. */
|
|
|
|
|
|
2023-12-17 17:02:17 +01:00
|
|
|
static bool seq_mute_sound_strips_cb(Sequence *seq, void *user_data)
|
2021-08-20 16:30:34 +02:00
|
|
|
{
|
|
|
|
|
Scene *scene = (Scene *)user_data;
|
2023-07-20 09:46:24 +02:00
|
|
|
if (seq->scene_sound != nullptr) {
|
2021-08-20 16:30:34 +02:00
|
|
|
BKE_sound_remove_scene_sound(scene, seq->scene_sound);
|
2023-07-20 09:46:24 +02:00
|
|
|
seq->scene_sound = nullptr;
|
2021-08-20 16:30:34 +02:00
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-17 17:02:17 +01:00
|
|
|
/* Adds sound of strip to the `scene->sound_scene` - "sound timeline". */
|
|
|
|
|
static void seq_update_mix_sounds(Scene *scene, Sequence *seq)
|
2021-08-20 16:30:34 +02:00
|
|
|
{
|
2023-07-20 09:46:24 +02:00
|
|
|
if (seq->scene_sound != nullptr) {
|
2023-12-17 17:02:17 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (seq->sound != nullptr) {
|
|
|
|
|
/* Adds `seq->sound->playback_handle` to `scene->sound_scene` */
|
|
|
|
|
seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq);
|
|
|
|
|
}
|
|
|
|
|
else if (seq->type == SEQ_TYPE_SCENE && seq->scene != nullptr) {
|
|
|
|
|
/* Adds `seq->scene->sound_scene` to `scene->sound_scene`. */
|
|
|
|
|
BKE_sound_ensure_scene(seq->scene);
|
|
|
|
|
seq->scene_sound = BKE_sound_scene_add_scene_sound_defaults(scene, seq);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void seq_update_sound_properties(const Scene *scene, const Sequence *seq)
|
|
|
|
|
{
|
2024-01-31 18:57:06 +01:00
|
|
|
const int frame = BKE_scene_frame_get(scene);
|
|
|
|
|
BKE_sound_set_scene_sound_volume_at_frame(
|
|
|
|
|
seq->scene_sound, frame, seq->volume, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0);
|
2023-12-17 17:02:17 +01:00
|
|
|
SEQ_retiming_sound_animation_data_set(scene, seq);
|
2024-01-31 18:57:06 +01:00
|
|
|
BKE_sound_set_scene_sound_pan_at_frame(
|
|
|
|
|
seq->scene_sound, frame, seq->pan, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0);
|
2023-12-17 17:02:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void seq_update_sound_modifiers(Sequence *seq)
|
|
|
|
|
{
|
|
|
|
|
void *sound_handle = seq->sound->playback_handle;
|
|
|
|
|
if (!BLI_listbase_is_empty(&seq->modifiers)) {
|
|
|
|
|
LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) {
|
|
|
|
|
sound_handle = SEQ_sound_modifier_recreator(seq, smd, sound_handle);
|
2021-08-20 16:30:34 +02:00
|
|
|
}
|
|
|
|
|
}
|
2023-12-17 17:02:17 +01:00
|
|
|
|
|
|
|
|
/* Assign modified sound back to `seq`. */
|
|
|
|
|
BKE_sound_update_sequence_handle(seq->scene_sound, sound_handle);
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-19 17:38:29 +01:00
|
|
|
static bool must_update_strip_sound(Scene *scene, Sequence *seq)
|
|
|
|
|
{
|
2024-02-19 15:54:08 +01:00
|
|
|
return (scene->id.recalc & (ID_RECALC_AUDIO | ID_RECALC_SYNC_TO_EVAL)) != 0 ||
|
|
|
|
|
(seq->sound->id.recalc & (ID_RECALC_AUDIO | ID_RECALC_SYNC_TO_EVAL)) != 0;
|
2023-12-19 17:38:29 +01:00
|
|
|
}
|
|
|
|
|
|
2023-12-17 17:02:17 +01:00
|
|
|
static void seq_update_sound_strips(Scene *scene, Sequence *seq)
|
|
|
|
|
{
|
2023-12-19 17:38:29 +01:00
|
|
|
if (seq->sound == nullptr || !must_update_strip_sound(scene, seq)) {
|
2023-12-17 17:02:17 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* Ensure strip is playing correct sound. */
|
|
|
|
|
BKE_sound_update_scene_sound(seq->scene_sound, seq->sound);
|
|
|
|
|
seq_update_sound_modifiers(seq);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void seq_update_scene_strip_sound(Sequence *seq)
|
|
|
|
|
{
|
|
|
|
|
if (seq->type != SEQ_TYPE_SCENE || seq->scene == nullptr) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set `seq->scene` volume.
|
2024-05-03 11:32:43 +10:00
|
|
|
* NOTE: Currently this doesn't work well, when this property is animated. Scene strip volume is
|
2023-12-17 17:02:17 +01:00
|
|
|
* also controlled by `seq_update_sound_properties()` via `seq->volume` which works if animated.
|
|
|
|
|
*
|
|
|
|
|
* Ideally, the entire `BKE_scene_update_sound()` will happen from a dependency graph, so
|
|
|
|
|
* then it is no longer needed to do such manual forced updates. */
|
|
|
|
|
BKE_sound_set_scene_volume(seq->scene, seq->scene->audio.volume);
|
|
|
|
|
|
|
|
|
|
/* Mute nested strips of scene when not using sequencer as input. */
|
2023-12-17 21:07:33 +01:00
|
|
|
if ((seq->flag & SEQ_SCENE_STRIPS) == 0 && seq->scene->sound_scene != nullptr &&
|
|
|
|
|
seq->scene->ed != nullptr)
|
|
|
|
|
{
|
2023-12-17 17:02:17 +01:00
|
|
|
SEQ_for_each_callback(&seq->scene->ed->seqbase, seq_mute_sound_strips_cb, seq->scene);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool seq_sound_update_cb(Sequence *seq, void *user_data)
|
|
|
|
|
{
|
|
|
|
|
Scene *scene = (Scene *)user_data;
|
|
|
|
|
|
|
|
|
|
seq_update_mix_sounds(scene, seq);
|
|
|
|
|
|
|
|
|
|
if (seq->scene_sound == nullptr) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
seq_update_sound_strips(scene, seq);
|
|
|
|
|
seq_update_scene_strip_sound(seq);
|
|
|
|
|
seq_update_sound_properties(scene, seq);
|
2021-08-20 16:30:34 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SEQ_eval_sequences(Depsgraph *depsgraph, Scene *scene, ListBase *seqbase)
|
|
|
|
|
{
|
|
|
|
|
DEG_debug_print_eval(depsgraph, __func__, scene->id.name, scene);
|
|
|
|
|
BKE_sound_ensure_scene(scene);
|
|
|
|
|
|
2023-12-17 17:02:17 +01:00
|
|
|
SEQ_for_each_callback(seqbase, seq_sound_update_cb, scene);
|
2021-08-20 16:30:34 +02:00
|
|
|
|
|
|
|
|
SEQ_edit_update_muting(scene->ed);
|
|
|
|
|
SEQ_sound_update_bounds_all(scene);
|
|
|
|
|
}
|