FBX C++ API Reference
fbxrenamingstrategy.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2017 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_UTILS_RENAMINGSTRATEGY_H_
14 #define _FBXSDK_UTILS_RENAMINGSTRATEGY_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
20 
21 #include <fbxsdk/fbxsdk_nsbegin.h>
22 
23 class FbxScene;
24 class FbxNode;
25 
35 {
36 public:
39 
41  virtual ~FbxRenamingStrategyInterface ();
42 
44  virtual void Clear() = 0;
45 
50  virtual bool Rename(FbxNameHandler& pName) = 0;
51 
55  virtual FbxRenamingStrategyInterface* Clone() = 0;
56 };
57 
65 {
66 public:
69 
71  virtual ~FbxRenamingStrategyNumber ();
72 
74  virtual void Clear();
75 
80  virtual bool Rename(FbxNameHandler& pName);
81 
86 
87 /*****************************************************************************************************************************
88 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
89 *****************************************************************************************************************************/
90 #ifndef DOXYGEN_SHOULD_SKIP_THIS
91 private:
92  struct NameCell
93  {
94  NameCell(const char* pName) :
95  mName(pName),
96  mInstanceCount(0)
97  {
98  }
99 
100  FbxString mName;
101  int mInstanceCount;
102  };
103 
104  FbxArray<NameCell*> mNameArray;
105 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
106 };
107 
118 {
119 public:
125  {
127  eFromFBX
128  };
129 
134  FbxRenamingStrategy(EDirection pMod, bool pOnCreationRun = false);
135 
137  virtual ~FbxRenamingStrategy();
138 
143  virtual bool Rename(FbxNameHandler& pName);
144 
146  virtual void Clear();
147 
151  virtual FbxRenamingStrategyInterface* Clone();
152 
159  {
162  eNameClashType2
163  };
164 
168  void SetClashSolverType(EClashType pType);
169 
173  virtual char* GetNameSpace() { return mNameSpace.Buffer(); }
174 
178  virtual void SetInNameSpaceSymbol(FbxString pNameSpaceSymbol){mInNameSpaceSymbol = pNameSpaceSymbol;}
179 
183  virtual void SetOutNameSpaceSymbol(FbxString pNameSpaceSymbol){mOutNameSpaceSymbol = pNameSpaceSymbol;}
184 
188  virtual void SetCaseSensibility(bool pIsCaseSensitive){mCaseSensitive = pIsCaseSensitive ;}
189 
193  virtual void SetReplaceNonAlphaNum(bool pReplaceNonAlphaNum){mReplaceNonAlphaNum = pReplaceNonAlphaNum;}
194 
198  virtual void SetFirstNotNum(bool pFirstNotNum){mFirstNotNum = pFirstNotNum;}
199 
206  virtual bool RenameUnparentNameSpace(FbxNode* pNode, bool pIsRoot = false);
207 
213  virtual bool RemoveImportNameSpaceClash(FbxNode* pNode);
214 
219  virtual void GetParentsNameSpaceList(FbxNode* pNode, FbxArray<FbxString*> &pNameSpaceList);
220 
228  virtual bool PropagateNameSpaceChange(FbxNode* pNode, FbxString OldNS, FbxString NewNS);
229 
230 /*****************************************************************************************************************************
231 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
232 *****************************************************************************************************************************/
233 #ifndef DOXYGEN_SHOULD_SKIP_THIS
234 protected:
235  virtual bool RenameToFBX(FbxNameHandler& pName);
236  virtual bool RenameFromFBX(FbxNameHandler& pName);
237  virtual FbxString& ReplaceNonAlphaNum(FbxString& pName, const char* pReplace, bool pIgnoreNameSpace);
238 
239  EDirection mMode;
240  EClashType mType;
241 
242  struct NameCell
243  {
244  NameCell(const char* pName) :
245  mName(pName),
246  mInstanceCount(0)
247  {
248  }
249 
250  FbxString mName;
251  int mInstanceCount;
252  };
253 
254  FbxCharPtrSet mStringNameArray;
255  FbxArray<NameCell*> mExistingNsList;
256  bool mOnCreationRun;
257  bool mCaseSensitive;
258  bool mReplaceNonAlphaNum;
259  bool mFirstNotNum;
260  FbxString mNameSpace;
261  FbxString mInNameSpaceSymbol; //symbol identifying a name space
262  FbxString mOutNameSpaceSymbol;
263 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
264 };
265 
280 {
281 public:
285  FbxSceneRenamer(FbxScene* pScene) {mScene = pScene;};
286 
288  virtual ~FbxSceneRenamer(){};
289 
311  {
329  eFBX_TO_DAE
330  };
331 
335  void RenameFor(ERenamingMode pMode);
336 
337 /*****************************************************************************************************************************
338 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
339 *****************************************************************************************************************************/
340 #ifndef DOXYGEN_SHOULD_SKIP_THIS
341 private:
342  void ResolveNameClashing(bool pFromFbx, bool pIgnoreNS, bool pIsCaseSensitive,
343  bool pReplaceNonAlphaNum, bool pFirstNotNum,
344  FbxString pInNameSpaceSymbol, FbxString pOutNameSpaceSymbol,
345  bool pNoUnparentNS/*for MB < 7.5*/, bool pRemoveNameSpaceClash);
346 
347  FbxRenamingStrategyInterface* mNodeRenamingStrategy;
348  FbxScene* mScene;
349 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
350 };
351 
352 #include <fbxsdk/fbxsdk_nsend.h>
353 
354 #endif /* _FBXSDK_UTILS_RENAMINGSTRATEGY_H_ */
355 
FbxSceneRenamer(FbxScene *pScene)
Constructor.
FBX SDK environment definition.
Utility class to manipulate strings.
Definition: fbxstring.h:66
EDirection
The mode describing the convention direction, from FBX format or to FBX format.
virtual char * GetNameSpace()
Get the namespace of the last renamed object.
Implements a renaming strategy that resolves name clashes by adding number postfixes.
virtual void SetInNameSpaceSymbol(FbxString pNameSpaceSymbol)
Sets the current scene namespace symbol.
virtual void SetOutNameSpaceSymbol(FbxString pNameSpaceSymbol)
Sets the wanted scene namespace symbol.
This base class is an abstract implementation of a renaming strategy for avoiding name clashes...
virtual void SetReplaceNonAlphaNum(bool pReplaceNonAlphaNum)
Sets the flag for character acceptance during renaming.
virtual void SetCaseSensibility(bool pIsCaseSensitive)
Sets case sensitivity for name clashing.
Represents an element in the scene graph.
Definition: fbxnode.h:72
This class contains the description of a 3D scene.
Definition: fbxscene.h:61
This class contains the data structure support for char pointer set.
Definition: fbxcharptrset.h:22
virtual FbxRenamingStrategyInterface * Clone()=0
Create a dynamic renaming strategy instance of the same type as the child class.
The FbxRenamingStrategy object can be set to rename all the objects in a scene.
#define FBXSDK_DLL
Definition: fbxarch.h:173
A name is a case-sensitive string ID of a property, a node, a node attribute, a texture, etc.
The FbxSceneRenamer provides a way to easily rename objects in a scene without using the FbxRenamingS...
virtual void SetFirstNotNum(bool pFirstNotNum)
Sets the flag for first character acceptance during renaming.
virtual bool Rename(FbxNameHandler &pName)=0
Rename a name if necessary to avoid name-clash issues.
virtual void Clear()=0
Resets internal state regarding assigned names.
Class for array of basic elements such as pointers and basic types.
Definition: fbxarray.h:23
virtual ~FbxSceneRenamer()
Destructor.
ERenamingMode
The Mode describing from which format to which format.