fbxsdk/fileio/fbx/fbxwriterfbx5.h Source File
 
 
 
fbxsdk/fileio/fbx/fbxwriterfbx5.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_WRITER_FBX5_H_
00014 #define _FBXSDK_FILEIO_FBX_WRITER_FBX5_H_
00015 
00016 #include <fbxsdk.h>
00017 
00018 #include <fbxsdk/fbxsdk_nsbegin.h>
00019 
00020 //Writable versions for this file type.  
00021 //Sync the functions PreProcessScene and PostProcessScene with these elements of this list.
00022 
00023 class FbxWriterFbx5 : public FbxWriter
00024 {
00025 public:
00026         FbxWriterFbx5(FbxManager& pManager, FbxExporter& pExporter, int pID, FbxStatus& pStatus);
00027         virtual ~FbxWriterFbx5();
00028 
00029         virtual bool FileCreate(char* pFileName);
00030     virtual bool FileCreate(FbxStream* pStream, void* pStreamData);
00031         virtual bool FileClose();
00032         virtual bool IsFileOpen();
00033 
00034         typedef enum 
00035         {
00036                 eASCII,
00037                 eBINARY,
00038                 eENCRYPTED
00039         } EExportMode;
00040 
00041         void SetExportMode(EExportMode pMode);
00042 
00043         virtual void GetWriteOptions();
00044         virtual bool Write(FbxDocument* pDocument);
00045 
00046         virtual bool Write(FbxDocument* pDocument, FbxIO* pFbx);
00047         virtual bool PreprocessScene(FbxScene& pScene);
00048         virtual bool PostprocessScene(FbxScene& pScene);
00049 
00050         virtual bool SupportsStreams() const            { return true; }
00051 
00052 private:
00053         bool WriteAnimation(FbxScene& pScene);
00054         bool WriteAnimation(FbxNode& pRootNode, FbxAnimLayer* pAnimLayer);
00055         void WriteTakeNode(KFCurveNode* pCurveNode, bool pRescaleShininess); 
00056         bool WriteTakeNode(FbxObject& pObj, FbxAnimLayer* pAnimLayer, const char* pBlockName, bool pRescaleShininess = false);
00057 
00058         bool WriteThumbnail(FbxThumbnail* pThumbnail);
00059         void WriteSceneInfo(FbxDocumentInfo*);
00060 
00061         bool WriteExtensionSection(FbxScene& pScene, int pMediaCount);
00062 
00063     bool WriteNode(FbxNode* pNode);
00064 
00065         bool WriteCameraSwitcher(FbxScene& pScene);
00066 
00067     void WriteGobo(FbxScene& pScene);
00068     void WriteGoboSection(FbxScene& pScene);
00069         void WriteGobo(FbxGobo& pGobo);
00070 
00071         void WriteCharacter(FbxScene& pScene);
00072         void WriteCharacter(FbxScene& pScene, int pCharacterIndex);
00073         void WriteCharacterLinkGroup(FbxCharacter& pCharacter, int pCharacterGroupId, FbxScene& pScene, bool pBackwardCompatible);
00074         void WriteCharacterLink(FbxCharacter& pCharacter, int pCharacterNodeId, FbxScene& pScene, bool pBackwardCompatible);
00075         void WriteFilterSet(FbxCharacter& pCharacter);
00076         void WriteControlSet(FbxControlSet& pControlSet, FbxScene& pScene, bool pBackwardCompatible);   
00077         void WriteControlSetLinkGroup(FbxControlSet& pControlSet, int pCharacterGroupId, FbxScene& pScene, bool pBackwardCompatible);
00078         void WriteControlSetLink(FbxControlSet& pControlSet, int pCharacterNodeId, FbxScene& pScene);
00079         void WriteEffector(FbxControlSet& pControlSet, int pEffectorNodeId, FbxScene& pScene);
00080         void WriteEffectorAux(FbxControlSet& pControlSet, int pEffectorNodeId, FbxScene& pScene);
00081 
00082         int  WriteCharacterPose(FbxScene& pScene);
00083         void WriteCharacterPose(FbxCharacterPose& pCharacterPose);
00084 
00085         void WritePose(FbxScene& pScene);
00086         void WritePose(FbxPose& pPose);
00087 
00088         void WriteConstraint(FbxScene& pScene);
00089 
00090         void WriteGlobalLightSettings(FbxScene& pScene);
00091     void WriteShadowPlane(FbxScene& pScene);
00092     void WriteShadowPlaneSection(FbxScene& pScene);
00093     void WriteAmbientColor(FbxScene& pScene);
00094     void WriteFogOption(FbxScene& pScene); 
00095 
00096         void WriteGlobalCameraAndTimeSettings(FbxScene& pScene);
00097         
00098         bool WriteMedia(FbxScene& pScene, bool pMediaEmbedded, int& pMediaCount);
00099         bool WriteMediaClip(FbxString& pFileName, bool pEmbeddedMedia);
00100         void WriteDefaultMedia();
00101 
00102         bool WriteNode                  (FbxNode& pNode);
00103         bool WriteNodeBegin             (FbxNode& pNode);
00104         bool WriteNodeParameters        (FbxNode& pNode);
00105         bool WriteNodeVersion           (FbxNode& pNode);
00106         bool WriteNodeShading           (FbxNode& pNode);
00107         bool WriteNodeAnimationSettings (FbxNode& pNode);
00108         bool WriteNodeCullingType       (FbxNode& pNode);
00109     bool WriteNodeLimits            (FbxNode& pNode);
00110         bool WriteNodeProperties            (FbxNode& pNode);
00111         bool WriteNodeTarget            (FbxNode& pNode);
00112         bool WriteNodeAnimatedProperties(FbxNode& pNode);
00113         bool WriteNodeAttribute         (FbxNode& pNode);
00114         bool WriteNodeDefaultAttributes (FbxNode& pNode);
00115         bool WriteNodeChildrenList      (FbxNode& pNode);
00116         bool WriteNodeEnd               (FbxNode& pNode);
00117 
00118         bool WriteNull                  ( FbxNull* pNull );
00119 
00120         bool WriteMarker                ( FbxNode& pNode );
00121 
00122         bool WriteCamera                ( FbxCamera& pCamera, bool pIsProducerCamera = false ); 
00123 
00124         bool WriteCameraSwitcher        ( FbxCameraSwitcher& pCameraSwitcher );
00125 
00126         bool WriteLight                 ( FbxLight& pLight );
00127 
00128         bool WriteGeometry              ( FbxGeometry& pGeometry );
00129         bool WriteGeometryLayer         ( FbxGeometry& pGeometry );
00130         bool WriteGeometryTextureLayer  ( FbxGeometry& pGeometry, int pIndex );
00131 
00132         bool WriteMesh                  ( FbxMesh& pMesh );
00133         bool WriteMeshVertices          ( FbxMesh& pMesh );
00134         bool WriteMeshNormals           ( FbxMesh& pMesh );
00135         bool WriteMeshMaterial          ( FbxMesh& pMesh );
00136         bool WriteMeshTexture           ( FbxMesh& pMesh );
00137         bool WriteMeshGeometryUVInfo    ( FbxMesh& pMesh );
00138         bool WriteMeshPolyVertexIndex   ( FbxMesh& pMesh );
00139         bool WriteMeshPolyGroupIndex    ( FbxMesh& pMesh );
00140         bool WriteMeshVertexColors      ( FbxMesh& pMesh );
00141 
00142         bool WriteNurb                  ( FbxNurbs& pNurbs );
00143 
00144         bool WritePatch                 ( FbxPatch& pPatch );
00145     bool WritePatchType             ( FbxPatch& pPatch, int pType );
00146 
00147         bool WriteSkeleton              ( FbxSkeleton& pSkeleton );
00148         bool WriteSkeletonRoot          ( FbxSkeleton& pSkeleton );
00149         bool WriteSkeletonLimb          ( FbxSkeleton& pSkeleton );
00150         bool WriteSkeletonLimbNode      ( FbxSkeleton& pSkeleton );
00151         bool WriteSkeletonEffector      ( FbxSkeleton& pSkeleton );
00152         
00153         bool WriteOpticalReference      ( FbxOpticalReference& pOpticalReference );
00154 
00155         bool WriteTexture(FbxFileTexture& pTexture);
00156         bool WriteSurfaceMaterial(FbxSurfaceMaterial& pMaterial);
00157         bool WriteLink(FbxCluster& pCluster);
00158         bool WriteShape(FbxShape& pShape, FbxString pShapeName, FbxGeometry& pGeometry);
00159 
00160         bool WriteProperties(FbxObject* pObject);
00161 
00162         int FindString(FbxString pString, FbxArray<FbxString*>& pStringArray);
00163         void FindShapeValidIndices(FbxArray<FbxVector4>& pGeometryControlPoints, FbxArray<FbxVector4>& pShapeControlPoints, FbxArray<int>& lValidIndices);
00164 
00165         void ConvertShapeNamesToV5Format(FbxNode& pNode);
00166         void RevertShapeNamesToV6Format (FbxNode& pNode);
00167 
00168         void WritePassword();
00169 
00170         void FindAnimatedChannels(FbxScene& pScene);
00171         void ClearAnimatedChannels();
00172 
00173         void WriteSceneGenericPersistenceSection(FbxScene& pScene);
00174 
00175     void ForceKFCurveNodesOnTRS(FbxNode* pNode);
00176     void SetPivotStateRecursive(FbxNode* pNode);
00177 
00178 private:
00179         FbxWriterFbx5& operator=(const FbxWriterFbx5&) { return *this; }
00180 
00181         FbxIO* mFileObject;     
00182         FbxExporter& mExporter;
00183 
00184         EExportMode mExportMode;
00185 
00186         FbxSet mTextureAnimatedChannels;
00187         FbxSet mMaterialAnimatedChannels;
00188 
00189         struct TextureAnimatedChannels
00190         {
00191                 bool mTranslation;
00192                 bool mRotation;
00193                 bool mScaling;
00194                 bool mAlpha;
00195         };
00196 
00197         struct SurfaceMaterialAnimatedChannels
00198         {
00199                 bool mAmbient;
00200                 bool mDiffuse;
00201                 bool mSpecular;
00202                 bool mEmissive;
00203                 bool mOpacity;
00204                 bool mShininess;
00205                 bool mReflectivity;
00206         };
00207 };
00208 
00209 #include <fbxsdk/fbxsdk_nsend.h>
00210 
00211 #endif /* _FBXSDK_FILEIO_FBX_WRITER_FBX5_H_ */