ynput / ayon-maya

Maya addon for AYON
Apache License 2.0
6 stars 9 forks source link

Alembic Exports: Do not force a preroll starting at frame 0 #151

Closed BigRoy closed 1 month ago

BigRoy commented 1 month ago

Changelog Description

Fixes Alembic Exports always defaulting to include a preroll run-up to the export from the preRollStartFrame, which defaulted to 0.

Also fixes this warning always being logged:

# Warning: Ignoring unsupported flag: -verbose

Additional info

The "pre roll" was not included in the exported data - but it did mean that for EVERY alembic export we basically ended up stepping through the frame ranges from frame 0 up to the start frame of the Alembic to export.

I'd say this is actually quite an inconvenience for scenes that happen to also be heavy to step through time before the start frame because it'd heavily influence the time taken if you actually did not care about pre roll at all.

The bug was introduced around April/May via these PRs:

I believe it all came from a misconception about what the preRoll argument on the AbcExport command was supposed to do. To explain that I'll just quote what I wrote as comment in the code for this PR:

Our logic is that preroll means:

  • True: include a preroll from preRollStartFrame to the start frame that is not included in the exported file. Just 'roll up' the export from there.
  • False: do not roll up from preRollStartFrame.

AbcExport however approaches this very differently.

A call to AbcExport allows to export multiple "jobs" of frame ranges in one go. Using -preroll argument there means: this one job in the full list of jobs SKIP writing these frames into the Alembic.

In short, marking that job as just preroll.

Then additionally, separate from -preroll the AbcExport command allows to supply preRollStartFrame which, when not None, means always RUN UP from that start frame. Since our preRollStartFrame is always an integer attribute we will convert the attributes so they behave like how we intended them initially

Testing notes:

How to debug

The easiest way to test this is to enable "Verbose" in settings: ayon+settings://maya/publish/ExtractAlembic/verbose image

You will then end up seeing the frame numbers printed by the Alembic Exporter - e.g. this: image

Going all the way from frame zero.

What to test

  1. Alembic Exports should not default to prerolling from frame 0.
  2. Enabling preroll on Alembic export for settings should still allow enabling the preroll.

Others that would be affected also calling extract_alembic and should now also NOT preroll from frame 0 but they did before this PR: