00001
00002
00003
00004
00005
00006
00007
00008
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
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
00102 FbxReaderFbx6(FbxManager& pManager, FbxImporter& pImporter, int pID);
00103
00107 virtual ~FbxReaderFbx6();
00108
00114 virtual bool FileOpen(char* pFileName, EFileOpenSpecialFlags pFlags);
00115
00120 virtual bool FileOpen(char* pFileName);
00121
00126 virtual bool FileOpen(FbxFile * pFile);
00127
00130 virtual bool FileOpen(FbxStream * pStream, void* pStreamData);
00131
00135 virtual bool FileClose();
00136
00140 virtual bool IsFileOpen();
00141
00145 typedef enum
00146 {
00147 eASCII,
00148 eBINARY,
00149 eENCRYPTED
00150 } EImportMode;
00151
00155 EImportMode GetImportMode();
00156
00162 virtual void GetVersion(int& pMajor, int& pMinor, int& pRevision);
00163
00169 virtual bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
00170
00177 virtual bool GetFrameRate(FbxTime::EMode &pTimeMode);
00178
00183 virtual bool GetStatistics(FbxStatistics* pStats);
00184
00189 virtual bool GetReadOptions(bool pParseFileAsNeeded = true);
00190
00191
00196 virtual bool Read(FbxDocument *pDocument);
00197
00203 virtual bool GetReadOptions(FbxIO* pFbx, bool pParseFileAsNeeded = true);
00204
00205
00211 virtual bool Read(FbxDocument *pDocument, FbxIO* pFbx);
00212
00213
00217 virtual void PluginReadParameters(FbxObject& pParams);
00218
00222 virtual FbxDocumentInfo* GetSceneInfo() { return mSceneInfo; }
00223
00224
00228 virtual FbxArray<FbxTakeInfo*>* GetTakeInfo() { return &mTakeInfo; }
00229
00233 virtual void SetProgressHandler(FbxProgress *pProgress);
00234
00235 virtual void SetEmbeddingExtractionFolder(const char* pExtractFolder);
00236
00237 virtual bool SupportsStreams() const { return true; }
00238
00239 private:
00240
00244 FbxDocumentInfo* ReadSceneInfo();
00245
00250 FbxDocumentInfo* ReadSceneInfo(FbxString& pType);
00251
00255 void WriteSceneInfo(FbxDocumentInfo*);
00256
00260 bool WriteThumbnail(FbxThumbnail*);
00261
00266
00275 FbxObject* CreateGenericObject(FbxDocument *pDocument, char* pObjectType, char* pObjectSubType, char* pObjectName, FbxObject::EObjectFlag pFlags=FbxObject::eSavable);
00276
00282 bool ReadDescriptionSection(FbxDocument *pDocument, FbxString& pDocumentName);
00283
00289 bool ReadReferenceSection(FbxDocument *pDocument, Fbx6TypeReadReferences& pDocReferences);
00290
00296 bool ReadDefinitionSection(FbxDocument *pDocument, FbxArray<Fbx6ObjectTypeInfo*>& pObjectContent );
00297
00304 bool ReadObjectSection(FbxDocument *pDocument, FbxArray<Fbx6ObjectTypeInfo*>& pObjectContent, Fbx6TypeReadReferences& pDocReferences );
00305
00316 bool ReadObject(FbxDocument *pDocument, FbxString& pObjectType, FbxString& pObjectSubType, FbxString& pObjectName, FbxString& pObjectUniqueId, FbxObject* pReferencedObject, Fbx6TypeReadReferences& pDocReferences);
00317
00322 bool ReadConnectionSection(FbxDocument *pDocument );
00324
00329
00334 bool ReadDocumentAnimation(FbxDocument *pDocument);
00335
00342 void ReadObjectAnimation(FbxIO& pFileObject, FbxObject* pNode, FbxAnimStack& pAnimStack, int pExceptionFlag);
00343
00349 void ReadPropertyAnimation(FbxIO& pFileObject, FbxProperty* pProp, FbxAnimStack& pAnimStack);
00350
00356 bool ReadTakeAnimation(FbxScene& pScene, FbxTakeInfo* pTakeInfo);
00357
00363 bool ReadNodeAnimation(FbxIO& pFileObject, FbxScene& pScene, FbxAnimStack& pAnimStack, FbxTakeInfo* pTakeInfo);
00364
00365
00370 void ReadLayers(FbxIO& pFileObject, FbxTakeInfo* pTakeInfo);
00371
00377 void ReadTimeWarps(FbxIO& pFileObject, FbxSet& pTimeWarpSet, FbxScene& pScene);
00378
00382 FbxThumbnail* ReadThumbnail();
00383
00389 bool TimeShiftNodeAnimation(FbxScene& pScene, FbxAnimStack& pAnimStack, int pTimeOffsetType, FbxTime pTimeOffset);
00391
00396
00400 void ReadCameraSwitcher(FbxScene& pScene);
00401
00405 bool ReadCameraSwitcher( FbxCameraSwitcher& pCameraSwitcher );
00406
00410 void ReorderCameraSwitcherIndices(FbxScene& pScene);
00412
00417
00421 void ReadGlobalLightSettings(FbxScene& pScene);
00422
00426 void ReadGlobalTimeSettings(FbxScene& pScene);
00427
00431 void ReadGlobalCameraSettings(FbxScene& pScene);
00432
00436 void ReadShadowPlane(FbxScene& pScene);
00437
00441 void ReadAmbientColor(FbxScene& pScene);
00442
00446 void ReadFogOption(FbxScene& pScene);
00448
00453
00457 void ReadCharacter(FbxCharacter& pCharacter,int& pInputType, int& pInputIndex);
00458
00463 void ReadCharacterLinkGroup(FbxCharacter& pCharacter, int pCharacterGroupId);
00464
00469 void ReadCharacterLink(FbxCharacter& pCharacter, int pCharacterNodeId);
00470
00474 void ReadCharacterLinkRotationSpace(FbxCharacterLink& pCharacterLink);
00475
00480 bool ReadCharacterPose(FbxCharacterPose& pCharacterPose);
00482
00487
00494 bool ReadPose(FbxScene& pScene, FbxPose* pPose, bool pAsBindPose);
00495
00501 bool ReadMedia(FbxDocument *pDocument, const char* pEmbeddedMediaDirectory = "");
00502
00507 bool ReadGlobalSettings(FbxGlobalSettings& pGlobalSettings);
00508
00513 bool ReadExposureControl(FbxExposureControl& pExposureControl);
00515
00520
00527 bool ReadNode ( FbxNode& pNode, FbxString& pObjectSubType, Fbx6TypeReadReferences& pDocReferences );
00528
00533 bool ReadContainer ( FbxContainer& pContainer );
00534
00539 bool ReadGenericNode ( FbxGenericNode& pNode );
00540
00545 bool ReadNodeShading ( FbxNode& pNode );
00546
00551 bool ReadNodeCullingType ( FbxNode& pNode );
00552
00557 bool ReadNodeTarget ( FbxNode& pNode );
00558
00566 bool ReadNodeAttribute ( FbxNode& pNode , FbxString& pObjectSubType, bool& pCreatedAttribute, Fbx6TypeReadReferences& pDocReferences);
00567
00575 FbxNodeAttribute* ReadNodeAttribute( FbxString& pObjectSubType, FbxString& pObjectName, FbxString& pObjectUniqueId, FbxObject* pReferencedObject);
00576
00583 bool ReadNodeProperties ( FbxNode& pNode, bool pReadNodeAttributeProperties );
00584
00589 bool ReadLayeredTexture ( FbxLayeredTexture& pTex );
00590
00595 bool ReadGeometryLinks ( FbxGeometry& pGeometry );
00596
00601 bool ReadGeometryShapes ( FbxGeometry& pGeometry );
00602
00607 bool ReadNull ( FbxNull& pNull );
00608
00613 bool ReadMarker ( FbxMarker& pMarker );
00614
00619 bool ReadCamera ( FbxCamera& pCamera );
00620
00625 bool ReadCameraStereo ( FbxCameraStereo& pCameraStereo );
00626
00631 bool ReadCameraStereoPrecomp (FbxCameraStereo& pCameraStereo);
00632
00637 bool ReadLight ( FbxLight& pLight );
00638
00644 bool ReadBindingTable ( FbxBindingTable& pTable );
00645
00650 bool ReadBindingOperator ( FbxBindingOperator& pOperator );
00651
00656 bool ReadMesh ( FbxMesh& pMesh );
00657
00662 bool ReadMeshSmoothness ( FbxMesh& pMesh );
00663
00668 bool ReadMeshVertices ( FbxMesh& pMesh );
00669
00674 bool ReadMeshPolygonIndex ( FbxMesh& pMesh );
00675
00680 bool ReadMeshEdges ( FbxMesh& pMesh );
00681
00688
00689 bool ReadSubdiv( FbxSubDiv& pSubdiv);
00690
00695 bool ReadDocument ( FbxDocument& pSubDocument );
00696
00701 bool ReadCollection ( FbxCollection& pCollection );
00702
00707 bool ReadSelectionSet ( FbxSelectionSet& pSelectionSet);
00708
00709 bool ReadSelectionNode (FbxSelectionNode& pSelectionNode);
00710
00715 bool ReadNurb ( FbxNurbs& pNurbs );
00716
00721 bool ReadNurbsSurface ( FbxNurbsSurface& pNurbs );
00722
00727 bool ReadPatch ( FbxPatch& pPatch );
00728
00733 int ReadPatchType ( FbxPatch& pPatch );
00734
00735
00740 bool ReadNurbsCurve ( FbxNurbsCurve& pNurbsCurve );
00741
00745 bool ReadTrimNurbsSurface ( FbxTrimNurbsSurface& pNurbs );
00746
00751 bool ReadBoundary ( FbxBoundary& pBoundary );
00752
00758 bool ReadShape ( FbxShape& pShape, FbxGeometry& pGeometry);
00759
00764 bool ReadImplementation ( FbxImplementation& pImplementation );
00765
00770 bool ReadFileTexture (FbxFileTexture& pTexture);
00771
00778 FbxSurfaceMaterial* ReadSurfaceMaterial(char const* pName, char const* pMaterialType, FbxSurfaceMaterial* pReferencedMaterial);
00779
00784 bool ReadVideo (FbxVideo& pVideo);
00785
00790 bool ReadThumbnail (FbxThumbnail& pThumbnail);
00792
00793
00798
00803 bool ReadLayerElements (FbxGeometry& pGeometry);
00804
00810 bool ReadLayerElementsMaterial (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsMaterial);
00811
00817 bool ReadLayerElementsNormal (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsNormal);
00818
00824 bool ReadLayerElementsTangent (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsTangent);
00825
00831 bool ReadLayerElementsBinormal (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsBinormal);
00832
00838 bool ReadLayerElementsVertexColor (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsVertexColor);
00839
00846 bool ReadLayerElementsTexture (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsTexture, FbxLayerElement::EType pTextureType);
00847
00854 bool ReadLayerElementsChannelUV (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsUV, FbxLayerElement::EType pTextureType);
00855
00861 bool ReadLayerElementsPolygonGroup (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsPolygonGroup);
00862
00868 bool ReadLayerElementsSmoothing (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsSmoothing);
00869
00875 bool ReadLayerElementsUserData (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsUserData);
00876
00882 bool ReadLayerElementsVisibility (FbxGeometry* pGeometry, FbxArray<FbxLayerElement*>& pElementsVisibility);
00883
00889 bool ReadLayerElementEdgeCrease (FbxGeometry*pGeometry, FbxArray<FbxLayerElement*>& pElementsEdgeCrease);
00890
00896 bool ReadLayerElementVertexCrease (FbxGeometry*pGeometry, FbxArray<FbxLayerElement*>& pElementsVertexCrease);
00897
00903 bool ReadLayerElementHole (FbxGeometry*pGeometry, FbxArray<FbxLayerElement*>& pElementsHole);
00905
00910
00915 bool ReadGeometryWeightedMap(FbxGeometryWeightedMap& pGeometryWeightedMap);
00917
00922
00927 bool ReadLink(FbxCluster& pLink);
00928
00933 bool ReadSkin(FbxSkin& pSkin);
00934
00939 bool ReadVertexCacheDeformer(FbxVertexCacheDeformer& pDeformer);
00940
00945 bool ReadCluster(FbxCluster& pCluster);
00946
00951 bool ReadConstraint(FbxConstraint& pPosition);
00953
00954
00955
00960 bool ReadCache(FbxCache& pCache);
00961
00966
00973 bool ResolveCameraBackgrounds(FbxScene& pScene);
00974
00978 void RemoveDuplicateTextures(FbxScene& pScene);
00979
00986 void ReplaceTextures(FbxArray<FbxTexture*> const& pTextureDuplicate,
00987 FbxArray<FbxTexture*> const& pTextureReplacement,
00988 FbxGeometry* pGeometry, FbxLayerElement::EType pTextureType);
00989
00993 void RemoveDuplicateMaterials(FbxScene& pScene);
00994
00999 FbxString ConvertCameraName(FbxString pCameraName);
01000
01006 int FindString(FbxString pString, FbxArray<FbxString*>& pStringArray);
01007
01012 bool ReadPassword(FbxString pPassword);
01013
01017 void PublishProperties(FbxObject& pObject);
01018
01024 bool ReadProperties(FbxObject *pFbxObject, FbxIO *pFbxFileObject, bool pReadNodeAttributeProperties=true);
01025
01026
01033 bool ReadPropertiesAndFlags(FbxObject *pFbxObject, FbxIO *pFbxFileObject, bool pReadNodeAttributeProperties=true);
01034
01040 bool ReadFlags(FbxObject *pFbxObject, FbxIO* pFbxFileObject);
01041
01045 void RebuildTrimRegions(FbxScene& pScene) const;
01046
01050 void SetSubdivision(FbxScene& pScene) const;
01051
01055 void ConvertShapeDeformProperty(FbxScene& pScene) const;
01056
01060 void RebuildLayeredTextureAlphas(FbxScene& pScene) const;
01061
01062
01063 void ReadOptionsInMainSection();
01064 void ReadTakeOptions();
01065 bool ReadOptionsInExtensionSection(int& pSectionIndex);
01066 bool WriteOptionsInExtensionSection(bool pOverwriteLastExtensionSection=false);
01067
01068
01072 void ReadGlobalSettingsInMainSection();
01073
01077 void ReadDefinitionSectionForStats();
01079
01080 private:
01081
01082 FbxReaderFbx6& operator=(FbxReaderFbx6 const&) { return *this; }
01083
01084 FbxIO* mFileObject;
01085 FbxImporter& mImporter;
01086 FbxCharPtrSet mNodeArrayName;
01087 FbxObjectStringMap mObjectMap;
01088 FbxObjectStringMap mNodeAttributeMap;
01089
01090 bool mParseGlobalSettings;
01091 FbxAxisSystem mAxisSystem;
01092 FbxSystemUnit mSystemUnit;
01093 FbxTime::EMode mFrameRate;
01094
01095 bool mRetrieveStats;
01096 FbxStatistics * mDefinitionsStatistics;
01097 FbxArray<FbxTakeInfo *> mTakeInfo;
01098 FbxDocumentInfo * mSceneInfo;
01099 FbxAnimLayer * mAnimLayer;
01100 FbxSet mNickToKFCurveNodeTimeWarpsSet;
01101 FbxSet* mNickToAnimCurveTimeWarpsSet;
01102
01103 Fbx6ClassTemplateMap mClassTemplateMap;
01104 FbxProgress * mProgress;
01105 bool mProgressPause;
01106 };
01107
01108 #include <fbxsdk/fbxsdk_nsend.h>
01109
01110 #endif