justinfx / fileseq

A Python library for parsing frame ranges.
Other
253 stars 42 forks source link

Support for <UDIM> token? #109

Closed herronelou closed 2 years ago

herronelou commented 2 years ago

Hello.

I have some need to support <UDIM> as a token for the frame padding, which should be interpreted as %04d.

Is that something you could see being useful as part of the library? If so I could try to implement and make a pull request, if not I might just do my own branch.

justinfx commented 2 years ago

Can you point at some kind of documentation about this being a standard? There has been talk in the past about multi-dimension sequences and I implemented a prototype in a local branch but never pushed it. However I didn't have any support for quotes in a filepath because as far as I know that is not really a valid character for common paths?

herronelou commented 2 years ago

Looks like my initial message has had a formatting issue, it was meant to say <UDIM>, not empty quotes.

Some documentation about standard support for the format:

Houdini: https://www.sidefx.com/docs/houdini/vex/functions/expand_udim.html Maya: https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/Maya/files/GUID-132520C0-F1DF-4C74-B8C1-D89154ADFBDB-htm.html OpenImageIO: https://openimageio.readthedocs.io/en/latest/texturesys.html#udim-texture-atlases

herronelou commented 2 years ago

I see, github doesn't like <> in a message, I've edited my previous 2 posts.

herronelou commented 2 years ago

I guess if I implemented <UDIM> I should also do U and V and %(UDIM)d and <UVTILE>...

justinfx commented 2 years ago

Right, that makes sense then. Could you explain what changes you would be proposing and how they might look as an example? Just having a single new token type sounds easy enough if in practice its the same as the printf vs houdini vs etc patterns. But it seems that with UDIM it can require 2 input values. Is that not the case in what you are trying to solve?

herronelou commented 2 years ago

In my case, I only need the <UDIM> case, which is similar to %04d (starts at 1001, and goes up from there), so it's similar to the houdini $F, for the U and V patterns, it complicates things, as that's a 2D array.

Personally I'm okay with only implementing the <UDIM> and %(UDIM)d notations, that would have a lot less implications.

justinfx commented 2 years ago

Sure. I would be fine with merging extra format patterns in that case.

justinfx commented 2 years ago

Fixed via #113