56 (channel->is_locked() &&
62 return !strip->is_effect_with_inputs();
67 return (strip1 != strip2 && strip1->channel == strip2->channel &&
68 ((strip1->right_handle(scene) <= strip2->left_handle()) ||
69 (strip1->left_handle() >= strip2->right_handle(scene))) == 0);
74 for (
Strip &strip : *seqbasep) {
98 for (
Strip &strip_child : strip->seqbase) {
102 const int left_handle = strip->left_handle();
103 const int right_handle = strip->right_handle(evil_scene);
104 strip->handles_set(evil_scene, left_handle + delta, right_handle + delta);
106 else if (strip->input1 ==
nullptr && strip->input2 ==
nullptr) {
107 strip->start += delta;
109 strip->startdisp = strip->left_handle();
110 strip->enddisp = strip->right_handle(evil_scene);
125 return strip->channel == other->channel &&
126 strip->left_handle() + offset < other->right_handle(scene) &&
127 strip->right_handle(scene) + offset > other->left_handle();
132 ListBaseT<Strip> *seqbasep,
141 offset_prev = offset;
142 for (
Strip *strip : strips_to_shuffle) {
143 for (
Strip &other : *seqbasep) {
151 min_ii(offset, other.left_handle() - strip->right_handle(scene)) :
152 max_ii(offset, other.right_handle(scene) - strip->left_handle());
155 }
while (offset != offset_prev);
161 ListBaseT<Strip> *seqbasep,
164 const bool use_sync_markers)
168 const int offset = (-offset_l < offset_r) ? offset_l : offset_r;
174 for (
Strip *strip : strips_to_shuffle) {
177 for (
Strip *strip : time_dependent_strips) {
185 marker.
frame += offset;
192 ListBaseT<Strip> *seqbasep,
193 const ListBaseT<SeqTimelineChannel> *channels,
197 return !channel->is_muted() && !channel->is_locked() &&
204 const int channel_delta)
208 if (!std::ranges::any_of(
218 for (
Strip *strip : strips) {
219 orig_channels.
append(strip->channel);
220 min_channel =
math::min(min_channel, strip->channel);
221 max_channel =
math::max(max_channel, strip->channel);
224 for (
int delta = channel_delta; min_channel + delta >= 1 && max_channel + delta <=
MAX_CHANNELS;
225 delta += channel_delta)
229 strips[i]->channel_set(orig_channels[i] + delta);
231 if (std::ranges::all_of(strips,
242 strips[i]->channel_set(orig_channels[i]);
251 for (
Strip *strip : transformed_strips) {
252 if (!strip->is_effect_with_inputs()) {
253 standalone_strips.
add(strip);
256 return standalone_strips;
262 bounds.xmin = strip->left_handle();
263 bounds.xmax = strip->right_handle(scene);
264 bounds.ymin = strip->channel;
265 bounds.ymax = strip->channel;
272 std::ranges::sort(sorted_strips, [](
const Strip *a,
const Strip *
b) {
273 return a->left_handle() <
b->left_handle();
277 for (
const Strip *strip : sorted_strips) {
278 if (!ranges.is_empty() && strip->left_handle() <= ranges.last().end) {
280 ranges.last().end =
math::max(ranges.last().end, strip->right_handle(scene));
281 ranges.last().channels.add(strip->channel);
285 ranges.append({strip->left_handle(), strip->right_handle(scene), {strip->channel}});
293 const bool all_channels)
312 ListBaseT<Strip> *seqbasep,
314 const int insert_frame,
316 std::optional<int> &r_shuffle_delta)
318 bool do_insert =
false;
319 int shuffle_delta = 0;
321 for (
Strip &target : *seqbasep) {
322 if (source_strips.
contains(&target)) {
326 if (target.left_handle() >= insert_frame || target.right_handle(scene) <= insert_frame) {
329 for (
Strip *source : source_strips) {
330 if (target.channel == source->channel) {
332 shuffle_delta =
math::max(shuffle_delta, target.right_handle(scene) - insert_frame);
342 BLI_assert(!(do_insert && (shuffle_delta > 0)));
344 if (shuffle_delta > 0) {
345 r_shuffle_delta = shuffle_delta;
353 for (
Strip *source : source_strips) {
366 for (
Strip *source : source_strips) {
367 if (source->left_handle() < range.
end && source->right_handle(scene) > range.
start) {
368 range_sources.
append(source);
371 return range_sources;
375 ListBaseT<Strip> *seqbasep,
383 int start_frame = range.
start;
384 int end_frame = range.
end;
386 std::optional<int> shuffle_delta;
388 scene, seqbasep, range_sources, start_frame, ripple_flag, shuffle_delta);
391 if (shuffle_delta.has_value()) {
395 start_frame += *shuffle_delta;
396 end_frame += *shuffle_delta;
400 int ripple_frame = start_frame;
402 delta = end_frame - start_frame;
407 for (
Strip &target : *seqbasep) {
408 if (source_strips.
contains(&target)) {
411 if (target.left_handle() >= start_frame || target.right_handle(scene) <= start_frame) {
417 strips_to_split.
append(&target);
421 Main *bmain =
nullptr;
422 for (
Strip *target : strips_to_split) {
423 const char *error_msg =
nullptr;
429 for (
Strip &target : *seqbasep) {
430 if (source_strips.
contains(&target) ||
435 delta =
math::max(delta, end_frame - target.left_handle());
436 ripple_frame =
math::min(ripple_frame, target.left_handle());
445 for (
Strip &target : *seqbasep) {
446 if (source_strips.
contains(&target)) {
449 if (target.left_handle() < ripple_frame) {
460 if (marker.
frame >= ripple_frame) {
461 marker.
frame += delta;
468 ListBaseT<Strip> *seqbasep,
478 ListBaseT<Strip> *seqbasep,
486 bool does_overlap =
false;
487 for (
Strip *source : source_strips) {
493 return !does_overlap;
512 for (
Strip *strip : targets) {
513 if (strip->is_effect_with_inputs()) {
517 strip->left_handle_set(scene, source->right_handle(scene));
520 strip->right_handle_set(scene, source->left_handle());
526 ListBaseT<Strip> *seqbasep,
537 Main *bmain =
nullptr;
538 const char *error_msg =
nullptr;
540 bmain, scene, seqbasep, target, source->left_handle(),
SPLIT_SOFT,
true, &error_msg);
541 if (right_strip ==
nullptr) {
544 right_strip->left_handle_set(scene, source->right_handle(scene));
549 ListBaseT<Strip> *seqbasep,
558 for (
int i = 0; i < targets.
size(); i++) {
559 Strip *target = targets[i];
560 for (
Strip *source : source_strips) {
566 const bool covers_left = source->left_handle() <= target->left_handle();
567 const bool covers_right = source->right_handle(scene) >= target->right_handle(scene);
570 if (covers_left && covers_right) {
571 to_delete.
add(target);
574 else if (covers_left || covers_right) {
581 targets.
add(new_strip);
589 for (
Strip *strip : to_delete) {
597 const bool left_selected = (strip->flag &
SEQ_LEFTSEL) != 0;
598 const bool right_selected = (strip->flag &
SEQ_RIGHTSEL) != 0;
600 if (left_selected && right_selected) {
606 if (right_selected) {
614 ListBaseT<Strip> *seqbasep)
621 for (
Strip *strip : strips_to_shuffle) {
623 for (
Strip &other : *seqbasep) {
630 offset = is_left ?
max_ii(offset, other.right_handle(scene) - strip->left_handle()) :
631 min_ii(offset, other.left_handle() - strip->right_handle(scene));
639 ListBaseT<Strip> *seqbasep,
648 for (
Strip *strip : strips_to_shuffle) {
650 strip->left_handle_set(scene, strip->left_handle() + offset);
653 strip->right_handle_set(scene, strip->right_handle(scene) + offset);
659 ListBaseT<Strip> *seqbasep,
662 bool use_sync_markers)
671 handles_to_shuffle.
add(strip);
674 strips_to_shuffle.
add(strip);
683 scene, seqbasep, strips_to_shuffle, time_dependent_strips, use_sync_markers);
687 ListBaseT<Strip> *seqbasep,
689 bool use_sync_markers,
698 time_dependent_strips);
702 ListBaseT<Strip> *seqbasep,
704 bool use_sync_markers,
709 switch (overlap_mode) {
718 scene, seqbasep, source_strips, time_dependent_strips, use_sync_markers);
725 for (
Strip *strip : source_strips) {
732 ListBaseT<Strip> *seqbase,
733 const int timeline_frame,
736 for (
Strip &strip : *seqbase) {
737 if (strip.left_handle() >= timeline_frame) {
745 if (marker.
frame >= timeline_frame) {
746 marker.
frame += delta;
761 const int2 parent_scene_size =
int2(scene->
r.xsch, scene->
r.ysch);
763 switch (strip->
type) {
767 return parent_scene_size;
780 return parent_scene_size;
786 return parent_scene_size;
788 return int2(strip->scene->r.xsch, strip->scene->r.ysch);
795 return parent_scene_size;
801 float2 mirror(1.0f, 1.0f);
834 return box_size * origin - (box_size / 2.0f);
848 const float2 render_size(scene->
r.xsch, scene->
r.ysch);
853 const float2 render_origin =
float2(0.5f) + offset_text_origin * (text_size / render_size);
854 return render_origin;
859 const float2 viewport_pixel_aspect(scene->
r.xasp / scene->
r.yasp, 1.0f);
887 constexpr int num_corners = 4;
897 {(box_size.x / 2) - crop->
right, (box_size.y / 2) - crop->
top},
898 {(box_size.x / 2) - crop->
right, (-box_size.y / 2) + crop->
bottom},
899 {(-box_size.x / 2) + crop->
left, (-box_size.y / 2) + crop->
bottom},
900 {(-box_size.x / 2) + crop->
left, (box_size.y / 2) - crop->
top},
907 switch (
data->anchor_x) {
909 offset.x += box_size.x / 2.0f;
914 offset.x += -box_size.x / 2.0f;
919 switch (
data->anchor_y) {
921 offset.y += box_size.y / 2.0f;
926 offset.y += -box_size.y / 2.0f;
932 for (
float2 &corner : quad) {
948 return {co_src.x * scene->
r.xsch, co_src.y * scene->
r.ysch};
953 return {co_src.x / scene->
r.xsch, co_src.y / scene->
r.ysch};
958 return {
float2(std::numeric_limits<float>::max()),
float2(std::numeric_limits<float>::lowest())};
965 for (
Strip *strip : strips) {
968 bounding_box =
bounds::merge(bounding_box, strip_bounding_box);
Span< T > as_span() const
constexpr IndexRange()=default
bool contains(const Key &key) const
constexpr IndexRange index_range() const
constexpr bool contains(const T &value) const
int64_t remove_if(Predicate &&predicate)
void append(const T &value)
const T & data(const Action &owning_action) const
Bounds< T > merge(const Bounds< T > &a, const Bounds< T > &b)
std::optional< Bounds< T > > min_max(const std::optional< Bounds< T > > &a, const T &b)
T min(const T &a, const T &b)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
MatT from_origin_transform(const MatT &transform, const VectorT origin)
T max(const T &a, const T &b)
MatT from_loc_rot_scale(const typename MatT::loc_type &location, const RotationT &rotation, const VecBase< typename MatT::base_type, ScaleDim > &scale)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
static VectorSet< Strip * > extract_standalone_strips(Span< Strip * > transformed_strips)
float2 image_preview_unit_to_px(const Scene *scene, const float2 co_src)
Vector< RippleRange > transform_ripple_ranges_get(const Scene *scene, Span< Strip * > strips)
Strip * lookup_meta_by_strip(Editing *ed, const Strip *key)
static VectorSet< Strip * > query_overwrite_targets(const Scene *scene, ListBaseT< Strip > *seqbasep, Span< Strip * > source_strips)
int2 image_transform_box_size_get(const Scene *scene, const Strip *strip)
float2 image_transform_mirror_factor_get(const Strip *strip)
void relations_invalidate_cache(Scene *scene, Strip *strip)
static bool sources_overlap_target(const Scene *scene, Span< Strip * > source_strips, Strip *target)
std::recursive_mutex & text_runtime_mutex_get()
void transform_translate_strip(Scene *evil_scene, Strip *strip, int delta)
void transform_handle_overlap(Scene *scene, ListBaseT< Strip > *seqbasep, Span< Strip * > source_strips, bool use_sync_markers, Span< Strip * > time_dependent_strips)
rcti strip_int_bounds_get(const Scene *scene, const Strip *strip)
static int shuffle_frame_offset_get(const Scene *scene, Span< Strip * > strips_to_shuffle, ListBaseT< Strip > *seqbasep, const Side side)
static void transform_shuffle_handles(const Scene *scene, ListBaseT< Strip > *seqbasep, Span< Strip * > strips_to_shuffle)
Array< float2 > image_transform_quad_get(const Scene *scene, const Strip *strip)
bool transform_test_overlap(const Scene *scene, Strip *strip1, Strip *strip2)
Editing * editing_get(const Scene *scene)
static int2 strip_source_size_get(const Scene *scene, const Strip *strip)
void edit_remove_flagged_strips(Scene *scene, ListBaseT< Strip > *seqbase)
void offset_animdata(const Scene *scene, Strip *strip, float ofs)
static bool shuffle_channel_is_free(const Scene *scene, ListBaseT< Strip > *seqbasep, const ListBaseT< SeqTimelineChannel > *channels, Strip *strip)
void expand_strips(Editing *ed, VectorSet< Strip * > &strips, const StripRelation include)
void text_effect_update_runtime(const RenderData *context, TextVars &text, const int2 image_size)
bool transform_single_image_check(const Strip *strip)
void strip_time_update_effects_strip_range(const Scene *scene, const Span< Strip * > effects)
float3x3 image_transform_matrix_get(const Scene *scene, const Strip *strip)
constexpr int MAX_CHANNELS
void time_update_meta_strip_range(const Scene *scene, Strip *strip_meta)
Bounds< float2 > image_transform_bounding_box_from_strips_get(Scene *scene, Span< Strip * > strips)
float2 image_transform_origin_preview_offset_get(const Scene *scene, const Strip *strip)
static void strip_transform_handle_shuffle(Scene *scene, ListBaseT< Strip > *seqbasep, Span< Strip * > source_strips, Span< Strip * > time_dependent_strips, bool use_sync_markers)
Span< Strip * > lookup_effects_by_strip(Editing *ed, const Strip *key)
static bool strips_overlap_at_offset(const Scene *scene, const Strip *strip, const Strip *other, const int offset)
void edit_flag_for_removal(Scene *scene, Strip *strip)
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)
float2 image_transform_origin_get(const Scene *scene, const Strip *strip)
static float2 image_transform_viewport_scale_get(const Scene *scene, const Strip *strip)
SeqTimelineChannel * channel_get_by_index(const ListBaseT< SeqTimelineChannel > *channels, const int channel_index)
static Bounds< float2 > negative_bounds()
bool relation_is_effect_of_strip(const Strip *effect, const Strip *input)
static float2 convert_origin_to_image_offset(const Scene *scene, const Strip *strip, float2 origin)
static Vector< Strip * > range_sources_get(const Scene *scene, Span< Strip * > source_strips, const RippleRange &range)
static void transform_shuffle_horizontal(Scene *scene, ListBaseT< Strip > *seqbasep, Span< Strip * > strips_to_shuffle, Span< Strip * > time_dependent_strips, const bool use_sync_markers)
void transform_strips_after_frame(Scene *scene, ListBaseT< Strip > *seqbase, const int timeline_frame, const int delta)
static bool should_ripple_insert(const Scene *scene, ListBaseT< Strip > *seqbasep, Span< Strip * > source_strips, const int insert_frame, const eSeqRippleFlag ripple_flag, std::optional< int > &r_shuffle_delta)
float2 image_preview_unit_from_px(const Scene *scene, const float2 co_src)
static Strip * strip_transform_handle_overwrite_split(Scene *scene, ListBaseT< Strip > *seqbasep, const Strip *source, Strip *target)
bool transform_strip_is_on_rippled_channel(const RippleRange &range, const Strip *strip, const bool all_channels)
eSeqRippleFlag tool_settings_ripple_flag_get(Scene *scene)
void transform_shuffle_vertical(ListBaseT< Strip > *seqbasep, Span< Strip * > strips, Scene *scene, const int channel_delta)
static int shuffle_handle_offset_get(const Scene *scene, Span< Strip * > strips_to_shuffle, ListBaseT< Strip > *seqbasep)
bool transform_is_locked(const ListBaseT< SeqTimelineChannel > *channels, const Strip *strip)
ListBaseT< SeqTimelineChannel > * channels_displayed_get(const Editing *ed)
bool transform_strip_can_be_translated(const Strip *strip)
static void strip_transform_handle_overwrite(Scene *scene, ListBaseT< Strip > *seqbasep, Span< Strip * > source_strips)
static void strip_transform_handle_overwrite_trim(Scene *scene, const Strip *source, Strip *target, bool covers_left)
VectorSet< Strip * > query_unselected_strips(ListBaseT< Strip > *seqbase)
static Side strip_selected_handles_get(const Strip *strip)
static void strip_transform_handle_ripple(Scene *scene, ListBaseT< Strip > *seqbasep, Span< Strip * > source_strips, const eSeqRippleFlag ripple_flag)
eSeqOverlapMode tool_settings_overlap_mode_get(Scene *scene)
StripElem * render_give_stripelem(const Scene *scene, const Strip *strip, int timeline_frame)
static void strip_transform_ripple_range(Scene *scene, ListBaseT< Strip > *seqbasep, Span< Strip * > source_strips, const RippleRange &range, const eSeqRippleFlag ripple_flag)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE int max_ii(int a, int b)
void BLF_disable(int fontid, FontFlags flag)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
BMesh const char void * data
@ SEQ_SINGLE_FRAME_CONTENT
MatBase< float, 3, 3 > float3x3
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
@ SEQ_RIPPLE_ALL_CHANNELS
@ SEQ_TEXT_ANCHOR_X_CENTER
@ SEQ_TEXT_ANCHOR_X_RIGHT
@ SEQ_TEXT_ANCHOR_Y_BOTTOM
@ SEQ_TEXT_ANCHOR_Y_CENTER
MINLINE int min_ii(int a, int b)
ListBaseT< TimeMarker > markers
struct ToolSettings * toolsettings