fbxwritercollada14.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 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 "fbxcolladautils.h"
00017 
00018 #include <fbxsdk/fbxsdk_nsbegin.h>
00019 
00020 class FbxAnimStack;
00021 
00025 class FbxWriterCollada : public FbxWriter 
00026 {
00027 public:
00032 
00037     FbxWriterCollada(FbxManager& pManager, int pID);
00038 
00040     virtual ~FbxWriterCollada();
00041 
00043 
00048 
00053     virtual bool FileCreate(char* pFileName);
00054 
00058     virtual bool FileClose();
00059 
00063     virtual bool IsFileOpen();
00064 
00066 
00071 
00074     virtual void GetWriteOptions(){}
00075 
00080     virtual bool Write(FbxDocument* pDocument);
00081 
00087     virtual bool PreprocessScene(FbxScene &pScene);
00088 
00093     virtual bool PostprocessScene(FbxScene &pScene);
00094 
00096 
00097 
00099     //
00100     //  WARNING!
00101     //
00102     //  Anything beyond these lines may not be documented accurately and is 
00103     //  subject to change without notice.
00104     //
00106 
00107 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00108 
00109 private:
00110 
00115 
00123     xmlNode*    ExportAsset(xmlNode* pXmlNode, FbxDocumentInfo* pSceneInfo);
00124 
00129     xmlNode * ExportScene(FbxScene* pScene);
00130 
00137     bool        ExportLibraries(xmlNode* pXmlNode);
00138 
00147     xmlNode* ExportNodeRecursive(xmlNode* pXmlNode, const FbxNode* pNode);
00148 
00153     void ExportVisualSceneMAX3DExtension(xmlNode * pExtraElement, FbxScene * pScene);
00154 
00159     void ExportVisualSceneFCOLLADAExtension(xmlNode * pExtraElement, FbxScene * pScene);
00160 
00168     xmlNode* ExportNode(xmlNode* pXmlNode, const FbxNode* pNode);
00169 
00177     bool ExportTransform(xmlNode* pXmlNode, const FbxNode* pNode);
00178 
00186     bool ExportNodeAttribute(xmlNode* pXmlNode, const FbxNode* pNode);
00187 
00194     xmlNode* CreateMeshLibrary(const FbxNode* pNode);
00195 
00202     xmlNode* CreateCameraLibrary(const FbxNode* pNode);
00203 
00210     xmlNode* CreateLightLibrary(const FbxNode* pNode);
00211 
00218     xmlNode* ExportMesh(const FbxNode* pNode);
00219 
00226     xmlNode*    ExportShapeGeometry(FbxMesh* pMeshShape, FbxString pShapeId);
00227 
00238     //Note why internally set pExportControlPoints to true?
00239     xmlNode*    ExportVertexPositions(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pMeshName, bool pInGeometry, bool pExportControlPoints);
00240 
00249     xmlNode*    ExportLayerElements(xmlNode* pXmlMesh, FbxMesh* pMesh, FbxString pName);
00250 
00260     xmlNode*    ExportNormals(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName, FbxString pExt, int pLayerIndex);
00261 
00270     xmlNode*    ExportUVs(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName, int pLayerIndex);
00271 
00280     xmlNode*    ExportVertexColors(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName, int pLayerIndex);
00281 
00288     xmlNode*    ExportVertices(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pName);
00289 
00299     xmlNode*    ExportPolygons(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pMaterialName, FbxString pName, bool pShape=false);
00300 
00306     bool        ExportMeshMaterials(FbxMesh *pMesh, int pNbMat);
00307 
00314     xmlNode*    ExportMaterial(FbxSurfaceMaterial *pMaterial);
00315 
00326     xmlNode*    ExportEffect(FbxSurfaceMaterial *pMaterial, FbxString pEffectId);
00327 
00336     //Note why return true when failed and popped waring?
00337     bool        AddMaterialTextureInput(xmlNode *pXmlMaterial, FbxFileTexture *pTexture, FbxString pImageId, int pLayerIndex, int pLayerElementType);
00338 
00345     xmlNode*    ExportTexture(FbxFileTexture *pTexture, FbxString pImageId, int pLayerIndex);
00346 
00352     bool        ExportMeshTextures(FbxMesh *pMesh);
00353 
00359     xmlNode* ExportCamera(const FbxNode* pNode);
00360 
00366     xmlNode* ExportLight(const FbxNode* pNode);
00367 
00370     void ExportSceneAmbient(xmlNode * pVisualSceneElement);
00371 
00377     bool        ExportController(FbxMesh *pMesh);
00378 
00384     bool        ExportControllerShape(FbxMesh *pMesh);
00385 
00392     //Note : empty method now
00393     xmlNode*    ExportJointWeights(xmlNode* pXmlNode, FbxMesh* pMesh, FbxString pExt);
00394 
00401     bool        UpdateMeshLibraryWithShapes(xmlNode* pXmlNode);
00402 
00408     bool        ExportAnimation(FbxNode* pNode);
00409 
00415     bool        ExportAnimationCurves(FbxNode* pNode, xmlNode* pAnimationNode);
00416 
00421     const FbxString ExportImage(FbxFileTexture * pTexture);
00422 
00434     bool        ExportCurve(xmlNode* pAnimationNode, FbxAnimCurve* pCurve,
00435         const char* pChannelName, const char* pSubChannelName,
00436         bool pExportShape=false, bool pExportIntensity=false, bool pExportLib=false);
00437 
00443     bool        NotZero(FbxVector4 pV);
00444 
00450     bool        NotValue(FbxVector4 pV, double pValue);
00451 
00457     bool        NotZero(double pD);
00458 
00464     bool IsTranslationAnimated(const FbxNode *pNode);
00465 
00471     bool IsRotationAnimated(const FbxNode *pNode);
00472 
00479     bool IsRotationAnimated(const FbxNode *pNode, int pAxis);
00480 
00486     bool IsScaleAnimated(const FbxNode *pNode);
00487 
00493     void        CopyMesh(FbxMesh *lNewMesh, FbxMesh *lRefMesh);
00494 
00500     void        ConvertFocalLengthCurveToFOV(FbxAnimCurve *pFOVCurve, FbxAnimCurve *pFLCurve, FbxCamera *pCamera);
00501 
00508     void        PreprocessNodeRecursive(FbxNode* pNode);
00509 
00514     void ExportPropertyValue(const FbxProperty & pProperty,
00515                              xmlNode * pParentElement);
00516 
00518 
00523 
00527     void AddNotificationError( FbxString pError );
00528 
00532     void AddNotificationWarning( FbxString pWarning );
00533 
00535 
00536 private:
00537 
00538     FbxFile* mFileObject;
00539     FbxString mFileName;
00540     bool mStatus;
00541 
00542     // XML lib stuff
00543     //
00544     xmlDocPtr mXmlDoc;
00545 
00546     // Scene information
00547     FbxScene*   mScene;
00548 
00549     // AnimStack/Layer holding the animation
00550     FbxAnimStack* mAnimStack;
00551     FbxAnimLayer* mAnimLayer;
00552 
00553     // Libraries
00554     // NB: CODE and PROGRAM libraries are unused, so they are not created.
00555     xmlNode*    mLibraryAnimation;
00556     xmlNode*    mLibraryCamera;
00557     xmlNode*    mLibraryController;
00558     xmlNode*    mLibraryGeometry;
00559     xmlNode*    mLibraryImage; 
00560     xmlNode*    mLibraryLight;
00561     xmlNode*    mLibraryMaterial;
00562     xmlNode*    mLibraryEffect;
00563     xmlNode*    mLibraryTexture;
00564     xmlNode*    mLibraryVisualScene;
00565 
00566     // Shape information
00567     FbxStringList   *mShapeMeshesList;
00568 
00569     // export options
00570     bool mTriangulate;
00571     bool mSingleMatrix;
00572     FbxTime mSamplingPeriod;
00573 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00574 };
00575 
00576 #include <fbxsdk/fbxsdk_nsend.h>
00577 
00578 #endif /* _FBXSDK_FILEIO_COLLADA_WRITER_H_ */