00001
00003 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXRENAMINGSTRATEGY_H
00004 #define FBXFILESDK_KFBXPLUGINS_KFBXRENAMINGSTRATEGY_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 <fbxfilesdk/fbxfilesdk_def.h>
00041
00042 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00043 #include <fbxfilesdk/components/kbaselib/klib/kstringlist.h>
00044 #include <fbxfilesdk/components/kbaselib/klib/krenamingstrategy.h>
00045 #include <fbxfilesdk/components/kbaselib/klib/kcharptrset.h>
00046
00047 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00048
00049 class KFbxNode;
00050 class KFbxTexture;
00051 class KFbxVideo;
00052 class KFbxScene;
00053 class KFbxNodeAttribute;
00054
00061 class KFBX_DLL KFbxRenamingStrategy : public KRenamingStrategy
00062 {
00063 public:
00069 enum EMode
00070 {
00071 eTO_FBX,
00072 eFROM_FBX,
00073 eMODE_COUNT
00074 };
00075
00080 KFbxRenamingStrategy(EMode pMod, bool pOnCreationRun = false);
00081
00083 virtual ~KFbxRenamingStrategy();
00084
00089 virtual bool Rename(KName& pName);
00090
00092 virtual void Clear();
00093
00097 virtual KRenamingStrategy* Clone();
00098
00100
00101
00102
00103
00104
00105
00107
00108 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00109
00115 enum EClashType
00116 {
00117 eNAMECLASH_AUTO,
00118 eNAMECLASH_TYPE1,
00119 eNAMECLASH_TYPE2
00120 };
00121
00125 void SetClashSoverType(EClashType pType);
00126
00131 static char* NoPrefixName (char const* pName);
00132
00137 static char* NoPrefixName (KString& pName);
00138
00142 virtual char* GetNameSpace() { return mNameSpace.Buffer(); }
00143
00147 virtual void SetInNameSpaceSymbol(KString pNameSpaceSymbol){mInNameSpaceSymbol = pNameSpaceSymbol;}
00148
00152 virtual void SetOutNameSpaceSymbol(KString pNameSpaceSymbol){mOutNameSpaceSymbol = pNameSpaceSymbol;}
00153
00157 virtual void SetCaseSensibility(bool pIsCaseSensitive){mCaseSensitive = pIsCaseSensitive ;}
00158
00162 virtual void SetReplaceNonAlphaNum(bool pReplaceNonAlphaNum){mReplaceNonAlphaNum = pReplaceNonAlphaNum;}
00163
00167 virtual void SetFirstNotNum(bool pFirstNotNum){mFirstNotNum = pFirstNotNum;}
00168
00174 virtual bool RenameUnparentNameSpace(KFbxNode* pNode, bool pIsRoot = false);
00175
00180 virtual bool RemoveImportNameSpaceClash(KFbxNode* pNode);
00181
00182 virtual void GetParentsNameSpaceList(KFbxNode* pNode, KArrayTemplate<KString*> &pNameSpaceList);
00183 virtual bool PropagateNameSpaceChange(KFbxNode* pNode, KString OldNS, KString NewNS);
00184
00185 protected:
00186
00187 virtual bool RenameToFBX(KName& pName);
00188 virtual bool RenameFromFBX(KName& pName);
00189 virtual KString& ReplaceNonAlphaNum(KString& pName, char* pReplace, bool pIgnoreNameSpace);
00190
00191 EMode mMode;
00192 EClashType mType;
00193
00194 struct NameCell
00195 {
00196 NameCell(char const* pName) :
00197 mName(pName),
00198 mInstanceCount(0)
00199 {
00200 }
00201
00202 KString mName;
00203 int mInstanceCount;
00204 };
00205
00206
00207 KCharPtrSet mStringNameArray;
00208 KArrayTemplate<NameCell*> mExistingNsList;
00209 bool mOnCreationRun;
00210 bool mCaseSensitive;
00211 bool mReplaceNonAlphaNum;
00212 bool mFirstNotNum;
00213 KString mNameSpace;
00214 KString mInNameSpaceSymbol;
00215 KString mOutNameSpaceSymbol;
00216
00217 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00218 };
00219
00233 class KFBX_DLL KFbxSceneRenamer
00234 {
00235 public:
00239 KFbxSceneRenamer(KFbxScene* pScene) {mScene = pScene;};
00240
00242 virtual ~KFbxSceneRenamer(){};
00243
00264 enum ERenamingMode
00265 {
00266 eNONE,
00267 eMAYA_TO_FBX5,
00268 eMAYA_TO_FBX_MB75,
00269 eMAYA_TO_FBX_MB70,
00270 eFBXMB75_TO_FBXMB70,
00271 eFBX_TO_FBX,
00272 eMAYA_TO_FBX,
00273 eFBX_TO_MAYA,
00274 eLW_TO_FBX,
00275 eFBX_TO_LW,
00276 eXSI_TO_FBX,
00277 eFBX_TO_XSI,
00278 eMAX_TO_FBX,
00279 eFBX_TO_MAX,
00280 eMB_TO_FBX,
00281 eFBX_TO_MB,
00282 eDAE_TO_FBX,
00283 eFBX_TO_DAE
00284 };
00285
00289 void RenameFor(ERenamingMode pMode);
00290
00292
00293
00294
00295
00296
00297
00299
00300 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00301
00302 private:
00303
00316 void ResolveNameClashing( bool pFromFbx, bool pIgnoreNS, bool pIsCaseSensitive,
00317 bool pReplaceNonAlphaNum, bool pFirstNotNum,
00318 KString pInNameSpaceSymbol, KString pOutNameSpaceSymbol,
00319 bool pNoUnparentNS, bool pRemoveNameSpaceClash);
00320
00321 KRenamingStrategy* mNodeRenamingStrategy;
00322 KFbxScene* mScene;
00323
00324 #endif // DOXYGEN_SHOULD_SKIP_THIS
00325 };
00326
00327
00328 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00329
00330 #endif // FBXFILESDK_KFBXPLUGINS_KFBXRENAMINGSTRATEGY_H
00331