OpenTimelineIO icon indicating copy to clipboard operation
OpenTimelineIO copied to clipboard

Fix for find_children() with stacks #2

Open darbyjohnston opened this issue 1 year ago • 6 comments

Fixes #1652

This PR is a replacement for #1755 which has some trouble with the git history.

After some investigation, it looks like the find_children() function was not working with stacks when given a search range. To fix this, an override is added for the function children_in_range() that works with "stacks" of children.

darbyjohnston avatar Jun 14 '24 17:06 darbyjohnston

Codecov Report

Attention: Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.

Project coverage is 81.69%. Comparing base (c0e97b0) to head (3a61e3c). Report is 57 commits behind head on main.

Files with missing lines Patch % Lines
src/opentimelineio/stack.cpp 75.00% 0 Missing and 2 partials :warning:

:x: Your changes status has failed because you have indirect coverage changes. Learn more about Unexpected Coverage Changes and reasons for indirect coverage changes.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1766      +/-   ##
==========================================
- Coverage   84.11%   81.69%   -2.43%     
==========================================
  Files         198      176      -22     
  Lines       22241    12342    -9899     
  Branches     4687     3027    -1660     
==========================================
- Hits        18709    10083    -8626     
+ Misses       2610     1723     -887     
+ Partials      922      536     -386     
Flag Coverage Δ
py-unittests 81.69% <92.59%> (-2.43%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/opentimelineio/composition.h 65.51% <ø> (ø)
tests/test_track.py 96.77% <100.00%> (+1.42%) :arrow_up:
src/opentimelineio/stack.cpp 63.38% <75.00%> (-6.47%) :arrow_down:

... and 66 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e10fdd2...3a61e3c. Read the comment docs.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Jun 14 '24 17:06 codecov-commenter

@jminor Sorry, I managed to mess up the git history on the previous PR while trying to update with the latest changes from main. I created this new PR as a replacement.

I believe your last comment was about using trimmed_range_in_parent() and testing with a source range on the track? I didn't realize that tracks could have source ranges, what would that test look like?

darbyjohnston avatar Jun 14 '24 18:06 darbyjohnston

There's an example of a track with a source_range in Figure 3 here: https://opentimelineio.readthedocs.io/en/stable/tutorials/otio-timeline-structure.html In that diagram, Track-003 is offset by using a source_range with a negative start time. A simpler use case would be to use a track's source range to just trim a nested track to a sub-range of the whole track.

There's also an example of a stack with a source_range in Figure 4 on that same page. In that case the source_range is used to trim the nested stack. Although rare, the source_range could be set on the top level stack of a timeline also.

jminor avatar Jun 20 '24 17:06 jminor

Thanks, those figures were very helpful; I guess I should have checked there first. :)

I changed the code to use trimmed_range_in_parent() and added extra C++ tests that put various source ranges on the track. If the C++ tests look OK I will update the Python tests to match.

darbyjohnston avatar Jun 22 '24 01:06 darbyjohnston

@jminor Just checking if you have time to review the latest changes?

darbyjohnston avatar Jul 12 '24 16:07 darbyjohnston

Thanks!

darbyjohnston avatar Jul 12 '24 18:07 darbyjohnston