Fix: VSE Slip Strips operator doesn't move effect strips inside of a meta strip. #113200

Merged
Richard Antalik merged 4 commits from ok_what/blender:vse-slip-effect-bug into main 2023-12-21 18:05:07 +01:00
Contributor

Steps to reproduce:

  1. Add two strips, and add a transition strip to them.
  2. Group all of them inside a meta strip
  3. Use the "Slip Strip Contents" operator on the meta strip.

Result: The transition strip isn't moved, and gets off-sync with the input strips.

Notes:

  1. Should the function that slips the content of a strip be moved inside source/blender/sequencer (eg. strip_time.cc), rather than exposing functions internal to /sequencer?
    • I've temporarily moved the internal functions to make them public. If it's better to merge the bug fix first before making other changes, I'll rename them to start with capital "SEQ_"
  2. Slip doesn't move the keyframes of a strip. I will make a separate PR for that. This is why I don't exclude the effect strips directly in slip_add_sequences_recursive(...).
  3. There is a bug with scene strips, where a negative strip offset start value causes the scene audio to play at the wrong time. This is not specific to the slip operator, since it happens when dragging the left strip handle to the left as well.
**Steps to reproduce:** 1. Add two strips, and add a transition strip to them. 2. Group all of them inside a meta strip 3. Use the "Slip Strip Contents" operator on the meta strip. Result: The transition strip isn't moved, and gets off-sync with the input strips. **Notes:** 1. Should the function that slips the content of a strip be moved inside source/blender/sequencer (eg. strip_time.cc), rather than exposing functions internal to /sequencer? - I've temporarily moved the internal functions to make them public. If it's better to merge the bug fix first before making other changes, I'll rename them to start with capital "SEQ_" 2. Slip doesn't move the keyframes of a strip. I will make a separate PR for that. This is why I don't exclude the effect strips directly in slip_add_sequences_recursive(...). 3. There is a bug with scene strips, where a negative strip offset start value causes the scene audio to play at the wrong time. This is not specific to the slip operator, since it happens when dragging the left strip handle to the left as well.
ok what added 1 commit 2023-10-03 12:26:33 +02:00
ok what requested review from Richard Antalik 2023-10-03 12:29:08 +02:00

Thanks for patch and sorry for late reply.

Should the function that slips the content of a strip be moved inside source/blender/sequencer (eg. strip_time.cc), rather than exposing functions internal to /sequencer?
I've temporarily moved the internal functions to make them public. If it's better to merge the bug fix first before making other changes, I'll rename them to start with capital "SEQ_"

Technically, any code in space_sequencer should not directly change value of Sequence. If it does, things like this would happen...
The lookup function I would rather not expose and exposing seq_time_update_effects_strip_range() is worst case scenario.

Solution should be to use API functions in transseq_backup() and counterparts elsewhere, like:

static void transseq_backup(TransSeq *ts, Sequence *seq)
{
  ts->content_start = SEQ_time_start_frame_get(seq);
  ts->timeline_start = SEQ_time_left_handle_frame_get(scene, seq);
  ts->timeline_end = SEQ_time_right_handle_frame_get(scene, seq);
  ts->anim_startofs = seq->anim_startofs;
  ts->anim_endofs = seq->anim_endofs;
  ts->len = SEQ_time_strip_length_get(scene, seq);
}

All SEQ_time_..._set functions that need to should update effects position.

I think I have tried to do this, but it had some issue. Perhaps that was before I had effects cache, I am not sure now. Note, that is no API to handle anim_startofs and anim_endofs, because I want it gone. That should not cause issues here though.

Slip doesn't move the keyframes of a strip. I will make a separate PR for that. This is why I don't exclude the effect strips directly in slip_add_sequences_recursive(...).

Sounds like a good idea.

There is a bug with scene strips, where a negative strip offset start value causes the scene audio to play at the wrong time. This is not specific to the slip operator, since it happens when dragging the left strip handle to the left as well.

