fbxsdk/fileio/collada/fbxwritercollada14.h Source File
 
 
 
fbxsdk/fileio/collada/fbxwritercollada14.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_WRITER_H_
00014 #define _FBXSDK_FILEIO_COLLADA_WRITER_H_
00015 
00016 #include <fbxsdk.h>
00017 
00018 #include <fbxsdk/fileio/collada/fbxcolladautils.h>
00019 
00020 #include <fbxsdk/fbxsdk_nsbegin.h>
00021 
00025 class FbxWriterCollada : public FbxWriter 
00026 {
00027 public:
00032 
00038     FbxWriterCollada(FbxManager& pManager, int pID, FbxStatus& pStatus);
00039 
00041     virtual ~FbxWriterCollada();
00042 
00044 
00049 
00054     virtual bool FileCreate(char* pFileName);
00055 
00059     virtual bool FileClose();
00060 
00064     virtual bool IsFileOpen();
00065 
00067 
00072 
00075         virtual void GetWriteOptions(){}
00076 
00081     virtual bool Write(FbxDocument* pDocument);
00082 
00088     virtual bool PreprocessScene(FbxScene &pScene);
00089 
00094     virtual bool PostprocessScene(FbxScene &pScene);
00095 
00097 
00098 
00099 /*****************************************************************************************************************************
00100 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
00101 *****************************************************************************************************************************/
00102 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00103 private:
00108 
00116     xmlNode*    ExportAsset(xmlNode* pXmlNode, FbxDocumentInfo* pSceneInfo);
00117 
00122     xmlNode * ExportScene(FbxScene* pScene);
00123 
00130     bool                ExportLibraries(xmlNode* pXmlNode);
00131 
00140     xmlNode* ExportNodeRecursive(xmlNode* pXmlNode, const FbxNode* pNode);
00141 
00146     void ExportVisualSceneMAX3DExtension(xmlNode * pExtraElement, FbxScene * pScene);
00147 
00152     void ExportVisualSceneFCOLLADAExtension(xmlNode * pExtraElement, FbxScene * pScene);
00153 
00161     xmlNode* ExportNode(xmlNode* pXmlNode, const FbxNode* pNode);
00162 
00170     bool ExportTransform(xmlNode* pXmlNode, const FbxNode* pNode);
00171 
00179     bool ExportNodeAttribute(xmlNode* pXmlNode, const FbxNode* pNode);
00180 
00187     xmlNode* CreateMeshLibrary(const FbxNode* pNode);
00188 
00195     xmlNode* CreateCameraLibrary(const FbxNode* pNode);
00196 
00203     xmlNode* CreateLightLibrary(const FbxNode* pNode);
00204 
00211     xmlNode* ExportMesh(const FbxNode* pNode);
00212 
00219     xmlNode*    ExportShapeGeometry(FbxMesh* pMeshShape, FbxString pShapeId);
00220 
00231     //Note why internally set pExportControlPoints to true?
00232     xmlNode*    ExportVertexPositions(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pMeshName, bool pInGeometry, bool pExportControlPoints);
00233 
00242     xmlNode*    ExportLayerElements(xmlNode* pXmlMesh, FbxMesh* pMesh, FbxString pName);
00243 
00253     xmlNode*    ExportNormals(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName, FbxString pExt, int pLayerIndex);
00254 
00263     xmlNode*    ExportUVs(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName, int pLayerIndex);
00264 
00273     xmlNode*    ExportVertexColors(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName, int pLayerIndex);
00274 
00281     xmlNode*    ExportVertices(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName);
00282 
00293     xmlNode* ExportPolygons(xmlNode* pMeshElement, FbxMesh* pMesh, FbxString pMaterialName, int pMaterialIndexInNode, FbxString pName, bool pShape = false);
00294 
00300     bool                ExportMeshMaterials(FbxMesh *pMesh, int pNbMat);
00301 
00308     xmlNode*    ExportMaterial(FbxSurfaceMaterial *pMaterial);
00309 
00320     xmlNode*    ExportEffect(FbxSurfaceMaterial *pMaterial, FbxString pEffectId);
00321 
00330     //Note why return true when failed and popped waring?
00331     bool                AddMaterialTextureInput(xmlNode *pXmlMaterial, FbxFileTexture *pTexture, FbxString pImageId, int pLayerIndex, int pLayerElementType);
00332 
00339     xmlNode*    ExportTexture(FbxFileTexture *pTexture, FbxString pImageId, int pLayerIndex);
00340 
00346     bool                ExportMeshTextures(FbxMesh *pMesh);
00347 
00353     xmlNode* ExportCamera(const FbxNode* pNode);
00354 
00360     xmlNode* ExportLight(const FbxNode* pNode);
00361 
00364     void ExportSceneAmbient(xmlNode * pVisualSceneElement);
00365 
00371     bool                ExportController(FbxMesh *pMesh);
00372 
00378     bool                ExportControllerShape(FbxMesh *pMesh);
00379 
00386     //Note : empty method now
00387     xmlNode*    ExportJointWeights(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pExt);
00388 
00395     bool                UpdateMeshLibraryWithShapes(xmlNode* pXmlNode);
00396 
00402     bool                ExportAnimation(FbxNode* pNode);
00403 
00409     bool                ExportAnimationCurves(FbxNode* pNode, xmlNode* pAnimationNode);
00410 
00415     const FbxString ExportImage(FbxFileTexture * pTexture);
00416 
00428     bool                ExportCurve(xmlNode* pAnimationNode, FbxAnimCurve* pCurve,
00429         const char* pChannelName, const char* pSubChannelName,
00430         bool pExportShape=false, bool pExportIntensity=false, bool pExportLib=false);
00431 
00437     bool                NotZero(FbxVector4 pV);
00438 
00444     bool                NotValue(FbxVector4 pV, double pValue);
00445 
00451     bool                NotZero(double pD);
00452 
00458     bool IsTranslationAnimated(const FbxNode *pNode);
00459 
00465     bool IsRotationAnimated(const FbxNode *pNode);
00466 
00473     bool IsRotationAnimated(const FbxNode *pNode, int pAxis);
00474 
00480     bool IsScaleAnimated(const FbxNode *pNode);
00481 
00487     void                CopyMesh(FbxMesh *lNewMesh, FbxMesh *lRefMesh);
00488 
00494     void                ConvertFocalLengthCurveToFOV(FbxAnimCurve *pFOVCurve, FbxAnimCurve *pFLCurve, FbxCamera *pCamera);
00495 
00502     void                PreprocessNodeRecursive(FbxNode* pNode);
00503 
00508     void ExportPropertyValue(const FbxProperty & pProperty,
00509                              xmlNode * pParentElement);
00510 
00512 
00517 
00521     void AddNotificationError( FbxString pError );
00522 
00526     void AddNotificationWarning( FbxString pWarning );
00527 
00529 
00530     FbxFile* mFileObject;
00531     FbxString mFileName;
00532     bool mStatus;
00533 
00534     // XML lib stuff
00535     //
00536     xmlDocPtr mXmlDoc;
00537 
00538     // Scene information
00539     FbxScene*   mScene;
00540 
00541     // AnimStack/Layer holding the animation
00542     FbxAnimStack* mAnimStack;
00543     FbxAnimLayer* mAnimLayer;
00544 
00545     // Libraries
00546     // NB: CODE and PROGRAM libraries are unused, so they are not created.
00547     xmlNode*    mLibraryAnimation;
00548     xmlNode*    mLibraryCamera;
00549     xmlNode*    mLibraryController;
00550     xmlNode*    mLibraryGeometry;
00551     xmlNode*    mLibraryImage; 
00552     xmlNode*    mLibraryLight;
00553     xmlNode*    mLibraryMaterial;
00554     xmlNode*    mLibraryEffect;
00555     xmlNode*    mLibraryTexture;
00556     xmlNode*    mLibraryVisualScene;
00557 
00558     // Shape information
00559     FbxStringList       *mShapeMeshesList;
00560 
00561     // export options
00562     bool mTriangulate;
00563     bool mSingleMatrix;
00564     FbxTime mSamplingPeriod;
00565 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
00566 };
00567 
00568 #include <fbxsdk/fbxsdk_nsend.h>
00569 
00570 #endif /* _FBXSDK_FILEIO_COLLADA_WRITER_H_ */