47 char name[
sizeof(strip_a->name)];
49 if (strip_a->length(scene) != strip_b->length(scene)) {
50 *r_error_str =
N_(
"Strips must be the same length");
55 if (strip_a->
type != strip_b->
type) {
57 *r_error_str =
N_(
"Strips were not compatible");
62 if (strip_a->is_effect() != strip_b->is_effect()) {
63 *r_error_str =
N_(
"Strips were not compatible");
67 if (strip_a->is_effect() && strip_b->is_effect()) {
68 if (strip_a->effect_num_inputs_get() != strip_b->effect_num_inputs_get()) {
69 *r_error_str =
N_(
"Strips must have the same number of inputs");
78 STRNCPY(name, strip_a->name + 2);
79 BLI_strncpy(strip_a->name + 2, strip_b->name + 2,
sizeof(strip_b->name) - 2);
80 BLI_strncpy(strip_b->name + 2, name,
sizeof(strip_b->name) - 2);
83 std::swap(strip_a->blend_mode, strip_b->blend_mode);
84 std::swap(strip_a->blend_opacity, strip_b->blend_opacity);
86 std::swap(strip_a->prev, strip_b->prev);
87 std::swap(strip_a->next, strip_b->next);
88 std::swap(strip_a->start, strip_b->start);
89 std::swap(strip_a->startofs, strip_b->startofs);
90 const float tmp_offset = strip_a->end_offset();
91 strip_a->end_offset_set(strip_b->end_offset());
92 strip_b->end_offset_set(tmp_offset);
93 std::swap(strip_a->channel, strip_b->channel);
103 ListBaseT<Strip> *seqbasep,
109 for (
Strip &strip : *seqbasep) {
115 if (&strip == strip_meta) {
122 if (strip.runtime->scene_sound) {
147 if (strip ==
nullptr ||
ed ==
nullptr ||
154 strips_to_delete.
add_new(strip);
160 for (
Strip *strip_to_mark : strips_to_delete) {
166 for (StripModifierData &smd : user_strip->modifiers) {
167 if (strips_to_delete.contains(smd.mask_strip)) {
168 smd.mask_strip = nullptr;
177 for (
Strip &strip : seqbase->items_mutable()) {
191 ListBaseT<Strip> *seqbase,
193 ListBaseT<Strip> *dst_seqbase)
209 const char **r_error_str)
216 *r_error_str =
N_(
"Cannot move strip to non-meta strip");
220 if (src_strip == dst_stripm) {
221 *r_error_str =
N_(
"Strip cannot be moved into itself");
225 if (seqbase == &dst_stripm->seqbase) {
226 *r_error_str =
N_(
"Moved strip is already inside provided meta strip");
231 *r_error_str =
N_(
"Moved strip is parent of provided meta strip");
236 *r_error_str =
N_(
"Cannot move strip to different scene");
241 strips.
add(src_strip);
244 for (
Strip *strip : strips) {
259 const float content_start = strip->content_start();
260 const float content_end = strip->content_end(scene);
263 if (timeline_frame < content_start) {
264 const float offset = content_start + 1 - timeline_frame;
265 strip->start -= offset;
266 strip->startofs += offset;
269 else if ((timeline_frame >= content_start) && (timeline_frame <= content_end)) {
270 strip->end_offset_set(0);
272 const float speed_factor = strip->media_playback_rate_factor(scene_fps);
273 strip->anim_endofs +=
round_fl_to_int((content_end - timeline_frame) * speed_factor);
277 strip->right_handle_set(scene, timeline_frame);
285 const float content_start = strip->content_start();
286 const float content_end = strip->content_end(scene);
289 if ((timeline_frame >= content_start) && (timeline_frame <= content_end)) {
291 const float speed_factor = strip->media_playback_rate_factor(scene_fps);
292 strip->anim_startofs +=
round_fl_to_int((timeline_frame - content_start) * speed_factor);
293 strip->start = timeline_frame;
297 else if (timeline_frame > content_end) {
298 const float offset = timeline_frame - content_end + 1;
299 strip->start += offset;
300 strip->end_offset_set(strip->end_offset() + offset);
304 strip->left_handle_set(scene, timeline_frame);
309 return timeline_frame > strip->left_handle() && timeline_frame < strip->right_handle(scene);
314 const std::optional<int> channel,
315 const bool only_selected)
321 for (
Strip &strip : *
ed->current_strips()) {
325 if (only_selected && (strip.flag &
SEQ_SELECT) == 0) {
329 if (strip.channel == *channel) {
346 const int timeline_frame,
352 right_strip->left_handle_set(scene, timeline_frame);
363 left_strip->right_handle_set(scene, timeline_frame);
374 const int timeline_frame)
376 bool input_does_intersect =
false;
379 if (strip->input1->is_effect()) {
381 scene, strip->input1, timeline_frame);
386 if (strip->input2->is_effect()) {
388 scene, strip->input2, timeline_frame);
391 return input_does_intersect;
396 const int timeline_frame,
397 const char **r_error)
399 for (
Strip *strip : strips) {
402 *r_error =
"Strip is locked, cannot split";
405 if (!strip->is_effect()) {
411 if (strip->effect_num_inputs_get() <= 1) {
415 *r_error =
"Splitting transition effect is not permitted.";
419 *r_error =
"Effect inputs don't overlap. Can not split such effect.";
428 ListBaseT<Strip> *seqbase,
430 const int timeline_frame,
433 const char **r_error)
437 for (
Strip *strip : strips_to_split) {
460 ListBaseT<Strip> left_strips = {
nullptr,
nullptr};
461 for (
Strip *strip_iter : strips) {
471 ListBaseT<Strip> right_strips = {
nullptr,
nullptr};
475 Strip *left_strip = left_strips.first();
476 Strip *right_strip = right_strips.first();
485 Strip *strip_rename = right_strip;
486 for (; strip_rename; strip_rename = strip_rename->next) {
491 while (left_strip && right_strip) {
492 if (left_strip->left_handle() >= timeline_frame) {
495 else if (right_strip->right_handle(scene) <= timeline_frame) {
499 return_strips.
append(right_strip);
503 bmain, scene, left_strip, right_strip, timeline_frame, method);
504 left_strip = left_strip->next;
505 right_strip = right_strip->next;
511 return return_strips;
516 ListBaseT<Strip> *seqbase,
518 const int timeline_frame,
520 const bool ignore_connections,
521 const char **r_error)
526 bmain, scene, seqbase, {strip}, timeline_frame, method, include, r_error);
531 ListBaseT<Strip> *seqbase,
532 const int initial_frame,
533 const bool remove_all_gaps)
542 if (remove_all_gaps) {
void add_multiple(Span< Key > keys)
bool contains(const Key &key) const
Span< Key > as_span() const
void add_new(const Key &key)
void append(const T &value)
void shallow_swap(T &a, T &b)
void relations_invalidate_cache(Scene *scene, Strip *strip)
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)
static void seq_split_set_left_hold_offset(Main *bmain, Scene *scene, Strip *strip, int timeline_frame)
void foreach_strip(ListBaseT< Strip > *seqbase, ForEachFunc callback, void *user_data)
void seq_time_gap_info_get(const Scene *scene, ListBaseT< Strip > *seqbase, const int initial_frame, GapInfo *r_gap_info)
bool render_is_muted(const ListBaseT< SeqTimelineChannel > *channels, const Strip *strip)
ListBaseT< Strip > * get_seqbase_by_strip(const Scene *scene, Strip *strip)
Editing * editing_get(const Scene *scene)
void edit_strip_name_set(Scene *scene, Strip *strip, const char *new_name)
void edit_remove_flagged_strips(Scene *scene, ListBaseT< Strip > *seqbase)
static void strip_update_muting_recursive(ListBaseT< SeqTimelineChannel > *channels, ListBaseT< Strip > *seqbasep, Strip *strip_meta, const bool mute)
void animation_duplicate_backup_to_scene(Scene *scene, Strip *strip, AnimationBackup *backup)
bool effect_is_transition(StripType type)
Vector< Strip * > edit_split_strips_get(Scene *scene, const int frame, const std::optional< int > channel, const bool only_selected)
void expand_strips(Editing *ed, VectorSet< Strip * > &strips, const StripRelation include)
void strip_free(Scene *scene, Strip *strip)
Vector< Strip * > edit_strips_split(Main *bmain, Scene *scene, ListBaseT< Strip > *seqbase, const Span< Strip * > strips_to_split, const int timeline_frame, const eSplitMethod method, const StripRelation include, const char **r_error)
static void seq_split_set_right_hold_offset(Main *bmain, Scene *scene, Strip *strip, int timeline_frame)
void time_update_meta_strip_range(const Scene *scene, Strip *strip_meta)
void ensure_unique_name(Strip *strip, Scene *scene, const DriverMap &driver_map)
void free_animdata(Scene *scene, Strip *strip)
bool edit_move_strip_to_meta(Scene *scene, Strip *src_strip, Strip *dst_stripm, const char **r_error_str)
void edit_update_muting(Editing *ed)
void edit_flag_for_removal(Scene *scene, Strip *strip)
bool exists_in_seqbase(const Strip *strip, const ListBaseT< Strip > *seqbase)
void animation_backup_original(Scene *scene, AnimationBackup *backup)
Strip * edit_strip_split(Main *bmain, Scene *scene, ListBaseT< Strip > *seqbase, Strip *strip, const int timeline_frame, const eSplitMethod method, const bool ignore_connections, const char **r_error)
static void seq_edit_split_handle_strip_offsets(Main *bmain, Scene *scene, Strip *left_strip, Strip *right_strip, const int timeline_frame, const eSplitMethod method)
void cut_outside_connections(const VectorSet< Strip * > &strip_list)
bool edit_remove_gaps(Scene *scene, ListBaseT< Strip > *seqbase, const int initial_frame, const bool remove_all_gaps)
bool edit_strip_swap(Scene *scene, Strip *strip_a, Strip *strip_b, const char **r_error_str)
void animation_restore_original(Scene *scene, AnimationBackup *backup)
static bool seq_edit_split_effect_inputs_intersect(const Scene *scene, const Strip *strip, const int timeline_frame)
void add_update_content_length(Main *bmain, Scene *scene, Strip *strip)
void transform_strips_after_frame(Scene *scene, ListBaseT< Strip > *seqbase, const int timeline_frame, const int delta)
void transform_shuffle_vertical(ListBaseT< Strip > *seqbasep, Span< Strip * > strips, Scene *scene, const int channel_delta)
bool transform_is_locked(const ListBaseT< SeqTimelineChannel > *channels, const Strip *strip)
ListBaseT< SeqTimelineChannel > * channels_displayed_get(const Editing *ed)
static bool seq_edit_split_operation_permitted_check(const Scene *scene, Span< Strip * > strips, const int timeline_frame, const char **r_error)
void strip_lookup_invalidate(const Editing *ed)
void strip_time_effect_range_set(const Scene *scene, Strip *strip)
bool edit_move_strip_to_seqbase(Scene *scene, ListBaseT< Strip > *seqbase, Strip *strip, ListBaseT< Strip > *dst_seqbase)
bool edit_frame_splits_strip(const Scene *scene, const Strip *strip, const int timeline_frame)
char * STRNCPY(char(&dst)[N], const char *src)
void BKE_sound_mute_scene_sound(AUD_SequenceEntry handle, bool mute)
MINLINE int round_fl_to_int(float a)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void void void BLI_movelisttolist(ListBase *dst, ListBase *src) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_str_utf8_invalid_strip(char *str, size_t str_len) ATTR_NONNULL(1)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float