I think this is already reported and classified as known issue. Audio evaluates from single time source, there may be some hacks to work around it, but it's hard to resolve this. Or at least it requires good knowledge of dependency graph and not sure what time investment would be.

Thanks for patch and sorry for late reply. >Should the function that slips the content of a strip be moved inside source/blender/sequencer (eg. strip_time.cc), rather than exposing functions internal to /sequencer? I've temporarily moved the internal functions to make them public. If it's better to merge the bug fix first before making other changes, I'll rename them to start with capital "SEQ_" Technically, any code in `space_sequencer` should not directly change value of `Sequence`. If it does, things like this would happen... The lookup function I would rather not expose and exposing `seq_time_update_effects_strip_range()` is worst case scenario. Solution should be to use API functions in `transseq_backup()` and counterparts elsewhere, like: ``` static void transseq_backup(TransSeq *ts, Sequence *seq) { ts->content_start = SEQ_time_start_frame_get(seq); ts->timeline_start = SEQ_time_left_handle_frame_get(scene, seq); ts->timeline_end = SEQ_time_right_handle_frame_get(scene, seq); ts->anim_startofs = seq->anim_startofs; ts->anim_endofs = seq->anim_endofs; ts->len = SEQ_time_strip_length_get(scene, seq); } ``` All `SEQ_time_..._set` functions that need to should update effects position. I think I have tried to do this, but it had some issue. Perhaps that was before I had effects cache, I am not sure now. Note, that is no API to handle `anim_startofs` and `anim_endofs`, because I want it gone. That should not cause issues here though. > Slip doesn't move the keyframes of a strip. I will make a separate PR for that. This is why I don't exclude the effect strips directly in slip_add_sequences_recursive(...). Sounds like a good idea. > There is a bug with scene strips, where a negative strip offset start value causes the scene audio to play at the wrong time. This is not specific to the slip operator, since it happens when dragging the left strip handle to the left as well. I think this is already reported and classified as known issue. Audio evaluates from single time source, there may be some hacks to work around it, but it's hard to resolve this. Or at least it requires good knowledge of dependency graph and not sure what time investment would be.
ok what added 2 commits 2023-12-20 18:10:59 +01:00
Author
Contributor

Sorry for the very late reply.
I've tried to keep the refactoring in this PR to a minimum, but I had to change some things:

  • recursion for meta strips is now done in sequencer_slip_recursively instead of slip_add_sequences_recursive
  • i added a SEQ_time_slip_strip function
  • the offset used for sequencer_slip_recursively is now relative to the strip position on the timeline. This gets rid of the backup and restore functions that caused bugs (canceling the operator wouldn't work properly). At first I tried adapting the existing functions to the API functions, but I think this is less error prone. It also now makes it easy to move the f-curves while slipping.
  • Removed call to SEQ_add_reload_new_file. Not quite sure why it was in there, but with the relative offset it shouldn't be necessary.

The caching I'm unsure about. Currently SEQ_relations_invalidate_cache_preprocessed is only called for the selected strips, not for strips inside metas. This seems to be the case for SEQ_transform_translate_sequence and the places where it is used as well. The caching system seems a bit much for me to dive into at the moment, so I'm not sure what the correct way to go about it is.

Should SEQ_time_slip_strip be in strip_edit.cc or strip_time.cc?

If you want, I can also try if this could be done with the existing API functions, by exposing seq_time_translate_handles and using SEQ_transform_translate_sequence for meta strip contents. When I initially tried it, it didn't work, because SEQ_time_update_meta_strip_range would end up being called prematurely (and unnecessarily), with strips being calculated in the wrong order. Now that it's recursive anyway and the order is predictable, I think it would work.
I personally think it's much more predictable and understandable the way it is now though, without any extra calculations.

Sorry for the very late reply. I've tried to keep the refactoring in this PR to a minimum, but I had to change some things: - recursion for meta strips is now done in `sequencer_slip_recursively` instead of `slip_add_sequences_recursive` - i added a `SEQ_time_slip_strip` function - the offset used for `sequencer_slip_recursively` is now relative to the strip position on the timeline. This gets rid of the backup and restore functions that caused bugs (canceling the operator wouldn't work properly). At first I tried adapting the existing functions to the API functions, but I think this is less error prone. It also now makes it easy to move the f-curves while slipping. - Removed call to `SEQ_add_reload_new_file`. Not quite sure why it was in there, but with the relative offset it shouldn't be necessary. The caching I'm unsure about. Currently `SEQ_relations_invalidate_cache_preprocessed` is only called for the selected strips, not for strips inside metas. This seems to be the case for `SEQ_transform_translate_sequence` and the places where it is used as well. The caching system seems a bit much for me to dive into at the moment, so I'm not sure what the correct way to go about it is. Should `SEQ_time_slip_strip` be in `strip_edit.cc` or `strip_time.cc`? If you want, I can also try if this could be done with the existing API functions, by exposing `seq_time_translate_handles` and using `SEQ_transform_translate_sequence` for meta strip contents. When I initially tried it, it didn't work, because `SEQ_time_update_meta_strip_range` would end up being called prematurely (and unnecessarily), with strips being calculated in the wrong order. Now that it's recursive anyway and the order is predictable, I think it would work. I personally think it's much more predictable and understandable the way it is now though, without any extra calculations.
Richard Antalik approved these changes 2023-12-20 21:02:09 +01:00
Richard Antalik left a comment
Member

