- Main Page
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# fbxrenamingstrategy.h

Go to the documentation of this file.

    00001 /****************************************************************************************
    00002
    00003    Copyright (C) 2012 Autodesk, Inc.
    00004    All rights reserved.
    00005
    00006    Use of this software is subject to the terms of the Autodesk license agreement
    00007    provided at the time of installation or download, or which otherwise accompanies
    00008    this software in either electronic or hard copy form.
    00009
    00010 ****************************************************************************************/
    00011
    00013 #ifndef _FBXSDK_UTILS_RENAMINGSTRATEGY_H_
    00014 #define _FBXSDK_UTILS_RENAMINGSTRATEGY_H_
    00015
    00016 #include <fbxsdk/fbxsdk_def.h>
    00017
    00018 #include <fbxsdk/core/base/fbxarray.h>
    00019 #include <fbxsdk/core/base/fbxstring.h>
    00020 #include <fbxsdk/core/base/fbxstringlist.h>
    00021 #include <fbxsdk/core/base/fbxcharptrset.h>
    00022 #include <fbxsdk/utils/fbxnamehandler.h>
    00023
    00024 #include <fbxsdk/fbxsdk_nsbegin.h>
    00025
    00026 class FbxNode;
    00027 class FbxTexture;
    00028 class FbxVideo;
    00029 class FbxScene;
    00030 class FbxNodeAttribute;
    00031
    00040 class FBXSDK_DLL FbxRenamingStrategyInterface
    00041 {
    00042 public:
    00044     FbxRenamingStrategyInterface();
    00045
    00047     virtual ~FbxRenamingStrategyInterface ();
    00048
    00050     virtual void Clear() = 0;
    00051
    00056     virtual bool Rename(FbxNameHandler& pName) = 0;
    00057
    00061     virtual FbxRenamingStrategyInterface* Clone() = 0;
    00062 };
    00063
    00070 class FBXSDK_DLL FbxRenamingStrategyNumber : public FbxRenamingStrategyInterface
    00071 {
    00072 public:
    00074     FbxRenamingStrategyNumber();
    00075
    00077     virtual ~FbxRenamingStrategyNumber ();
    00078
    00080     virtual void Clear();
    00081
    00086     virtual bool Rename(FbxNameHandler& pName);
    00087
    00091     virtual FbxRenamingStrategyInterface* Clone();
    00092
    00094     //
    00095     //  WARNING!
    00096     //
    00097     //    Anything beyond these lines may not be documented accurately and is
    00098     //     subject to change without notice.
    00099     //
    00101
    00102 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00103
    00104 private:
    00105
    00106     struct NameCell
    00107     {
    00108         NameCell(char const* pName) :
    00109             mName(pName),
    00110             mInstanceCount(0)
    00111         {
    00112         }
    00113
    00114         FbxString mName;
    00115         int mInstanceCount;
    00116     };
    00117
    00118     FbxArray<NameCell*> mNameArray;
    00119
    00120 #endif // DOXYGEN_SHOULD_SKIP_THIS
    00121 };
    00122
    00129 class FBXSDK_DLL FbxRenamingStrategy : public FbxRenamingStrategyInterface
    00130 {
    00131 public:
    00136     enum EDirection
    00137     {
    00138         eToFBX,
    00139         eFromFBX
    00140     };
    00141
    00146     FbxRenamingStrategy(EDirection pMod, bool pOnCreationRun = false);
    00147
    00149     virtual ~FbxRenamingStrategy();
    00150
    00155     virtual bool Rename(FbxNameHandler& pName);
    00156
    00158     virtual void Clear();
    00159
    00163     virtual FbxRenamingStrategyInterface* Clone();
    00164
    00166     //
    00167     //  WARNING!
    00168     //
    00169     //  Anything beyond these lines may not be documented accurately and is
    00170     //  subject to change without notice.
    00171     //
    00173
    00174 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00175
    00181     enum EClashType
    00182     {
    00183         eNameClashAuto,
    00184         eNameClashType1,
    00185         eNameClashType2
    00186     };
    00187
    00191     void SetClashSoverType(EClashType pType);
    00192
    00197     static char* NoPrefixName (char const* pName);
    00198
    00203     static char* NoPrefixName (FbxString& pName);
    00204
    00208     virtual char* GetNameSpace() { return mNameSpace.Buffer(); }
    00209
    00213     virtual void SetInNameSpaceSymbol(FbxString pNameSpaceSymbol){mInNameSpaceSymbol = pNameSpaceSymbol;}
    00214
    00218     virtual void SetOutNameSpaceSymbol(FbxString pNameSpaceSymbol){mOutNameSpaceSymbol = pNameSpaceSymbol;}
    00219
    00223     virtual void SetCaseSensibility(bool pIsCaseSensitive){mCaseSensitive = pIsCaseSensitive ;}
    00224
    00228     virtual void SetReplaceNonAlphaNum(bool pReplaceNonAlphaNum){mReplaceNonAlphaNum = pReplaceNonAlphaNum;}
    00229
    00233     virtual void SetFirstNotNum(bool pFirstNotNum){mFirstNotNum = pFirstNotNum;}
    00234
    00240     virtual bool RenameUnparentNameSpace(FbxNode* pNode, bool pIsRoot = false);
    00241
    00246     virtual bool RemoveImportNameSpaceClash(FbxNode* pNode);
    00247
    00252     virtual void GetParentsNameSpaceList(FbxNode* pNode, FbxArray<FbxString*> &pNameSpaceList);
    00253
    00259     virtual bool PropagateNameSpaceChange(FbxNode* pNode, FbxString OldNS, FbxString NewNS);
    00260
    00261 protected:
    00262
    00263     virtual bool RenameToFBX(FbxNameHandler& pName);
    00264     virtual bool RenameFromFBX(FbxNameHandler& pName);
    00265     virtual FbxString& ReplaceNonAlphaNum(FbxString& pName,  const char* pReplace, bool pIgnoreNameSpace);
    00266
    00267     EDirection mMode;
    00268     EClashType mType;
    00269
    00270     struct NameCell
    00271     {
    00272         NameCell(char const* pName) :
    00273             mName(pName),
    00274             mInstanceCount(0)
    00275         {
    00276         }
    00277
    00278         FbxString mName;
    00279         int mInstanceCount;
    00280     };
    00281
    00282
    00283     FbxCharPtrSet                    mStringNameArray;
    00284     FbxArray<NameCell*>    mExistingNsList;
    00285     bool                        mOnCreationRun;
    00286     bool                        mCaseSensitive;
    00287     bool                        mReplaceNonAlphaNum;
    00288     bool                        mFirstNotNum;
    00289     FbxString                        mNameSpace;
    00290     FbxString                        mInNameSpaceSymbol; //symbol identifying a name space
    00291     FbxString                        mOutNameSpaceSymbol;
    00292
    00293 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00294 };
    00295
    00309 class FBXSDK_DLL FbxSceneRenamer
    00310 {
    00311 public:
    00315     FbxSceneRenamer(FbxScene* pScene) {mScene = pScene;};
    00316
    00318     virtual ~FbxSceneRenamer(){};
    00319
    00340     enum ERenamingMode
    00341     {
    00342         eNone,
    00343         eMAYA_TO_FBX5,
    00344         eMAYA_TO_FBX_MB75,
    00345         eMAYA_TO_FBX_MB70,
    00346         eFBXMB75_TO_FBXMB70,
    00347         eFBX_TO_FBX,
    00348         eMAYA_TO_FBX,
    00349         eFBX_TO_MAYA,
    00350         eLW_TO_FBX,
    00351         eFBX_TO_LW,
    00352         eXSI_TO_FBX,
    00353         eFBX_TO_XSI,
    00354         eMAX_TO_FBX,
    00355         eFBX_TO_MAX,
    00356         eMB_TO_FBX,
    00357         eFBX_TO_MB,
    00358         eDAE_TO_FBX,
    00359         eFBX_TO_DAE
    00360     };
    00361
    00365     void RenameFor(ERenamingMode pMode);
    00366
    00368 //
    00369 //  WARNING!
    00370 //
    00371 //  Anything beyond these lines may not be documented accurately and is
    00372 //  subject to change without notice.
    00373 //
    00375
    00376 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00377
    00378 private:
    00379
    00392     void ResolveNameClashing(    bool pFromFbx, bool pIgnoreNS, bool pIsCaseSensitive,
    00393                                 bool pReplaceNonAlphaNum, bool pFirstNotNum,
    00394                                 FbxString pInNameSpaceSymbol, FbxString pOutNameSpaceSymbol,
    00395                                 bool pNoUnparentNS/*for MB < 7.5*/, bool pRemoveNameSpaceClash);
    00396
    00397     FbxRenamingStrategyInterface* mNodeRenamingStrategy;
    00398     FbxScene* mScene;
    00399
    00400 #endif // DOXYGEN_SHOULD_SKIP_THIS
    00401 };
    00402
    00403 #include <fbxsdk/fbxsdk_nsend.h>
    00404
    00405 #endif /* _FBXSDK_UTILS_RENAMINGSTRATEGY_H_ */
    00406