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/components/kbaselib/kaydaradef_h.h>
00041 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00042 #include <fbxfilesdk/components/kbaselib/klib/kstringlist.h>
00043 #include <fbxfilesdk/components/kbaselib/klib/krenamingstrategy.h>
00044 #include <fbxfilesdk/components/kbaselib/klib/kcharptrset.h>
00045
00046 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00047 class KFbxNode;
00048 class KFbxTexture;
00049 class KFbxVideo;
00050 class KFbxScene;
00051 class KFbxNodeAttribute;
00052
00053
00061 class KFBX_DLL KFbxRenamingStrategy : public KRenamingStrategy
00062 {
00063 public:
00064
00070 enum EMode
00071 {
00072 eTO_FBX,
00073 eFROM_FBX,
00074 eMODE_COUNT
00075 };
00076
00082 enum EClashType
00083 {
00084 eNAMECLASH_AUTO,
00085 eNAMECLASH_TYPE1,
00086 eNAMECLASH_TYPE2
00087 };
00088
00089
00094 KFbxRenamingStrategy(EMode pMod, bool pOnCreationRun = false);
00095
00097 virtual ~KFbxRenamingStrategy ();
00098
00102 void SetClashSoverType(EClashType pType);
00103
00108 virtual bool Rename(KName& pName);
00109
00111 virtual void Clear();
00112
00117 virtual KRenamingStrategy* Clone();
00118
00123 static char* NoPrefixName (char const* pName);
00124 static char* NoPrefixName (KString& pName);
00125
00129 virtual char* GetNameSpace() { return mNameSpace.Buffer(); }
00130
00134 virtual void SetInNameSpaceSymbol(KString pNameSpaceSymbol){mInNameSpaceSymbol = pNameSpaceSymbol;}
00135
00139 virtual void SetOutNameSpaceSymbol(KString pNameSpaceSymbol){mOutNameSpaceSymbol = pNameSpaceSymbol;}
00140
00144 virtual void SetCaseSensibility(bool pIsCaseSensitive){mCaseSensitive = pIsCaseSensitive ;}
00145
00149 virtual void SetReplaceNonAlphaNum(bool pReplaceNonAlphaNum){mReplaceNonAlphaNum = pReplaceNonAlphaNum;}
00150
00154 virtual void SetFirstNotNum(bool pFirstNotNum){mFirstNotNum = pFirstNotNum;}
00155
00161 virtual bool RenameUnparentNameSpace(KFbxNode* pNode, bool pIsRoot = false);
00162
00167 virtual bool RemoveImportNameSpaceClash(KFbxNode* pNode);
00168
00169 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00170
00171 virtual void GetParentsNameSpaceList(KFbxNode* pNode, KArrayTemplate<KString*> &pNameSpaceList);
00172 virtual bool PropagateNameSpaceChange(KFbxNode* pNode, KString OldNS, KString NewNS);
00173
00174 protected:
00175
00176 virtual bool RenameToFBX(KName& pName);
00177 virtual bool RenameFromFBX(KName& pName);
00178 virtual KString& ReplaceNonAlphaNum(KString& pName, char* pReplace, bool pIgnoreNameSpace);
00179
00180 EMode mMode;
00181 EClashType mType;
00182
00183 struct NameCell
00184 {
00185 NameCell(char const* pName) :
00186 mName(pName),
00187 mInstanceCount(0)
00188 {
00189 }
00190
00191 KString mName;
00192 int mInstanceCount;
00193 };
00194
00195
00196 KCharPtrSet mStringNameArray;
00197 KArrayTemplate<NameCell*> mExistingNsList;
00198 bool mOnCreationRun;
00199 bool mCaseSensitive;
00200 bool mReplaceNonAlphaNum;
00201 bool mFirstNotNum;
00202 KString mNameSpace;
00203 KString mInNameSpaceSymbol;
00204 KString mOutNameSpaceSymbol;
00205
00206 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00207
00208 };
00209
00218 class KFBX_DLL KFbxSceneRenamer
00219 {
00220
00221 public:
00222
00226 KFbxSceneRenamer(KFbxScene* pScene){mScene = pScene;};
00227
00231 virtual ~KFbxSceneRenamer(){};
00232
00253 enum ERenamingMode
00254 {
00255 eNONE,
00256 eMAYA_TO_FBX5,
00257 eMAYA_TO_FBX_MB75,
00258 eMAYA_TO_FBX_MB70,
00259 eFBXMB75_TO_FBXMB70,
00260 eFBX_TO_FBX,
00261 eMAYA_TO_FBX,
00262 eFBX_TO_MAYA,
00263 eLW_TO_FBX,
00264 eFBX_TO_LW,
00265 eXSI_TO_FBX,
00266 eFBX_TO_XSI,
00267 eMAX_TO_FBX,
00268 eFBX_TO_MAX,
00269 eMB_TO_FBX,
00270 eFBX_TO_MB,
00271 eDAE_TO_FBX,
00272 eFBX_TO_DAE
00273 };
00274
00275 void RenameFor(ERenamingMode pMode);
00276
00289 void ResolveNameClashing( bool pFromFbx, bool pIgnoreNS, bool pIsCaseSensitive,
00290 bool pReplaceNonAlphaNum, bool pFirstNotNum,
00291 KString pInNameSpaceSymbol, KString pOutNameSpaceSymbol,
00292 bool pNoUnparentNS, bool pRemoveNameSpaceClash);
00293 private:
00294
00295 KRenamingStrategy* mNodeRenamingStrategy;
00296 KFbxScene* mScene;
00297 };
00298
00299
00300 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00301
00302 #endif // FBXFILESDK_KFBXPLUGINS_KFBXRENAMINGSTRATEGY_H
00303