- Main Page
- Classes
- Files
- Directories

- File List
- File Members

# fbxreaderfbx6.h

Go to the documentation of this file.

    00001 /****************************************************************************************
    00002
    00003    Copyright (C) 2013 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_FILEIO_FBX_READER_FBX6_H_
    00014 #define _FBXSDK_FILEIO_FBX_READER_FBX6_H_
    00015
    00016 #include <fbxsdk.h>
    00017
    00018 #include <fbxsdk/fbxsdk_nsbegin.h>
    00019
    00020 class FbxAnimStack;
    00021 class FbxAnimLayer;
    00022 class Fbx6ObjectTypeInfo;
    00023 class Fbx6TypeReadReferences;
    00024
    00025
    00030 class Fbx6ClassTemplateMap
    00031 {
    00032 public:
    00033
    00037     Fbx6ClassTemplateMap();
    00038
    00042     ~Fbx6ClassTemplateMap();
    00043
    00044     // Fbx6ClassTemplateMap will own this template object.
    00045
    00051     bool AddClassId( FbxClassId pId, FbxObject* pTemplateObject );
    00052
    00057     bool MergeWithTemplate( FbxObject* pObject ) const;
    00058
    00059     class FbxClassIdCompare {
    00060     public:
    00061         inline int operator()(const FbxClassId& pKeyA, const FbxClassId& pKeyB) const
    00062         {
    00063             FbxHandle lA = reinterpret_cast<FbxHandle>( pKeyA.GetClassIdInfo() );
    00064             FbxHandle lB = reinterpret_cast<FbxHandle>( pKeyB.GetClassIdInfo() );
    00065
    00066             return (lA < lB) ? -1 : ((lB < lA) ? 1 : 0);
    00067         }
    00068     };
    00069
    00073     void Clear();
    00074
    00075 private:
    00076     typedef FbxMap< FbxClassId, FbxObject*, FbxClassIdCompare > MapType;
    00077     MapType mClassMap;
    00078
    00083     bool HasModifiedFlags(FbxProperty lProp) const;
    00084     inline FbxPropertyAttr::EFlags IndexToFlag( int i ) const { return static_cast<FbxPropertyAttr::EFlags>(1 << i); }
    00085 };
    00086
    00087
    00088
    00093 class FbxReaderFbx6 : public FbxReader
    00094 {
    00095 public:
    00096
    00103     FbxReaderFbx6(FbxManager& pManager, FbxImporter& pImporter, int pID, FbxStatus& pStatus);
    00104
    00108     virtual ~FbxReaderFbx6();
    00109
    00115     virtual bool FileOpen(char* pFileName, EFileOpenSpecialFlags pFlags);
    00116
    00121     virtual bool FileOpen(char* pFileName);
    00122
    00127     virtual bool FileOpen(FbxFile * pFile);
    00128
    00131     virtual bool FileOpen(FbxStream * pStream, void* pStreamData);
    00132
    00136     virtual bool FileClose();
    00137
    00141     virtual bool IsFileOpen();
    00142
    00146     typedef enum
    00147     {
    00148         eASCII,
    00149         eBINARY,
    00150         eENCRYPTED
    00151     } EImportMode;
    00152
    00156     EImportMode GetImportMode();
    00157
    00163     virtual void GetVersion(int& pMajor, int& pMinor, int& pRevision);
    00164
    00170     virtual bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
    00171
    00178     virtual bool GetFrameRate(FbxTime::EMode &pTimeMode);
    00179
    00184     virtual bool GetStatistics(FbxStatistics* pStats);
    00185
    00190     virtual bool GetReadOptions(bool pParseFileAsNeeded = true);
    00191
    00192
    00197     virtual bool Read(FbxDocument *pDocument);
    00198
    00204     virtual bool GetReadOptions(FbxIO* pFbx, bool pParseFileAsNeeded = true);
    00205
    00206
    00212     virtual bool Read(FbxDocument *pDocument, FbxIO* pFbx);
    00213
    00214
    00218     virtual void PluginReadParameters(FbxObject& pParams);
    00219
    00223     virtual FbxDocumentInfo*  GetSceneInfo() { return mSceneInfo; }
    00224
    00225
    00229     virtual FbxArray<FbxTakeInfo*>* GetTakeInfo() { return &mTakeInfo; }
    00230
    00234     virtual void SetProgressHandler(FbxProgress *pProgress);
    00235
    00236     virtual void SetEmbeddingExtractionFolder(const char* pExtractFolder);
    00237
    00238     virtual bool SupportsStreams() const { return true; }
    00239
    00240 private:
    00241
    00245     FbxDocumentInfo* ReadSceneInfo();
    00246
    00251     FbxDocumentInfo* ReadSceneInfo(FbxString& pType);
    00252
    00256     void WriteSceneInfo(FbxDocumentInfo*);
    00257
    00261     bool WriteThumbnail(FbxThumbnail*);
    00262
    00267
    00276     FbxObject* CreateGenericObject(FbxDocument *pDocument, char* pObjectType, char* pObjectSubType, char* pObjectName, FbxObject::EObjectFlag pFlags=FbxObject::eSavable);
    00277
    00283     bool ReadDescriptionSection(FbxDocument *pDocument, FbxString& pDocumentName);
    00284
    00290     bool ReadReferenceSection(FbxDocument *pDocument, Fbx6TypeReadReferences& pDocReferences);
    00291
    00297     bool ReadDefinitionSection(FbxDocument *pDocument, FbxArray<Fbx6ObjectTypeInfo*>& pObjectContent );
    00298
    00305     bool ReadObjectSection(FbxDocument *pDocument, FbxArray<Fbx6ObjectTypeInfo*>& pObjectContent, Fbx6TypeReadReferences& pDocReferences );
    00306
    00317     bool ReadObject(FbxDocument *pDocument, FbxString& pObjectType, FbxString& pObjectSubType, FbxString& pObjectName, FbxString& pObjectUniqueId, FbxObject* pReferencedObject, Fbx6TypeReadReferences& pDocReferences);
    00318
    00323     bool ReadConnectionSection(FbxDocument *pDocument );
    00325
    00330
    00335     bool ReadDocumentAnimation(FbxDocument *pDocument);
    00336
    00343     void ReadObjectAnimation(FbxIO& pFileObject, FbxObject* pNode, FbxAnimStack& pAnimStack, int pExceptionFlag);
    00344
    00350     void ReadPropertyAnimation(FbxIO& pFileObject, FbxProperty* pProp, FbxAnimStack& pAnimStack);
    00351
    00357     bool ReadTakeAnimation(FbxScene& pScene, FbxTakeInfo* pTakeInfo);
    00358
    00364     bool ReadNodeAnimation(FbxIO& pFileObject, FbxScene& pScene, FbxAnimStack& pAnimStack, FbxTakeInfo* pTakeInfo);
    00365
    00366
    00371     void ReadLayers(FbxIO& pFileObject, FbxTakeInfo* pTakeInfo);
    00372
    00378     void ReadTimeWarps(FbxIO& pFileObject, FbxSet& pTimeWarpSet, FbxScene& pScene);
    00379
    00383     FbxThumbnail* ReadThumbnail();
    00384
    00390     bool TimeShiftNodeAnimation(FbxScene& pScene, FbxAnimStack& pAnimStack, int pTimeOffsetType, FbxTime pTimeOffset);
    00392
    00397
    00401     void ReadCameraSwitcher(FbxScene& pScene);
    00402
    00406     bool ReadCameraSwitcher( FbxCameraSwitcher& pCameraSwitcher );
    00407
    00411     void ReorderCameraSwitcherIndices(FbxScene& pScene);
    00413
    00418
    00422     void ReadGlobalLightSettings(FbxScene& pScene);
    00423
    00427     void ReadGlobalTimeSettings(FbxScene& pScene);
    00428
    00432     void ReadGlobalCameraSettings(FbxScene& pScene);
    00433
    00437     void ReadShadowPlane(FbxScene& pScene);
    00438
    00442     void ReadAmbientColor(FbxScene& pScene);
    00443
    00447     void ReadFogOption(FbxScene& pScene);
    00449
    00454
    00458     void ReadCharacter(FbxCharacter& pCharacter,int& pInputType, int& pInputIndex);
    00459
    00464     void ReadCharacterLinkGroup(FbxCharacter& pCharacter, int pCharacterGroupId);
    00465
    00470     void ReadCharacterLink(FbxCharacter& pCharacter, int pCharacterNodeId);
    00471
    00475     void ReadCharacterLinkRotationSpace(FbxCharacterLink& pCharacterLink);
    00476
    00481     bool ReadCharacterPose(FbxCharacterPose& pCharacterPose); // TBV
    00483
    00494         bool ReadPose(FbxScene& pScene, FbxPose* pPose, bool pAsBindPose);
    00495
    00501         bool ReadMedia(FbxDocument *pDocument, const char* pEmbeddedMediaDirectory = "");
    00502
    00507         bool ReadGlobalSettings(FbxGlobalSettings& pGlobalSettings);
    00509
    00514
    00521     bool ReadNode                       ( FbxNode& pNode, FbxString& pObjectSubType, Fbx6TypeReadReferences& pDocReferences );
    00522
    00527     bool ReadContainer                  ( FbxContainer& pContainer );
    00528
    00533     bool ReadGenericNode                ( FbxGenericNode& pNode );
    00534
    00539     bool ReadNodeShading                ( FbxNode& pNode );
    00540
    00545     bool ReadNodeCullingType            ( FbxNode& pNode ); // TBV, probablement passe tout en property
    00546
    00551     bool ReadNodeTarget                 ( FbxNode& pNode );
    00552
    00560     bool ReadNodeAttribute              ( FbxNode& pNode , FbxString& pObjectSubType, bool& pCreatedAttribute, Fbx6TypeReadReferences& pDocReferences);
    00561
    00569     FbxNodeAttribute* ReadNodeAttribute( FbxString& pObjectSubType, FbxString& pObjectName, FbxString& pObjectUniqueId, FbxObject* pReferencedObject);
    00570
    00577     bool ReadNodeProperties             ( FbxNode& pNode, bool pReadNodeAttributeProperties );
    00578
    00583     bool ReadLayeredTexture             ( FbxLayeredTexture& pTex );
    00584
    00589     bool ReadGeometryLinks              ( FbxGeometry& pGeometry );
    00590
    00595     bool ReadGeometryShapes             ( FbxGeometry& pGeometry );
    00596
    00601     bool ReadNull                       ( FbxNull& pNull );
    00602
    00607     bool ReadMarker                     ( FbxMarker& pMarker );
    00608
    00613     bool ReadCamera                     ( FbxCamera& pCamera );
    00614
    00619     bool ReadCameraStereo               ( FbxCameraStereo& pCameraStereo );
    00620
    00625     bool ReadCameraStereoPrecomp        (FbxCameraStereo& pCameraStereo);
    00626
    00631     bool ReadLight                      ( FbxLight& pLight );
    00632
    00638     bool ReadBindingTable               ( FbxBindingTable& pTable );
    00639
    00644     bool ReadBindingOperator            ( FbxBindingOperator& pOperator );
    00645
    00650     bool ReadMesh                       ( FbxMesh& pMesh );
    00651
    00656     bool ReadMeshSmoothness               ( FbxMesh& pMesh );
    00657
    00662     bool ReadMeshVertices               ( FbxMesh& pMesh );
    00663
    00668     bool ReadMeshPolygonIndex           ( FbxMesh& pMesh );
    00669
    00674     bool ReadMeshEdges                  ( FbxMesh& pMesh );
    00675
    00682     //bool ReadSubdiv( FbxSubDiv& pSubdiv, FbxString& pObjectName, FbxObject* pReferencedObject);
    00683     bool ReadSubdiv( FbxSubDiv& pSubdiv);
    00684
    00689     bool ReadDocument                   ( FbxDocument& pSubDocument );
    00690
    00695     bool ReadCollection                 ( FbxCollection& pCollection );
    00696
    00701     bool ReadSelectionSet                ( FbxSelectionSet& pSelectionSet);
    00702
    00703     bool ReadSelectionNode             (FbxSelectionNode& pSelectionNode);
    00704
    00709     bool ReadNurb                       ( FbxNurbs& pNurbs );
    00710
    00715     bool ReadNurbsSurface               ( FbxNurbsSurface& pNurbs );
    00716
    00721     bool ReadPatch                      ( FbxPatch& pPatch );
    00722
    00727     int  ReadPatchType                  ( FbxPatch& pPatch );
    00728
    00729
    00734     bool ReadNurbsCurve                 ( FbxNurbsCurve& pNurbsCurve );
    00735
    00739     bool ReadTrimNurbsSurface           ( FbxTrimNurbsSurface& pNurbs );
    00740
    00745     bool ReadBoundary                   ( FbxBoundary& pBoundary );
    00746
    00752     bool ReadShape                      ( FbxShape& pShape, FbxGeometry& pGeometry);
    00753
    00758     bool ReadImplementation             ( FbxImplementation& pImplementation );
    00759
    00764     bool ReadFileTexture                    (FbxFileTexture& pTexture);
    00765
    00772     FbxSurfaceMaterial* ReadSurfaceMaterial(char const* pName, char const* pMaterialType, FbxSurfaceMaterial* pReferencedMaterial);
    00773
    00778     bool ReadVideo                      (FbxVideo& pVideo);
    00779
    00784     bool ReadThumbnail                  (FbxThumbnail& pThumbnail);
    00786
    00787
    00792
    00797     bool ReadLayerElements              (FbxGeometry& pGeometry);
    00798
    00804     bool ReadLayerElementsMaterial      (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsMaterial);
    00805
    00811     bool ReadLayerElementsNormal        (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsNormal);
    00812
    00818     bool ReadLayerElementsTangent        (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsTangent);
    00819
    00825     bool ReadLayerElementsBinormal        (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsBinormal);
    00826
    00832     bool ReadLayerElementsVertexColor   (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsVertexColor);
    00833
    00840     bool ReadLayerElementsTexture (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsTexture, FbxLayerElement::EType pTextureType);
    00841
    00848     bool ReadLayerElementsChannelUV (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsUV, FbxLayerElement::EType pTextureType);
    00849
    00855     bool ReadLayerElementsPolygonGroup  (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsPolygonGroup);
    00856
    00862     bool ReadLayerElementsSmoothing     (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsSmoothing);
    00863
    00869     bool ReadLayerElementsUserData      (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsUserData);
    00870
    00876     bool ReadLayerElementsVisibility    (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsVisibility);
    00877
    00883     bool ReadLayerElementEdgeCrease     (FbxGeometry*pGeometry, FbxArray<FbxLayerElement*>& pElementsEdgeCrease);
    00884
    00890     bool ReadLayerElementVertexCrease   (FbxGeometry*pGeometry, FbxArray<FbxLayerElement*>& pElementsVertexCrease);
    00891
    00897     bool ReadLayerElementHole           (FbxGeometry*pGeometry, FbxArray<FbxLayerElement*>& pElementsHole);
    00899
    00904
    00909     bool ReadGeometryWeightedMap(FbxGeometryWeightedMap& pGeometryWeightedMap);
    00911
    00916
    00921     bool ReadLink(FbxCluster& pLink);
    00922
    00927     bool ReadSkin(FbxSkin& pSkin);
    00928
    00933     bool ReadVertexCacheDeformer(FbxVertexCacheDeformer& pDeformer);
    00934
    00939     bool ReadCluster(FbxCluster& pCluster);
    00940
    00945     bool ReadConstraint(FbxConstraint& pPosition);
    00947
    00948     // Cache
    00949
    00954     bool ReadCache(FbxCache& pCache);
    00955
    00960
    00967     bool ResolveCameraBackgrounds(FbxScene& pScene);
    00968
    00972     void RemoveDuplicateTextures(FbxScene& pScene);
    00973
    00980     void ReplaceTextures(FbxArray<FbxTexture*> const& pTextureDuplicate,
    00981                          FbxArray<FbxTexture*> const& pTextureReplacement,
    00982                          FbxGeometry* pGeometry, FbxLayerElement::EType pTextureType);
    00983
    00987     void RemoveDuplicateMaterials(FbxScene& pScene);
    00988
    00993     FbxString ConvertCameraName(FbxString pCameraName);
    00994
    01000     int  FindString(FbxString pString, FbxArray<FbxString*>& pStringArray);
    01001
    01006     bool ReadPassword(FbxString pPassword);
    01007
    01011     void PublishProperties(FbxObject& pObject);
    01012
    01018     bool ReadProperties(FbxObject *pFbxObject, FbxIO *pFbxFileObject, bool pReadNodeAttributeProperties=true);
    01019
    01020
    01027     bool ReadPropertiesAndFlags(FbxObject *pFbxObject, FbxIO *pFbxFileObject, bool pReadNodeAttributeProperties=true);
    01028
    01034     bool ReadFlags(FbxObject *pFbxObject, FbxIO* pFbxFileObject);
    01035
    01039     void RebuildTrimRegions(FbxScene& pScene) const;
    01040
    01044     void SetSubdivision(FbxScene& pScene) const;
    01045
    01049     void ConvertShapeDeformProperty(FbxScene& pScene) const;
    01050
    01054     void RebuildLayeredTextureAlphas(FbxScene& pScene) const;
    01055
    01056     //---------------- in progress -------------------------------
    01057     void ReadOptionsInMainSection();
    01058     void ReadTakeOptions();
    01059     bool ReadOptionsInExtensionSection(int& pSectionIndex);
    01060     bool WriteOptionsInExtensionSection(bool pOverwriteLastExtensionSection=false);
    01061     //--------------- end in progress ----------------------------
    01062
    01066     void ReadGlobalSettingsInMainSection();
    01067
    01071     void ReadDefinitionSectionForStats();
    01073
    01074 private:
    01075
    01076     FbxReaderFbx6& operator=(FbxReaderFbx6 const&) { return *this; }
    01077
    01078     FbxIO*                  mFileObject;
    01079     FbxImporter&            mImporter;
    01080     FbxCharPtrSet           mNodeArrayName;
    01081     FbxObjectStringMap      mObjectMap;
    01082
    01083     bool                    mParseGlobalSettings;
    01084     FbxAxisSystem           mAxisSystem;
    01085     FbxSystemUnit           mSystemUnit;
    01086     FbxTime::EMode          mFrameRate;
    01087
    01088     bool                    mRetrieveStats;
    01089     FbxStatistics*          mDefinitionsStatistics;
    01090     FbxArray<FbxTakeInfo *> mTakeInfo;
    01091     FbxDocumentInfo*        mSceneInfo;
    01092     FbxAnimLayer*           mAnimLayer;
    01093     FbxSet                  mNickToKFCurveNodeTimeWarpsSet;
    01094     FbxSet*                 mNickToAnimCurveTimeWarpsSet;
    01095
    01096     Fbx6ClassTemplateMap    mClassTemplateMap;
    01097     FbxProgress*            mProgress;
    01098     bool                    mProgressPause;
    01099 };
    01100
    01101 #include <fbxsdk/fbxsdk_nsend.h>
    01102
    01103 #endif /* _FBXSDK_FILEIO_FBX_READER_FBX6_H_ */