//- // ========================================================================== // Copyright (C) 1995 - 2005 Alias Systems Corp. and/or its licensors. All // rights reserved. // // The coded instructions, statements, computer programs, and/or related // material (collectively the "Data") in these files are provided by Alias // Systems Corp. ("Alias") and/or its licensors for the exclusive use of the // Customer (as defined in the Alias Software License Agreement that // accompanies this Alias software). Such Customer has the right to use, // modify, and incorporate the Data into other products and to distribute such // products for use by end-users. // // THE DATA IS PROVIDED "AS IS". ALIAS HEREBY DISCLAIMS ALL WARRANTIES // RELATING TO THE DATA, INCLUDING, WITHOUT LIMITATION, ANY AND ALL EXPRESS OR // IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. IN NO EVENT SHALL ALIAS BE LIABLE FOR ANY DAMAGES // WHATSOEVER, WHETHER DIRECT, INDIRECT, SPECIAL, OR PUNITIVE, WHETHER IN AN // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, OR IN EQUITY, // ARISING OUT OF ACCESS TO, USE OF, OR RELIANCE UPON THE DATA. // ========================================================================== //+ // // File Name: animFileUitls.h // // Description: // // #ifndef _animFileUtils #define _animFileUtils #include #include #include #include class MArgList; // The base class for the translators. // class animBase { public: animBase(); virtual ~animBase(); enum AnimBaseType {kAnimBaseUnitless, kAnimBaseTime, kAnimBaseLinear, kAnimBaseAngular}; const char * tangentTypeAsWord(MFnAnimCurve::TangentType); MFnAnimCurve::TangentType wordAsTangentType(char *); const char * infinityTypeAsWord(MFnAnimCurve::InfinityType); MFnAnimCurve::InfinityType wordAsInfinityType(const char *); const char * outputTypeAsWord(MFnAnimCurve::AnimCurveType); MFnAnimCurve::AnimCurveType typeAsAnimCurveType(AnimBaseType, AnimBaseType); AnimBaseType wordAsOutputType(const char *); AnimBaseType wordAsInputType(const char *); const char * boolInputTypeAsWord(bool); double asDouble(ifstream &); char * asString(ifstream &); char * asWord(ifstream &, bool = false); char asChar(ifstream &); bool isNextNumeric(ifstream &); bool isEquivalent(double, double); protected: void resetUnits(); void advance(ifstream &); MTime::Unit timeUnit; MAngle::Unit angularUnit; MDistance::Unit linearUnit; }; class MAnimCurveClipboard; class MAnimCurveClipboardItem; class animReader : public animBase { public: animReader(); virtual ~animReader(); MStatus readClipboard(ifstream &, MAnimCurveClipboard&); protected: bool readAnimCurve(ifstream&, MAnimCurveClipboardItem&); void convertAnglesAndWeights2To3(MFnAnimCurve::AnimCurveType, bool, MAngle &, double &); void convertAnglesAndWeights3To2(MFnAnimCurve::AnimCurveType, bool, MAngle &, double &); bool convertAnglesFromV2To3; bool convertAnglesFromV3To2; double animVersion; }; class animWriter : public animBase { public: animWriter(); virtual ~animWriter(); MStatus writeClipboard( ofstream&, const MAnimCurveClipboard&, bool = false, bool = false); protected: bool writeHeader(ofstream&); bool writeAnim( ofstream&, const MAnimCurveClipboardItem&, bool = false, bool = false); bool writeAnimCurve( ofstream&, const MObject *, MFnAnimCurve::AnimCurveType, bool = false); }; class animUnitNames { public: animUnitNames(); virtual ~animUnitNames(); static void setToLongName(const MAngle::Unit&, MString&); static void setToShortName(const MAngle::Unit&, MString&); static void setToLongName(const MDistance::Unit&, MString&); static void setToShortName(const MDistance::Unit&, MString&); static void setToLongName(const MTime::Unit&, MString&); static void setToShortName(const MTime::Unit&, MString&); static bool setFromName(const MString&, MAngle::Unit&); static bool setFromName(const MString&, MDistance::Unit&); static bool setFromName(const MString&, MTime::Unit&); }; #endif /* _animFileUtils */