00001
00003 #ifndef _FBXSDK_RENAMING_STRATEGY_H_
00004 #define _FBXSDK_RENAMING_STRATEGY_H_
00005
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 #include <kaydaradef.h>
00041 #ifndef KFBX_DLL
00042 #define KFBX_DLL K_DLLIMPORT
00043 #endif
00044
00045 #include <klib/kstring.h>
00046 #include <klib/kstringlist.h>
00047 #include <klib/krenamingstrategy.h>
00048 #include <klib/kcharptrset.h>
00049
00050 #ifndef MB_FBXSDK
00051 #include <kbaselib_nsuse.h>
00052 #endif
00053
00054 #include <fbxfilesdk_nsbegin.h>
00055 class KFbxNode;
00056 class KFbxTexture;
00057 class KFbxVideo;
00058 class KFbxScene;
00059 class KFbxNodeAttribute;
00060
00061
00069 class KFBX_DLL KFbxRenamingStrategy : public KRenamingStrategy
00070 {
00071 public:
00072
00078 enum EMode
00079 {
00080 eTO_FBX,
00081 eFROM_FBX,
00082 eMODE_COUNT
00083 };
00084
00090 enum EClashType
00091 {
00092 eNAMECLASH_AUTO,
00093 eNAMECLASH_TYPE1,
00094 eNAMECLASH_TYPE2
00095 };
00096
00097
00099 KFbxRenamingStrategy(EMode pMod, bool pOnCreationRun = false);
00100
00102 virtual ~KFbxRenamingStrategy ();
00103
00105 void SetClashSoverType(EClashType pType);
00106
00111 virtual bool Rename(KName& pName);
00112
00114 virtual void Clear();
00115
00120 virtual KRenamingStrategy* Clone();
00121
00126 static char* NoPrefixName (char const* pName);
00127 static char* NoPrefixName (KString& pName);
00128
00132 virtual char* GetNameSpace() { return mNameSpace.Buffer(); }
00133
00137 virtual void SetInNameSpaceSymbol(KString pNameSpaceSymbol){mInNameSpaceSymbol = pNameSpaceSymbol;}
00138
00142 virtual void SetOutNameSpaceSymbol(KString pNameSpaceSymbol){mOutNameSpaceSymbol = pNameSpaceSymbol;}
00143
00147 virtual void SetCaseSensibility(bool pIsCaseSensitive){mCaseSensitive = pIsCaseSensitive ;}
00148
00152 virtual void SetReplaceNonAlphaNum(bool pReplaceNonAlphaNum){mReplaceNonAlphaNum = pReplaceNonAlphaNum;}
00153
00157 virtual void SetFirstNotNum(bool pFirstNotNum){mFirstNotNum = pFirstNotNum;}
00158
00164 virtual bool RenameUnparentNameSpace(KFbxNode* pNode, bool pIsRoot = false);
00165
00170 virtual bool RemoveImportNameSpaceClash(KFbxNode* pNode);
00171
00172 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00173
00174 virtual void GetParentsNameSpaceList(KFbxNode* pNode, KArrayTemplate<KString*> &pNameSpaceList);
00175 virtual bool PropagateNameSpaceChange(KFbxNode* pNode, KString OldNS, KString NewNS);
00176
00177 protected:
00178
00179 virtual bool RenameToFBX(KName& pName);
00180 virtual bool RenameFromFBX(KName& pName);
00181 virtual KString& ReplaceNonAlphaNum(KString& pName, char* pReplace, bool pIgnoreNameSpace);
00182
00183 EMode mMode;
00184 EClashType mType;
00185
00186 struct NameCell
00187 {
00188 NameCell(char const* pName) :
00189 mName(pName),
00190 mInstanceCount(0)
00191 {
00192 }
00193
00194 KString mName;
00195 int mInstanceCount;
00196 };
00197
00198
00199 KCharPtrSet mStringNameArray;
00200 KArrayTemplate<NameCell*> mExistingNsList;
00201 bool mOnCreationRun;
00202 bool mCaseSensitive;
00203 bool mReplaceNonAlphaNum;
00204 bool mFirstNotNum;
00205 KString mNameSpace;
00206 KString mInNameSpaceSymbol;
00207 KString mOutNameSpaceSymbol;
00208
00209 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00210
00211 };
00212
00221 class KFBX_DLL KFbxSceneRenamer
00222 {
00223
00224 public:
00225
00229 KFbxSceneRenamer(KFbxScene* pScene){mScene = pScene;};
00230
00234 virtual ~KFbxSceneRenamer(){};
00235
00256 enum ERenamingMode
00257 {
00258 eNONE,
00259 eMAYA_TO_FBX5,
00260 eMAYA_TO_FBX_MB75,
00261 eMAYA_TO_FBX_MB70,
00262 eFBXMB75_TO_FBXMB70,
00263 eFBX_TO_FBX,
00264 eMAYA_TO_FBX,
00265 eFBX_TO_MAYA,
00266 eLW_TO_FBX,
00267 eFBX_TO_LW,
00268 eXSI_TO_FBX,
00269 eFBX_TO_XSI,
00270 eMAX_TO_FBX,
00271 eFBX_TO_MAX,
00272 eMB_TO_FBX,
00273 eFBX_TO_MB,
00274 eDAE_TO_FBX,
00275 eFBX_TO_DAE
00276 };
00277
00278 void RenameFor(ERenamingMode pMode);
00279
00292 void ResolveNameClashing( bool pFromFbx, bool pIgnoreNS, bool pIsCaseSensitive,
00293 bool pReplaceNonAlphaNum, bool pFirstNotNum,
00294 KString pInNameSpaceSymbol, KString pOutNameSpaceSymbol,
00295 bool pNoUnparentNS, bool pRemoveNameSpaceClash);
00296 private:
00297
00298 KRenamingStrategy* mNodeRenamingStrategy;
00299 KFbxScene* mScene;
00300 };
00301
00302
00303 #include <fbxfilesdk_nsend.h>
00304
00305 #endif // #define _FBXSDK_RENAMING_STRATEGY_H_
00306