fbxsdk/fileio/fbx/fbxwriterfbx5.h Source File

fbxwriterfbx5.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_FILEIO_FBX_WRITER_FBX5_H_
14 #define _FBXSDK_FILEIO_FBX_WRITER_FBX5_H_
15 
16 #include <fbxsdk.h>
17 
18 #include <fbxsdk/fbxsdk_nsbegin.h>
19 
20 //Writable versions for this file type.
21 //Sync the functions PreProcessScene and PostProcessScene with these elements of this list.
22 
23 class FbxWriterFbx5 : public FbxWriter
24 {
25 public:
26  FbxWriterFbx5(FbxManager& pManager, FbxExporter& pExporter, int pID, FbxStatus& pStatus);
27  virtual ~FbxWriterFbx5();
28 
29  virtual bool FileCreate(char* pFileName);
30  virtual bool FileCreate(FbxStream* pStream, void* pStreamData);
31  virtual bool FileClose();
32  virtual bool IsFileOpen();
33 
34  typedef enum
35  {
39  } EExportMode;
40 
41  void SetExportMode(EExportMode pMode);
42 
43  virtual void GetWriteOptions();
44  virtual bool Write(FbxDocument* pDocument);
45 
46  virtual bool Write(FbxDocument* pDocument, FbxIO* pFbx);
47  virtual bool PreprocessScene(FbxScene& pScene);
48  virtual bool PostprocessScene(FbxScene& pScene);
49 
50  virtual bool SupportsStreams() const { return true; }
51 
52 private:
53  bool WriteAnimation(FbxScene& pScene);
54  bool WriteAnimation(FbxNode& pRootNode, FbxAnimLayer* pAnimLayer);
55  void WriteTakeNode(KFCurveNode* pCurveNode, bool pRescaleShininess);
56  bool WriteTakeNode(FbxObject& pObj, FbxAnimLayer* pAnimLayer, const char* pBlockName, bool pRescaleShininess = false);
57 
58  bool WriteThumbnail(FbxThumbnail* pThumbnail);
59  void WriteSceneInfo(FbxDocumentInfo*);
60 
61  bool WriteExtensionSection(FbxScene& pScene, int pMediaCount);
62 
63  bool WriteNode(FbxNode* pNode);
64 
65  bool WriteCameraSwitcher(FbxScene& pScene);
66 
67  void WriteGobo(FbxScene& pScene);
68  void WriteGoboSection(FbxScene& pScene);
69  void WriteGobo(FbxGobo& pGobo);
70 
71  void WriteCharacter(FbxScene& pScene);
72  void WriteCharacter(FbxScene& pScene, int pCharacterIndex);
73  void WriteCharacterLinkGroup(FbxCharacter& pCharacter, int pCharacterGroupId, FbxScene& pScene, bool pBackwardCompatible);
74  void WriteCharacterLink(FbxCharacter& pCharacter, int pCharacterNodeId, FbxScene& pScene, bool pBackwardCompatible);
75  void WriteFilterSet(FbxCharacter& pCharacter);
76  void WriteControlSet(FbxControlSet& pControlSet, FbxScene& pScene, bool pBackwardCompatible);
77  void WriteControlSetLinkGroup(FbxControlSet& pControlSet, int pCharacterGroupId, FbxScene& pScene, bool pBackwardCompatible);
78  void WriteControlSetLink(FbxControlSet& pControlSet, int pCharacterNodeId, FbxScene& pScene);
79  void WriteEffector(FbxControlSet& pControlSet, int pEffectorNodeId, FbxScene& pScene);
80  void WriteEffectorAux(FbxControlSet& pControlSet, int pEffectorNodeId, FbxScene& pScene);
81 
82  int WriteCharacterPose(FbxScene& pScene);
83  void WriteCharacterPose(FbxCharacterPose& pCharacterPose);
84 
85  void WritePose(FbxScene& pScene);
86  void WritePose(FbxPose& pPose);
87 
88  void WriteConstraint(FbxScene& pScene);
89 
90  void WriteGlobalLightSettings(FbxScene& pScene);
91  void WriteShadowPlane(FbxScene& pScene);
92  void WriteShadowPlaneSection(FbxScene& pScene);
93  void WriteAmbientColor(FbxScene& pScene);
94  void WriteFogOption(FbxScene& pScene);
95 
96  void WriteGlobalCameraAndTimeSettings(FbxScene& pScene);
97 
98  bool WriteMedia(FbxScene& pScene, bool pMediaEmbedded, int& pMediaCount);
99  bool WriteMediaClip(FbxString& pFileName, bool pEmbeddedMedia);
100  void WriteDefaultMedia();
101 
102  bool WriteNode (FbxNode& pNode);
103  bool WriteNodeBegin (FbxNode& pNode);
104  bool WriteNodeParameters (FbxNode& pNode);
105  bool WriteNodeVersion (FbxNode& pNode);
106  bool WriteNodeShading (FbxNode& pNode);
107  bool WriteNodeAnimationSettings (FbxNode& pNode);
108  bool WriteNodeCullingType (FbxNode& pNode);
109  bool WriteNodeLimits (FbxNode& pNode);
110  bool WriteNodeProperties (FbxNode& pNode);
111  bool WriteNodeTarget (FbxNode& pNode);
112  bool WriteNodeAnimatedProperties(FbxNode& pNode);
113  bool WriteNodeAttribute (FbxNode& pNode);
114  bool WriteNodeDefaultAttributes (FbxNode& pNode);
115  bool WriteNodeChildrenList (FbxNode& pNode);
116  bool WriteNodeEnd (FbxNode& pNode);
117 
118  bool WriteNull ( FbxNull* pNull );
119 
120  bool WriteMarker ( FbxNode& pNode );
121 
122  bool WriteCamera ( FbxCamera& pCamera, bool pIsProducerCamera = false );
123 
124  bool WriteCameraSwitcher ( FbxCameraSwitcher& pCameraSwitcher );
125 
126  bool WriteLight ( FbxLight& pLight );
127 
128  bool WriteGeometry ( FbxGeometry& pGeometry );
129  bool WriteGeometryLayer ( FbxGeometry& pGeometry );
130  bool WriteGeometryTextureLayer ( FbxGeometry& pGeometry, int pIndex );
131 
132  bool WriteMesh ( FbxMesh& pMesh );
133  bool WriteMeshVertices ( FbxMesh& pMesh );
134  bool WriteMeshNormals ( FbxMesh& pMesh );
135  bool WriteMeshMaterial ( FbxMesh& pMesh );
136  bool WriteMeshTexture ( FbxMesh& pMesh );
137  bool WriteMeshGeometryUVInfo ( FbxMesh& pMesh );
138  bool WriteMeshPolyVertexIndex ( FbxMesh& pMesh );
139  bool WriteMeshPolyGroupIndex ( FbxMesh& pMesh );
140  bool WriteMeshVertexColors ( FbxMesh& pMesh );
141 
142  bool WriteNurb ( FbxNurbs& pNurbs );
143 
144  bool WritePatch ( FbxPatch& pPatch );
145  bool WritePatchType ( FbxPatch& pPatch, int pType );
146 
147  bool WriteSkeleton ( FbxSkeleton& pSkeleton );
148  bool WriteSkeletonRoot ( FbxSkeleton& pSkeleton );
149  bool WriteSkeletonLimb ( FbxSkeleton& pSkeleton );
150  bool WriteSkeletonLimbNode ( FbxSkeleton& pSkeleton );
151  bool WriteSkeletonEffector ( FbxSkeleton& pSkeleton );
152 
153  bool WriteOpticalReference ( FbxOpticalReference& pOpticalReference );
154 
155  bool WriteTexture(FbxFileTexture& pTexture);
156  bool WriteSurfaceMaterial(FbxSurfaceMaterial& pMaterial);
157  bool WriteLink(FbxCluster& pCluster);
158  bool WriteShape(FbxShape& pShape, FbxString pShapeName, FbxGeometry& pGeometry);
159 
160  bool WriteProperties(FbxObject* pObject);
161 
162  int FindString(FbxString pString, FbxArray<FbxString*>& pStringArray);
163  void FindShapeValidIndices(FbxArray<FbxVector4>& pGeometryControlPoints, FbxArray<FbxVector4>& pShapeControlPoints, FbxArray<int>& lValidIndices);
164 
165  void ConvertShapeNamesToV5Format(FbxNode& pNode);
166  void RevertShapeNamesToV6Format (FbxNode& pNode);
167 
168  void WritePassword();
169 
170  void FindAnimatedChannels(FbxScene& pScene);
171  void ClearAnimatedChannels();
172 
173  void WriteSceneGenericPersistenceSection(FbxScene& pScene);
174 
175  void ForceKFCurveNodesOnTRS(FbxNode* pNode);
176  void SetPivotStateRecursive(FbxNode* pNode);
177 
178 private:
179  FbxWriterFbx5& operator=(const FbxWriterFbx5&) { return *this; }
180 
181  FbxIO* mFileObject;
182  FbxExporter& mExporter;
183 
184  EExportMode mExportMode;
185 
186  FbxMultiMap mTextureAnimatedChannels;
187  FbxMultiMap mMaterialAnimatedChannels;
188 
189  struct TextureAnimatedChannels
190  {
191  bool mTranslation;
192  bool mRotation;
193  bool mScaling;
194  bool mAlpha;
195  };
196 
197  struct SurfaceMaterialAnimatedChannels
198  {
199  bool mAmbient;
200  bool mDiffuse;
201  bool mSpecular;
202  bool mEmissive;
203  bool mOpacity;
204  bool mShininess;
205  bool mReflectivity;
206  };
207 };
208 
209 #include <fbxsdk/fbxsdk_nsend.h>
210 
211 #endif /* _FBXSDK_FILEIO_FBX_WRITER_FBX5_H_ */
The animation layer is a collection of animation curve nodes.
Definition: fbxanimlayer.h:30
This class describes image mapping on top of geometry.
virtual bool FileCreate(char *pFileName)
Creates a new file.
virtual bool PreprocessScene(FbxScene &pScene)
Pre-processes the scene.
A gobo is a filter placed over a spot light to project light patterns through fog on a surface...
Definition: fbxgobo.h:26
SDK object manager.
Definition: fbxmanager.h:56
FbxWriterFbx5(FbxManager &pManager, FbxExporter &pExporter, int pID, FbxStatus &pStatus)
virtual bool FileClose()
Closes the file.
Abstract class for implementing I/O operations through a stream of data.
Definition: fbxstream.h:26
This class contains material settings.
Utility class to manipulate strings.
Definition: fbxstring.h:66
FbxDocument is a base class for FbxScene and FbxLibrary classes.
Definition: fbxdocument.h:46
This node attribute contains the properties of an optical reference.
Class for clusters (links).
Definition: fbxcluster.h:47
This node attribute contains methods for accessing the properties of a camera switcher.
This class facilitates the testing/reporting of errors.
Definition: fbxstatus.h:26
virtual bool IsFileOpen()
Test if the file is open.
This class contains scene thumbnails and user-defined summary data.
A character pose is a character and an associated hierarchy of nodes.
The base class of most FBX objects.
Definition: fbxobject.h:157
Represents an element in the scene graph.
Definition: fbxnode.h:72
Class to export SDK objects into an FBX file.
Definition: fbxexporter.h:89
A patch is a type of node attribute with parametric surface.
Definition: fbxpatch.h:26
This node attribute contains methods for accessing the properties of a light.
Definition: fbxlight.h:27
virtual bool PostprocessScene(FbxScene &pScene)
Post-processes the scene.
This class contains the description of a 3D scene.
Definition: fbxscene.h:61
virtual void GetWriteOptions()
Setup write options.
This class contains the description of a Pose and provide some methods to access Pose info in one FBX...
Definition: fbxpose.h:96
virtual bool SupportsStreams() const
Returns true if this writer supports FbxStream I/O.
Definition: fbxwriterfbx5.h:50
Base class of other writers used internally.
Definition: fbxwriter.h:58
virtual bool Write(FbxDocument *pDocument)
Writes content to the specified file with given stream options.
A shape describes the deformation on a set of control points, which is similar to the cluster deforme...
Definition: fbxshape.h:32
void SetExportMode(EExportMode pMode)
FbxIO represents an FBX file.
Definition: fbxio.h:324
This node attribute contains methods for accessing the properties of a camera.
Definition: fbxcamera.h:34
A NURBS surface is a type of parametric geometry.
Definition: fbxnurbs.h:31
This node attribute contains the properties of a null node.
Definition: fbxnull.h:25
This class contains all methods to either set-up an exported control rig or query information on an i...
virtual ~FbxWriterFbx5()
This class specializes a node attribute to represent the elements forming "bone" chains.
Definition: fbxskeleton.h:34
A Character is a person or animal with pre-defined skeleton system.
Definition: fbxcharacter.h:91
The base class of geometric objects that support control point deformations (e.g. ...
Definition: fbxgeometry.h:45
Class to manipulate a map that can contain multiple times the same key.
Definition: fbxmultimap.h:22
Simple class to hold RGBA values of a thumbnail image.
Definition: fbxthumbnail.h:27
A mesh is a geometry made of polygons.
Definition: fbxmesh.h:32