- Main Page
- Classes
- Files
- Directories

- File List
- File Members

# fbxreadercollada14.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_COLLADA_READER_H_
    00014 #define _FBXSDK_FILEIO_COLLADA_READER_H_
    00015
    00016 #include <fbxsdk.h>
    00017
    00018 #include <fbxsdk/fileio/collada/fbxcolladautils.h>
    00019 #include <fbxsdk/fileio/collada/fbxcolladanamespace.h>
    00020
    00021 #include <fbxsdk/fbxsdk_nsbegin.h>
    00022
    00023
    00053 class FbxReaderCollada : public FbxReader
    00054 {
    00055 public:
    00060
    00066     FbxReaderCollada(FbxManager& pManager, int pID, FbxStatus& pStatus);
    00067
    00069     virtual ~FbxReaderCollada();
    00070
    00072
    00077
    00082     virtual bool FileOpen(char* pFileName);
    00083
    00087     virtual bool FileClose();
    00088
    00092     virtual bool IsFileOpen();
    00093
    00095
    00100
    00105     virtual bool GetReadOptions(bool pParseFileAsNeeded = true){ return true; }
    00106
    00112     virtual bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
    00113
    00117     virtual FbxArray<FbxTakeInfo*>* GetTakeInfo();
    00118
    00123     virtual bool Read(FbxDocument* pDocument);
    00124
    00126
    00127 /*****************************************************************************************************************************
    00128 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
    00129 *****************************************************************************************************************************/
    00130 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00131 private:
    00136
    00142     bool ReadCollada(FbxScene &pScene, xmlNode* pXmlNode);
    00143
    00149     bool ImportVisualScene(xmlNode* pXmlNode, FbxScene * pScene);
    00150
    00156     bool ImportVisualSceneMax3DExtension(xmlNode * pTechniqueElement, FbxScene * pScene);
    00157
    00163     bool ImportVisualSceneFCOLLADAExtension(xmlNode * pTechniqueElement, FbxScene * pScene);
    00164
    00170     bool ImportVisualSceneMayaExtension(xmlNode * pTechniqueElement, FbxScene * pScene);
    00171
    00180     bool ImportAsset(xmlNode* pXmlNode, FbxGlobalSettings & pGlobalSettings, FbxDocumentInfo &pSceneInfo);
    00181
    00189     FbxNode * ImportNode(xmlNode* pXmlNode);
    00190
    00196     bool ImportNodeFCOLLADAExtension(xmlNode* pTechniqueElement, FbxNode * pNode);
    00197
    00203     bool ImportNodeXSIExtension(xmlNode* pTechniqueElement, FbxNode * pNode);
    00204
    00210     bool ImportNodeFBXExtension(xmlNode* pTechniqueElement, FbxNode * pNode);
    00211
    00218     FbxGeometry * ImportGeometry(const FbxString & pGeometryID, const FbxDynamicArray<FbxString> & pMaterialSequence);
    00219
    00224     bool ImportSkin(xmlNode* pSkinElement);
    00225
    00231     FbxGeometry * ImportMorph(xmlNode * pMorphElement, const FbxDynamicArray<FbxString> & pMaterialSequence);
    00232
    00238     FbxGeometry * ImportController(const FbxString & pControllerID, const FbxDynamicArray<FbxString> & pMaterialSequence);
    00239
    00245     FbxCamera * ImportCamera(xmlNode* pXmlNode);
    00246
    00252     FbxLight * ImportLight(xmlNode* pXmlNode);
    00253
    00258     FbxSurfaceMaterial * ImportMaterial(xmlNode* pXmlNode);
    00259
    00264     FbxSurfaceMaterial * ImportEffect(xmlNode* pEffectElement);
    00265
    00271     FbxSurfaceMaterial * ImportEffectNVidiaExtension(xmlNode * pEffectElement);
    00272
    00278     FbxFileTexture * ImportTexture(xmlNode* pXmlNode);
    00279
    00284     FbxFileTexture * ImportImage(xmlNode* pXmlNode);
    00285
    00293     FbxGeometry * ImportMesh(xmlNode* pXmlNode, const FbxDynamicArray<FbxString> & pMaterialSequence);
    00294
    00301     bool ImportVertices(xmlNode* pVerticesElement, FbxGeometry * pGeometry);
    00302
    00310     bool ImportPolygons(xmlNode* pXmlNode, FbxMesh& pMesh, const FbxDynamicArray<FbxString> & pMaterialSequence);
    00311
    00318     bool ImportTransforms(xmlNode* pXmlNode, FbxNode* pNode);
    00319
    00325     int ImportRotationElement(xmlNode* pXmlNode, FbxVector4& pRotationVector);
    00326
    00331     void SetRotationOrder(FbxNode * pNode, const std::vector<int> & pRotationOrder);
    00332
    00342     bool ImportLookAt(xmlNode* pXmlNode, FbxVector4& lCameraPosition,
    00343                                          FbxVector4& lInterestPosition, FbxVector4& lUpVector,
    00344                                          FbxAMatrix& lCameraTransformMatrix);
    00345
    00347
    00348
    00353
    00360     bool IsNodeExportable(FbxString lId);
    00361
    00366     bool CheckColladaVersion(const FbxString & pVersionString);
    00367
    00369
    00370
    00375
    00379     void AddNotificationError( FbxString pError );
    00380
    00384     void AddNotificationWarning( FbxString pWarning );
    00386
    00392     bool ImportScene(xmlNode * pColladaNode);
    00393
    00397     void Preprocess(xmlNode * pColladaElement);
    00398
    00401     void BuildUpLibraryMap();
    00402
    00407     void BuildUpLibraryMap(xmlNode * pElement, const FbxString & pElementTag);
    00408
    00416     bool ConnectMaterialsToNode(FbxNode * pNode, xmlNode * pElement, FbxDynamicArray<FbxString> & pMaterialSequence);
    00417
    00423     bool ImportTransparent(xmlNode * pElement, FbxSurfaceLambert * pSurfaceMaterial);
    00424
    00425     // Some traits with a typed element.
    00426     struct LibraryTypeTraits
    00427     {
    00428         FbxString library_tag;
    00429         FbxString element_tag;
    00430     };
    00431
    00437     FbxObject * GetLibrary(const LibraryTypeTraits & pTypeTraits, const FbxString & pID);
    00438     FbxObject * GetLibrary(const LibraryTypeTraits & pTypeTraits, xmlNode * pElement);
    00439
    00445     bool ImportMatrixAnimation(FbxNode * pNode, const FbxString & pAnimationChannelID);
    00446
    00453     bool ImportPropertyAnimation(FbxProperty & pProperty, const FbxString & pAnimationChannelID, const char * pChannelName = NULL);
    00454
    00459     FbxAnimLayer * GetAnimLayer(const FbxString & pAnimationID);
    00460
    00465     double GetLocalUnitConversion(xmlNode * pElement);
    00466
    00471     void SetProperty(xmlNode* pPropertyElement, FbxProperty & pProperty);
    00472
    00478     void ImportPropertyValue(FbxObject * pObject, const char * pPropertyName,
    00479                              xmlNode * pPropertyValueElement);
    00480
    00481     FbxFile*        mFileObject;
    00482     FbxString       mFileName;
    00483
    00484     // XML lib stuff
    00485     xmlDocPtr       mXmlDoc;
    00486
    00487     FbxAnimLayer*   mAnimLayer;
    00488     FbxScene*       mScene;
    00489
    00490     // Save the global settings and document info in pre-reading
    00491     FbxGlobalSettings * mGlobalSettings;
    00492     FbxDocumentInfo * mDocumentInfo;
    00493     FbxArray<FbxTakeInfo*> mTakeInfo;
    00494
    00495     xmlNode * mColladaElement;
    00496
    00497     struct ColladaElementData
    00498     {
    00499         explicit ColladaElementData(xmlNode * pElement = NULL)
    00500             : mColladaElement(pElement), mFBXObject(NULL) {}
    00501         xmlNode * mColladaElement;
    00502         FbxObject * mFBXObject;
    00503     };
    00504     typedef std::map<FbxString, ColladaElementData> ColladaElementMapType;
    00505     ColladaElementMapType mColladaElements;
    00506
    00507     LibraryTypeTraits mEffectTypeTraits;
    00508     LibraryTypeTraits mMaterialTypeTraits;
    00509     LibraryTypeTraits mImageTypeTraits;
    00510     LibraryTypeTraits mGeometryTypeTraits;
    00511     LibraryTypeTraits mControllerTypeTraits;
    00512     LibraryTypeTraits mLightTypeTraits;
    00513     LibraryTypeTraits mCameraTypeTraits;
    00514     LibraryTypeTraits mNodeTypeTraits;
    00515     LibraryTypeTraits mAnimationTypeTraits;
    00516
    00517     typedef std::map< FbxString, std::vector<xmlNode*> > AnimationMapType;
    00518     AnimationMapType mAnimationElements;
    00519
    00520     SourceElementMapType mSourceElements;
    00521
    00522     struct AnimationClipData
    00523     {
    00524         AnimationClipData(const FbxString & pID) : mID(pID), mAnimLayer(NULL) {}
    00525
    00526         FbxString mID;                                // ID of animation clip
    00527         std::set<FbxString> mAnimationElementIDs;     // IDs of animation belong to this animation clip
    00528         FbxAnimLayer * mAnimLayer;                 // The corresponding animation layer
    00529     };
    00530     std::vector<AnimationClipData> mAnimationClipData;
    00531
    00532     // Map from skin ID to skin element.
    00533     SkinMapType mSkinElements;
    00534
    00535     // There are two distinct namespaces for node ID & SID mapping.
    00536     // One with ID and the other with SID.
    00537     typedef std::map<FbxString, FbxNode *> NodeMapType;
    00538     NodeMapType mIDNamespaceNodes;
    00539     NodeMapType mSIDNamespaceNodes;
    00540
    00541     // Record the nodes which are to connect to its target node.
    00542     // Save the ID of the target node if a node has its target
    00543     std::map<FbxNode *, FbxString> mTargetIDs;
    00544
    00545     FbxColladaNamespace mNamespace;
    00546 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
    00547 };
    00548
    00549 #include <fbxsdk/fbxsdk_nsend.h>
    00550
    00551 #endif /* _FBXSDK_FILEIO_COLLADA_READER_H_ */