FBX C++ API Reference
fbxreaderfbx6.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 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_FILEIO_FBX_READER_FBX6_H_
14 #define _FBXSDK_FILEIO_FBX_READER_FBX6_H_
15 
16 #include <fbxsdk.h>
17 
18 #include <fbxsdk/fbxsdk_nsbegin.h>
19 
20 class FbxAnimStack;
21 class FbxAnimLayer;
22 class Fbx6ObjectTypeInfo;
23 class Fbx6TypeReadReferences;
24 
25 
31 {
32 public:
33 
38 
43 
44  // Fbx6ClassTemplateMap will own this template object.
45 
51  bool AddClassId( FbxClassId pId, FbxObject* pTemplateObject );
52 
57  bool MergeWithTemplate( FbxObject* pObject ) const;
58 
62  void Clear();
63 
64 private:
66  MapType mClassMap;
67 
72  bool HasModifiedFlags(FbxProperty lProp) const;
73  inline FbxPropertyFlags::EFlags IndexToFlag( int i ) const { return static_cast<FbxPropertyFlags::EFlags>(1 << i); }
74 };
75 
76 
77 
82 class FbxReaderFbx6 : public FbxReader
83 {
84 public:
85 
92  FbxReaderFbx6(FbxManager& pManager, FbxImporter& pImporter, int pID, FbxStatus& pStatus);
93 
97  virtual ~FbxReaderFbx6();
98 
104  virtual bool FileOpen(char* pFileName, EFileOpenSpecialFlags pFlags);
105 
110  virtual bool FileOpen(char* pFileName);
111 
116  virtual bool FileOpen(FbxFile * pFile);
117 
120  virtual bool FileOpen(FbxStream * pStream, void* pStreamData);
121 
125  virtual bool FileClose();
126 
130  virtual bool IsFileOpen();
131 
135  typedef enum
136  {
139  eENCRYPTED
140  } EImportMode;
141 
145  EImportMode GetImportMode();
146 
152  virtual void GetVersion(int& pMajor, int& pMinor, int& pRevision);
153 
159  virtual bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
160 
167  virtual bool GetFrameRate(FbxTime::EMode &pTimeMode);
168 
173  virtual bool GetStatistics(FbxStatistics* pStats);
174 
179  virtual bool GetReadOptions(bool pParseFileAsNeeded = true);
180 
181 
186  virtual bool Read(FbxDocument *pDocument);
187 
193  virtual bool GetReadOptions(FbxIO* pFbx, bool pParseFileAsNeeded = true);
194 
195 
201  virtual bool Read(FbxDocument *pDocument, FbxIO* pFbx);
202 
203 
207  virtual void PluginReadParameters(FbxObject& pParams);
208 
212  virtual FbxDocumentInfo* GetSceneInfo() { return mSceneInfo; }
213 
214 
218  virtual FbxArray<FbxTakeInfo*>* GetTakeInfo() { return &mTakeInfo; }
219 
223  virtual void SetProgressHandler(FbxProgress *pProgress);
224 
225  virtual void SetEmbeddingExtractionFolder(const char* pExtractFolder);
226 
227  virtual bool SupportsStreams() const { return true; }
228 
229 private:
230 
234  FbxDocumentInfo* ReadSceneInfo();
235 
240  FbxDocumentInfo* ReadSceneInfo(FbxString& pType);
241 
245  void WriteSceneInfo(FbxDocumentInfo*);
246 
250  bool WriteThumbnail(FbxThumbnail*);
251 
256 
265  FbxObject* CreateGenericObject(FbxDocument *pDocument, char* pObjectType, char* pObjectSubType, char* pObjectName, FbxObject::EObjectFlag pFlags=FbxObject::eSavable);
266 
272  bool ReadDescriptionSection(FbxDocument *pDocument, FbxString& pDocumentName);
273 
279  bool ReadReferenceSection(FbxDocument *pDocument, Fbx6TypeReadReferences& pDocReferences);
280 
286  bool ReadDefinitionSection(FbxDocument *pDocument, FbxArray<Fbx6ObjectTypeInfo*>& pObjectContent );
287 
294  bool ReadObjectSection(FbxDocument *pDocument, FbxArray<Fbx6ObjectTypeInfo*>& pObjectContent, Fbx6TypeReadReferences& pDocReferences );
295 
306  bool ReadObject(FbxDocument *pDocument, FbxString& pObjectType, FbxString& pObjectSubType, FbxString& pObjectName, FbxString& pObjectUniqueId, FbxObject* pReferencedObject, Fbx6TypeReadReferences& pDocReferences);
307 
312  bool ReadConnectionSection(FbxDocument *pDocument );
314 
319 
324  bool ReadDocumentAnimation(FbxDocument *pDocument);
325 
332  void ReadObjectAnimation(FbxIO& pFileObject, FbxObject* pNode, FbxAnimStack& pAnimStack, int pExceptionFlag);
333 
339  void ReadPropertyAnimation(FbxIO& pFileObject, FbxProperty* pProp, FbxAnimStack& pAnimStack);
340 
346  bool ReadTakeAnimation(FbxScene& pScene, FbxTakeInfo* pTakeInfo);
347 
354  bool ReadNodeAnimation(FbxIO& pFileObject, FbxScene& pScene, FbxAnimStack& pAnimStack, FbxTakeInfo* pTakeInfo);
355 
356 
361  void ReadLayers(FbxIO& pFileObject, FbxTakeInfo* pTakeInfo);
362 
368  void ReadTimeWarps(FbxIO& pFileObject, FbxMultiMap& pTimeWarpSet, FbxScene& pScene);
369 
373  FbxThumbnail* ReadThumbnail();
374 
382  bool TimeShiftNodeAnimation(FbxScene& pScene, FbxAnimStack& pAnimStack, int pTimeOffsetType, FbxTime pTimeOffset);
384 
389 
393  void ReadCameraSwitcher(FbxScene& pScene);
394 
398  bool ReadCameraSwitcher( FbxCameraSwitcher& pCameraSwitcher );
399 
403  void ReorderCameraSwitcherIndices(FbxScene& pScene);
405 
410 
414  void ReadGlobalLightSettings(FbxScene& pScene);
415 
419  void ReadGlobalTimeSettings(FbxScene& pScene);
420 
424  void ReadGlobalCameraSettings(FbxScene& pScene);
425 
429  void ReadShadowPlane(FbxScene& pScene);
430 
434  void ReadAmbientColor(FbxScene& pScene);
435 
439  void ReadFogOption(FbxScene& pScene);
441 
446 
452  void ReadCharacter(FbxCharacter& pCharacter,int& pInputType, int& pInputIndex);
453 
458  void ReadCharacterLinkGroup(FbxCharacter& pCharacter, int pCharacterGroupId);
459 
464  void ReadCharacterLink(FbxCharacter& pCharacter, int pCharacterNodeId);
465 
469  void ReadCharacterLinkRotationSpace(FbxCharacterLink& pCharacterLink);
470 
475  bool ReadCharacterPose(FbxCharacterPose& pCharacterPose); // TBV
477 
488  bool ReadPose(FbxScene& pScene, FbxPose* pPose, bool pAsBindPose);
489 
495  bool ReadMedia(FbxDocument *pDocument, const char* pEmbeddedMediaDirectory = "");
496 
501  bool ReadGlobalSettings(FbxGlobalSettings& pGlobalSettings);
503 
508 
515  bool ReadNode ( FbxNode& pNode, FbxString& pObjectSubType, Fbx6TypeReadReferences& pDocReferences );
516 
521  bool ReadContainer ( FbxContainer& pContainer );
522 
527  bool ReadGenericNode ( FbxGenericNode& pNode );
528 
533  bool ReadNodeShading ( FbxNode& pNode );
534 
539  bool ReadNodeCullingType ( FbxNode& pNode ); // TBV, probablement passe tout en property
540 
545  bool ReadNodeTarget ( FbxNode& pNode );
546 
554  bool ReadNodeAttribute ( FbxNode& pNode , FbxString& pObjectSubType, bool& pCreatedAttribute, Fbx6TypeReadReferences& pDocReferences);
555 
563  FbxNodeAttribute* ReadNodeAttribute( FbxString& pObjectSubType, FbxString& pObjectName, FbxString& pObjectUniqueId, FbxObject* pReferencedObject);
564 
571  bool ReadNodeProperties ( FbxNode& pNode, bool pReadNodeAttributeProperties );
572 
577  bool ReadLayeredTexture ( FbxLayeredTexture& pTex );
578 
583  bool ReadGeometryLinks ( FbxGeometry& pGeometry );
584 
589  bool ReadGeometryShapes ( FbxGeometry& pGeometry );
590 
595  bool ReadNull ( FbxNull& pNull );
596 
601  bool ReadMarker ( FbxMarker& pMarker );
602 
607  bool ReadCamera ( FbxCamera& pCamera );
608 
613  bool ReadCameraStereo ( FbxCameraStereo& pCameraStereo );
614 
619  bool ReadCameraStereoPrecomp (FbxCameraStereo& pCameraStereo);
620 
625  bool ReadLight ( FbxLight& pLight );
626 
632  bool ReadBindingTable ( FbxBindingTable& pTable );
633 
638  bool ReadBindingOperator ( FbxBindingOperator& pOperator );
639 
644  bool ReadMesh ( FbxMesh& pMesh );
645 
650  bool ReadMeshSmoothness ( FbxMesh& pMesh );
651 
656  bool ReadMeshVertices ( FbxMesh& pMesh );
657 
662  bool ReadMeshPolygonIndex ( FbxMesh& pMesh );
663 
668  bool ReadMeshEdges ( FbxMesh& pMesh );
669 
670  //** Read FBX subdiv, base mesh, finest mesh, current subdiv level...
671  //* \param pSubdiv fbx subdiv
672  //* \param pObjectName Object Name
673  //* \param pReferencedObject pointer of reference object
674  //* \return if reading subdiv object is successful return \c true, otherwise return \c false.
675  //*/
676  //bool ReadSubdiv( FbxSubDiv& pSubdiv, FbxString& pObjectName, FbxObject* pReferencedObject);
677 
682  bool ReadSubdiv( FbxSubDiv& pSubdiv);
683 
688  bool ReadDocument ( FbxDocument& pSubDocument );
689 
694  bool ReadCollection ( FbxCollection& pCollection );
695 
700  bool ReadSelectionSet ( FbxSelectionSet& pSelectionSet);
701 
702  bool ReadSelectionNode (FbxSelectionNode& pSelectionNode);
703 
708  bool ReadNurb ( FbxNurbs& pNurbs );
709 
714  bool ReadNurbsSurface ( FbxNurbsSurface& pNurbs );
715 
720  bool ReadPatch ( FbxPatch& pPatch );
721 
726  int ReadPatchType ( FbxPatch& pPatch );
727 
728 
733  bool ReadNurbsCurve ( FbxNurbsCurve& pNurbsCurve );
734 
738  bool ReadTrimNurbsSurface ( FbxTrimNurbsSurface& pNurbs );
739 
744  bool ReadBoundary ( FbxBoundary& pBoundary );
745 
751  bool ReadShape ( FbxShape& pShape, FbxGeometry& pGeometry);
752 
757  bool ReadImplementation ( FbxImplementation& pImplementation );
758 
763  bool ReadFileTexture (FbxFileTexture& pTexture);
764 
771  FbxSurfaceMaterial* ReadSurfaceMaterial(const char* pName, const char* pMaterialType, FbxSurfaceMaterial* pReferencedMaterial);
772 
777  bool ReadVideo (FbxVideo& pVideo);
778 
783  bool ReadThumbnail (FbxThumbnail& pThumbnail);
785 
786 
791 
796  bool ReadLayerElements (FbxGeometry& pGeometry);
797 
803  bool ReadLayerElementsMaterial (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsMaterial);
804 
810  bool ReadLayerElementsNormal (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsNormal);
811 
817  bool ReadLayerElementsTangent (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsTangent);
818 
824  bool ReadLayerElementsBinormal (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsBinormal);
825 
831  bool ReadLayerElementsVertexColor (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsVertexColor);
832 
839  bool ReadLayerElementsTexture (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsTexture, FbxLayerElement::EType pTextureType);
840 
847  bool ReadLayerElementsChannelUV (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsUV, FbxLayerElement::EType pTextureType);
848 
854  bool ReadLayerElementsPolygonGroup (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsPolygonGroup);
855 
861  bool ReadLayerElementsSmoothing (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsSmoothing);
862 
868  bool ReadLayerElementsUserData (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsUserData);
869 
875  bool ReadLayerElementsVisibility (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsVisibility);
876 
882  bool ReadLayerElementEdgeCrease (FbxGeometry*pGeometry, FbxArray<FbxLayerElement*>& pElementsEdgeCrease);
883 
889  bool ReadLayerElementVertexCrease (FbxGeometry*pGeometry, FbxArray<FbxLayerElement*>& pElementsVertexCrease);
890 
896  bool ReadLayerElementHole (FbxGeometry*pGeometry, FbxArray<FbxLayerElement*>& pElementsHole);
898 
903 
908  bool ReadGeometryWeightedMap(FbxGeometryWeightedMap& pGeometryWeightedMap);
910 
915 
920  bool ReadLink(FbxCluster& pLink);
921 
926  bool ReadSkin(FbxSkin& pSkin);
927 
932  bool ReadVertexCacheDeformer(FbxVertexCacheDeformer& pDeformer);
933 
938  bool ReadCluster(FbxCluster& pCluster);
939 
944  bool ReadConstraint(FbxConstraint& pPosition);
946 
947  // Cache
948 
953  bool ReadCache(FbxCache& pCache);
954 
959 
966  bool ResolveCameraBackgrounds(FbxScene& pScene);
967 
971  void RemoveDuplicateTextures(FbxScene& pScene);
972 
979  void ReplaceTextures(FbxArray<FbxTexture*> const& pTextureDuplicate,
980  FbxArray<FbxTexture*> const& pTextureReplacement,
981  FbxGeometry* pGeometry, FbxLayerElement::EType pTextureType);
982 
986  void RemoveDuplicateMaterials(FbxScene& pScene);
987 
992  FbxString ConvertCameraName(FbxString pCameraName);
993 
999  int FindString(FbxString pString, FbxArray<FbxString*>& pStringArray);
1000 
1005  bool ReadPassword(FbxString pPassword);
1006 
1010  void PublishProperties(FbxObject& pObject);
1011 
1017  bool ReadProperties(FbxObject *pFbxObject, FbxIO *pFbxFileObject, bool pReadNodeAttributeProperties=true);
1018 
1019 
1026  bool ReadPropertiesAndFlags(FbxObject *pFbxObject, FbxIO *pFbxFileObject, bool pReadNodeAttributeProperties=true);
1027 
1033  bool ReadFlags(FbxObject *pFbxObject, FbxIO* pFbxFileObject);
1034 
1038  void RebuildTrimRegions(FbxScene& pScene) const;
1039 
1043  void SetSubdivision(FbxScene& pScene) const;
1044 
1048  void ConvertShapeDeformProperty(FbxScene& pScene) const;
1049 
1053  void RebuildLayeredTextureAlphas(FbxScene& pScene) const;
1054 
1055  //---------------- in progress -------------------------------
1056  void ReadOptionsInMainSection();
1057  void ReadTakeOptions();
1058  bool ReadOptionsInExtensionSection(int& pSectionIndex);
1059  bool WriteOptionsInExtensionSection(bool pOverwriteLastExtensionSection=false);
1060  //--------------- end in progress ----------------------------
1061 
1065  void ReadGlobalSettingsInMainSection();
1066 
1070  void ReadDefinitionSectionForStats();
1072 
1073 private:
1074 
1075  FbxReaderFbx6& operator=(FbxReaderFbx6 const&) { return *this; }
1076 
1077  FbxIO* mFileObject;
1078  FbxImporter& mImporter;
1079  FbxCharPtrSet mNodeArrayName;
1080  FbxObjectStringMap mObjectMap;
1081 
1082  bool mParseGlobalSettings;
1083  FbxAxisSystem mAxisSystem;
1084  FbxSystemUnit mSystemUnit;
1085  FbxTime::EMode mFrameRate;
1086 
1087  bool mRetrieveStats;
1088  FbxStatistics* mDefinitionsStatistics;
1089  FbxArray<FbxTakeInfo *> mTakeInfo;
1090  FbxDocumentInfo* mSceneInfo;
1091  FbxAnimLayer* mAnimLayer;
1092  FbxMultiMap mNickToKFCurveNodeTimeWarpsSet;
1093  FbxMultiMap* mNickToAnimCurveTimeWarpsSet;
1094 
1095  Fbx6ClassTemplateMap mClassTemplateMap;
1096  FbxProgress* mProgress;
1097  bool mProgressPause;
1098 };
1099 
1100 #include <fbxsdk/fbxsdk_nsend.h>
1101 
1102 #endif /* _FBXSDK_FILEIO_FBX_READER_FBX6_H_ */
The animation layer is a collection of animation curve nodes.
Definition: fbxanimlayer.h:30
virtual bool SupportsStreams() const
Returns true if this reader supports FbxStream I/O.
This class describes image mapping on top of geometry.
EFileOpenSpecialFlags
Flags for reading parts of file.
Definition: fbxreader.h:91
void Clear()
Delete all FbxObject in template map.
Fbx6ClassTemplateMap()
Constructor.
SDK object manager.
Definition: fbxmanager.h:56
The Animation stack is a collection of animation layers.
Definition: fbxanimstack.h:37
bool MergeWithTemplate(FbxObject *pObject) const
Merge the properties of FbxObject with the object with the same class id.
EFlags
Property flags that affect their behaviors.
This class represents the coordinate system of the scene and can convert scenes to other coordinate s...
Definition: fbxaxissystem.h:97
FBX SDK video class.
Definition: fbxvideo.h:25
Abstract class for implementing I/O operations through a stream of data.
Definition: fbxstream.h:26
This class contains material settings.
Utility class to manipulate strings.
Definition: fbxstring.h:66
FbxDocument is a base class for FbxScene and FbxLibrary classes.
Definition: fbxdocument.h:46
Generic container for object grouping and encapsulation.
Definition: fbxcontainer.h:26
A class that maps strings to objects with a basic string comparator.
Definition: fbxmap.h:366
Class for clusters (links).
Definition: fbxcluster.h:47
This class is a basic class to get the quantity of items.
Definition: fbxstatistics.h:62
Base class of other readers used internally.
Definition: fbxreader.h:64
This node attribute contains methods for accessing the properties of a camera switcher.
This class facilitates the testing/reporting of errors.
Definition: fbxstatus.h:26
This object represents the shading node implementation.
This class contains scene thumbnails and user-defined summary data.
This class contains functions for accessing global settings.
This node attribute contains the properties of a marker.
Definition: fbxmarker.h:26
Base class for weighted animation constraints.
Definition: fbxconstraint.h:27
Empty node containing properties.
Plain text mode.
bool AddClassId(FbxClassId pId, FbxObject *pTemplateObject)
Add the template object to template map.
A character pose is a character and an associated hierarchy of nodes.
Class to encapsulate time units.
Definition: fbxtime.h:44
FBX SDK selection set class.
The base class of most FBX objects.
Definition: fbxobject.h:157
This class deforms control points of a geometry using control point positions stored in the associate...
FbxTrimNurbsSurface describes a NURBS surface with regions trimmed or cut away with trimming boundari...
Represents an element in the scene graph.
Definition: fbxnode.h:72
A patch is a type of node attribute with parametric surface.
Definition: fbxpatch.h:26
This node attribute contains methods for accessing the properties of a light.
Definition: fbxlight.h:27
This class contains the description of a 3D scene.
Definition: fbxscene.h:61
This class contains the description of a Pose and provide some methods to access Pose info in one FBX...
Definition: fbxpose.h:96
A NURBS surface is a type of parametric geometry.
This class contains the data structure support for char pointer set.
Definition: fbxcharptrset.h:22
EImportMode
File import mode.
If set, object is stored in FBX file upon export.
Definition: fbxobject.h:202
EMode
Time modes.
Definition: fbxtime.h:90
A shape describes the deformation on a set of control points, which is similar to the cluster deforme...
Definition: fbxshape.h:32
Class for progress reporting.
Definition: fbxprogress.h:31
FbxBoundary describes a trimming boundary for a trimmed NURBS object.
Internal class used to differentiate objects during run-time.
Definition: fbxclassid.h:39
EType
Layer Element type identifier.
Definition: fbxlayer.h:75
FbxSelectionNode is an auxiliary class for Selection Set.
Class to hold user properties.
Definition: fbxproperty.h:37
FbxLayeredTexture is a combination of multiple textures(FbxTexture) blended sequentially.
virtual FbxDocumentInfo * GetSceneInfo()
Returns the scene info from the file.
Skin deformer class.
Definition: fbxskin.h:37
Helper class to merge Class root property templates.
Definition: fbxreaderfbx6.h:30
A FbxObject derived container for FbxObject.
Definition: fbxcollection.h:28
FbxIO represents an FBX file.
Definition: fbxio.h:325
A binding table represents a collection of bindings from source types such as FbxObject, or FbxLayerElements to corresponding destinations, usually a third party shader parameters.
~Fbx6ClassTemplateMap()
Destructor.
This class describes the units of measurement used within a particular scene.
Definition: fbxsystemunit.h:31
This class contains take information from an imported file or exported to an output file...
Definition: fbxtakeinfo.h:56
This node attribute contains methods for accessing the properties of a camera.
Definition: fbxcamera.h:34
This object represents a binding operation on a FbxObject or FbxProperty.
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
This node attribute contains the properties of a null node.
Definition: fbxnull.h:25
virtual FbxArray< FbxTakeInfo * > * GetTakeInfo()
Returns the pointer to the list of TakeInfo from the file.
A Character is a person or animal with pre-defined skeleton system.
Definition: fbxcharacter.h:91
Class for interfacing with files, providing a similar interface for files independant of the OS or fi...
Definition: fbxfile.h:27
This class provides the structure to build a correspondence between 2 geometries. ...
The base class of geometric objects that support control point deformations (e.g. ...
Definition: fbxgeometry.h:45
EObjectFlag
Flags available to control objects.
Definition: fbxobject.h:197
This class is the FBX v6 reader.
Definition: fbxreaderfbx6.h:82
This class is the base class to all types of node attributes.
Class to manipulate a map that can contain multiple times the same key.
Definition: fbxmultimap.h:22
Simple class to hold RGBA values of a thumbnail image.
Definition: fbxthumbnail.h:27
This object contains methods for accessing point animation in a cache file.
Definition: fbxcache.h:33
Class for array of basic elements such as pointers and basic types.
Definition: fbxarray.h:23
Class to import an FBX file into SDK objects.
Definition: fbximporter.h:90
A mesh is a geometry made of polygons.
Definition: fbxmesh.h:32
This node attribute contains methods for accessing the properties of a stereo camera.