Blender V5.3
sequencer.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 * SPDX-FileCopyrightText: 2003-2009 Blender Authors
3 * SPDX-FileCopyrightText: 2005-2006 Peter Schlaile <peter [at] schlaile [dot] de>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later */
6
10
11#define DNA_DEPRECATED_ALLOW
12
13#include <cstddef>
14
15#include "MEM_guardedalloc.h"
16
17#include "DNA_listBase.h"
18#include "DNA_mask_types.h"
19#include "DNA_movieclip_types.h"
20#include "DNA_scene_types.h"
21#include "DNA_sequence_types.h"
22#include "DNA_sound_types.h"
23
24#include "BLI_assert.hh"
25#include "BLI_listbase.hh"
26#include "BLI_map.hh"
27#include "BLI_path_utils.hh"
28#include "BLI_string.hh"
29#include "BLI_string_utf8.hh"
30
31#include "BKE_duplilist.hh"
32#include "BKE_fcurve.hh"
33#include "BKE_idprop.hh"
34#include "BKE_layer.hh"
35#include "BKE_lib_id.hh"
36#include "BKE_lib_remap.hh"
37#include "BKE_main.hh"
38#include "BKE_scene.hh"
39#include "BKE_sound.hh"
40
41#include "DEG_depsgraph.hh"
43
44#include "MOV_read.hh"
45
46#include "SEQ_channels.hh"
47#include "SEQ_connect.hh"
48#include "SEQ_edit.hh"
49#include "SEQ_iterator.hh"
50#include "SEQ_modifier.hh"
51#include "SEQ_preview_cache.hh"
52#include "SEQ_proxy.hh"
53#include "SEQ_relations.hh"
54#include "SEQ_retiming.hh"
55#include "SEQ_sequencer.hh"
56#include "SEQ_sound.hh"
58#include "SEQ_transform.hh"
59#include "SEQ_utils.hh"
60
62
63#include "BLO_read_write.hh"
64
65#include "WM_api.hh"
66
71#include "effects/effects.hh"
72#include "modifiers/modifier.hh"
73#include "prefetch.hh"
74#include "sequencer.hh"
75
76#include "BKE_scene_runtime.hh"
77
78namespace blender {
79namespace seq {
80
81/* -------------------------------------------------------------------- */
84
86{
87 StripProxy *strip_proxy = MEM_new<StripProxy>("StripProxy");
88 strip_proxy->quality = 50;
89 return strip_proxy;
90}
91
93{
94 StripData *data = MEM_new<StripData>("strip");
95
96 if (type != STRIP_TYPE_SOUND) {
97 data->transform = MEM_new<StripTransform>("StripTransform");
98 data->transform->scale_x = 1;
99 data->transform->scale_y = 1;
100 data->transform->origin[0] = 0.5f;
101 data->transform->origin[1] = 0.5f;
102 data->transform->filter = SEQ_TRANSFORM_FILTER_AUTO;
103 data->crop = MEM_new<StripCrop>("StripCrop");
104 }
105 return data;
106}
107
109{
110 if (data->stripdata) {
111 MEM_delete(data->stripdata);
112 }
113
114 if (data->proxy) {
115 if (data->proxy->anim) {
116 MOV_close(data->proxy->anim);
117 }
118
119 MEM_delete(data->proxy);
120 }
121 if (data->crop) {
122 MEM_delete(data->crop);
123 }
124 if (data->transform) {
125 MEM_delete(data->transform);
126 }
127
128 MEM_delete(data);
129}
130
131Strip *strip_alloc(ListBaseT<Strip> *lb, int timeline_frame, int channel, StripType type)
132{
133 Strip *strip = MEM_new<Strip>("addseq");
134 strip->runtime = MEM_new<StripRuntime>(__func__);
136 BLI_addtail(lb, strip);
137
138 *(reinterpret_cast<short *>(strip->name)) = ID_SEQ;
139 strip->name[2] = 0;
140
141 strip->flag = SEQ_SELECT;
142 strip->start = timeline_frame;
143 strip->channel_set(channel);
144 strip->sat = 1.0;
145 strip->mul = 1.0;
146 strip->blend_opacity = 100.0;
147 strip->volume = 1.0f;
148 strip->type = type;
149 strip->media_playback_rate = 0.0f;
150 strip->speed_factor = 1.0f;
151 strip->strobe = 1.0f;
152
153 if (strip->type == STRIP_TYPE_ADJUSTMENT) {
154 strip->blend_mode = STRIP_BLEND_CROSS;
155 }
156 else {
157 strip->blend_mode = STRIP_BLEND_ALPHAOVER;
158 }
159
160 strip->data = strip_data_alloc(type);
161 strip->stereo3d_format = MEM_new<Stereo3dFormat>("Sequence Stereo Format");
162
163 strip->color_tag = STRIP_COLOR_NONE;
164
165 if (strip->type == STRIP_TYPE_META) {
166 channels_ensure(&strip->channels);
167 }
168
169 return strip;
170}
171
172/* only give option to skip cache locally (static func) */
173static void seq_strip_free_ex(Scene *scene,
174 Strip *strip,
175 const bool do_cache,
176 const bool do_id_user)
177{
178 if (strip->data) {
179 strip_data_free(strip->data);
180 strip->data = nullptr;
181 }
182
183 if (strip->is_effect()) {
185 if (sh.free) {
186 sh.free(strip, do_id_user);
187 }
188 }
189
190 if (strip->sound && do_id_user) {
191 id_us_min(id_cast<ID *>(strip->sound));
192 }
193
194 if (strip->clip && do_id_user) {
195 id_us_min(&strip->clip->id);
196 }
197
198 if (strip->mask && do_id_user) {
199 id_us_min(&strip->mask->id);
200 }
201
202 if (strip->stereo3d_format) {
203 MEM_delete(strip->stereo3d_format);
204 }
205
206 /* clipboard has no scene and will never have a sound handle or be active
207 * same goes to sequences copy for proxy rebuild job
208 */
209 if (scene) {
210 Editing *ed = scene->ed;
211
212 if (ed->act_strip == strip) {
213 ed->act_strip = nullptr;
214 }
215
216 if (strip->runtime->scene_sound && ELEM(strip->type, STRIP_TYPE_SOUND, STRIP_TYPE_SCENE)) {
217 BKE_sound_remove_scene_sound(scene, strip->runtime->scene_sound);
218 strip->runtime->scene_sound.reset();
219 }
220 }
221
222 if (strip->prop) {
223 IDP_FreeProperty_ex(strip->prop, do_id_user);
224 }
225 if (strip->system_properties) {
226 IDP_FreeProperty_ex(strip->system_properties, do_id_user);
227 }
228
229 /* free modifiers */
230 modifier_clear(strip);
231
232 if (is_strip_connected(strip)) {
233 disconnect(strip);
234 }
235
236 /* free cached data used by this strip,
237 * also invalidate cache for all dependent sequences
238 *
239 * be _very_ careful here, invalidating cache loops over the scene sequences and
240 * assumes the listbase is valid for all strips,
241 * this may not be the case if lists are being freed.
242 * this is optional SEQ_relations_invalidate_cache
243 */
244 if (do_cache) {
245 if (scene) {
246 relations_invalidate_cache_raw(scene, strip);
247 }
248 }
249 if (strip->type == STRIP_TYPE_META) {
250 channels_free(&strip->channels);
251 }
252
253 if (strip->retiming_keys != nullptr) {
254 MEM_delete(strip->retiming_keys);
255 strip->retiming_keys = nullptr;
256 strip->retiming_keys_num = 0;
257 }
258
259 MEM_SAFE_DELETE(strip->scene_view_layer_name);
260
261 MEM_SAFE_DELETE(strip->runtime);
262 MEM_delete(strip);
263}
264
265void strip_free(Scene *scene, Strip *strip)
266{
267 seq_strip_free_ex(scene, strip, true, true);
268}
269
270void seq_free_strip_recurse(Scene *scene, Strip *strip, const bool do_id_user)
271{
272 Strip *istrip_next;
273
274 for (Strip *istrip = strip->seqbase.first(); istrip; istrip = istrip_next) {
275 istrip_next = istrip->next;
276 seq_free_strip_recurse(scene, istrip, do_id_user);
277 }
278
279 seq_strip_free_ex(scene, strip, false, do_id_user);
280}
281
289
295
297{
298 if (scene_sound != nullptr) {
300 scene_sound.reset();
301 }
302}
303
305{
306 return scene ? scene->ed : nullptr;
307}
308
310{
311 if (scene->ed == nullptr) {
312 Editing *ed = scene->ed = MEM_new<Editing>("addseq");
314 ed->show_missing_media_flag = SEQ_EDIT_SHOW_MISSING_MEDIA;
315 channels_ensure(&ed->channels);
316 }
317
318 return scene->ed;
319}
320
321void editing_free(Scene *scene, const bool do_id_user)
322{
323 Editing *ed = scene->ed;
324
325 if (ed == nullptr) {
326 return;
327 }
328
329 seq_prefetch_free(scene);
330
331 /* handle cache freeing above */
332 for (Strip &strip : ed->seqbase.items_mutable()) {
333 seq_free_strip_recurse(scene, &strip, do_id_user);
334 }
335
336 ed->metastack.free_no_destruct();
338 media_presence_free(scene);
344 channels_free(&ed->channels);
345
346 MEM_delete(ed);
347
348 scene->ed = nullptr;
349}
350
352{
353 if (strip->is_effect()) {
354 strip->input1 = strip_map.lookup_default(strip->input1, strip->input1);
355 strip->input2 = strip_map.lookup_default(strip->input2, strip->input2);
356 }
357
358 for (StripModifierData &smd : strip->modifiers) {
359 smd.mask_strip = strip_map.lookup_default(smd.mask_strip, smd.mask_strip);
360 }
361
362 if (is_strip_connected(strip)) {
363 for (StripConnection &con : strip->connections) {
364 con.strip_ref = strip_map.lookup_default(con.strip_ref, con.strip_ref);
365 }
366 }
367
368 if (strip->type == STRIP_TYPE_META) {
369 for (Strip &strip_n : strip->seqbase) {
370 seq_new_fix_links_recursive(&strip_n, strip_map);
371 }
372 }
373}
374
376{
377 SequencerToolSettings *tool_settings = MEM_new<SequencerToolSettings>("Sequencer tool settings");
378 tool_settings->fit_method = SEQ_SCALE_TO_FIT;
384 tool_settings->snap_distance = 15;
385 tool_settings->overlap_mode = SEQ_OVERLAP_SHUFFLE;
388 tool_settings->pivot_point = V3D_AROUND_CENTER_MEDIAN;
389
390 return tool_settings;
391}
392
394{
396 if (tool_settings == nullptr) {
398 tool_settings = scene->toolsettings->sequencer_tool_settings;
399 }
400
401 return tool_settings;
402}
403
405{
406 MEM_delete(tool_settings);
407}
408
410{
411 const SequencerToolSettings *tool_settings = tool_settings_ensure(scene);
412 return eSeqImageFitMethod(tool_settings->fit_method);
413}
414
416{
417 const SequencerToolSettings *tool_settings = tool_settings_ensure(scene);
418 return tool_settings->snap_mode;
419}
420
422{
423 const SequencerToolSettings *tool_settings = tool_settings_ensure(scene);
424 return tool_settings->snap_flag;
425}
426
428{
429 const SequencerToolSettings *tool_settings = tool_settings_ensure(scene);
430 return tool_settings->snap_distance;
431}
432
434{
435 SequencerToolSettings *tool_settings = tool_settings_ensure(scene);
436 tool_settings->fit_method = fit_method;
437}
438
440{
441 SequencerToolSettings *tool_settings = tool_settings_ensure(scene);
442 tool_settings->overlap_mode = overlap_mode;
443}
444
446{
447 const SequencerToolSettings *tool_settings = tool_settings_ensure(scene);
448 return eSeqOverlapMode(tool_settings->overlap_mode);
449}
450
452{
453 const SequencerToolSettings *tool_settings = tool_settings_ensure(scene);
454 return eSeqRippleFlag(tool_settings->ripple_flag);
455}
456
458{
459 const SequencerToolSettings *tool_settings = tool_settings_ensure(scene);
460 return tool_settings->pivot_point;
461}
462
463ListBaseT<Strip> *active_seqbase_get(const Editing *ed)
464{
465 return ed ? ed->current_strips() : nullptr;
466}
467
468static MetaStack *seq_meta_stack_alloc(const Scene *scene, Strip *strip_meta)
469{
470 Editing *ed = editing_get(scene);
471
472 MetaStack *ms = MEM_new<MetaStack>("metastack");
473 BLI_addhead(&ed->metastack, ms);
474 ms->parent_strip = strip_meta;
475
476 /* Reference to previously displayed timeline data. */
477 ms->old_strip = lookup_meta_by_strip(ed, strip_meta);
478
479 ms->disp_range[0] = ms->parent_strip->left_handle();
480 ms->disp_range[1] = ms->parent_strip->right_handle(scene);
481 return ms;
482}
483
485{
486 if (ed == nullptr) {
487 return nullptr;
488 }
489
490 return ed->metastack.last();
491}
492
493void meta_stack_set(const Scene *scene, Strip *dst)
494{
495 Editing *ed = editing_get(scene);
496 /* Clear metastack */
497 ed->metastack.free_no_destruct();
498
499 if (dst != nullptr) {
500 /* Allocate meta stack in a way, that represents meta hierarchy in timeline. */
501 seq_meta_stack_alloc(scene, dst);
502 Strip *meta_parent = dst;
503 while ((meta_parent = lookup_meta_by_strip(ed, meta_parent))) {
504 seq_meta_stack_alloc(scene, meta_parent);
505 }
506
507 ed->current_meta_strip = dst;
508 }
509 else {
510 ed->current_meta_strip = nullptr;
511 }
512}
513
515{
517 Strip *meta_parent = ms->parent_strip;
518 ed->current_meta_strip = ms->old_strip;
519 BLI_remlink(&ed->metastack, ms);
520 MEM_delete(ms);
521 return meta_parent;
522}
523
525
526/* -------------------------------------------------------------------- */
529
534 /* Mapping from original strips to their duplicates, for fixing effect/modifier/connection links
535 * in `seq_duplicate_postprocess`. */
539
540 /* Sources of newly created datablocks when duplicating strips.
541 * Their duplicates are processed with `seq_duplicate_postprocess`. */
546};
547
549 Main *bmain, const Scene *scene_src, Scene *scene_dst, StripDuplicate dupe_flag, int copy_flag)
550{
552 ctx.bmain = bmain;
553 ctx.scene_src = scene_src;
554 ctx.scene_dst = scene_dst;
555 ctx.dupe_flag = dupe_flag;
556 ctx.copy_flag = copy_flag;
557
558 return ctx;
559}
560
562{
564
565 if (flag_is_set(ctx.dupe_flag, StripDuplicate::Data)) {
566 /* Remapping newids in Scenes will usually trigger a view_layers/collections resync after each
567 * scene. Besides performances considerations, this is also bad because it means some
568 * not-yet-remapped scenes will get their view-layer updated while still referencing old
569 * (source) collections, objects etc. This can e.g. lead to losing the active object in the
570 * duplicated scenes.
571 *
572 * So instead, prevent any resync until all new IDs have been remapped. */
574
575 /* Newly created data-blocks may reference IDs that themselves have also been duplicated in the
576 * "current duplication". E.g. a scene may have a custom property that refers to itself; when
577 * it is duplicated, we should ensure that these references are properly remapped.
578 *
579 * NOTE: Some of these IDs may be processed as part of dependencies when relinking another ID,
580 * so they may have already been remapped, and their `newid` pointer, reset to nullptr. */
581 for (Scene *scene_src : ctx.scenes) {
582 BLI_assert(scene_src);
583 if (scene_src->id.newid) {
584 BKE_libblock_relink_to_newid(ctx.bmain, scene_src->id.newid, remap_flag);
585 }
586 }
587 for (Object *scene_camera_src : ctx.scene_cameras) {
588 BLI_assert(scene_camera_src);
589 if (scene_camera_src->id.newid) {
590 BKE_libblock_relink_to_newid(ctx.bmain, scene_camera_src->id.newid, remap_flag);
591 }
592 }
593 for (MovieClip *movieclip_src : ctx.movieclips) {
594 BLI_assert(movieclip_src);
595 if (movieclip_src->id.newid) {
596 BKE_libblock_relink_to_newid(ctx.bmain, movieclip_src->id.newid, remap_flag);
597 }
598 }
599 for (Mask *mask_src : ctx.masks) {
600 BLI_assert(mask_src);
601 if (mask_src->id.newid) {
602 BKE_libblock_relink_to_newid(ctx.bmain, mask_src->id.newid, remap_flag);
603 }
604 }
605
607
608 if (ctx.bmain != nullptr) {
609#ifndef NDEBUG
610 /* Calls to `BKE_libblock_relink_to_newid` above are supposed to have cleared all these
611 * flags.
612 */
613 ID *id_iter;
614 FOREACH_MAIN_ID_BEGIN (ctx.bmain, id_iter) {
615 BLI_assert((id_iter->tag & ID_TAG_NEW) == 0);
616 }
618#endif
619
620 /* Clear temporary `newid` for potentially copied datablocks (scene, scene cameras, mask, and
621 * movieclip) to indicate that we have finished processing them. */
623
625 }
626 }
627 else {
628 BLI_assert(ctx.scenes.is_empty());
629 BLI_assert(ctx.scene_cameras.is_empty());
630 BLI_assert(ctx.movieclips.is_empty());
631 BLI_assert(ctx.masks.is_empty());
632 }
633
634 /* Fix effect, modifier, and connected strip links. */
635 for (Strip *strip_new : ctx.strip_map.values()) {
637 }
638
639 /* One-way connections must be cut after all connections are remapped above. */
640 for (Strip *strip_new : ctx.strip_map.values()) {
641 if (is_strip_connected(strip_new)) {
642 cut_one_way_connections(strip_new);
643 }
644 }
645}
646
648 ListBaseT<Strip> *seqbase_dst,
649 Strip *strip)
650{
651 Strip *strip_new = MEM_new<Strip>(__func__, *strip);
652 strip_new->scene_view_layer_name = BLI_strdup_null(strip->scene_view_layer_name);
653 strip_new->runtime = MEM_new<StripRuntime>(__func__);
654 strip_new->runtime->flag = strip->runtime->flag;
655
656 ctx.strip_map.add(strip, strip_new);
657
658 if ((ctx.copy_flag & LIB_ID_CREATE_NO_MAIN) == 0) {
660 }
661 else {
662 strip_new->runtime->session_uid = strip->runtime->session_uid;
663 }
664
665 strip_new->data = MEM_dupalloc(strip->data);
666
667 strip_new->stereo3d_format = MEM_dupalloc(strip->stereo3d_format);
668
669 /* XXX: add F-Curve duplication stuff? */
670
671 if (strip->data->crop) {
672 strip_new->data->crop = MEM_dupalloc(strip->data->crop);
673 }
674
675 if (strip->data->transform) {
676 strip_new->data->transform = MEM_dupalloc(strip->data->transform);
677 }
678
679 if (strip->data->proxy) {
680 strip_new->data->proxy = MEM_dupalloc(strip->data->proxy);
681 strip_new->data->proxy->anim = nullptr;
682 }
683
684 if (strip->prop) {
685 strip_new->prop = IDP_CopyProperty_ex(strip->prop, ctx.copy_flag);
686 }
687 if (strip->system_properties) {
688 strip_new->system_properties = IDP_CopyProperty_ex(strip->system_properties, ctx.copy_flag);
689 }
690
691 if (strip_new->modifiers.first_) {
692 strip_new->modifiers.clear_no_delete();
693
694 modifier_list_copy(strip_new, strip, ctx.copy_flag);
695 }
697
698 if (is_strip_connected(strip)) {
699 strip_new->connections.clear_no_delete();
700 connections_duplicate(&strip_new->connections, &strip->connections);
701 }
702
703 if (strip->type == STRIP_TYPE_META) {
704 strip_new->data->stripdata = nullptr;
705
706 strip_new->seqbase.clear_no_delete();
707 strip_new->channels.clear_no_delete();
708 channels_duplicate(&strip_new->channels, &strip->channels);
709 }
710 else if (strip->type == STRIP_TYPE_SCENE) {
711 if (flag_is_set(ctx.dupe_flag, StripDuplicate::Data) && strip_new->scene != nullptr) {
712 Scene *scene_old = strip_new->scene;
713 ctx.scenes.add(scene_old);
714
715 Object *scene_camera_old = strip_new->scene_camera;
716 if (scene_camera_old) {
717 ctx.scene_cameras.add(scene_camera_old);
718 }
719
720 strip_new->scene = BKE_scene_duplicate(ctx.bmain,
721 scene_old,
726
727 if (scene_camera_old && scene_camera_old->id.newid) {
728 strip_new->scene_camera = blender::id_cast<Object *>(scene_camera_old->id.newid);
729 }
730 }
731 strip_new->data->stripdata = nullptr;
732 if (strip->runtime->scene_sound) {
733 strip_new->runtime->scene_sound = BKE_sound_scene_add_scene_sound(ctx.scene_dst, strip_new);
734 }
735 }
736 else if (strip->type == STRIP_TYPE_MOVIECLIP) {
737 if (flag_is_set(ctx.dupe_flag, StripDuplicate::Data) && strip_new->clip != nullptr) {
738 MovieClip *clip_old = strip_new->clip;
739 ctx.movieclips.add(clip_old);
740 strip_new->clip = reinterpret_cast<MovieClip *>(BKE_id_copy_for_duplicate(
741 ctx.bmain, reinterpret_cast<ID *>(clip_old), USER_DUP_LINKED_ID, LIB_ID_COPY_DEFAULT));
742 }
743 if ((ctx.copy_flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
744 id_us_plus(&strip_new->clip->id);
745 }
746 }
747 else if (strip->type == STRIP_TYPE_MASK) {
748 if (flag_is_set(ctx.dupe_flag, StripDuplicate::Data) && strip_new->mask != nullptr) {
749 Mask *mask_old = strip_new->mask;
750 ctx.masks.add(mask_old);
751 strip_new->mask = reinterpret_cast<Mask *>(BKE_id_copy_for_duplicate(
752 ctx.bmain, reinterpret_cast<ID *>(mask_old), USER_DUP_LINKED_ID, LIB_ID_COPY_DEFAULT));
753 }
754 if ((ctx.copy_flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
755 id_us_plus(&strip_new->mask->id);
756 }
757 }
758 else if (strip->type == STRIP_TYPE_MOVIE) {
759 strip_new->data->stripdata = MEM_dupalloc(strip->data->stripdata);
760 }
761 else if (strip->type == STRIP_TYPE_SOUND) {
762 strip_new->data->stripdata = MEM_dupalloc(strip->data->stripdata);
763 strip_new->runtime->scene_sound = nullptr;
764 strip_new->runtime->sound_time_stretch = nullptr;
765 if ((ctx.copy_flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
766 id_us_plus(id_cast<ID *>(strip_new->sound));
767 }
768 }
769 else if (strip->type == STRIP_TYPE_IMAGE) {
770 strip_new->data->stripdata = MEM_dupalloc(strip->data->stripdata);
771 }
772 else if (strip->is_effect()) {
774 if (sh.copy) {
775 sh.copy(strip_new, strip, ctx.copy_flag);
776 }
777
778 strip_new->data->stripdata = nullptr;
779 }
780 else {
781 /* sequence type not handled in duplicate! Expect a crash now... */
783 }
784
785 /* When using StripDuplicate::UniqueName, it is mandatory to add new strips in relevant container
786 * (scene or meta's one), *before* checking for unique names. Otherwise the meta's list is empty
787 * and hence we miss all sequencer strips in that meta that have already been duplicated,
788 * (see #55668). Note that unique name check itself could be done at a later step in calling
789 * code, once all sequencer strips have been duplicated (that was first, simpler solution),
790 * but then handling of animation data will be broken (see #60194). */
791 if (seqbase_dst != nullptr) {
792 BLI_addtail(seqbase_dst, strip_new);
793 }
794
795 if (ctx.scene_src == ctx.scene_dst) {
796 if (flag_is_set(ctx.dupe_flag, StripDuplicate::UniqueName)) {
797 strip_unique_name_set(ctx.scene_dst, &ctx.scene_dst->ed->seqbase, strip_new);
798 }
799 }
800
801 if (strip->retiming_keys != nullptr) {
802 strip_new->retiming_keys = MEM_dupalloc(strip->retiming_keys);
803 strip_new->retiming_keys_num = strip->retiming_keys_num;
804 }
805
806 return strip_new;
807}
808
810 ListBaseT<Strip> *seqbase_dst,
811 Strip *strip)
812{
813 Strip *strip_new = strip_duplicate(ctx, seqbase_dst, strip);
814 if (strip->type == STRIP_TYPE_META) {
815 for (Strip &strip_child : strip->seqbase) {
816 strip_duplicate_recursive_impl(ctx, &strip_new->seqbase, &strip_child);
817 }
818 }
819 return strip_new;
820}
821
823 const Scene *scene_src,
824 Scene *scene_dst,
825 ListBaseT<Strip> *seqbase_dst,
826 Strip *strip,
827 const StripDuplicate dupe_flag)
828{
830 bmain, scene_src, scene_dst, dupe_flag, 0);
831
832 Strip *strip_new = strip_duplicate_recursive_impl(ctx, seqbase_dst, strip);
833
835
836 return strip_new;
837}
838
840 ListBaseT<Strip> *seqbase_dst,
841 const ListBaseT<Strip> *seqbase_src)
842{
843 for (Strip &strip : *seqbase_src) {
844 if ((strip.flag & SEQ_SELECT) == 0 && !flag_is_set(ctx.dupe_flag, StripDuplicate::All)) {
845 continue;
846 }
847
848 Strip *strip_new = strip_duplicate(ctx, seqbase_dst, &strip);
849 BLI_assert(strip_new != nullptr);
850
851 if (strip.type == STRIP_TYPE_META) {
852 const StripDuplicate dupe_flag_restore = ctx.dupe_flag;
853 /* Always duplicate all strip children inside a selected metastrip. */
855 seqbase_duplicate_recursive_impl(ctx, &strip_new->seqbase, &strip.seqbase);
856 ctx.dupe_flag = dupe_flag_restore;
857 }
858 }
859}
860
862 const Scene *scene_src,
863 Scene *scene_dst,
864 ListBaseT<Strip> *seqbase_dst,
865 const ListBaseT<Strip> *seqbase_src,
866 const StripDuplicate dupe_flag,
867 const int copy_flag)
868{
870 bmain, scene_src, scene_dst, dupe_flag, copy_flag);
871
872 seqbase_duplicate_recursive_impl(ctx, seqbase_dst, seqbase_src);
873
875}
876
878{
879 return strip->channel >= 1 && strip->channel <= MAX_CHANNELS;
880}
881
883{
885 MEM_dupalloc(tool_settings));
886 return tool_settings_copy;
887}
888
890
891static bool strip_write_data_cb(Strip *strip, void *userdata)
892{
893 BlendWriter *writer = static_cast<BlendWriter *>(userdata);
894 writer->write_struct(strip);
895 writer->write_string(strip->scene_view_layer_name);
896 if (strip->data) {
897 /* TODO this doesn't depend on the `Strip` data to be present? */
898 if (strip->effectdata) {
899 switch (strip->type) {
900 case STRIP_TYPE_COLOR:
901 writer->write_struct_cast<SolidColorVars>(strip->effectdata);
902 break;
903 case STRIP_TYPE_SPEED:
904 writer->write_struct_cast<SpeedControlVars>(strip->effectdata);
905 break;
906 case STRIP_TYPE_WIPE:
907 writer->write_struct_cast<WipeVars>(strip->effectdata);
908 break;
909 case STRIP_TYPE_GLOW:
910 writer->write_struct_cast<GlowVars>(strip->effectdata);
911 break;
913 writer->write_struct_cast<GaussianBlurVars>(strip->effectdata);
914 break;
915 case STRIP_TYPE_TEXT: {
916 TextVars *text = static_cast<TextVars *>(strip->effectdata);
917 if (!writer->is_undo()) {
918 /* Copy current text into legacy buffer. */
919 STRNCPY_UTF8(text->text_legacy, text->text_ptr);
920 }
921 writer->write_struct(text);
922 writer->write_string(text->text_ptr);
923 break;
924 }
926 writer->write_struct_cast<ColorMixVars>(strip->effectdata);
927 break;
929 CompositorEffectVars *comp = static_cast<CompositorEffectVars *>(strip->effectdata);
930 if (comp->system_properties) {
931 IDP_BlendWrite(writer, comp->system_properties);
932 }
933 writer->write_struct_cast<CompositorEffectVars>(strip->effectdata);
934 break;
935 }
936 default:
937 break;
938 }
939 }
940
941 writer->write_struct(strip->stereo3d_format);
942
943 StripData *data = strip->data;
944 writer->write_struct(data);
945 if (data->crop) {
946 writer->write_struct(data->crop);
947 }
948 if (data->transform) {
949 writer->write_struct(data->transform);
950 }
951 if (data->proxy) {
952 writer->write_struct(data->proxy);
953 }
954 if (strip->type == STRIP_TYPE_IMAGE) {
955 writer->write_struct_array(data->stripdata_num, data->stripdata);
956 }
957 else if (ELEM(strip->type, STRIP_TYPE_MOVIE, STRIP_TYPE_SOUND)) {
958 writer->write_struct(data->stripdata);
959 }
960 }
961
962 if (strip->prop) {
963 IDP_BlendWrite(writer, strip->prop);
964 }
965 if (strip->system_properties) {
966 IDP_BlendWrite(writer, strip->system_properties);
967 }
968
969 modifier_blend_write(writer, &strip->modifiers);
970
971 for (SeqTimelineChannel &channel : strip->channels) {
972 writer->write_struct(&channel);
973 }
974
975 for (StripConnection &con : strip->connections) {
976 writer->write_struct(&con);
977 }
978
979 if (strip->retiming_keys != nullptr) {
980 int size = retiming_keys_count(strip);
981 writer->write_struct_array(size, strip->retiming_keys);
982 }
983
984 return true;
985}
986
987void blend_write(BlendWriter *writer, ListBaseT<Strip> *seqbase)
988{
989 foreach_strip(seqbase, strip_write_data_cb, writer);
990}
991
992static bool strip_read_data_cb(Strip *strip, void *user_data)
993{
994 BlendDataReader *reader = static_cast<BlendDataReader *>(user_data);
995
996 strip->runtime = MEM_new<StripRuntime>(__func__);
997 /* Do as early as possible, so that other parts of reading can rely on valid session UID. */
999
1000 BLO_read_struct(reader, Strip, &strip->input1);
1001 BLO_read_struct(reader, Strip, &strip->input2);
1002 BLO_read_string(reader, &strip->scene_view_layer_name);
1003
1004 if (strip->effectdata) {
1005 switch (strip->type) {
1006 case STRIP_TYPE_COLOR:
1007 BLO_read_struct_nonnull(reader, SolidColorVars, &strip->effectdata);
1008 break;
1009 case STRIP_TYPE_SPEED: {
1010 if (BLO_read_struct_nonnull(reader, SpeedControlVars, &strip->effectdata)) {
1011 SpeedControlVars *speed = static_cast<SpeedControlVars *>(strip->effectdata);
1012 speed->frameMap = nullptr;
1013 }
1014 break;
1015 }
1016 case STRIP_TYPE_WIPE:
1017 BLO_read_struct_nonnull(reader, WipeVars, &strip->effectdata);
1018 break;
1019 case STRIP_TYPE_GLOW:
1020 BLO_read_struct_nonnull(reader, GlowVars, &strip->effectdata);
1021 break;
1023 BLO_read_struct_nonnull(reader, TransformVarsLegacy, &strip->effectdata);
1024 break;
1026 BLO_read_struct_nonnull(reader, GaussianBlurVars, &strip->effectdata);
1027 break;
1028 case STRIP_TYPE_TEXT: {
1029 if (BLO_read_struct_nonnull(reader, TextVars, &strip->effectdata)) {
1030 TextVars *text = static_cast<TextVars *>(strip->effectdata);
1031 BLO_read_string(reader, &text->text_ptr);
1032 text->text_len_bytes = text->text_ptr ? strlen(text->text_ptr) : 0;
1034 text->runtime = nullptr;
1035 }
1036 break;
1037 }
1039 BLO_read_struct_nonnull(reader, ColorMixVars, &strip->effectdata);
1040 break;
1041 case STRIP_TYPE_COMPOSITOR: {
1042 BLO_read_struct_nonnull(reader, CompositorEffectVars, &strip->effectdata);
1043 CompositorEffectVars *comp = static_cast<CompositorEffectVars *>(strip->effectdata);
1044 BLO_read_struct(reader, IDProperty, &comp->system_properties);
1045 IDP_BlendDataRead(reader, &comp->system_properties);
1046 break;
1047 }
1048 default:
1050 strip->effectdata = nullptr;
1051 break;
1052 }
1053 }
1054
1055 BLO_read_struct(reader, Stereo3dFormat, &strip->stereo3d_format);
1056
1057 BLO_read_struct(reader, IDProperty, &strip->prop);
1058 IDP_BlendDataRead(reader, &strip->prop);
1059 BLO_read_struct(reader, IDProperty, &strip->system_properties);
1060 IDP_BlendDataRead(reader, &strip->system_properties);
1061
1062 BLO_read_struct(reader, StripData, &strip->data);
1063 if (strip->data) {
1064 switch (strip->type) {
1065 case STRIP_TYPE_IMAGE: {
1066 /* Avoid using `strip->data->stripdata_num` since it is initialized by versioning code. */
1067 const int count = strip->data->stripdata_num == 0 ?
1068 strip->anim_startofs + strip->len + strip->anim_endofs :
1069 strip->data->stripdata_num;
1070 if (!BLO_read_array(reader, &strip->data->stripdata, count)) {
1071 strip->data->stripdata_num = 0;
1072 }
1073 break;
1074 }
1075 case STRIP_TYPE_MOVIE:
1076 case STRIP_TYPE_SOUND:
1077 case STRIP_TYPE_SOUND_HD: {
1078 /* `STRIP_TYPE_SOUND_HD` case needs to be kept here, for backward compatibility. */
1079 BLO_read_struct(reader, StripElem, &strip->data->stripdata);
1080 break;
1081 }
1082 default:
1083 strip->data->stripdata = nullptr;
1084 break;
1085 }
1086
1087 BLO_read_struct(reader, StripCrop, &strip->data->crop);
1088 BLO_read_struct(reader, StripTransform, &strip->data->transform);
1089 BLO_read_struct(reader, StripProxy, &strip->data->proxy);
1090 if (strip->data->proxy) {
1091 strip->data->proxy->anim = nullptr;
1092 }
1093 else if (strip->flag & SEQ_USE_PROXY) {
1094 proxy_set(strip, true);
1095 }
1096
1097 /* need to load color balance to it could be converted to modifier */
1098 BLO_read_struct(reader, StripColorBalance, &strip->data->color_balance_legacy);
1099 }
1100
1101 modifier_blend_read_data(reader, &strip->modifiers);
1102
1103 BLO_read_struct_list(reader, StripConnection, &strip->connections);
1104 for (StripConnection &con : strip->connections) {
1105 if (con.strip_ref) {
1106 BLO_read_struct(reader, Strip, &con.strip_ref);
1107 }
1108 }
1109
1110 BLO_read_struct_list(reader, SeqTimelineChannel, &strip->channels);
1111
1112 if (strip->retiming_keys != nullptr) {
1113 if (!BLO_read_array(reader, &strip->retiming_keys, retiming_keys_count(strip))) {
1114 strip->retiming_keys_num = 0;
1115 }
1116 }
1117
1118 return true;
1119}
1120void blend_read(BlendDataReader *reader, ListBaseT<Strip> *seqbase)
1121{
1122 foreach_strip(seqbase, strip_read_data_cb, reader);
1123}
1124
1125static bool strip_doversion_250_sound_proxy_update_cb(Strip *strip, void *user_data)
1126{
1127 Main *bmain = static_cast<Main *>(user_data);
1128 if (strip->type == STRIP_TYPE_SOUND_HD) {
1129 char filepath_abs[FILE_MAX];
1130 BLI_path_join(filepath_abs,
1131 sizeof(filepath_abs),
1132 strip->data->dirpath,
1133 strip->data->stripdata->filename);
1134 BLI_path_abs(filepath_abs, BKE_main_blendfile_path(bmain));
1135 strip->sound = BKE_sound_new_file(bmain, filepath_abs);
1136 strip->type = STRIP_TYPE_SOUND;
1137 }
1138 return true;
1139}
1140
1145
1146/* Depsgraph update functions. */
1147
1148static bool seq_mute_sound_strips_cb(Strip *strip, void *user_data)
1149{
1150 Scene *scene = static_cast<Scene *>(user_data);
1151 strip->runtime->remove_scene_sound(scene);
1152 strip->runtime->clear_sound_time_stretch();
1153 return true;
1154}
1155
1156/* Adds sound of strip to the `scene->sound_scene` - "sound timeline". */
1157static void strip_update_mix_sounds(Scene *scene, Strip *strip)
1158{
1159 if (strip->runtime->scene_sound != nullptr) {
1160 return;
1161 }
1162
1163 if (strip->sound != nullptr) {
1164 /* Adds `strip->sound->playback_handle` to `scene->sound_scene` */
1165 strip->runtime->scene_sound = BKE_sound_add_scene_sound(scene, strip);
1166 }
1167 else if (strip->type == STRIP_TYPE_SCENE && strip->scene != nullptr) {
1168 /* Adds `strip->scene->sound_scene` to `scene->sound_scene`. */
1169 BKE_sound_ensure_scene(strip->scene);
1170 strip->runtime->scene_sound = BKE_sound_scene_add_scene_sound(scene, strip);
1171 }
1172}
1173
1174static void strip_update_sound_properties(const Scene *scene, const Strip *strip)
1175{
1176 const Strip *meta = lookup_meta_by_strip(editing_get(scene), strip);
1177 float output_volume = strip->volume;
1178 if (meta != nullptr) {
1179 output_volume *= meta->volume;
1180 }
1181 const int frame = BKE_scene_frame_get(scene);
1182 BKE_sound_set_scene_sound_volume_at_frame(strip->runtime->scene_sound,
1183 frame,
1184 output_volume,
1185 (strip->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0);
1188 strip->runtime->scene_sound, frame, strip->pan, (strip->flag & SEQ_AUDIO_PAN_ANIMATED) != 0);
1189}
1190
1192{
1193 AUD_Sound sound_handle = BKE_sound_playback_handle_get(strip->sound);
1194 bool needs_update = false;
1195 int sound_modifiers_count = 0;
1196
1197 for (StripModifierData &smd : strip->modifiers) {
1198 sound_handle = sound_modifier_recreator(strip, &smd, sound_handle, needs_update);
1199 sound_modifiers_count++;
1200 }
1201
1202 /* Check if a modifier was removed. It is particularly needed when the last modifier is removed
1203 * and the `scene_sound` handle has to be updated but all the previous modifiers detect no change
1204 * and `needs_update` remains false. */
1205 if (strip->runtime->sound_modifiers_count != sound_modifiers_count) {
1206 needs_update = true;
1207 strip->runtime->sound_modifiers_count = sound_modifiers_count;
1208 }
1209
1210 if (needs_update) {
1211 /* Assign modified sound back to `strip`. */
1212 BKE_sound_update_sequence_handle(strip->runtime->scene_sound, sound_handle);
1213 }
1214}
1215
1216static bool must_update_strip_sound(Scene *scene, Strip *strip)
1217{
1218 return (scene->id.recalc & (ID_RECALC_AUDIO | ID_RECALC_SYNC_TO_EVAL)) != 0 ||
1219 (strip->sound->id.recalc & (ID_RECALC_AUDIO | ID_RECALC_SYNC_TO_EVAL)) != 0;
1220}
1221
1222static void seq_update_sound_strips(Scene *scene, Strip *strip)
1223{
1224 if (strip->sound == nullptr || !must_update_strip_sound(scene, strip)) {
1225 return;
1226 }
1227
1228 /* Ensure strip is playing correct sound. */
1229 if (strip->modifiers.is_empty()) {
1230 /* No modifiers: ensure we are playing the sound ID. However do not do this
1231 * if we are pitch correcting, as the proper playback handle will be assigned there.
1232 * Changing between original file sound and the pitch correction sound produces garbage
1233 * audio in renders. */
1234 if (strip->runtime->sound_time_stretch == nullptr) {
1235 BKE_sound_update_scene_sound(strip->runtime->scene_sound, strip->sound);
1236 }
1237 }
1238 else {
1239 /* Use Playback handle from sound ID as input for modifier stack. */
1241 }
1242}
1243
1244static bool scene_sequencer_is_used(const Scene *scene, ListBaseT<Strip> *seqbase)
1245{
1246 bool sequencer_is_used = false;
1247 for (Strip &strip_iter : *seqbase) {
1248 if (strip_iter.scene == scene && (strip_iter.flag & SEQ_SCENE_STRIPS) != 0) {
1249 sequencer_is_used = true;
1250 }
1251 if (strip_iter.type == STRIP_TYPE_META) {
1252 sequencer_is_used |= scene_sequencer_is_used(scene, &strip_iter.seqbase);
1253 }
1254 }
1255
1256 return sequencer_is_used;
1257}
1258
1259static void seq_update_scene_strip_sound(const Scene *scene, Strip *strip)
1260{
1261 if (strip->type != STRIP_TYPE_SCENE || strip->scene == nullptr) {
1262 return;
1263 }
1264
1265 /* Set `strip->scene` volume.
1266 * NOTE: Currently this doesn't work well, when this property is animated. Scene strip volume is
1267 * also controlled by `strip_update_sound_properties()` via `strip->volume` which works if
1268 * animated.
1269 *
1270 * Ideally, the entire `BKE_scene_update_sound()` will happen from a dependency graph, so
1271 * then it is no longer needed to do such manual forced updates. */
1272 BKE_sound_set_scene_volume(strip->scene, strip->scene->audio.volume);
1273
1274 /* Mute sound when all scene strips using particular scene are not rendering sequencer strips. */
1275 bool sequencer_is_used = scene_sequencer_is_used(strip->scene, &scene->ed->seqbase);
1276
1277 if (!sequencer_is_used && strip->scene->runtime->audio.sound_scene != nullptr &&
1278 strip->scene->ed != nullptr)
1279 {
1280 foreach_strip(&strip->scene->ed->seqbase, seq_mute_sound_strips_cb, strip->scene);
1281 }
1282}
1283
1284static bool strip_sound_update_cb(Strip *strip, void *user_data)
1285{
1286 Scene *scene = static_cast<Scene *>(user_data);
1287
1288 strip_update_mix_sounds(scene, strip);
1289
1290 if (strip->runtime->scene_sound == nullptr) {
1291 return true;
1292 }
1293
1294 seq_update_sound_strips(scene, strip);
1295 seq_update_scene_strip_sound(scene, strip);
1296 strip_update_sound_properties(scene, strip);
1297 return true;
1298}
1299
1300void eval_strips(Depsgraph *depsgraph, Scene *scene, ListBaseT<Strip> *seqbase)
1301{
1302 DEG_debug_print_eval(depsgraph, __func__, scene->id.name, scene);
1303
1304 /* Note: sequencer caches are stored on the original scene, not the evaluated copy. */
1306
1308
1309 foreach_strip(seqbase, strip_sound_update_cb, scene);
1310
1311 edit_update_muting(scene->ed);
1313}
1314
1316
1322
1324{
1325 if (this->compositor_cache == nullptr) {
1326 this->compositor_cache = MEM_new<CompositorCache>(__func__);
1327 }
1328 return *this->compositor_cache;
1329}
1330
1331} // namespace seq
1332
1333Editing::Editing()
1334{
1335 this->runtime = MEM_new<seq::EditingRuntime>(__func__);
1336}
1337
1338Editing::~Editing()
1339{
1340 MEM_delete(this->runtime);
1341}
1342
1343ListBaseT<Strip> *Editing::current_strips()
1344{
1345 if (this->current_meta_strip) {
1346 return &this->current_meta_strip->seqbase;
1347 }
1348 return &this->seqbase;
1349}
1350
1351ListBaseT<Strip> *Editing::current_strips() const
1352{
1353 if (this->current_meta_strip) {
1354 return &this->current_meta_strip->seqbase;
1355 }
1356 /* NOTE: Const correctness is non-existent with ListBaseT anyway. */
1357 return &const_cast<ListBaseT<Strip> &>(this->seqbase);
1358}
1359
1360ListBaseT<SeqTimelineChannel> *Editing::current_channels()
1361{
1362 if (this->current_meta_strip) {
1363 return &this->current_meta_strip->channels;
1364 }
1365 return &this->channels;
1366}
1367
1368ListBaseT<SeqTimelineChannel> *Editing::current_channels() const
1369{
1370 if (this->current_meta_strip) {
1371 return &this->current_meta_strip->channels;
1372 }
1373 /* NOTE: Const correctness is non-existent with ListBaseT anyway. */
1374 return &const_cast<ListBaseT<SeqTimelineChannel> &>(this->channels);
1375}
1376
1377std::optional<int> Editing::edit_point() const
1378{
1379 return this->runtime->edit_point;
1380}
1381
1382void Editing::edit_point_set(Scene *scene, const std::optional<int> frame)
1383{
1384 if (this->runtime->edit_point == frame) {
1385 return;
1386 }
1387 this->runtime->edit_point = frame;
1389}
1390
1391bool Strip::is_effect() const
1392{
1394}
1395
1396int Strip::effect_num_inputs_get() const
1397{
1398 /* Compositor can have varying amount of inputs; return based on assigned inputs. */
1399 if (this->type == STRIP_TYPE_COMPOSITOR) {
1400 return this->input1 && this->input2 ? 2 : this->input1 ? 1 : 0;
1401 }
1403}
1404
1405bool StripModifierData::is_type_sound() const
1406{
1407 return ELEM(
1409}
1410
1411} // namespace blender
#define IDP_BlendDataRead(reader, prop)
#define FOREACH_MAIN_ID_END
Definition BKE_main.hh:735
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
Definition BKE_main.hh:729
std::shared_ptr< void > AUD_Sound
#define FILE_MAX
#define BLI_path_join(...)
#define STRNCPY_UTF8(dst, src)
#define BLO_read_struct_nonnull(reader, struct_name, ptr_p)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define ID_SEQ
These structs are the foundation for all linked lists in the library system.
#define STRIP_FONT_NOT_LOADED
Read Blender memory allocation and freeing.
#define ND_SEQUENCER
Definition WM_types.hh:456
#define NC_SCENE
Definition WM_types.hh:391
#define BLI_assert_unreachable()
#define ELEM(...)
Value lookup_default(const Key &key, const Value &default_value) const
Definition BLI_map.hh:570
const T & data(const Action &owning_action) const
void modifier_list_copy(Strip *strip_new, Strip *strip, const int flag)
static void seq_update_sound_strips(Scene *scene, Strip *strip)
Strip * lookup_meta_by_strip(Editing *ed, const Strip *key)
SequencerToolSettings * tool_settings_init()
Definition sequencer.cc:375
static bool scene_sequencer_is_used(const Scene *scene, ListBaseT< Strip > *seqbase)
void eval_strips(Depsgraph *depsgraph, Scene *scene, ListBaseT< Strip > *seqbase)
static void seqbase_duplicate_recursive_impl(StripDuplicateContext &ctx, ListBaseT< Strip > *seqbase_dst, const ListBaseT< Strip > *seqbase_src)
Definition sequencer.cc:839
bool disconnect(Strip *strip)
EffectHandle strip_effect_handle_get(Strip *strip)
Definition effects.cc:284
void seqbase_duplicate_recursive(Main *bmain, const Scene *scene_src, Scene *scene_dst, ListBaseT< Strip > *seqbase_dst, const ListBaseT< Strip > *seqbase_src, const StripDuplicate dupe_flag, const int copy_flag)
Definition sequencer.cc:861
void channels_ensure(ListBaseT< SeqTimelineChannel > *channels)
Definition channels.cc:31
void channels_free(ListBaseT< SeqTimelineChannel > *channels)
Definition channels.cc:52
void sound_update_bounds_all(Scene *scene)
static void strip_update_mix_sounds(Scene *scene, Strip *strip)
eSeqImageFitMethod tool_settings_fit_method_get(Scene *scene)
Definition sequencer.cc:409
int retiming_keys_count(const Strip *strip)
ListBaseT< Strip > * active_seqbase_get(const Editing *ed)
Definition sequencer.cc:463
void foreach_strip(ListBaseT< Strip > *seqbase, ForEachFunc callback, void *user_data)
Definition iterator.cc:60
void strip_unique_name_set(Scene *scene, ListBaseT< Strip > *seqbasep, Strip *strip)
static void seq_update_scene_strip_sound(const Scene *scene, Strip *strip)
void doversion_250_sound_proxy_update(Main *bmain, Editing *ed)
void media_presence_free(Scene *scene)
SequencerToolSettings * tool_settings_copy(SequencerToolSettings *tool_settings)
Definition sequencer.cc:882
static bool must_update_strip_sound(Scene *scene, Strip *strip)
void connections_duplicate(ListBaseT< StripConnection > *connections_dst, ListBaseT< StripConnection > *connections_src)
void tool_settings_free(SequencerToolSettings *tool_settings)
Definition sequencer.cc:404
Editing * editing_get(const Scene *scene)
Definition sequencer.cc:304
void meta_stack_set(const Scene *scene, Strip *dst)
Definition sequencer.cc:493
StripProxy * seq_strip_proxy_alloc()
Definition sequencer.cc:85
void seq_prefetch_free(Scene *scene)
Definition prefetch.cc:412
static bool strip_sound_update_cb(Strip *strip, void *user_data)
static void seq_duplicate_postprocess(StripDuplicateContext &ctx)
Definition sequencer.cc:561
void seq_free_strip_recurse(Scene *scene, Strip *strip, const bool do_id_user)
Definition sequencer.cc:270
static void strip_update_sound_modifiers(Strip *strip)
void relations_invalidate_temporary_animation_frame(Scene *scene)
void relations_invalidate_cache_raw(Scene *scene, Strip *strip)
void strip_free(Scene *scene, Strip *strip)
Definition sequencer.cc:265
void cut_one_way_connections(Strip *strip)
static void seq_strip_free_ex(Scene *scene, Strip *strip, const bool do_cache, const bool do_id_user)
Definition sequencer.cc:173
AUD_Sound sound_modifier_recreator(Strip *strip, StripModifierData *smd, AUD_Sound sound, bool &needs_update)
MetaStack * meta_stack_active_get(const Editing *ed)
Definition sequencer.cc:484
Editing * editing_ensure(Scene *scene)
Definition sequencer.cc:309
void proxy_set(Strip *strip, bool value)
Definition proxy.cc:771
static bool seq_mute_sound_strips_cb(Strip *strip, void *user_data)
static MetaStack * seq_meta_stack_alloc(const Scene *scene, Strip *strip_meta)
Definition sequencer.cc:468
static bool strip_doversion_250_sound_proxy_update_cb(Strip *strip, void *user_data)
void final_image_cache_destroy(Scene *scene)
void editing_free(Scene *scene, const bool do_id_user)
Definition sequencer.cc:321
constexpr int MAX_CHANNELS
static void strip_update_sound_properties(const Scene *scene, const Strip *strip)
static bool strip_write_data_cb(Strip *strip, void *userdata)
Definition sequencer.cc:891
static void seq_new_fix_links_recursive(Strip *strip, Map< Strip *, Strip * > strip_map)
Definition sequencer.cc:351
bool is_strip_connected(const Strip *strip)
void blend_read(BlendDataReader *reader, ListBaseT< Strip > *seqbase)
void preview_cache_destroy(Scene *scene)
bool modifier_persistent_uids_are_valid(const Strip &strip)
int tool_settings_pivot_point_get(Scene *scene)
Definition sequencer.cc:457
Strip * strip_alloc(ListBaseT< Strip > *lb, int timeline_frame, int channel, StripType type)
Definition sequencer.cc:131
void edit_update_muting(Editing *ed)
void retiming_sound_animation_data_set(const Scene *scene, const Strip *strip)
static StripDuplicateContext strip_duplicate_context_get(Main *bmain, const Scene *scene_src, Scene *scene_dst, StripDuplicate dupe_flag, int copy_flag)
Definition sequencer.cc:548
void tool_settings_fit_method_set(Scene *scene, eSeqImageFitMethod fit_method)
Definition sequencer.cc:433
void channels_duplicate(ListBaseT< SeqTimelineChannel > *channels_dst, ListBaseT< SeqTimelineChannel > *channels_src)
Definition channels.cc:42
MovieReaderCache * movie_reader_cache_create()
bool is_valid_strip_channel(const Strip *strip)
Definition sequencer.cc:877
short tool_settings_snap_flag_get(Scene *scene)
Definition sequencer.cc:421
SequencerToolSettings * tool_settings_ensure(Scene *scene)
Definition sequencer.cc:393
static bool strip_read_data_cb(Strip *strip, void *user_data)
Definition sequencer.cc:992
static StripData * strip_data_alloc(StripType type)
Definition sequencer.cc:92
int tool_settings_snap_distance_get(Scene *scene)
Definition sequencer.cc:427
Strip * strip_duplicate_recursive(Main *bmain, const Scene *scene_src, Scene *scene_dst, ListBaseT< Strip > *seqbase_dst, Strip *strip, const StripDuplicate dupe_flag)
Definition sequencer.cc:822
void intra_frame_cache_destroy(Scene *scene)
static Strip * strip_duplicate_recursive_impl(StripDuplicateContext &ctx, ListBaseT< Strip > *seqbase_dst, Strip *strip)
Definition sequencer.cc:809
void source_image_cache_destroy(Scene *scene)
void relations_session_uid_generate(Strip *strip)
void modifier_blend_read_data(BlendDataReader *reader, ListBaseT< StripModifierData > *lb)
eSeqRippleFlag tool_settings_ripple_flag_get(Scene *scene)
Definition sequencer.cc:451
static void strip_data_free(StripData *data)
Definition sequencer.cc:108
int effect_type_get_min_num_inputs(StripType type)
Definition effects.cc:347
short tool_settings_snap_mode_get(Scene *scene)
Definition sequencer.cc:415
void modifier_blend_write(BlendWriter *writer, ListBaseT< StripModifierData > *modbase)
Strip * meta_stack_pop(Editing *ed)
Definition sequencer.cc:514
void blend_write(BlendWriter *writer, ListBaseT< Strip > *seqbase)
Definition sequencer.cc:987
void strip_lookup_free(Editing *ed)
void tool_settings_overlap_mode_set(Scene *scene, eSeqOverlapMode overlap_mode)
Definition sequencer.cc:439
static Strip * strip_duplicate(StripDuplicateContext &ctx, ListBaseT< Strip > *seqbase_dst, Strip *strip)
Definition sequencer.cc:647
void thumbnail_cache_destroy(Scene *scene)
eSeqOverlapMode tool_settings_overlap_mode_get(Scene *scene)
Definition sequencer.cc:445
bool strip_type_is_effect(StripType type)
Definition effects.cc:374
void movie_reader_cache_destroy(MovieReaderCache *cache)
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
UserDef U
Definition blender.cc:58
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void IDP_FreeProperty_ex(IDProperty *prop, bool do_id_user)
Definition idprop.cc:1398
AUD_Sound BKE_sound_playback_handle_get(const bSound *sound)
void BKE_sound_ensure_scene(Scene *scene)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
void BKE_libblock_relink_to_newid(Main *bmain, ID *id, int remap_flag) ATTR_NONNULL()
Definition lib_remap.cc:932
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:98
void id_us_plus(ID *id)
Definition lib_id.cc:433
void MOV_close(MovieReader *anim)
Definition movie_read.cc:70
void IDP_BlendWrite(BlendWriter *writer, const IDProperty *prop)
Definition idprop.cc:1696
@ V3D_AROUND_CENTER_MEDIAN
void DEG_debug_print_eval(Depsgraph *depsgraph, const char *function_name, const char *object_name, const void *object_address)
@ SCE_COPY_FULL
Definition BKE_scene.hh:39
ID * BKE_id_copy_for_duplicate(Main *bmain, ID *id, eDupli_ID_Flags duplicate_flags, int copy_flags)
Definition lib_id.cc:861
@ ID_REMAP_SKIP_USER_CLEAR
@ ID_REMAP_FORCE_OBDATA_IN_EDITMODE
AUD_SequenceEntry BKE_sound_add_scene_sound(Scene *scene, Strip *strip)
@ LIB_ID_CREATE_NO_USER_REFCOUNT
@ LIB_ID_COPY_DEFAULT
@ LIB_ID_CREATE_NO_MAIN
@ STRIP_TYPE_TRANSFORM_LEGACY
void BKE_layer_collection_resync_forbid(Main &bmain)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
Definition main.cc:1058
@ LIB_ID_DUPLICATE_IS_SUBPROCESS
@ LIB_ID_DUPLICATE_IS_ROOT_ID
void BKE_layer_collection_resync_allow(Main &bmain)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:138
float BKE_scene_frame_get(const Scene *scene)
Definition scene.cc:2595
BMesh const char void * data
void BKE_sound_set_scene_volume(Scene *scene, float volume)
bSound * BKE_sound_new_file(Main *bmain, const char *filepath, short stream_index=0)
@ SEQ_AUDIO_VOLUME_ANIMATED
bool BLO_read_array(BlendDataReader *reader, T **ptr_p, const SizeT array_size, const int elems=1)
@ SEQ_RIPPLE_CLEAR_RANGES
@ SEQ_RIPPLE_ALL_CHANNELS
@ SEQ_SNAP_TO_ALL_CHANNEL_STRIPS
void BKE_main_id_newptr_and_tag_clear(Main *bmain)
Definition lib_id.cc:2097
void BKE_sound_update_scene_sound(AUD_SequenceEntry handle, bSound *sound)
T * DEG_get_original(T *id)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
void IDP_FreeProperty(IDProperty *prop)
Definition idprop.cc:1403
@ SEQ_EDIT_SHOW_MISSING_MEDIA
@ ID_RECALC_AUDIO
Definition DNA_ID.h:1132
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
@ SEQ_SNAP_TO_PREVIEW_BORDERS
@ SEQ_SNAP_TO_PREVIEW_CENTER
@ SEQ_SNAP_TO_STRIPS_PREVIEW
@ SEQ_SNAP_TO_CURRENT_FRAME
@ SEQ_SNAP_TO_FRAME_RANGE
void BKE_sound_remove_scene_sound(Scene *scene, AUD_SequenceEntry handle)
@ ID_TAG_NEW
Definition DNA_ID.h:922
char * BLI_strdup_null(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_MALLOC
IDProperty * IDP_CopyProperty_ex(const IDProperty *prop, int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:968
bool BKE_main_collection_sync(const Main *bmain)
AUD_SequenceEntry BKE_sound_scene_add_scene_sound(Scene *scene, Strip *strip)
void BKE_sound_set_scene_sound_volume_at_frame(AUD_SequenceEntry handle, int frame, float volume, bool animated)
@ eSeqModifierType_SoundEqualizer
void id_us_min(ID *id)
Definition lib_id.cc:441
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
Definition readfile.cc:6653
Scene * BKE_scene_duplicate(Main *bmain, Scene *sce, eSceneCopyMethod type, eDupli_ID_Flags duplicate_flags, uint duplicate_options)
Definition scene.cc:1917
void BKE_sound_set_scene_sound_pan_at_frame(AUD_SequenceEntry handle, int frame, float pan, bool animated)
void BKE_sound_update_sequence_handle(AUD_SequenceEntry handle, AUD_Sound sound_handle)
void write_string(const char *data)
void write_struct_cast(const void *data, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct(const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
bool is_undo() const
void write_struct_array(const int64_t array_size, const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
seq::EditingRuntime * runtime
ListBaseT< SeqTimelineChannel > channels
ListBaseT< Strip > seqbase
char name[258]
Definition DNA_ID.h:433
struct ID * newid
Definition DNA_ID.h:419
unsigned int recalc
Definition DNA_ID.h:446
struct Editing * ed
struct ToolSettings * toolsettings
seq::TextVarsRuntime * runtime
struct SequencerToolSettings * sequencer_tool_settings
MovieReaderCache * movie_reader_cache
CompositorCache * compositor_cache
std::optional< int > edit_point
CompositorCache & ensure_compositor_cache()
void(*) copy(Strip *dst, const Strip *src, int flag)
Definition effects.hh:44
void(*) free(Strip *strip, bool do_id_user)
Definition effects.hh:47
Map< Strip *, Strip * > strip_map
Definition sequencer.cc:536
void remove_scene_sound(Scene *scene)
Definition sequencer.cc:296
AUD_SequenceEntry scene_sound