I started review before finishing reading your comment, so I suggested to not do recursive call of seq_time_slip_strip_ex and use SEQ_transform_translate_sequence() for moving stuff in metas... Also tried it quickly and it didn't work nicely. IMO the code would be nicer that way, but seems this is not practical for now.

Also was thinking of using seq_time_translate_handles just to avoid start/enddisp magic, but this also updates effects, so not sure if that would be practical either.

That said, I think I will accept this as is. I mean, this is supposed to be bugfix anyway. Still have minor nitpicks. But I can change these before committing.

I started review before finishing reading your comment, so I suggested to not do recursive call of `seq_time_slip_strip_ex` and use `SEQ_transform_translate_sequence()` for moving stuff in metas... Also tried it quickly and it didn't work nicely. IMO the code would be nicer that way, but seems this is not practical for now. Also was thinking of using `seq_time_translate_handles` just to avoid start/enddisp magic, but this also updates effects, so not sure if that would be practical either. That said, I think I will accept this as is. I mean, this is supposed to be bugfix anyway. Still have minor nitpicks. But I can change these before committing.
@ -605,3 +559,3 @@
}
static void sequencer_slip_recursively(Scene *scene, SlipData *data, int offset)
static void sequencer_slip_recursively(Scene *scene, SlipData *data, int delta)

I guess this function is not recursive anymore?

I guess this function is not recursive anymore?
@ -579,0 +602,4 @@
return;
}
Sequence *seq_child;
for (seq_child = static_cast<Sequence *>(seq->seqbase.first); seq_child;

Please use LISTBASE_FOREACH macro

Please use `LISTBASE_FOREACH` macro
ok_what marked this conversation as resolved
ok what added 1 commit 2023-12-21 15:47:05 +01:00
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
693dfa3495
Changes from code review suggestions
ok what changed title from WIP: Fix: VSE Slip Strips operator doesn't move effect strips inside of a meta strip. to Fix: VSE Slip Strips operator doesn't move effect strips inside of a meta strip. 2023-12-21 15:48:18 +01:00
ok what requested review from Richard Antalik 2023-12-21 15:54:43 +01:00

Eeh and let's not forget this time.. @blender-bot build
Seem it doesn't work this way, wanted to try it anyway :)

Eeh and let's not forget this time.. @blender-bot build Seem it doesn't work this way, wanted to try it anyway :)

@blender-bot build

@blender-bot build
Richard Antalik merged commit 04efca91f9 into main 2023-12-21 18:05:07 +01:00
ok what deleted branch vse-slip-effect-bug 2023-12-30 09:02:16 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#113200
No description provided.