00001 
00004 #ifndef FBXFILESDK_KFBXIO_KFBXIOSETTINGS_H
00005 #define FBXFILESDK_KFBXIO_KFBXIOSETTINGS_H
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 
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 #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 
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     
00115 
00116 private: 
00117         KTime::ETimeMode mTimeMode;
00118         KFbxObject * mASFScene;
00119 
00120         EIMPEXP mImpExp;
00121 };
00122 
00123 class KFbxSdkManager;
00124 
00125 
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
00136 
00137 enum FBXUILANGUAGE
00138 {
00139     eENU = 0,                   
00140     eDEU,                       
00141     eFRA,                       
00142     eJPN,                       
00143     eKOR,                       
00144     eCHS,                       
00145     eFBXUILANGUAGE_COUNT
00146 };
00147 
00148 static const char* XML_LAGUAGE_LABELS[] = 
00149 {
00150     "lbENU",       
00151     "lbDEU",       
00152     "lbFRA",       
00153     "lbJPN",       
00154     "lbKOR",       
00155     "lbCHS"        
00156 };
00157 
00158 static const char* LAGUAGE_SYMBOLS[] = 
00159 {
00160     "ENU",       
00161     "DEU",       
00162     "FRA",       
00163     "JPN",       
00164     "KOR",       
00165     "CHS"        
00166 };
00167 
00168 
00169 class PropInfo
00170 {
00171 public:
00172     PropInfo();
00173     ~PropInfo();
00174 
00175     void            * UIWidget;            
00176     void            * cbValueChanged;      
00177     void            * cbDirty;             
00178     KStringList       labels;              
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 
00483 public: enum EEnveloppeSystem
00484     {
00485         eSKIN_MODIFIER,
00486         ePHYSIQUE,
00487         eBONESPRO,
00488         eENVELOPPE_SYSTEM_COUNT
00489     };
00490 
00491 
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             
00505             
00506 protected:  KFbxIOSettings(KFbxSdkManager& pManager,char const* pName);
00507 
00508             
00509 private:    void AddXMLProp(KFbxProperty& pProp, xmlNodePtr pParent, xmlDocPtr pXmlDoc);
00510 
00511             
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 
00533 private: KString* GetAttributeFromXmlNode(xmlNode* node, KString* attName);
00534 
00535 
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 
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