Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for find_children() with stacks #2 #1766

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

darbyjohnston
Copy link
Contributor

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.

@codecov-commenter
Copy link

codecov-commenter commented Jun 14, 2024

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 12 commits behind head on main.

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%) ⬇️

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

Files Coverage Δ
src/opentimelineio/composition.h 65.51% <ø> (ø)
tests/test_track.py 96.77% <100.00%> (+1.42%) ⬆️
src/opentimelineio/stack.cpp 63.38% <75.00%> (-6.47%) ⬇️

... 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.

@darbyjohnston
Copy link
Contributor Author

@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?

@jminor
Copy link
Collaborator

jminor commented Jun 20, 2024

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.

Signed-off-by: Darby Johnston <[email protected]>
@darbyjohnston
Copy link
Contributor Author

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
Copy link
Contributor Author

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

Copy link
Collaborator

@jminor jminor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. The use of trimmed_range_in_parent looks correct to me :)

@darbyjohnston
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

find_children is broken with two tracks.
3 participants