Katana Plug-in APIs 0.1
Public Member Functions

Foundry::Katana::FileSequence Class Reference

Primary class to derive from when implementing file sequence plugin. More...

#include <FnFileSequence.h>

Inheritance diagram for Foundry::Katana::FileSequence:
FileSeq

List of all members.

Public Member Functions

virtual bool isValid () const =0
 Return whether this instance contains a valid file sequence.
virtual FileSequenceclone () const =0
 Return new copy of this class instance.
virtual void getAsString (std::string &retValue)=0
 Get string representation of the file sequence.
virtual void getDirectory (std::string &retValue)=0
 Get the directory portion of file sequence.
virtual void getPrefix (std::string &retValue)=0
 Get the portion of file sequence before the frame number.
virtual void getSuffix (std::string &retValue)=0
 Get the portion of file sequence after the frame number.
virtual unsigned int getPadding ()=0
 Get the padding of the file sequence frame number.
virtual void getResolvedPath (const int frame, std::string &retValue)=0
 Get the filename for file sequence with sequence portion replaced by correctly padded frame.
virtual bool hasFrameSet ()=0
 Return whether file sequence has explicit frame set.
virtual bool isFrameInFrameSet (const int frame)=0
 Test whether frame is within explicit frame set.
virtual int getFirstFrameInFrameSet ()=0
 Return first frame in explicit frame set.
virtual int getLastFrameInFrameSet ()=0
 Return last frame in explicit frame set.
virtual void getNearestFramesInFrameSet (int frame, bool *hasLeft, int *nearestLeft, bool *hasRight, int *nearestRight)=0
 Return nearest frame to left and right of frame.
virtual void getFrameListFromFrameSet (std::vector< int > &returnList)=0
 Get frame set as list of integers.

Detailed Description

Primary class to derive from when implementing file sequence plugin.

File sequences are closely related to the asset system. A file sequence spec is a file path that contains tokens to be substituted with the current frame number. Some file sequence specs may also specify the frame range of the sequence.

An example from the FileSeq plugin: /path/to/image.1-10#.exr

This example references a sequence of images, frames 1 through 10, with the frame number zero-padded to length 4.

Resolving this sequence at frame 5 would result in: /path/to/image.0005.exr

In addition to implementing all the pure virtual functions in this class, you must also implement static methods in your derived class:

 // return a new instance of your derived class, owned by caller.
 static FileSequence * create(const char *);

 // return true if string is a valid file sequence
 static bool isFileSequence(const char*);

 // return a valid file sequence string built from input prefix/suffix/padding
 std::string buildFileSequenceString(const std::string &prefix, const std::string &suffix, int padding);

 // return a new FileSequenceArray instance containing sequences and non-sequence file paths found
 // in input file path list
 FileSequenceArray* findSequence(const char** fileList, unsigned int fileCount);

To indicate an error to the caller, your implemntation may throw an exception derived from std::exception.


Member Function Documentation

virtual void Foundry::Katana::FileSequence::getAsString ( std::string &  retValue) [pure virtual]

Get string representation of the file sequence.

Parameters:
retValueSet to file sequence string.

Implemented in FileSeq.

virtual void Foundry::Katana::FileSequence::getDirectory ( std::string &  retValue) [pure virtual]

Get the directory portion of file sequence.

Parameters:
retValueSet to directory portion of file sequence (e.g. "/a/b/c" for fileseq "/a/b/c/d.#.exr").

Implemented in FileSeq.

virtual int Foundry::Katana::FileSequence::getFirstFrameInFrameSet ( ) [pure virtual]

Return first frame in explicit frame set.

Returns:
First (minimum) frame in frame set. If file sequence does not have explicit frame set, always return 0.

Implemented in FileSeq.

virtual void Foundry::Katana::FileSequence::getFrameListFromFrameSet ( std::vector< int > &  returnList) [pure virtual]

Get frame set as list of integers.

Parameters:
returnListFill with integer frame numbers (e.g. [1,2,3,4,5] for "image.1-5#.exr").

Implemented in FileSeq.

virtual int Foundry::Katana::FileSequence::getLastFrameInFrameSet ( ) [pure virtual]

Return last frame in explicit frame set.

Returns:
Last (maximum) frame in frame set. If file sequence does not have explicit frame set, always return 0.

Implemented in FileSeq.

virtual void Foundry::Katana::FileSequence::getNearestFramesInFrameSet ( int  frame,
bool *  hasLeft,
int *  nearestLeft,
bool *  hasRight,
int *  nearestRight 
) [pure virtual]

Return nearest frame to left and right of frame.

Parameters:
frameFrame number to return nearest frames of.
hasLeftSet to true if frame exists in list to left of specified frame.
nearestLeftSet to nearest frame in list to left of specified frame.
hasRightSet to true if frame exists in list to right of specified frame.
nearestRightSet to nearest frame in list to right of specified frame.

Set return values to (false, 0, false, 0) if file sequence does not have explicit fram set.

Implemented in FileSeq.

virtual unsigned int Foundry::Katana::FileSequence::getPadding ( ) [pure virtual]

Get the padding of the file sequence frame number.

Returns:
Padding amount of file sequence (e.g. 4 for fileseq that expands to image.0001.exr)

Implemented in FileSeq.

virtual void Foundry::Katana::FileSequence::getPrefix ( std::string &  retValue) [pure virtual]

Get the portion of file sequence before the frame number.

Parameters:
retValueSet to prefix portion of file sequence (e.g. "/a/b/c/d." for fileseq "/a/b/c/d.#.exr").

Implemented in FileSeq.

virtual void Foundry::Katana::FileSequence::getResolvedPath ( const int  frame,
std::string &  retValue 
) [pure virtual]

Get the filename for file sequence with sequence portion replaced by correctly padded frame.

Parameters:
frameThe frame to get the filename.
retValueSet to resolved filename.

Implemented in FileSeq.

virtual void Foundry::Katana::FileSequence::getSuffix ( std::string &  retValue) [pure virtual]

Get the portion of file sequence after the frame number.

Parameters:
retValueSet to suffix portion of file sequence (e.g. ".exr" for fileseq "/a/b/c/d.#.exr").

Implemented in FileSeq.

virtual bool Foundry::Katana::FileSequence::hasFrameSet ( ) [pure virtual]

Return whether file sequence has explicit frame set.

Returns:
True if file sequence has explicit frame range (set) embedded in it (e.g. "image.1-10#.exr").

Implemented in FileSeq.

virtual bool Foundry::Katana::FileSequence::isFrameInFrameSet ( const int  frame) [pure virtual]

Test whether frame is within explicit frame set.

Returns:
True if frame is in frame set. If file sequence does not have explicit frame set, always return true.

Implemented in FileSeq.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator