00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef TIL_FILE_SEQUENCE_H
00021 #define TIL_FILE_SEQUENCE_H
00022
00023 #include "TIL_API.h"
00024 #include <sys/types.h>
00025 #include <UT/UT_String.h>
00026 #include <UT/UT_Rect.h>
00027 #include <UT/UT_BitArray.h>
00028 #include <UT/UT_PtrArray.h>
00029 #include <UT/UT_RefArray.h>
00030 #include <UT/UT_IntArray.h>
00031
00032 #include "TIL_Defines.h"
00033
00034 class IMG_Stat;
00035 class TIL_Sequence;
00036 class til_FrameInfo;
00037
00038 class TIL_API TIL_FileSequence
00039 {
00040 public:
00041 TIL_FileSequence();
00042 virtual ~TIL_FileSequence();
00043
00044 TIL_FileSequence &operator=(const TIL_FileSequence &);
00045
00046
00047 int setNewPattern(const char *filepattern);
00048
00049
00050
00051 int getFileInfo(TIL_Sequence &seq_info,
00052 int override_size = 0,
00053 int override_range = 0,
00054 TIL_DataFormat *depth_override = 0,
00055 int use_rgba = 0,
00056 bool useframe = false, int frame = 0,
00057 bool clearseq = true,
00058 bool coloronly = false,
00059 bool fractional = false);
00060
00061 int getSingleFileInfo(const char *name, TIL_Sequence &seq_info,
00062 bool override_size = true,
00063 TIL_DataFormat *override_depth = 0,
00064 int use_rgba = 0,
00065 bool clearseq = true,
00066 bool coloronly = false);
00067
00068
00069
00070 bool getFrameRange(int &start, int &end, bool fractional=false);
00071
00072
00073
00074 bool getFilename(UT_String &name, int frame = 0x80000000);
00075
00076 bool doesFrameExist(const UT_String &framename) const;
00077 bool doesFrameExist(int frame) const;
00078 int getClosestFrame(int to_frame) const;
00079 int getClosestPrevFrame(int to_frame) const;
00080 int getClosestNextFrame(int to_frame) const;
00081
00082
00083
00084 int getFrameStep();
00085
00086
00087
00088
00089 bool isSingleFrame() const { return myFrameSingle ? 1 : 0; }
00090
00091 int getNumFrames() const { return myFrames.entries(); }
00092
00093
00094
00095
00096
00097
00098
00099 bool isMovieFile() const;
00100
00101 int isTopFirstImage() const { return myIsTopFirst; }
00102 IMG_ColorModel getColorModel() const { return myColorModel; }
00103
00104
00105
00106
00107 bool getFileDigits(int &digits) const;
00108 void setFileDigits(int digits);
00109
00110 int getFractionFrameIndex(float frame) const;
00111
00112 UT_InclusiveRect getBounds(int frame, bool &streak);
00113 UT_InclusiveRect getBounds(const char *filename, bool &streak);
00114
00115
00116 void markBadFrame(int frame);
00117
00118 void resetBadFrames();
00119
00120
00121 const UT_IntArray &getBadFrames() const { return myBadFrames; }
00122
00123 void setComment(const UT_String &comment, int frame);
00124 void getComment(UT_String &comment, int frame) const;
00125
00126 private:
00127 int getInfoForFilename(const char *name, TIL_Sequence &seq_info,
00128 bool override_size = true,
00129 TIL_DataFormat *override_depth = 0,
00130 int use_rgba = 0,
00131 bool clearseq = true,
00132 bool coloronly = false);
00133
00134 int lookupRange(char sepchar, bool fractional);
00135 void removeBadFrames();
00136 void reorganizeFractions();
00137 void clearBoundsCache();
00138 UT_InclusiveRect getBoundsByIndex(int index, bool &streak);
00139
00140 static int compareFileToRange(const char *filename, void *me);
00141 static int checkExist(const char *filename, void *me);
00142
00143 UT_String myFilePattern;
00144 UT_String myMatchPattern;
00145 int myFileNumberDigits;
00146 IMG_Stat *myStat;
00147 IMG_ColorModel myColorModel;
00148 int myIsTopFirst;
00149
00150
00151 int myFrameStart;
00152 int myFrameSingle;
00153 int myFrameEnd;
00154 int myFrameInit;
00155 int myFrameHasFraction;
00156 float myFrameFractionScale;
00157 bool myFractional;
00158 UT_PtrArray<til_FrameInfo *> myFrames;
00159 UT_IntArray myBadFrames;
00160 UT_String myBase, mySuffix;
00161 UT_String myPath;
00162 bool myUserSpecifiedDigits;
00163 UT_BitArray myCachedBoundsFrame;
00164 UT_RefArray<UT_InclusiveRect> myCachedBounds;
00165 UT_BitArray myCachedBoundsStreak;
00166 };
00167
00168 #endif