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 - 2009 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 // undef the macro mkdir, since it conflict with function mkdir in Qt\4.2.3\src\corelib\io\qdir.h
00059 #if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(mkdir)
00060 #undef mkdir
00061 #endif
00062 
00063 #include <fbxfilesdk/kfbxplugins/kfbxtypes.h>
00064 
00065 #include <fbxfilesdk/components/kbaselib/kbaselib_forward.h>
00066 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00067 
00068 #include <fbxfilesdk/kfbxio/kfbxiosettingspath.h>
00069 
00070 #define IOSREF  KFbxIOSettings::IOSettingsRef()
00071 
00072 #define IOSVisible    true
00073 #define IOSHidden     false
00074 
00075 #define IOSSavable    true
00076 #define IOSNotSavable false
00077 
00078 #define IOSEnabled    true
00079 #define IOSDisabled   false
00080 
00081 
00082 #define IOSBinary     0
00083 #define IOSASCII      1
00084 
00085 // class to handle old StreamOptions information
00086 class KsoInfo
00087 {
00088 
00089 public: enum EIMPEXP
00090 {
00091     eIMPORT = 0,
00092     eEXPORT
00093 };
00094 
00095 public: 
00096     KsoInfo();
00097 
00099     void Reset(EIMPEXP pImpExp);
00100     
00102     void SetTimeMode(KTime::ETimeMode pTimeMode, double pCustomFrameRate = 0.0);
00103 
00105     KTime::ETimeMode GetTimeMode(){ return mTimeMode; }
00106 
00108     KTime GetFramePeriod();
00109     
00110     void SetASFScene(KFbxObject* pASFScene, bool pASFSceneOwned = false);
00111     KFbxObject* GetASFScene(){ return mASFScene; }
00112 
00113     //-----------------
00114     // data
00115 
00116 private: 
00117         KTime::ETimeMode mTimeMode;
00118         KFbxObject * mASFScene;
00119 
00120         EIMPEXP mImpExp;
00121 };
00122 
00123 class KFbxSdkManager;
00124 
00125 
00126 // http://www.microsoft.com/globaldev/reference/winxp/langtla.mspx
00127 
00128 //  LOCALE                            TLA  LCID
00129 
00130 //  English - United States           ENU  0409
00131 //  German - Germany                  DEU  0407
00132 //  French - France                   FRA  040c
00133 //  Japanese - Japan                  JPN  0411
00134 //  Korean(Extended Wansung) - Korea  KOR  0412
00135 //  Chinese - PRC                     CHS  0804
00136 
00137 enum FBXUILANGUAGE
00138 {
00139     eENU = 0,                   // MAX 409 English - United States
00140     eDEU,                       // MAX 407 German - Germany
00141     eFRA,                       // MAX 40c French - France
00142     eJPN,                       // MAX 411 Japanese - Japan
00143     eKOR,                       // MAX 412 Korean(Extended Wansung) - Korea 
00144     eCHS,                       // MAX 804 Chinese - PRC
00145     eFBXUILANGUAGE_COUNT
00146 };
00147 
00148 static const char* XML_LAGUAGE_LABELS[] = 
00149 {
00150     "lbENU",       // = eENU English - United States
00151     "lbDEU",       // = eDEU German - Germany                  
00152     "lbFRA",       // = eFRA French - France
00153     "lbJPN",       // = eJPN Japanese - Japan
00154     "lbKOR",       // = eKOR Korean(Extended Wansung) - Korea
00155     "lbCHS"        // = eCHS Chinese - PRC
00156 };
00157 
00158 static const char* LAGUAGE_SYMBOLS[] = 
00159 {
00160     "ENU",       // = eENU English - United States
00161     "DEU",       // = eDEU German - Germany                  
00162     "FRA",       // = eFRA French - France
00163     "JPN",       // = eJPN Japanese - Japan
00164     "KOR",       // = eKOR Korean(Extended Wansung) - Korea
00165     "CHS"        // = eCHS Chinese - PRC
00166 };
00167 
00168 // this class is located in the UserDataPtr of each KFbxIOSettings properties
00169 class PropInfo
00170 {
00171 public:
00172     PropInfo();
00173     ~PropInfo();
00174 
00175     void            * UIWidget;            // UI widget for showing the property
00176     void            * cbValueChanged;      // call back when value changed
00177     void            * cbDirty;             // call back when value changed
00178     KStringList       labels;              // list of labels in many languages
00179 };
00180 
00181 
00182 
00189 class KFBX_DLL KFbxIOSettings : public KFbxObject
00190 {
00191 
00192 KFBXOBJECT_DECLARE(KFbxIOSettings,KFbxObject);
00193 
00194     virtual void Destruct(bool pRecursive, bool pDependents);
00195 
00199 public: static void AllocateIOSettings(KFbxSdkManager& pManager);
00200 
00201 public: static bool IsIOSettingsAllocated();
00202 
00204 public: void FreeIOSettings();
00205 
00207 public: static KFbxIOSettings& IOSettingsRef();
00208 
00210 public: virtual void Clear();
00211 
00217 public: KFbxProperty AddPropertyGroup(char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00218 
00228 public: KFbxProperty AddPropertyGroup(  KFbxProperty const &pParentProperty, 
00229                                         char const*         pName, 
00230                                         KFbxDataType const &pDataType      = KFbxDataType(), 
00231                                         char const*         pLabel         = "",
00232                                         bool                pVisible       = true,
00233                                         bool                pSavable       = true,
00234                                         bool                pEnabled       = true
00235                                      );
00236 
00248 public: KFbxProperty AddProperty(    KFbxProperty const     &pParentProperty, 
00249                                      char const*            pName, 
00250                                      KFbxDataType const     &pDataType      = KFbxDataType(), 
00251                                      char const*            pLabel          = "",
00252                                      void const*            pValue          = NULL,
00253                                      EFbxType               pValueType      = eUNIDENTIFIED,
00254                                      bool                   pVisible        = true,
00255                                      bool                   pSavable        = true,
00256                                      bool                   pEnabled        = true
00257                                    );
00258 
00272 public: KFbxProperty AddPropertyMinMax(    KFbxProperty const     &pParentProperty, 
00273                                      char const*            pName, 
00274                                      KFbxDataType const     &pDataType      = KFbxDataType(), 
00275                                      char const*            pLabel          = "",
00276                                      void const*            pValue          = NULL,
00277                                      double const*          pMinValue       = NULL,
00278                                      double const*          pMaxValue       = NULL,
00279                                      EFbxType               pValueType      = eUNIDENTIFIED,                                     
00280                                      bool                   pVisible        = true,
00281                                      bool                   pSavable        = true,
00282                                      bool                   pEnabled        = true
00283                                    );
00284 
00285 
00289 public: KFbxProperty GetProperty(char const* pName);
00290 
00295 public: KFbxProperty GetProperty(KFbxProperty const &pParentProperty, char const* pName);
00296 
00301 public: bool GetBoolProp(char const* pName, bool pDefValue);
00302 
00307 public: void SetBoolProp(char const* pName, bool pValue);
00308 
00313 public: double GetDoubleProp(char const* pName, double pDefValue);
00314 
00319 public: void   SetDoubleProp(char const* pName, double pValue);
00320 
00325 public: int    GetIntProp(char const* pName, int pDefValue);
00326 
00331 public: void   SetIntProp(char const* pName, int pValue);
00332 
00337 public: KTime  GetKTimeProp(char const* pName, KTime pDefValue);
00338 
00343 public: void   SetKTimeProp(char const* pName, KTime pValue);
00344 
00349 public: KString GetEnumProp(char const* pName, KString pDefValue);
00350 
00355 public: int     GetEnumProp(char const* pName, int pDefValue);
00356 
00361 public: int     GetEnumIndex(char const* pName, KString pValue);
00362 
00367 public: void    SetEnumProp(char const* pName, KString pValue);
00368 
00373 public: void    SetEnumProp(char const* pName, int pValue);
00374 
00375 public: void    RemoveEnumPropValue(char const* pName, KString pValue);
00376 public: void    EmptyEnumProp(char const* pName);
00377 
00383 public: bool    SetFlag(char const* pName, FbxPropertyFlags::eFbxPropertyFlags propFlag, bool pValue);
00384 
00389 public: KString GetStringProp(char const* pName, KString pDefValue);
00390 
00395 public: void    SetStringProp(char const* pName, KString pValue);
00396 
00397 
00402 public: virtual bool ReadXMLFile(KString& path);
00403 
00408 public: virtual bool WriteXMLFile(KString& path);
00409 
00410 public: bool WriteXmlPropToFile(KString& pFullPath, KString& propPath);
00411 
00419 public: bool WriteXmlPropToRegistry(KString& regKeyName, KString& regValueName, KString& propPath, KString& regPath );
00420         
00427 public: bool ReadXmlPropFromRegistry(KString& regKeyName, KString& regValueName, KString& regPath);
00428 
00434 public: bool ReadXmlPropFromMyDocument(KString& subDir, KString& filename);
00435 
00442 public: bool WriteXmlPropToMyDocument(KString& subDir, KString& filename, KString& propPath);
00443 
00444 public: static KString GetUserMyDocumentDir();
00445 public: void SetPropVisible(KFbxProperty &pProp, bool pWithChildren, bool pVisible);
00446 
00447         
00448 
00449 public: enum ELoadMode         { eMERGE, eEXCLUSIVE_MERGE, eCREATE };
00450 public: enum EQuaternionMode   { eAS_QUATERNION, eAS_EULER, eRESAMPLE };
00451 public: enum EObjectDerivation { eBY_LAYER, eBY_ENTITY, eBY_BLOCK }; 
00452 
00453 public: enum ESysUnits
00454     {
00455         kUNITS_USER,
00456         kUNITS_INCHES, 
00457         kUNITS_FEET,
00458         kUNITS_YARDS,
00459         kUNITS_MILES,
00460         kUNITS_MILLIMETERS,
00461         kUNITS_CENTIMETERS,
00462         kUNITS_METERS,
00463         kUNITS_KILOMETERS
00464     };
00465 
00466 public: enum ESysFrameRate  
00467     {
00468         kFRAMERATE_USER,
00469         kFRAMERATE_HOURS,
00470         kFRAMERATE_MINUTES,
00471         kFRAMERATE_SECONDS,
00472         kFRAMERATE_MILLISECONDS,
00473         kFRAMERATE_GAMES_15,
00474         kFRAMERATE_FILM_24,
00475         kFRAMERATE_PAL_25,
00476         kFRAMERATE_NTSC_30,
00477         kFRAMERATE_SHOWSCAN_48,
00478         kFRAMERATE_PALFIELD_50,
00479         kFRAMERATE_NTSCFIELD_60
00480     };
00481     
00482 // Max
00483 public: enum EEnveloppeSystem
00484     {
00485         eSKIN_MODIFIER,
00486         ePHYSIQUE,
00487         eBONESPRO,
00488         eENVELOPPE_SYSTEM_COUNT
00489     };
00490 
00491 // Max
00492 public: enum EGeometryType
00493     {
00494         eTRIANGLE,
00495         eSIMPLIFIED_POLY,
00496         ePOLY,
00497         eNURB,
00498         ePATCH,
00499         eGEOMETRY_TYPE_COUNT
00500     };
00501 
00502 
00503 //------------------------------------------------------------------------
00504             // Constructor
00505             // Use AllocateIOSettings() to construct a KFbxIOSettings
00506 protected:  KFbxIOSettings(KFbxSdkManager& pManager,char const* pName);
00507 
00508             // add recurively a xml node equivalent for a KFbxProperty and all child KFbxProperties
00509 private:    void AddXMLProp(KFbxProperty& pProp, xmlNodePtr pParent, xmlDocPtr pXmlDoc);
00510 
00511             // create a new xmlNode with all KFbxProperty info
00512 private:    xmlNodePtr GetXMLNode(KFbxProperty& pProp);
00513 
00514 public:     KsoInfo impInfo;
00515 public:     KsoInfo expInfo;
00516 
00517 public:     FBXUILANGUAGE UILanguage;
00518 
00519 private:    void AddNewPropInfo(KFbxProperty &pProp);
00520 private:    void DeletePropInfo(KFbxProperty &pProp);
00521 private:    void DeleteAllPropInfo(KFbxProperty &pProp);
00522 
00523 public:     PropInfo * GetPropInfo(KFbxProperty &pProp);
00524 public:     KString GetLanguageLabel(KFbxProperty &pProp);
00525 public:     void SetLanguageLabel(KFbxProperty &pProp, KString &pLabel);
00526 public:     FBXUILANGUAGE Get_Max_Runtime_Language(KString regLocation);
00527 
00528 private: xmlNode* GetChildXmlNode(xmlNode* parent, KString* nodeName);
00529 private: xmlNode* AddChildXmlNode(xmlNode* parent, KString* nodeName, KString* nodeValue = NULL);
00530 private: xmlAttr* AddAttributeToXmlNode(xmlNode* node, KString* attName, KString* attValue = NULL);
00531 
00532 // the caller must delete the KString returned
00533 private: KString* GetAttributeFromXmlNode(xmlNode* node, KString* attName);
00534 
00535 // the caller must delete the KString returned
00536 private: KString* GetInnerTextXmlNode(xmlNode* node);
00537 
00538 
00539 public: bool IsEnumExist(KFbxProperty& pProp, KString& enumString);
00540 public: int  GetEnumIndex(KFbxProperty& pProp, KString& enumString, bool pNoCase = false);
00541 
00542 private: bool WriteXmlDocToRegistry(KString* regPath, KString* regKeyName, KString* regValueName, xmlDocPtr XmlDoc);
00543 
00544 // the caller must delete the xmlDocPtr returned
00545 private: xmlDocPtr ReadXmlDocFromRegistry(KString* regPath, KString* regKeyName, KString* regValueName );
00546 
00547 private: void CreatePropRecursive(xmlNode* pNode, KFbxProperty& pPropParent);
00548 
00549 public: virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pType) const;
00550 
00551 };
00552 
00553 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00554 
00555 #endif // KARCH_ENV_MACOSX_CFM
00556 
00557 #endif // FBXFILESDK_KFBXIO_KFBXIOSETTINGS_H
00558