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

Refactor filtering by explicit frames #1039

Merged
merged 12 commits into from
Dec 9, 2024

Conversation

kalisp
Copy link
Member

@kalisp kalisp commented Dec 5, 2024

Changelog Description

Simplified filtering of explicit frames set by artist in Publisher UI. This should be more explicit and safer.
Removed filtering on remainders, eg. single files as there is no real safe way how to get frame pattern there and it doesn't make sense for artist to filter on single file.

Testing notes:

  1. publish in your DCC of choice as usuall
  2. try set Frames to explicitly filter only specific frames
    image

Remainder has now real way to find frame pattern from single file. Doesn't make sense to filter on single file.
Previous implementation was naive and could be dangerous.
Updated docstrings. Renamed.
@kalisp kalisp added the type: enhancement Improvement of existing functionality or minor addition label Dec 5, 2024
@kalisp kalisp self-assigned this Dec 5, 2024
@ynbot ynbot added the size/XS label Dec 5, 2024
@64qam
Copy link
Member

64qam commented Dec 6, 2024

Return another error:

  File "C:\Users\qam\AppData\Local\Ynput\AYON\dependency_packages\ayon_2411211808_windows.zip\dependencies\pyblish\plugin.py", line 528, in __explicit_process
    runner(*args)
  File "C:\Users\qam\AppData\Local\Ynput\AYON\addons\deadline_0.5.0+dev\ayon_deadline\plugins\publish\nuke\submit_nuke_deadline.py", line 51, in process
    self._deadline_url = instance.data["deadline"]["url"]
KeyError: 'deadline'

…_safer' into chore/frames_to_render_filtering_safer
>>
["foo_v01.0001.exr"] - only explicitly requested frame returned
"""
found_frame_pattern_length = collection.padding
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do note that clique.assemble creates a clique.Collection where padding is 0 if it has no frame starting with 0 by default. See the assume_padded_when_ambiguous argument to clique.assemble in recent clique versions here.

The question is however whether that could be problematic. If e.g. someone has explicit frame to render 999 but the assembled sequence was 1001-1010 then padding would be zero instead of four meaning we'd get:

  • 999.exr
  • 1000.exr
  • 1001.exr

Instead of:

  • 0999.exr
  • 1000.exr
  • 1001.exr

Whether that's problematic, I'm not sure - just wanted to clarify that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, wouldn't it just work to do:

# Get overlapping frame ranges
included_frames = set(collection.indexes).intersection(frames_to_render)

# Create matching collection that refers to those frames
# and get their filenames.
collection = 
collection.indexes.clear()
collection.indexes.update(included_frames)
return list(collection)

Note that this changes the input collection - if you don't want that you may need to create a copy collection or just do:

included_frames = set(collection.indexes).intersection(frames_to_render)
real_collection = clique.Collection(
    collection.head,
    collection.tail,
    collection.padding,
    indexes=included_frames
)
return list(real_collection)

@kalisp kalisp requested a review from BigRoy December 9, 2024 11:54
Copy link
Collaborator

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

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

Didn't test - but code changes make sense.

@kalisp kalisp merged commit 3b0154c into develop Dec 9, 2024
3 checks passed
@kalisp kalisp deleted the chore/frames_to_render_filtering_safer branch December 9, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS type: enhancement Improvement of existing functionality or minor addition
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants