kfbxiosettings.h

Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_KFBXIO_KFBXIOSETTINGS_H
00005 #define FBXFILESDK_KFBXIO_KFBXIOSETTINGS_H
00006 
00007 /**************************************************************************************
00008 
00009  Copyright (C) 2001 - 2010 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
00039 
00040 **************************************************************************************/
00041 #include <fbxfilesdk/fbxfilesdk_def.h>
00042 
00043 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00044 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00045 
00046 #include <fbxfilesdk/kfbxplugins/kfbxobject.h>
00047 
00048 #include <fbxfilesdk/components/libxml2-2.6.4/libxml.h>
00049 #include <fbxfilesdk/components/libxml2-2.6.4/include/libxml/parser.h>
00050 #include <fbxfilesdk/components/libxml2-2.6.4/include/libxml/tree.h>
00051 #include <fbxfilesdk/components/libxml2-2.6.4/include/libxml/globals.h>
00052 
00053 // undef the macro mkdir, since it conflict with function mkdir in Qt\4.2.3\src\corelib\io\qdir.h
00054 #if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(mkdir)
00055     #undef mkdir
00056 #endif
00057 
00058 #include <fbxfilesdk/kfbxplugins/kfbxtypes.h>
00059 
00060 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00061 
00062 #include <fbxfilesdk/kfbxio/kfbxiosettingspath.h>
00063 
00064 #define IOSVisible    true
00065 #define IOSHidden     false
00066 
00067 #define IOSSavable    true
00068 #define IOSNotSavable false
00069 
00070 #define IOSEnabled    true
00071 #define IOSDisabled   false
00072 
00073 #define IOSBinary     0
00074 #define IOSASCII      1
00075 
00076 class KFbxIOSettings;
00077 
00078 // class to handle old StreamOptions information
00079 class KsoInfo
00080 {
00081 
00082 public: enum EIMPEXP
00083 {
00084     eIMPORT = 0,
00085     eEXPORT
00086 };
00087 
00088 public:
00090     KsoInfo();
00091 
00093     void Reset(EIMPEXP pImpExp);
00094     
00096     void SetTimeMode(KTime::ETimeMode pTimeMode, double pCustomFrameRate = 0.0);
00097 
00099     KTime::ETimeMode GetTimeMode(){ return mTimeMode; }
00100 
00102     KTime GetFramePeriod();
00103     
00104     void SetASFScene(KFbxObject* pASFScene, bool pASFSceneOwned = false);
00105     KFbxObject* GetASFScene(){ return mASFScene; }
00106 
00107     void Set_IOS(KFbxIOSettings *pios){ios = pios;}
00108 
00109     //-----------------
00110     // data
00111 
00112 private: 
00113         KTime::ETimeMode mTimeMode;
00114         KFbxObject * mASFScene;
00115 
00116         EIMPEXP mImpExp;
00117 
00118         KFbxIOSettings *ios;
00119 };
00120 
00121 class KFbxSdkManager;
00122 
00123 
00124 // http://www.microsoft.com/globaldev/reference/winxp/langtla.mspx
00125 
00126 //  LOCALE                            TLA  LCID
00127 
00128 //  English - United States           ENU  0409
00129 //  German - Germany                  DEU  0407
00130 //  French - France                   FRA  040c
00131 //  Japanese - Japan                  JPN  0411
00132 //  Korean(Extended Wansung) - Korea  KOR  0412
00133 //  Chinese - PRC                     CHS  0804
00134 
00135 enum FBXUILANGUAGE
00136 {
00137     eENU = 0,                   // MAX 409 English - United States
00138     eDEU,                       // MAX 407 German - Germany
00139     eFRA,                       // MAX 40c French - France
00140     eJPN,                       // MAX 411 Japanese - Japan
00141     eKOR,                       // MAX 412 Korean(Extended Wansung) - Korea 
00142     eCHS,                       // MAX 804 Chinese - PRC
00143     eFBXUILANGUAGE_COUNT
00144 };
00145 
00146 // this class is located in the UserDataPtr of each KFbxIOSettings properties
00147 class PropInfo
00148 {
00149 public:
00150     PropInfo();
00151     ~PropInfo();
00152 
00153     void            * UIWidget;            // UI widget for showing the property
00154     void            * cbValueChanged;      // call back when value changed
00155     void            * cbDirty;             // call back when value changed
00156     KStringList       labels;              // list of labels in many languages
00157 };
00158 
00165 class KFBX_DLL KFbxIOSettings : public KFbxObject
00166 {
00167     KFBXOBJECT_DECLARE(KFbxIOSettings,KFbxObject);
00168 
00169 public:
00170     virtual void Destruct(bool pRecursive, bool pDependents);
00171 
00177     KFbxProperty AddPropertyGroup(char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00178 
00188 public: KFbxProperty AddPropertyGroup(  KFbxProperty const &pParentProperty, 
00189                                         char const*         pName, 
00190                                         KFbxDataType const &pDataType      = KFbxDataType(), 
00191                                         char const*         pLabel         = "",
00192                                         bool                pVisible       = true,
00193                                         bool                pSavable       = true,
00194                                         bool                pEnabled       = true
00195                                      );
00196 
00208 public: KFbxProperty AddProperty(    KFbxProperty const     &pParentProperty, 
00209                                      char const*            pName, 
00210                                      KFbxDataType const     &pDataType      = KFbxDataType(), 
00211                                      char const*            pLabel          = "",
00212                                      void const*            pValue          = NULL,
00213                                      EFbxType               pValueType      = eUNIDENTIFIED,
00214                                      bool                   pVisible        = true,
00215                                      bool                   pSavable        = true,
00216                                      bool                   pEnabled        = true
00217                                    );
00218 
00232 public: KFbxProperty AddPropertyMinMax(    KFbxProperty const     &pParentProperty, 
00233                                      char const*            pName, 
00234                                      KFbxDataType const     &pDataType      = KFbxDataType(), 
00235                                      char const*            pLabel          = "",
00236                                      void const*            pValue          = NULL,
00237                                      double const*          pMinValue       = NULL,
00238                                      double const*          pMaxValue       = NULL,
00239                                      EFbxType               pValueType      = eUNIDENTIFIED,                                     
00240                                      bool                   pVisible        = true,
00241                                      bool                   pSavable        = true,
00242                                      bool                   pEnabled        = true
00243                                    );
00244 
00245 
00249 public: KFbxProperty GetProperty(char const* pName) const;
00250 
00255 public: KFbxProperty GetProperty(KFbxProperty const &pParentProperty, char const* pName) const;
00256 
00261 public: bool GetBoolProp(char const* pName, bool pDefValue) const;
00262 
00267 public: void SetBoolProp(char const* pName, bool pValue);
00268 
00273 public: double GetDoubleProp(char const* pName, double pDefValue) const;
00274 
00279 public: void   SetDoubleProp(char const* pName, double pValue);
00280 
00285 public: int    GetIntProp(char const* pName, int pDefValue) const;
00286 
00291 public: void   SetIntProp(char const* pName, int pValue);
00292 
00297 public: KTime  GetKTimeProp(char const* pName, KTime pDefValue) const;
00298 
00303 public: void   SetKTimeProp(char const* pName, KTime pValue);
00304 
00309 public: KString GetEnumProp(char const* pName, KString pDefValue) const;
00310 
00315 public: int     GetEnumProp(char const* pName, int pDefValue) const;
00316 
00321 public: int     GetEnumIndex(char const* pName, KString pValue) const;
00322 
00327 public: void    SetEnumProp(char const* pName, KString pValue);
00328 
00333 public: void    SetEnumProp(char const* pName, int pValue);
00334 
00339 public: void    RemoveEnumPropValue(char const* pName, KString pValue);
00340 
00344 public: void    EmptyEnumProp(char const* pName);
00345 
00350 public: bool    IsEnumExist(KFbxProperty& pProp, KString& enumString) const;
00351 
00357 public: int     GetEnumIndex(KFbxProperty& pProp, KString& enumString, bool pNoCase = false) const;
00358 
00364 public: bool    SetFlag(char const* pName, FbxPropertyFlags::eFbxPropertyFlags propFlag, bool pValue);
00365 
00370 public: KString GetStringProp(char const* pName, KString pDefValue) const;
00371 
00376 public: void    SetStringProp(char const* pName, KString pValue);
00377 
00382 public: virtual bool ReadXMLFile(KString& path);
00383 
00388 public: virtual bool WriteXMLFile(KString& path);
00389 
00395 public: bool WriteXmlPropToFile(KString& pFullPath, KString& propPath);
00396 
00397 
00398 
00400 //
00401 //  WARNING!
00402 //
00403 //  Anything beyond these lines may not be documented accurately and is
00404 //  subject to change without notice.
00405 //
00407 
00408 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00409 
00410 // protected constructor
00411 protected:  KFbxIOSettings(KFbxSdkManager& pManager,char const* pName);
00412 
00413 // the caller must delete the KString returned
00414 private:    KString* GetAttributeFromXmlNode(xmlNode* node, KString* attName);
00415 
00416 // the caller must delete the KString returned
00417 private:    KString* GetInnerTextXmlNode(xmlNode* node);
00418 
00419 private:    void CreatePropRecursive(xmlNode* pNode, KFbxProperty& pPropParent);
00420 public:     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pType) const;
00421 
00422 private:    xmlNode* GetChildXmlNode(xmlNode* parent, KString* nodeName);
00423 private:    xmlNode* AddChildXmlNode(xmlNode* parent, KString* nodeName, KString* nodeValue = NULL);
00424 private:    xmlAttr* AddAttributeToXmlNode(xmlNode* node, KString* attName, KString* attValue = NULL);
00425 
00426 private:    void AddNewPropInfo(KFbxProperty &pProp);
00427 private:    void DeletePropInfo(KFbxProperty &pProp);
00428 private:    void DeleteAllPropInfo(KFbxProperty &pProp);
00429 
00430 public:     PropInfo * GetPropInfo(KFbxProperty &pProp);
00431 
00432 public:     FBXUILANGUAGE UILanguage;
00433 public:     KString GetLanguageLabel(KFbxProperty &pProp);
00434 public:     void SetLanguageLabel(KFbxProperty &pProp, KString &pLabel);
00435 public:     FBXUILANGUAGE Get_Max_Runtime_Language(KString regLocation);
00436 
00437 public:     KsoInfo impInfo;
00438 public:     KsoInfo expInfo;
00439 
00440             // add recurively a xml node equivalent for a KFbxProperty and all child KFbxProperties
00441 private:    void AddXMLProp(KFbxProperty& pProp, xmlNodePtr pParent, xmlDocPtr pXmlDoc);
00442 
00443             // create a new xmlNode with all KFbxProperty info
00444 private:    xmlNodePtr GetXMLNode(KFbxProperty& pProp);
00445 
00446 public:     static KString GetUserMyDocumentDir();
00447 public:     void SetPropVisible(KFbxProperty &pProp, bool pWithChildren, bool pVisible);
00448 
00449 public:     virtual bool ConstructProperties(bool pForceSet);
00450 
00451             // Read an XML file from MyDocument dir
00452 public:     bool ReadXmlPropFromMyDocument(KString& subDir, KString& filename);
00453 
00454             // Write property branch to an XML file in MyDocument dir
00455 public:     bool WriteXmlPropToMyDocument(KString& subDir, KString& filename, KString& propPath);
00456 
00457 public: enum ELoadMode         { eMERGE, eEXCLUSIVE_MERGE, eCREATE };
00458 public: enum EQuaternionMode   { eAS_QUATERNION, eAS_EULER, eRESAMPLE };
00459 public: enum EObjectDerivation { eBY_LAYER, eBY_ENTITY, eBY_BLOCK }; 
00460 
00461 public: enum ESysUnits
00462     {
00463         kUNITS_USER,
00464         kUNITS_INCHES, 
00465         kUNITS_FEET,
00466         kUNITS_YARDS,
00467         kUNITS_MILES,
00468         kUNITS_MILLIMETERS,
00469         kUNITS_CENTIMETERS,
00470         kUNITS_METERS,
00471         kUNITS_KILOMETERS
00472     };
00473 
00474 public: enum ESysFrameRate  
00475     {
00476         kFRAMERATE_USER,
00477         kFRAMERATE_HOURS,
00478         kFRAMERATE_MINUTES,
00479         kFRAMERATE_SECONDS,
00480         kFRAMERATE_MILLISECONDS,
00481         kFRAMERATE_GAMES_15,
00482         kFRAMERATE_FILM_24,
00483         kFRAMERATE_PAL_25,
00484         kFRAMERATE_NTSC_30,
00485         kFRAMERATE_SHOWSCAN_48,
00486         kFRAMERATE_PALFIELD_50,
00487         kFRAMERATE_NTSCFIELD_60
00488     };
00489     
00490 // Max
00491 public: enum EEnveloppeSystem
00492     {
00493         eSKIN_MODIFIER,
00494         ePHYSIQUE,
00495         eBONESPRO,
00496         eENVELOPPE_SYSTEM_COUNT
00497     };
00498 
00499 // Max
00500 public: enum EGeometryType
00501     {
00502         eTRIANGLE,
00503         eSIMPLIFIED_POLY,
00504         ePOLY,
00505         eNURB,
00506         ePATCH,
00507         eGEOMETRY_TYPE_COUNT
00508     };
00509 
00510 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00511 
00512 };
00513 
00514 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00515 
00516 #endif // FBXFILESDK_KFBXIO_KFBXIOSETTINGS_H
00517