FBX SDK Reference Guide: kfbxiosettings.h Source File
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 © 2001 - 2008 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 
00042 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 // libxml is not included on CFM.
00044 #ifndef KARCH_ENV_MACOSX_CFM
00045 
00046 
00047 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00048 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00049 
00050 
00051 #include <fbxfilesdk/kfbxplugins/kfbxobject.h>
00052 
00053 #include <fbxfilesdk/components/libxml2-2.6.4/libxml.h>
00054 #include <fbxfilesdk/components/libxml2-2.6.4/include/libxml/parser.h>
00055 #include <fbxfilesdk/components/libxml2-2.6.4/include/libxml/tree.h>
00056 #include <fbxfilesdk/components/libxml2-2.6.4/include/libxml/globals.h>
00057 
00058 
00059 #include <fbxfilesdk/kfbxplugins/kfbxtypes.h>
00060 
00061 #include <fbxfilesdk/components/kbaselib/kbaselib_forward.h>
00062 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00063 
00064 #include <fbxfilesdk/kfbxio/kfbxiosettingspath.h>
00065 
00066 #define IOSREF  KFbxIOSettings::IOSettingsRef()
00067 
00068 #define IOSVisible    true
00069 #define IOSHidden     false
00070 
00071 #define IOSSavable    true
00072 #define IOSNotSavable false
00073 
00074 #define IOSEnabled    true
00075 #define IOSDisabled   false
00076 
00077 
00078 #define IOSBinary     0
00079 #define IOSASCII      1
00080 
00081 // class to handle old StreamOptions information
00082 class KsoInfo
00083 {
00084 
00085 public: enum EIMPEXP
00086 {
00087     eIMPORT = 0,
00088     eEXPORT
00089 };
00090 
00091 public: 
00092     KsoInfo();
00093 
00095     void Reset(EIMPEXP pImpExp);
00096     
00098     void SetTimeMode(KTime::ETimeMode pTimeMode, double pCustomFrameRate = 0.0);
00099 
00101     KTime::ETimeMode GetTimeMode(){ return mTimeMode; }
00102 
00104     KTime GetFramePeriod();
00105     
00106     void SetASFScene(KFbxObject* pASFScene, bool pASFSceneOwned = false);
00107     KFbxObject* GetASFScene(){ return mASFScene; }
00108 
00109     //-----------------
00110     // data
00111 
00112 private: 
00113         KTime::ETimeMode mTimeMode;
00114         KFbxObject * mASFScene;
00115 
00116         EIMPEXP mImpExp;
00117 };
00118 
00119 class KFbxSdkManager;
00120 
00121 
00122 // http://www.microsoft.com/globaldev/reference/winxp/langtla.mspx
00123 
00124 //  LOCALE                            TLA  LCID
00125 
00126 //  English - United States           ENU  0409
00127 //  German - Germany                  DEU  0407
00128 //  French - France                   FRA  040c
00129 //  Japanese - Japan                  JPN  0411
00130 //  Korean(Extended Wansung) - Korea  KOR  0412
00131 //  Chinese - PRC                     CHS  0804
00132 
00133 enum FBXUILANGUAGE
00134 {
00135     eENU = 0,                   // MAX 409 English - United States
00136     eDEU,                       // MAX 407 German - Germany
00137     eFRA,                       // MAX 40c French - France
00138     eJPN,                       // MAX 411 Japanese - Japan
00139     eKOR,                       // MAX 412 Korean(Extended Wansung) - Korea 
00140     eCHS,                       // MAX 804 Chinese - PRC
00141     eFBXUILANGUAGE_COUNT
00142 };
00143 
00144 static const char* XML_LAGUAGE_LABELS[] = 
00145 {
00146     "lbENU",       // = eENU English - United States
00147     "lbDEU",       // = eDEU German - Germany                  
00148     "lbFRA",       // = eFRA French - France
00149     "lbJPN",       // = eJPN Japanese - Japan
00150     "lbKOR",       // = eKOR Korean(Extended Wansung) - Korea
00151     "lbCHS"        // = eCHS Chinese - PRC
00152 };
00153 
00154 static const char* LAGUAGE_SYMBOLS[] = 
00155 {
00156     "ENU",       // = eENU English - United States
00157     "DEU",       // = eDEU German - Germany                  
00158     "FRA",       // = eFRA French - France
00159     "JPN",       // = eJPN Japanese - Japan
00160     "KOR",       // = eKOR Korean(Extended Wansung) - Korea
00161     "CHS"        // = eCHS Chinese - PRC
00162 };
00163 
00164 // this class is located in the UserDataPtr of each KFbxIOSettings properties
00165 class PropInfo
00166 {
00167 public:
00168     PropInfo();
00169     ~PropInfo();
00170 
00171     void            * UIWidget;            // UI widget for showing the property
00172     void            * cbValueChanged;      // call back when value changed
00173     void            * cbDirty;             // call back when value changed
00174     KStringList       labels;              // list of labels in many languages
00175 };
00176 
00177 
00178 
00185 class KFBX_DLL KFbxIOSettings : public KFbxObject
00186 {
00187 
00188 KFBXOBJECT_DECLARE(KFbxIOSettings,KFbxObject);
00189 
00191 public: virtual ~KFbxIOSettings();
00192 
00196 public: static void AllocateIOSettings(KFbxSdkManager& pManager);
00197 
00198 public: static bool IsIOSettingsAllocated();
00199 
00201 public: void FreeIOSettings();
00202 
00204 public: static KFbxIOSettings& IOSettingsRef();
00205 
00207 public: virtual void Clear();
00208 
00214 public: KFbxProperty AddPropertyGroup(char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00215 
00225 public: KFbxProperty AddPropertyGroup(  KFbxProperty const &pParentProperty, 
00226                                         char const*         pName, 
00227                                         KFbxDataType const &pDataType      = KFbxDataType(), 
00228                                         char const*         pLabel         = "",
00229                                         bool                pVisible       = true,
00230                                         bool                pSavable       = true,
00231                                         bool                pEnabled       = true
00232                                      );
00233 
00245 public: KFbxProperty AddProperty(    KFbxProperty const     &pParentProperty, 
00246                                      char const*            pName, 
00247                                      KFbxDataType const     &pDataType      = KFbxDataType(), 
00248                                      char const*            pLabel          = "",
00249                                      void const*            pValue          = NULL,
00250                                      EFbxType               pValueType      = eUNIDENTIFIED,
00251                                      bool                   pVisible        = true,
00252                                      bool                   pSavable        = true,
00253                                      bool                   pEnabled        = true
00254                                    );
00255 
00269 public: KFbxProperty AddPropertyMinMax(    KFbxProperty const     &pParentProperty, 
00270                                      char const*            pName, 
00271                                      KFbxDataType const     &pDataType      = KFbxDataType(), 
00272                                      char const*            pLabel          = "",
00273                                      void const*            pValue          = NULL,
00274                                      double const*          pMinValue       = NULL,
00275                                      double const*          pMaxValue       = NULL,
00276                                      EFbxType               pValueType      = eUNIDENTIFIED,                                     
00277                                      bool                   pVisible        = true,
00278                                      bool                   pSavable        = true,
00279                                      bool                   pEnabled        = true
00280                                    );
00281 
00282 
00286 public: KFbxProperty GetProperty(char const* pName);
00287 
00292 public: KFbxProperty GetProperty(KFbxProperty const &pParentProperty, char const* pName);
00293 
00298 public: bool GetBoolProp(char const* pName, bool pDefValue);
00299 
00304 public: void SetBoolProp(char const* pName, bool pValue);
00305 
00310 public: double GetDoubleProp(char const* pName, double pDefValue);
00311 
00316 public: void   SetDoubleProp(char const* pName, double pValue);
00317 
00322 public: int    GetIntProp(char const* pName, int pDefValue);
00323 
00328 public: void   SetIntProp(char const* pName, int pValue);
00329 
00334 public: KTime  GetKTimeProp(char const* pName, KTime pDefValue);
00335 
00340 public: void   SetKTimeProp(char const* pName, KTime pValue);
00341 
00346 public: KString GetEnumProp(char const* pName, KString pDefValue);
00347 
00352 public: int     GetEnumProp(char const* pName, int pDefValue);
00353 
00358 public: int     GetEnumIndex(char const* pName, KString pValue);
00359 
00364 public: void    SetEnumProp(char const* pName, KString pValue);
00365 
00370 public: void    SetEnumProp(char const* pName, int pValue);
00371 
00372 public: void    RemoveEnumPropValue(char const* pName, KString pValue);
00373 public: void    EmptyEnumProp(char const* pName);
00374 
00380 public: bool    SetFlag(char const* pName, FbxPropertyFlags::eFbxPropertyFlags propFlag, bool pValue);
00381 
00386 public: KString GetStringProp(char const* pName, KString pDefValue);
00387 
00392 public: void    SetStringProp(char const* pName, KString pValue);
00393 
00394 
00399 public: virtual bool ReadXMLFile(KString& path);
00400 
00405 public: virtual bool WriteXMLFile(KString& path);
00406 
00407 public: bool WriteXmlPropToFile(KString& pFullPath, KString& propPath);
00408 
00416 public: bool WriteXmlPropToRegistry(KString& regKeyName, KString& regValueName, KString& propPath, KString& regPath );
00417         
00424 public: bool ReadXmlPropFromRegistry(KString& regKeyName, KString& regValueName, KString& regPath);
00425 
00431 public: bool ReadXmlPropFromMyDocument(KString& subDir, KString& filename);
00432 
00439 public: bool WriteXmlPropToMyDocument(KString& subDir, KString& filename, KString& propPath);
00440 
00441 public: static KString GetUserMyDocumentDir();
00442 
00443         
00444 
00445 public: enum ELoadMode         { eMERGE, eEXCLUSIVE_MERGE, eCREATE };
00446 public: enum EQuaternionMode   { eAS_QUATERNION, eAS_EULER, eRESAMPLE };
00447 public: enum EObjectDerivation { eBY_LAYER, eBY_ENTITY, eBY_BLOCK }; 
00448 
00449 public: enum ESysUnits
00450     {
00451         kUNITS_USER,
00452         kUNITS_INCHES, 
00453         kUNITS_FEET,
00454         kUNITS_YARDS,
00455         kUNITS_MILES,
00456         kUNITS_MILLIMETERS,
00457         kUNITS_CENTIMETERS,
00458         kUNITS_METERS,
00459         kUNITS_KILOMETERS
00460     };
00461 
00462 public: enum ESysFrameRate  
00463     {
00464         kFRAMERATE_USER,
00465         kFRAMERATE_HOURS,
00466         kFRAMERATE_MINUTES,
00467         kFRAMERATE_SECONDS,
00468         kFRAMERATE_MILLISECONDS,
00469         kFRAMERATE_GAMES_15,
00470         kFRAMERATE_FILM_24,
00471         kFRAMERATE_PAL_25,
00472         kFRAMERATE_NTSC_30,
00473         kFRAMERATE_SHOWSCAN_48,
00474         kFRAMERATE_PALFIELD_50,
00475         kFRAMERATE_NTSCFIELD_60
00476     };
00477     
00478 // Max
00479 public: enum EEnveloppeSystem
00480     {
00481         eSKIN_MODIFIER,
00482         ePHYSIQUE,
00483         eBONESPRO,
00484         eENVELOPPE_SYSTEM_COUNT
00485     };
00486 
00487 // Max
00488 public: enum EGeometryType
00489     {
00490         eTRIANGLE,
00491         eSIMPLIFIED_POLY,
00492         ePOLY,
00493         eNURB,
00494         ePATCH,
00495         eGEOMETRY_TYPE_COUNT
00496     };
00497 
00498 
00499 //------------------------------------------------------------------------
00500             // Constructor
00501             // Use AllocateIOSettings() to construct a KFbxIOSettings
00502 protected:  KFbxIOSettings(KFbxSdkManager& pManager,char const* pName);
00503 
00504             // add recurively a xml node equivalent for a KFbxProperty and all child KFbxProperties
00505 private:    void AddXMLProp(KFbxProperty& pProp, xmlNodePtr pParent, xmlDocPtr pXmlDoc);
00506 
00507             // create a new xmlNode with all KFbxProperty info
00508 private:    xmlNodePtr GetXMLNode(KFbxProperty& pProp);
00509 
00510 public:     KsoInfo impInfo;
00511 public:     KsoInfo expInfo;
00512 
00513 public:     FBXUILANGUAGE UILanguage;
00514 
00515 private:    void AddNewPropInfo(KFbxProperty &pProp);
00516 private:    void DeletePropInfo(KFbxProperty &pProp);
00517 private:    void DeleteAllPropInfo(KFbxProperty &pProp);
00518 
00519 public:     PropInfo * GetPropInfo(KFbxProperty &pProp);
00520 public:     KString GetLanguageLabel(KFbxProperty &pProp);
00521 public:     void SetLanguageLabel(KFbxProperty &pProp, KString &pLabel);
00522 public:     FBXUILANGUAGE Get_Max_Runtime_Language(KString regLocation);
00523 
00524 private: xmlNode* GetChildXmlNode(xmlNode* parent, KString* nodeName);
00525 private: xmlNode* AddChildXmlNode(xmlNode* parent, KString* nodeName, KString* nodeValue = NULL);
00526 private: xmlAttr* AddAttributeToXmlNode(xmlNode* node, KString* attName, KString* attValue = NULL);
00527 
00528 // the caller must delete the KString returned
00529 private: KString* GetAttributeFromXmlNode(xmlNode* node, KString* attName);
00530 
00531 // the caller must delete the KString returned
00532 private: KString* GetInnerTextXmlNode(xmlNode* node);
00533 
00534 
00535 public: bool IsEnumExist(KFbxProperty& pProp, KString& enumString);
00536 public: int  GetEnumIndex(KFbxProperty& pProp, KString& enumString, bool pNoCase = false);
00537 
00538 private: bool WriteXmlDocToRegistry(KString* regPath, KString* regKeyName, KString* regValueName, xmlDocPtr XmlDoc);
00539 
00540 // the caller must delete the xmlDocPtr returned
00541 private: xmlDocPtr ReadXmlDocFromRegistry(KString* regPath, KString* regKeyName, KString* regValueName );
00542 
00543 private: void CreatePropRecursive(xmlNode* pNode, KFbxProperty& pPropParent);
00544 
00545 public: virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pType) const;
00546 
00547 private: bool UseEnglishLabelOnly;
00548 
00549 public: void SetUseEnglishLabelOnly( bool flag=true ){ UseEnglishLabelOnly = flag; }
00550 public: bool GetUseEnglishLabelOnly(){ return UseEnglishLabelOnly; }
00551 
00552 };
00553 
00554 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00555 
00556 #endif // KARCH_ENV_MACOSX_CFM
00557 
00558 #endif // FBXFILESDK_KFBXIO_KFBXIOSETTINGS_H
00559