Page MenuHome

Fix T72831: Keyframes moved on invalid transformation.
AbandonedPublic

Authored by Richard Antalik (ISS) on Jul 18 2020, 6:09 AM.

Details

Summary

Tag all strips to update timebase. This should be safe to do with
effects.

Diff Detail

Repository
rB Blender
Branch
T72831 (branched from master)
Build Status
Buildable 9094
Build 9094: arc lint + arc unit

Event Timeline

Richard Antalik (ISS) requested review of this revision.Jul 18 2020, 6:09 AM
Richard Antalik (ISS) created this revision.
Sergey Sharybin (sergey) requested changes to this revision.Jul 20 2020, 10:09 AM

Please pay more attention when working on fixes.

Here from the code side, you removed assignments of has_effect_any and has_effect_root, which keeps them always at false, leaving if (has_effect_any) { and if (has_effect_root) { checks some lines below dead.
If the patch was the way to go, all code referencing has_effect_any and has_effect_root is to be removed.

The patch also causes a regression in a situation when moving strip makes effect to intersect with another strip. In the attached file move the selected green strip down to the track 1 without moving it in time. This will make effect to intersect with the blue strip. Compare behavior before and after the patch. Behavior before the patch makes more sense from user perspective.

This revision now requires changes to proceed.Jul 20 2020, 10:09 AM
  • Offset animdata after removing overlap of "parent" strip and recalculating bounds

This is a bit weird why it's only done in one place. There are other places from where BKE_sequence_calc is called, and some other places where strip position is changed (RNA properties, Python API, and so on).

This is a bit weird why it's only done in one place. There are other places from where BKE_sequence_calc is called, and some other places where strip position is changed (RNA properties, Python API, and so on).

This is fix only for transform operator. Following code more closely this is best place I could find to offset animdata. BKE_sequence_calc will look at effect inputs and adjust it's position in time.
I am using this approach here for several reasons:

  • I could traverse strips when moving "base strip", but I really don't want to increase problem complexity. This operator is incredibly slow as it is now. Traversing would have to be recursive loop over whole seqbase
    • Some operators already handle this problem by own logic. Doing this effectively inside BKE_sequence_calc may be possible, but it's recipe for disaster. There should be no such function as BKE_sequence_calc
    • from python API point of view, we can change strip position and we don't need to reference seqbase. since strip have no idea if it has any effects, we would have to look in scene, where exactly strip is, then traverse seqbase and offset animdata. It is possible, but unnecessary for this fix IMO
  • we don't know what strips exactly are overlapping, we could change this, but I just don't want to do it yet. Current logic is is_effect_overlapping? move_it_up : move_it_sideways_and_possibly_up;

So this left me with solution: Whatever happens, capture previous state of effects, and if they teleport, adjust animdata.

Thing is: such manual animation offsets calls are fragile. One might think of a better API which would do something like "place this strip to time FOO, offset its and all related animation".

Thing is: such manual animation offsets calls are fragile. One might think of a better API which would do something like "place this strip to time FOO, offset its and all related animation".

I am aware that this is not nice solution. I would rather rewrite this whole thing, but this is supposed to be bugfix.

Why not fix this behavior now when we can?

I don't see a reason why not to start working on a reaosnabel API and gradually spread it over, without rewriting the whole thing. It should be possible and simple to make a tiny new function, which is then to be used in all areas which moves strips.
You can use this function in a single place there in the transform code.

Well technically this could be part of T77580 logic consolidation so I can leave this unresolved for time being.