fbxsdk/fileio/collada/fbxreadercollada14.h Source File

fbxreadercollada14.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_COLLADA_READER_H_
14 #define _FBXSDK_FILEIO_COLLADA_READER_H_
15 
16 #include <fbxsdk.h>
17 
20 
21 #include <fbxsdk/fbxsdk_nsbegin.h>
22 
23 
53 class FbxReaderCollada : public FbxReader
54 {
55 public:
60 
66  FbxReaderCollada(FbxManager& pManager, int pID, FbxStatus& pStatus);
67 
69  virtual ~FbxReaderCollada();
70 
72 
77 
82  virtual bool FileOpen(char* pFileName);
83 
87  virtual bool FileClose();
88 
92  virtual bool IsFileOpen();
93 
95 
100 
105  virtual bool GetReadOptions(bool pParseFileAsNeeded = true){ return true; }
106 
112  virtual bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
113 
118 
123  virtual bool Read(FbxDocument* pDocument);
124 
126 
127 /*****************************************************************************************************************************
128 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
129 *****************************************************************************************************************************/
130 #ifndef DOXYGEN_SHOULD_SKIP_THIS
131 private:
136 
142  bool ReadCollada(FbxScene &pScene, xmlNode* pXmlNode);
143 
149  bool ImportVisualScene(xmlNode* pXmlNode, FbxScene * pScene);
150 
156  bool ImportVisualSceneMax3DExtension(xmlNode * pTechniqueElement, FbxScene * pScene);
157 
163  bool ImportVisualSceneFCOLLADAExtension(xmlNode * pTechniqueElement, FbxScene * pScene);
164 
170  bool ImportVisualSceneMayaExtension(xmlNode * pTechniqueElement, FbxScene * pScene);
171 
180  bool ImportAsset(xmlNode* pXmlNode, FbxGlobalSettings & pGlobalSettings, FbxDocumentInfo &pSceneInfo);
181 
189  FbxNode * ImportNode(xmlNode* pXmlNode);
190 
196  bool ImportNodeFCOLLADAExtension(xmlNode* pTechniqueElement, FbxNode * pNode);
197 
203  bool ImportNodeXSIExtension(xmlNode* pTechniqueElement, FbxNode * pNode);
204 
210  bool ImportNodeFBXExtension(xmlNode* pTechniqueElement, FbxNode * pNode);
211 
218  FbxGeometry * ImportGeometry(const FbxString & pGeometryID, const FbxDynamicArray<FbxString> & pMaterialSequence);
219 
224  bool ImportSkin(xmlNode* pSkinElement);
225 
231  FbxGeometry * ImportMorph(xmlNode * pMorphElement, const FbxDynamicArray<FbxString> & pMaterialSequence);
232 
238  FbxGeometry * ImportController(const FbxString & pControllerID, const FbxDynamicArray<FbxString> & pMaterialSequence);
239 
245  FbxCamera * ImportCamera(xmlNode* pXmlNode);
246 
252  FbxLight * ImportLight(xmlNode* pXmlNode);
253 
258  FbxSurfaceMaterial * ImportMaterial(xmlNode* pXmlNode);
259 
264  FbxSurfaceMaterial * ImportEffect(xmlNode* pEffectElement);
265 
271  FbxSurfaceMaterial * ImportEffectNVidiaExtension(xmlNode * pEffectElement);
272 
278  FbxFileTexture * ImportTexture(xmlNode* pXmlNode);
279 
284  FbxFileTexture * ImportImage(xmlNode* pXmlNode);
285 
295  FbxGeometry * ImportMesh(xmlNode* pXmlNode, const FbxDynamicArray<FbxString> & pMaterialSequence, FbxArray<FbxObject*>& pObjects);
296 
303  bool ImportVertices(xmlNode* pVerticesElement, FbxGeometry * pGeometry);
304 
312  bool ImportPolygons(xmlNode* pXmlNode, FbxMesh& pMesh, const FbxDynamicArray<FbxString> & pMaterialSequence);
313 
320  bool ImportTransforms(xmlNode* pXmlNode, FbxNode* pNode);
321 
327  int ImportRotationElement(xmlNode* pXmlNode, FbxVector4& pRotationVector);
328 
333  void SetRotationOrder(FbxNode * pNode, const FbxArray<int> & pRotationOrder);
334 
344  bool ImportLookAt(xmlNode* pXmlNode, FbxVector4& lCameraPosition,
345  FbxVector4& lInterestPosition, FbxVector4& lUpVector,
346  FbxAMatrix& lCameraTransformMatrix);
347 
349 
350 
355 
362  bool IsNodeExportable(FbxString lId);
363 
368  bool CheckColladaVersion(const FbxString & pVersionString);
369 
371 
372 
377 
381  void AddNotificationError( FbxString pError );
382 
386  void AddNotificationWarning( FbxString pWarning );
388 
394  bool ImportScene(xmlNode * pColladaNode);
395 
399  void Preprocess(xmlNode * pColladaElement);
400 
403  void BuildUpLibraryMap();
404 
409  void BuildUpLibraryMap(xmlNode * pElement, const FbxString & pElementTag);
410 
418  bool ConnectMaterialsToNode(FbxNode * pNode, xmlNode * pElement, FbxDynamicArray<FbxString> & pMaterialSequence);
419 
425  bool ImportTransparent(xmlNode * pElement, FbxSurfaceLambert * pSurfaceMaterial);
426 
427  // Some traits with a typed element.
428  struct LibraryTypeTraits
429  {
430  FbxString library_tag;
431  FbxString element_tag;
432  };
433 
439  FbxObject * GetLibrary(const LibraryTypeTraits & pTypeTraits, const FbxString & pID);
440  FbxObject * GetLibrary(const LibraryTypeTraits & pTypeTraits, xmlNode * pElement);
441 
447  bool ImportMatrixAnimation(FbxNode * pNode, const FbxString & pAnimationChannelID);
448 
455  bool ImportPropertyAnimation(FbxProperty & pProperty, const FbxString & pAnimationChannelID, const char * pChannelName = NULL);
456 
461  FbxAnimLayer * GetAnimLayer(const FbxString & pAnimationID);
462 
467  double GetLocalUnitConversion(xmlNode * pElement);
468 
473  void SetProperty(xmlNode* pPropertyElement, FbxProperty & pProperty);
474 
480  void ImportPropertyValue(FbxObject * pObject, const char * pPropertyName,
481  xmlNode * pPropertyValueElement);
482 
483  FbxFile* mFileObject;
484  FbxString mFileName;
485 
486  // XML lib stuff
487  xmlDocPtr mXmlDoc;
488 
489  FbxAnimLayer* mAnimLayer;
490  FbxScene* mScene;
491 
492  // Save the global settings and document info in pre-reading
493  FbxGlobalSettings * mGlobalSettings;
494  FbxDocumentInfo * mDocumentInfo;
495  FbxArray<FbxTakeInfo*> mTakeInfo;
496 
497  xmlNode * mColladaElement;
498 
499  struct ColladaElementData
500  {
501  explicit ColladaElementData(xmlNode * pElement = NULL)
502  : mColladaElement(pElement), mFBXObject(NULL) {}
503  xmlNode * mColladaElement;
504  FbxObject * mFBXObject;
505  FbxArray<FbxObject*> mFBXObjects;
506  };
507  typedef FbxMap<FbxString, ColladaElementData> ColladaElementMapType;
508  ColladaElementMapType mColladaElements;
509 
510  LibraryTypeTraits mEffectTypeTraits;
511  LibraryTypeTraits mMaterialTypeTraits;
512  LibraryTypeTraits mImageTypeTraits;
513  LibraryTypeTraits mGeometryTypeTraits;
514  LibraryTypeTraits mControllerTypeTraits;
515  LibraryTypeTraits mLightTypeTraits;
516  LibraryTypeTraits mCameraTypeTraits;
517  LibraryTypeTraits mNodeTypeTraits;
518  LibraryTypeTraits mAnimationTypeTraits;
519 
520  typedef FbxMap<FbxString, FbxArray<xmlNode*> > AnimationMapType;
521  AnimationMapType mAnimationElements;
522 
523  SourceElementMapType mSourceElements;
524 
525  struct AnimationClipData
526  {
527  AnimationClipData(const FbxString & pID) : mID(pID), mAnimLayer(NULL) {}
528  AnimationClipData(const AnimationClipData& pOther){ *this = pOther; }
529  AnimationClipData& operator=(const AnimationClipData& pOther){ mID = pOther.mID; mAnimationElementIDs = pOther.mAnimationElementIDs; mAnimLayer = pOther.mAnimLayer; return *this; }
530 
531  FbxString mID; // ID of animation clip
532  FbxSet<FbxString> mAnimationElementIDs; // IDs of animation belong to this animation clip
533  FbxAnimLayer * mAnimLayer; // The corresponding animation layer
534  };
535  FbxDynamicArray<AnimationClipData> mAnimationClipData;
536 
537  // Map from skin ID to skin element.
538  SkinMapType mSkinElements;
539 
540  // There are two distinct namespaces for node ID & SID mapping.
541  // One with ID and the other with SID.
542  typedef FbxMap<FbxString, FbxNode *> NodeMapType;
543  NodeMapType mIDNamespaceNodes;
544  NodeMapType mSIDNamespaceNodes;
545 
546  // Record the nodes which are to connect to its target node.
547  // Save the ID of the target node if a node has its target
548  typedef FbxMap<FbxNode *, FbxString> TargetIDMapType;
549  TargetIDMapType mTargetIDs;
550 
551  FbxColladaNamespace mNamespace;
552 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
553 };
554 
555 #include <fbxsdk/fbxsdk_nsend.h>
556 
557 #endif /* _FBXSDK_FILEIO_COLLADA_READER_H_ */
The animation layer is a collection of animation curve nodes.
Definition: fbxanimlayer.h:30
This class describes image mapping on top of geometry.
SDK object manager.
Definition: fbxmanager.h:56
virtual ~FbxReaderCollada()
Destructor.
This class represents the coordinate system of the scene and can convert scenes to other coordinate s...
Definition: fbxaxissystem.h:97
#define NULL
Definition: fbxarch.h:210
This class contains material settings.
Utility class to manipulate strings.
Definition: fbxstring.h:66
Class to read a Collada file and import it to a FBX scene.
FbxDocument is a base class for FbxScene and FbxLibrary classes.
Definition: fbxdocument.h:46
Base class of other readers used internally.
Definition: fbxreader.h:64
This class facilitates the testing/reporting of errors.
Definition: fbxstatus.h:26
virtual bool Read(FbxDocument *pDocument)
Read from Collada file and import it to the FBX document, according to the given options settings...
This class contains scene thumbnails and user-defined summary data.
This class contains functions for accessing global settings.
virtual bool FileClose()
Close file.
This class implements an efficient map based on key comparison, which stores key-value pairs...
Definition: fbxmap.h:68
The base class of most FBX objects.
Definition: fbxobject.h:157
virtual bool GetAxisInfo(FbxAxisSystem *pAxisSystem, FbxSystemUnit *pSystemUnits)
Get axis system information from file.
Represents an element in the scene graph.
Definition: fbxnode.h:72
This node attribute contains methods for accessing the properties of a light.
Definition: fbxlight.h:27
This class contains settings for Lambert Materials.
This class contains the description of a 3D scene.
Definition: fbxscene.h:61
This class implements an efficient set based on value comparison, which stores values.
Definition: fbxset.h:25
virtual FbxArray< FbxTakeInfo * > * GetTakeInfo()
Returns the list of take infos from the file.
Containing the valid parameter definition and modification in local scope.
Template class for dynamic array holding objects.
Class to hold user properties.
Definition: fbxproperty.h:37
A four double mathematic vector class.
Definition: fbxvector4.h:25
FBX SDK affine matrix class.
This class describes the units of measurement used within a particular scene.
Definition: fbxsystemunit.h:31
This node attribute contains methods for accessing the properties of a camera.
Definition: fbxcamera.h:34
virtual bool FileOpen(char *pFileName)
Open file with the given name.
virtual bool IsFileOpen()
Check if current file is open.
virtual bool GetReadOptions(bool pParseFileAsNeeded=true)
Get Collada import options settings.
Class for interfacing with files, providing a similar interface for files independant of the OS or fi...
Definition: fbxfile.h:27
The base class of geometric objects that support control point deformations (e.g. ...
Definition: fbxgeometry.h:45
FbxReaderCollada(FbxManager &pManager, int pID, FbxStatus &pStatus)
Constructor.
A mesh is a geometry made of polygons.
Definition: fbxmesh.h:32