FBX C++ API Reference
fbxscenecheckutility.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2016 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_SCENE_CHECK_UTILITY_H_
14 #define _FBXSDK_SCENE_CHECK_UTILITY_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
19 #include <fbxsdk/fbxsdk_nsbegin.h>
20 
21 class FbxScene;
22 class FbxStatus;
23 
29 {
30 public:
31  enum ECheckMode {
32  eCheckCycles = 0x01,
33  eCheckAnimationData = 0x06,
34  eCheckAnimationEmptyLayers = 0x02,
35  eCheckAnimatioCurveData = 0x04,
36  eCheckGeometryData = 0x7FFF8,
37  eCheckPolyVertex = 0x00008,
38  eCheckLayerElems = 0x0FFF0,
39  // leave room for more granularity
40  eCheckOtherData = 0xF0000,
41  eCheckSkin = 0x00010000,
42  eCheckCluster = 0x00020000,
43  eCheckShape = 0x00040000,
44  eSelectionNode= 0x00080000,
45  eCkeckData = 0x7FFFE // includes GeometryData,AnimationData & OtherData
46  };
47 
55  FbxSceneCheckUtility(const FbxScene* pScene, FbxStatus* pStatus=NULL, FbxArray<FbxString*>* pDetails = NULL);
57 
67  bool Validate(ECheckMode pCheckMode=eCheckCycles, bool pTryToRemoveBadData=false);
68 
69 /*****************************************************************************************************************************
70 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
71 *****************************************************************************************************************************/
72 #ifndef DOXYGEN_SHOULD_SKIP_THIS
73  bool Validate(FbxGeometry* pGeom, int pCheckMode = eCheckGeometryData);
74 
75  template <typename T>
76  bool ValidateArray(T* pData, int pNbItems, T pMinVal, T pMaxVal, T* pFixVal = nullptr);
77 
78  // Check functions return true if valid, false otherwise
79  static bool ValidateMappingMode(FbxLayerElement::EMappingMode pMappingMode);
80  static bool ValidateReferenceMode(FbxLayerElement::EReferenceMode pReferenceMode);
81  static bool ValidateSurfaceMode(FbxGeometry::ESurfaceMode pSurfaceMode);
82 
83  // Return 0 if an error is detected or the expected size of the reference array based on the mapping & reference modes
84  static int ExpectedNbItems(const FbxGeometryBase* pGeom, FbxLayerElement::EMappingMode pMappingMode);
85 
86 
90  static bool ValidateObjectData(const FbxNurbs* pNurbs);
91  static bool ValidateObjectData(const FbxNurbsCurve* pNurbs);
92  static bool ValidateObjectData(const FbxNurbsSurface* pNurbs);
93 
94 protected:
95  bool HaveCycles();
96  bool HaveInvalidData(int pCheckMode);
97 
98 private:
101 
102  bool CheckMappingMode(FbxLayerElement::EMappingMode pMappingMode, const FbxString& pPrefix);
103  bool CheckReferenceMode(FbxLayerElement::EReferenceMode pReferenceMode, const FbxString& pPrefix);
104  bool CheckSurfaceMode(FbxGeometry::ESurfaceMode pSurfaceMode, const FbxString& pPrefix);
105 
106  template<class T>
107  bool CheckSurfaceType(T pSurfaceType, const FbxString& pPrefix, const char* pDir);
108 
109  enum {
110  eNoRestriction,
111  eDirectOnly,
112  eIndexOnly,
113  };
114 
115  template <class T>
116  bool ResetLayerElement(FbxLayerElementTemplate<T>* pLET, FbxString& pMsg);
117 
118  template <class T>
119  bool CheckLayerElement(FbxLayerElementTemplate<T>* pLET,
120  int pMaxCount,
121  const char* pId,
122  const FbxString& pPrefix,
123  int pRestriction = eNoRestriction);
124 
125  bool MeshHaveInvalidData(int pCheckMode, FbxGeometry* pGeom, const FbxString& pName);
126  bool NurbsHaveInvalidData(int pCheckMode, FbxGeometry* pGeom, const FbxString& pName);
127  bool LineHaveInvalidData(int pCheckMode, FbxGeometry* pGeom, const FbxString& pName);
128  bool GeometryHaveInvalidData(int pCheckMode, FbxGeometry* pGeom, const FbxString& pBase);
129 
130  bool LayersHaveInvalidData(FbxGeometryBase* pGeom, const FbxString& pBase, int pNbConnectedMaterials=0);
131  bool ClusterHaveInvalidData(FbxCluster* pCluster, const FbxString& pBase, int lMaxValue=-1);
132 
133  bool ShapeHaveInvalidData();
134  bool SelectionNodeHaveInvalidData();
135  bool GlobalSettingsHaveInvalidData();
136 
137  bool AnimationHaveInvalidData(int pCheckMode);
138  bool AnimationHaveEmptyLayers();
139  bool AnimationHaveInvalidCurveData();
140 
141  const FbxScene* mScene;
142 
143  FbxStatus* mStatus;
144  FbxArray<FbxString*>* mDetails;
145  FbxString mBuffer;
146  bool mCanTryToRecover;
147 
148 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
149 };
150 
151 #include <fbxsdk/fbxsdk_nsend.h>
152 
153 #endif /* _FBXSDK_UTILS_ROOT_NODE_UTILITY_H_ */
FBX SDK environment definition.
EReferenceMode
Determines how the mapping information is stored in the array of coordinates.
Definition: fbxlayer.h:163
#define NULL
Definition: fbxarch.h:213
Utility class to manipulate strings.
Definition: fbxstring.h:66
ESurfaceMode
NURBS and Patches surface modes.
Definition: fbxgeometry.h:200
Class for clusters (links).
Definition: fbxcluster.h:47
This class facilitates the testing/reporting of errors.
Definition: fbxstatus.h:29
This class complements the FbxLayerElement class.
Definition: fbxlayer.h:1042
EMappingMode
Determines how the element is mapped to a surface.
Definition: fbxlayer.h:140
This class contains the description of a 3D scene.
Definition: fbxscene.h:61
This class is the base class for geometric object such as meshes, NURBS and patches.
A NURBS surface is a type of parametric geometry.
This class defines functions to check the received scene graph for issues.
#define FBXSDK_DLL
Definition: fbxarch.h:176
A NURBS surface is a type of parametric geometry.
Definition: fbxnurbs.h:31
A Non-Uniform Rational B-Spline (NURBS) curve is a type of parametric geometry.
Definition: fbxnurbscurve.h:60
The base class of geometric objects that support control point deformations (e.g. ...
Definition: fbxgeometry.h:45