Fix T70844: Incorrect snappping of strips when effects attached

Sometimes, when moving strip with 2 input effect attached and causing
strip overlap, this overlap is resolved incorrectly - too big offset
is applied. This is because effects are not taken into consideration
when "shuffeling" to resolve overlap.

To fix usual cases (transitions), overlap between strip and it's effect
is considered to be impossible.

There are edge cases, but these would be much more complicated to
implement and could have negative impact on performance.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D14578
This commit is contained in:
Shrey Aggarwal 2022-04-21 00:44:57 +02:00 committed by Richard Antalik
parent e16ff4132e
commit 502f3debf9
Notes: blender-bot 2023-02-14 07:39:44 +01:00
Referenced by issue #70844, VSE: Grabbing and dropping strips with a crossfade on them can cause incorrect snapping
3 changed files with 13 additions and 0 deletions

View File

@ -18,6 +18,10 @@ struct ReportList;
struct Scene;
struct Sequence;
/**
* Check if one sequence is input to the other.
*/
bool SEQ_relation_is_effect_of_strip(const struct Sequence *effect, const struct Sequence *input);
/**
* Function to free imbuf and anim data on changes.
*/
@ -64,6 +68,7 @@ void SEQ_cache_iterate(
struct Sequence *SEQ_find_metastrip_by_sequence(ListBase *seqbase /* = ed->seqbase */,
struct Sequence *meta /* = NULL */,
struct Sequence *seq);
#ifdef __cplusplus
}
#endif

View File

@ -34,6 +34,11 @@
#include "image_cache.h"
#include "utils.h"
bool SEQ_relation_is_effect_of_strip(const Sequence *effect, const Sequence *input)
{
return ELEM(input, effect->seq1, effect->seq2);
}
/* check whether sequence cur depends on seq */
static bool seq_relations_check_depend(Sequence *seq, Sequence *cur)
{

View File

@ -297,6 +297,9 @@ static int shuffle_seq_time_offset_test(SeqCollection *strips_to_shuffle,
if (!SEQ_transform_test_overlap_seq_seq(seq, seq_other)) {
continue;
}
if (SEQ_relation_is_effect_of_strip(seq_other, seq)) {
continue;
}
if (UNLIKELY(SEQ_collection_has_strip(seq_other, strips_to_shuffle))) {
CLOG_WARN(&LOG,
"Strip overlaps with itself or another strip, that is to be shuffled. "