0

Extract path of source without frame number

I seem to feel like this already exists...

 

I'm trying to determine the path of a source without baked in frame numbers.  When users use shell expansion, frame numbers are explicitly baked it; and I imagine there's many other ways of specifying frames that will result in various formats.

 

So before I try to cover them all on my own, is there any sort of mu/python command that can extract the name of a path sans explicit frame numbers for use in accompanying scripts?

4 comments

  • 0
    Avatar
    Jon Morley

    Hi Michael,

    Are you trying to take something like:

    image.1.exr, image.2.exr, ... image.N.exr

    and get back:

    image.1-N@.exr

    Is that what you are trying to do? If not can you please give me a before and after kind of thing.

    Thanks,
    Jon

  • 0
    Avatar
    Michael Kessler

    Yeah; that's the sort of thing; only the expansion is happening from the shell.

     

    An artist types rv *.exr in a directory; which is essentially doing rv image.1.exr image.2.exr, image.N.exr...

  • 0
    Avatar
    Jon Morley

    Hi Michael,

    I found this in the Help -> Mu Commands API Browser...

    Path: commands.contractSequences

    contractSequences (string[]; 
                       string[] files)
    

    Description

    Given an array of file names, the function will attempt to contract them into image sequence notation. For example, the files:

     foo.0001.tif
     foo.0002.tif
     foo.0003.tif
     foo.0004.tif
    

    would result in a single sequence named foo.#.tif. See the rv user's manual for information about sequence notation.

    Please let me know if that works.

    Thanks,
    Jon

  • 0
    Avatar
    Johannes Hezer

    Hi Jon and Michael,

    rv.commands.sequenceOfFile("image.0001.exr")
    also tries to attempt to return "image.1-110#.exr"

     

    cheers

    johannes

Please sign in to leave a comment.