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 
00054 // undef the macro mkdir, since it conflict with function mkdir in Qt\4.2.3\src\corelib\io\qdir.h
00055 #if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(mkdir)
00056     #undef mkdir
00057 #endif
00058 
00059 #include <fbxfilesdk/kfbxplugins/kfbxtypes.h>
00060 
00061 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00062 
00063 #include <fbxfilesdk/kfbxio/kfbxiosettingspath.h>
00064 
00065 #define IOSVisible    true
00066 #define IOSHidden     false
00067 
00068 #define IOSSavable    true
00069 #define IOSNotSavable false
00070 
00071 #define IOSEnabled    true
00072 #define IOSDisabled   false
00073 
00074 #define IOSBinary     0
00075 #define IOSASCII      1
00076 
00077 class KFbxIOSettings;
00078 
00079 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00080 
00082 class KsoInfo
00083 {
00084 
00085 public: enum EIMPEXP
00086 {
00087     eIMPORT = 0,
00088     eEXPORT
00089 };
00090 
00091 public:
00093     KsoInfo();
00094 
00096     void Reset(EIMPEXP pImpExp);
00097     
00099     void SetTimeMode(KTime::ETimeMode pTimeMode, double pCustomFrameRate = 0.0);
00100 
00102     KTime::ETimeMode GetTimeMode(){ return mTimeMode; }
00103 
00105     KTime GetFramePeriod();
00106     
00107     void SetASFScene(KFbxObject* pASFScene, bool pASFSceneOwned = false);
00108     KFbxObject* GetASFScene(){ return mASFScene; }
00109 
00110     void Set_IOS(KFbxIOSettings *pios){ios = pios;}
00111 
00112 
00113 private: 
00114 
00115     KTime::ETimeMode mTimeMode;
00116     KFbxObject * mASFScene;
00117 
00118     EIMPEXP mImpExp;
00119 
00120     KFbxIOSettings *ios;
00121 };
00122 
00123 #endif // DOXYGEN_SHOULD_SKIP_THIS
00124 
00125 class KFbxSdkManager;
00126 
00127 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00128 
00131 // http://www.microsoft.com/globaldev/reference/winxp/langtla.mspx
00132 
00133 //  LOCALE                            TLA  LCID
00134 
00135 //  English - United States           ENU  0409
00136 //  German - Germany                  DEU  0407
00137 //  French - France                   FRA  040c
00138 //  Japanese - Japan                  JPN  0411
00139 //  Korean(Extended Wansung) - Korea  KOR  0412
00140 //  Chinese - PRC                     CHS  0804
00141 
00142 enum FBXUILANGUAGE
00143 {
00144     eENU = 0,                   // MAX 409 English - United States
00145     eDEU,                       // MAX 407 German - Germany
00146     eFRA,                       // MAX 40c French - France
00147     eJPN,                       // MAX 411 Japanese - Japan
00148     eKOR,                       // MAX 412 Korean(Extended Wansung) - Korea 
00149     eCHS,                       // MAX 804 Chinese - PRC
00150     eFBXUILANGUAGE_COUNT
00151 };
00152 
00153 // this class is located in the UserDataPtr of each KFbxIOSettings properties
00154 class PropInfo
00155 {
00156 public:
00157     PropInfo();
00158     ~PropInfo();
00159 
00160     void            * UIWidget;            // UI widget for showing the property
00161     void            * cbValueChanged;      // call back when value changed
00162     void            * cbDirty;             // call back when value changed
00163     KStringList       labels;              // list of labels in many languages
00164 };
00165 #endif // DOXYGEN_SHOULD_SKIP_THIS
00166 
00291 class KFBX_DLL KFbxIOSettings : public KFbxObject
00292 {
00293     KFBXOBJECT_DECLARE(KFbxIOSettings,KFbxObject);
00294 
00295 public:
00296 
00301     virtual void Destruct(bool pRecursive, bool pDependents);
00302 
00309     KFbxProperty AddPropertyGroup(char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00310 
00321     KFbxProperty AddPropertyGroup(  KFbxProperty const &pParentProperty, 
00322                                         char const*         pName, 
00323                                         KFbxDataType const &pDataType      = KFbxDataType(), 
00324                                         char const*         pLabel         = "",
00325                                         bool                pVisible       = true,
00326                                         bool                pSavable       = true,
00327                                         bool                pEnabled       = true
00328                                      );
00329 
00342     KFbxProperty AddProperty(    KFbxProperty const     &pParentProperty, 
00343                                      char const*            pName,      
00344                                      KFbxDataType const     &pDataType      = KFbxDataType(), 
00345                                      char const*            pLabel          = "",
00346                                      void const*            pValue          = NULL,
00347                                      EFbxType               pValueType      = eUNIDENTIFIED,
00348                                      bool                   pVisible        = true,
00349                                      bool                   pSavable        = true,
00350                                      bool                   pEnabled        = true
00351                                    );
00352 
00368     KFbxProperty AddPropertyMinMax(    KFbxProperty const     &pParentProperty, 
00369                                      char const*            pName, 
00370                                      KFbxDataType const     &pDataType      = KFbxDataType(), 
00371                                      char const*            pLabel          = "",
00372                                      void const*            pValue          = NULL,
00373                                      double const*          pMinValue       = NULL,
00374                                      double const*          pMaxValue       = NULL,
00375                                      EFbxType               pValueType      = eUNIDENTIFIED,                                     
00376                                      bool                   pVisible        = true,
00377                                      bool                   pSavable        = true,
00378                                      bool                   pEnabled        = true
00379                                    );
00380 
00381 
00388     KFbxProperty GetProperty(char const* pName) const;
00389 
00396     KFbxProperty GetProperty(KFbxProperty const &pParentProperty, char const* pName) const;
00397 
00403     bool GetBoolProp(char const* pName, bool pDefValue) const;
00404 
00409     void SetBoolProp(char const* pName, bool pValue);
00410 
00416     double GetDoubleProp(char const* pName, double pDefValue) const;
00417 
00422     void   SetDoubleProp(char const* pName, double pValue);
00423 
00429     int    GetIntProp(char const* pName, int pDefValue) const;
00430 
00435     void   SetIntProp(char const* pName, int pValue);
00436 
00441     KTime  GetKTimeProp(char const* pName, KTime pDefValue) const;
00442 
00448     void   SetKTimeProp(char const* pName, KTime pValue);
00449 
00468     
00474     KString GetEnumProp(char const* pName, KString pDefValue) const;
00475 
00481     int     GetEnumProp(char const* pName, int pDefValue) const;
00482 
00488     int     GetEnumIndex(char const* pName, KString pValue) const;
00489 
00495     void    SetEnumProp(char const* pName, KString pValue);
00496 
00502     void    SetEnumProp(char const* pName, int pValue);
00503 
00511     void    RemoveEnumPropValue(char const* pName, KString pValue);
00512 
00516     void    EmptyEnumProp(char const* pName);
00517 
00523     bool    IsEnumExist(KFbxProperty& pProp, KString& enumString) const;
00524 
00531     int     GetEnumIndex(KFbxProperty& pProp, KString& enumString, bool pNoCase = false) const;
00533 
00540     bool    SetFlag(char const* pName, FbxPropertyFlags::eFbxPropertyFlags propFlag, bool pValue);
00541 
00547     KString GetStringProp(char const* pName, KString pDefValue) const;
00548 
00553     void    SetStringProp(char const* pName, KString pValue);
00554 
00557      
00562     virtual bool ReadXMLFile(KString& path);
00563 
00569     virtual bool WriteXMLFile(KString& path);
00570 
00577     bool WriteXmlPropToFile(KString& pFullPath, KString& propPath);
00579 
00581 //
00582 //  WARNING!
00583 //
00584 //  Anything beyond these lines may not be documented accurately and is
00585 //  subject to change without notice.
00586 //
00588 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00589 public:
00590     PropInfo * GetPropInfo(KFbxProperty &pProp);
00591 
00592     FBXUILANGUAGE UILanguage;
00593     KString GetLanguageLabel(KFbxProperty &pProp);
00594     void SetLanguageLabel(KFbxProperty &pProp, KString &pLabel);
00595     FBXUILANGUAGE Get_Max_Runtime_Language(KString regLocation);
00596 
00597     KsoInfo impInfo;
00598     KsoInfo expInfo;
00599 
00600     static KString GetUserMyDocumentDir();
00601     void SetPropVisible(KFbxProperty &pProp, bool pWithChildren, bool pVisible);
00602 
00603     virtual bool ConstructProperties(bool pForceSet);
00604 
00605             // Read an XML file from MyDocument dir
00606     bool ReadXmlPropFromMyDocument(KString& subDir, KString& filename);
00607 
00608             // Write property branch to an XML file in MyDocument dir
00609     bool WriteXmlPropToMyDocument(KString& subDir, KString& filename, KString& propPath);
00610 
00611     static const char * GetFileMergeDescription(int pIndex);
00612 
00613     enum ELoadMode         
00614     { 
00615         eCREATE,          
00616         eMERGE,           
00617         eEXCLUSIVE_MERGE  
00618     };
00619 
00620 
00621     enum EQuaternionMode   { eAS_QUATERNION, eAS_EULER, eRESAMPLE };
00622     enum EObjectDerivation { eBY_LAYER, eBY_ENTITY, eBY_BLOCK }; 
00623 
00624     enum ESysUnits
00625     {
00626         kUNITS_USER,
00627         kUNITS_INCHES, 
00628         kUNITS_FEET,
00629         kUNITS_YARDS,
00630         kUNITS_MILES,
00631         kUNITS_MILLIMETERS,
00632         kUNITS_CENTIMETERS,
00633         kUNITS_METERS,
00634         kUNITS_KILOMETERS
00635     };
00636 
00637     enum ESysFrameRate  
00638     {
00639         kFRAMERATE_USER,
00640         kFRAMERATE_HOURS,
00641         kFRAMERATE_MINUTES,
00642         kFRAMERATE_SECONDS,
00643         kFRAMERATE_MILLISECONDS,
00644         kFRAMERATE_GAMES_15,
00645         kFRAMERATE_FILM_24,
00646         kFRAMERATE_PAL_25,
00647         kFRAMERATE_NTSC_30,
00648         kFRAMERATE_SHOWSCAN_48,
00649         kFRAMERATE_PALFIELD_50,
00650         kFRAMERATE_NTSCFIELD_60
00651     };
00652     
00653 // Max
00654     enum EEnveloppeSystem
00655     {
00656         eSKIN_MODIFIER,
00657         ePHYSIQUE,
00658         eBONESPRO,
00659         eENVELOPPE_SYSTEM_COUNT
00660     };
00661 
00662 // Max
00663     enum EGeometryType
00664     {
00665         eTRIANGLE,
00666         eSIMPLIFIED_POLY,
00667         ePOLY,
00668         eNURB,
00669         ePATCH,
00670         eGEOMETRY_TYPE_COUNT
00671     };
00672 
00673 // Maya IK type
00674     enum EIKType
00675     {
00676         eNONE,
00677         eFBIK,      
00678         eHUMANIK
00679     };
00680 
00681 protected:
00682     KFbxIOSettings(KFbxSdkManager& pManager,char const* pName);
00683 
00684 private:
00685     // the caller must delete the KString returned
00686     KString* GetAttributeFromXmlNode(xmlNode* node, KString* attName);
00687 
00688     // the caller must delete the KString returned
00689     KString* GetInnerTextXmlNode(xmlNode* node);
00690 
00691     void CreatePropRecursive(xmlNode* pNode, KFbxProperty& pPropParent);
00692 
00693     xmlNode* GetChildXmlNode(xmlNode* parent, KString* nodeName);
00694     xmlNode* AddChildXmlNode(xmlNode* parent, KString* nodeName, KString* nodeValue = NULL);
00695     xmlAttr* AddAttributeToXmlNode(xmlNode* node, KString* attName, KString* attValue = NULL);
00696 
00697     void AddNewPropInfo(KFbxProperty &pProp);
00698     void DeletePropInfo(KFbxProperty &pProp);
00699     void DeleteAllPropInfo(KFbxProperty &pProp);
00700 
00701     // add recurively a xml node equivalent for a KFbxProperty and all child KFbxProperties
00702     void AddXMLProp(KFbxProperty& pProp, xmlNodePtr pParent, xmlDocPtr pXmlDoc);
00703 
00704     // create a new xmlNode with all KFbxProperty info
00705     xmlNodePtr GetXMLNode(KFbxProperty& pProp);
00706 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00707 };
00708 
00709 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00710 
00711 #endif // FBXFILESDK_KFBXIO_KFBXIOSETTINGS_H
00712