00001
00004 #ifndef _FBXSDK_IO_SETTINGS_H_
00005 #define _FBXSDK_IO_SETTINGS_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 <kaydaradef.h>
00043 #ifndef KFBX_DLL
00044 #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046
00047
00048 #ifndef KARCH_ENV_MACOSX_CFM
00049
00050
00051 #include <klib/karrayul.h>
00052 #include <klib/kstring.h>
00053
00054 #ifndef MB_FBXSDK
00055 #include <kbaselib_nsuse.h>
00056 #endif
00057
00058
00059 #include <kfbxplugins/kfbxobject.h>
00060
00061 #include <libxml.h>
00062 #include <libxml/parser.h>
00063 #include <libxml/tree.h>
00064 #include <libxml/globals.h>
00065
00066
00067 #include <kfbxplugins/kfbxtypes.h>
00068
00069 #include <kbaselib_forward.h>
00070 #include <fbxfilesdk_nsbegin.h>
00071
00072 #include "kfbxiosettingspath.h"
00073
00074 #define IOSREF KFbxIOSettings::IOSettingsRef()
00075
00076 #define IOSVisible true
00077 #define IOSHidden false
00078
00079 #define IOSSavable true
00080 #define IOSNotSavable false
00081
00082 #define IOSEnabled true
00083 #define IOSDisabled false
00084
00085
00086 #define IOSBinary 0
00087 #define IOSASCII 1
00088
00089
00090 class KsoInfo
00091 {
00092
00093 public: enum EIMPEXP
00094 {
00095 eIMPORT = 0,
00096 eEXPORT
00097 };
00098
00099 public:
00100 KsoInfo();
00101
00103 void Reset(EIMPEXP pImpExp);
00104
00106 void SetTimeMode(KTime::ETimeMode pTimeMode, double pCustomFrameRate = 0.0);
00107
00109 KTime::ETimeMode GetTimeMode(){ return mTimeMode; }
00110
00112 KTime GetFramePeriod();
00113
00114 void SetASFScene(KFbxObject* pASFScene, bool pASFSceneOwned = false);
00115 KFbxObject* GetASFScene(){ return mASFScene; }
00116
00117
00118
00119
00120 private:
00121 KTime::ETimeMode mTimeMode;
00122 KFbxObject * mASFScene;
00123
00124 EIMPEXP mImpExp;
00125 };
00126
00127 class KFbxSdkManager;
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 enum FBXUILANGUAGE
00142 {
00143 eENU = 0,
00144 eDEU,
00145 eFRA,
00146 eJPN,
00147 eKOR,
00148 eCHS,
00149 eFBXUILANGUAGE_COUNT
00150 };
00151
00152 static const char* XML_LAGUAGE_LABELS[] =
00153 {
00154 "lbENU",
00155 "lbDEU",
00156 "lbFRA",
00157 "lbJPN",
00158 "lbKOR",
00159 "lbCHS"
00160 };
00161
00162 static const char* LAGUAGE_SYMBOLS[] =
00163 {
00164 "ENU",
00165 "DEU",
00166 "FRA",
00167 "JPN",
00168 "KOR",
00169 "CHS"
00170 };
00171
00172
00173 class PropInfo
00174 {
00175 public:
00176 PropInfo();
00177 ~PropInfo();
00178
00179 void * UIWidget;
00180 void * cbValueChanged;
00181 void * cbDirty;
00182 KStringList labels;
00183 };
00184
00185
00186
00193 class KFBX_DLL KFbxIOSettings : public KFbxObject
00194 {
00195
00196 KFBXOBJECT_DECLARE(KFbxIOSettings,KFbxObject);
00197
00199 public: virtual ~KFbxIOSettings();
00200
00202 public: static void AllocateIOSettings(KFbxSdkManager& pManager);
00203
00204 public: static bool IsIOSettingsAllocated();
00205
00207 public: void FreeIOSettings();
00208
00210 public: static KFbxIOSettings& IOSettingsRef();
00211
00213 public: virtual void Clear();
00214
00216 public: KFbxProperty AddPropertyGroup(char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00217
00219 public: KFbxProperty AddPropertyGroup( KFbxProperty const &pParentProperty,
00220 char const* pName,
00221 KFbxDataType const &pDataType = KFbxDataType(),
00222 char const* pLabel = "",
00223 bool pVisible = true,
00224 bool pSavable = true,
00225 bool pEnabled = true
00226 );
00227
00229 public: KFbxProperty AddProperty( KFbxProperty const &pParentProperty,
00230 char const* pName,
00231 KFbxDataType const &pDataType = KFbxDataType(),
00232 char const* pLabel = "",
00233 void const* pValue = NULL,
00234 EFbxType pValueType = eUNIDENTIFIED,
00235 bool pVisible = true,
00236 bool pSavable = true,
00237 bool pEnabled = true
00238 );
00239
00241 public: KFbxProperty AddPropertyMinMax( KFbxProperty const &pParentProperty,
00242 char const* pName,
00243 KFbxDataType const &pDataType = KFbxDataType(),
00244 char const* pLabel = "",
00245 void const* pValue = NULL,
00246 double const* pMinValue = NULL,
00247 double const* pMaxValue = NULL,
00248 EFbxType pValueType = eUNIDENTIFIED,
00249 bool pVisible = true,
00250 bool pSavable = true,
00251 bool pEnabled = true
00252 );
00253
00254
00256 public: KFbxProperty GetProperty(char const* pName);
00257
00259 public: KFbxProperty GetProperty(KFbxProperty const &pParentProperty, char const* pName);
00260
00262 public: bool GetBoolProp(char const* pName, bool pDefValue);
00263 public: void SetBoolProp(char const* pName, bool pValue);
00264
00266 public: double GetDoubleProp(char const* pName, double pDefValue);
00267 public: void SetDoubleProp(char const* pName, double pValue);
00268
00270 public: int GetIntProp(char const* pName, int pDefValue);
00271 public: void SetIntProp(char const* pName, int pValue);
00272
00274 public: KTime GetKTimeProp(char const* pName, KTime pDefValue);
00275 public: void SetKTimeProp(char const* pName, KTime pValue);
00276
00278 public: KString GetEnumProp(char const* pName, KString pDefValue);
00279 public: int GetEnumProp(char const* pName, int pDefValue);
00280 public: int GetEnumIndex(char const* pName, KString pValue);
00281
00282 public: void SetEnumProp(char const* pName, KString pValue);
00283 public: void SetEnumProp(char const* pName, int pValue);
00284
00285 public: void RemoveEnumPropValue(char const* pName, KString pValue);
00286 public: void EmptyEnumProp(char const* pName);
00287
00288
00289 public: bool SetFlag(char const* pName, FbxPropertyFlags::eFbxPropertyFlags propFlag, bool pValue);
00290
00292 public: KString GetStringProp(char const* pName, KString pDefValue);
00293 public: void SetStringProp(char const* pName, KString pValue);
00294
00295
00297 public: virtual bool ReadXMLFile(KString& path);
00298
00300 public: virtual bool WriteXMLFile(KString& path);
00301
00302 public: bool WriteXmlPropToFile(KString& pFullPath, KString& propPath);
00303
00305 public: bool WriteXmlPropToRegistry(KString& regKeyName, KString& regValueName, KString& propPath, KString& regPath );
00306
00308 public: bool ReadXmlPropFromRegistry(KString& regKeyName, KString& regValueName, KString& regPath);
00309
00311 public: bool ReadXmlPropFromMyDocument(KString& subDir, KString& filename);
00312
00314 public: bool WriteXmlPropToMyDocument(KString& subDir, KString& filename, KString& propPath);
00315
00316 public: static KString GetUserMyDocumentDir();
00317
00318
00319
00320 public: enum ELoadMode { eMERGE, eEXCLUSIVE_MERGE, eCREATE };
00321 public: enum EQuaternionMode { eAS_QUATERNION, eAS_EULER, eRESAMPLE };
00322 public: enum EObjectDerivation { eBY_LAYER, eBY_ENTITY, eBY_BLOCK };
00323
00324 public: enum ESysUnits
00325 {
00326 kUNITS_USER,
00327 kUNITS_INCHES,
00328 kUNITS_FEET,
00329 kUNITS_YARDS,
00330 kUNITS_MILES,
00331 kUNITS_MILLIMETERS,
00332 kUNITS_CENTIMETERS,
00333 kUNITS_METERS,
00334 kUNITS_KILOMETERS
00335 };
00336
00337 public: enum ESysFrameRate
00338 {
00339 kFRAMERATE_USER,
00340 kFRAMERATE_HOURS,
00341 kFRAMERATE_MINUTES,
00342 kFRAMERATE_SECONDS,
00343 kFRAMERATE_MILLISECONDS,
00344 kFRAMERATE_GAMES_15,
00345 kFRAMERATE_FILM_24,
00346 kFRAMERATE_PAL_25,
00347 kFRAMERATE_NTSC_30,
00348 kFRAMERATE_SHOWSCAN_48,
00349 kFRAMERATE_PALFIELD_50,
00350 kFRAMERATE_NTSCFIELD_60
00351 };
00352
00353
00354 public: enum EEnveloppeSystem
00355 {
00356 eSKIN_MODIFIER,
00357 ePHYSIQUE,
00358 eBONESPRO,
00359 eENVELOPPE_SYSTEM_COUNT
00360 };
00361
00362
00363 public: enum EGeometryType
00364 {
00365 eTRIANGLE,
00366 eSIMPLIFIED_POLY,
00367 ePOLY,
00368 eNURB,
00369 ePATCH,
00370 eGEOMETRY_TYPE_COUNT
00371 };
00372
00373
00374
00375
00376
00377 protected: KFbxIOSettings(KFbxSdkManager& pManager,char const* pName);
00378
00379
00380 private: void AddXMLProp(KFbxProperty& pProp, xmlNodePtr pParent, xmlDocPtr pXmlDoc);
00381
00382
00383 private: xmlNodePtr GetXMLNode(KFbxProperty& pProp);
00384
00385 public: KsoInfo impInfo;
00386 public: KsoInfo expInfo;
00387
00388 public: FBXUILANGUAGE UILanguage;
00389
00390 private: void AddNewPropInfo(KFbxProperty &pProp);
00391 private: void DeletePropInfo(KFbxProperty &pProp);
00392 private: void DeleteAllPropInfo(KFbxProperty &pProp);
00393
00394 public: PropInfo * GetPropInfo(KFbxProperty &pProp);
00395 public: KString GetLanguageLabel(KFbxProperty &pProp);
00396 public: void SetLanguageLabel(KFbxProperty &pProp, KString &pLabel);
00397 public: FBXUILANGUAGE Get_Max_Runtime_Language(KString regLocation);
00398
00399 private: xmlNode* GetChildXmlNode(xmlNode* parent, KString* nodeName);
00400 private: xmlNode* AddChildXmlNode(xmlNode* parent, KString* nodeName, KString* nodeValue = NULL);
00401 private: xmlAttr* AddAttributeToXmlNode(xmlNode* node, KString* attName, KString* attValue = NULL);
00402
00403
00404 private: KString* GetAttributeFromXmlNode(xmlNode* node, KString* attName);
00405
00406
00407 private: KString* GetInnerTextXmlNode(xmlNode* node);
00408
00409
00410 public: bool IsEnumExist(KFbxProperty& pProp, KString& enumString);
00411 public: int GetEnumIndex(KFbxProperty& pProp, KString& enumString, bool pNoCase = false);
00412
00413 private: bool WriteXmlDocToRegistry(KString* regPath, KString* regKeyName, KString* regValueName, xmlDocPtr XmlDoc);
00414
00415
00416 private: xmlDocPtr ReadXmlDocFromRegistry(KString* regPath, KString* regKeyName, KString* regValueName );
00417
00418 private: void CreatePropRecursive(xmlNode* pNode, KFbxProperty& pPropParent);
00419
00420 public: virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pType) const;
00421
00422 };
00423
00424 #include <fbxfilesdk_nsend.h>
00425
00426 #endif // KARCH_ENV_MACOSX_CFM
00427
00428 #endif // #define _FBXSDK_IO_SETTINGS_H_
00429