Public Member Functions | Protected Member Functions | Protected Attributes | Friends

KFbxDocument Class Reference

This reference page is linked to from the following overview topics: List of Python FBX classes.


Search for all occurrences

Detailed Description

KFbxDocument is a base class for KFbxScene and KFbxLibrary classes.

A document is a collection (KFbxCollection) of objects (KFbxObject), called the root member objects. This is because these objects each form the root of an object graph. The manager (KFbxSdkManager) has access to all documents, scenes and libraries.

A document can be contained in another document, thus, a hierarchy of documents can be built. The root of all documents is simply called the root document.

A document manages animation stacks (KFbxAnimStack). It also provides access to animation stack information (KFbxTakeInfo).

A document carries information in its KFbxDocumentInfo.

Documents manage peripherals to load and unload objects (see class KFbxPeripheral), as well as references to other objects or documents.

Error management is also available.

Examples:

Common/Common.cxx, Common/Common.h, ExportDocument/main.cxx, MyOwnWriterReader/MyOwnReader.cxx, MyOwnWriterReader/MyOwnReader.h, MyOwnWriterReader/MyOwnWriter.cxx, MyOwnWriterReader/MyOwnWriter.h, UIExamples/CubeCreator/SDK_Utility.cxx, and UIExamples/CubeCreator/SDK_Utility.h.

Definition at line 71 of file kfbxdocument.h.

#include <kfbxdocument.h>

Inheritance diagram for KFbxDocument:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual KFbxObject Copy (const KFbxObject &pObject)
  Copy an object content into this object.
void  ConnectVideos ()

Protected Member Functions

  KFbxDocument (KFbxSdkManager &pManager, char const *pName)
virtual void  Construct (const KFbxDocument *pFrom)
virtual void  Destruct (bool pRecursive, bool pDependents)
bool  ConstructProperties (bool pForceSet)
virtual bool  ConnecNotify (KFbxConnectEvent const &pEvent)
virtual void  SetDocument (KFbxDocument *pDocument)
bool  FindTakeName (const KString &pTakeName)

Protected Attributes

KFbxSdkManager mSdkManager
KFbxPeripheral mPeripheral
KArrayTemplate< KFbxTakeInfo * >  mTakeInfoArray
KError  mError
KFbxDocumentInfo mDocumentInfo

Friends

class  KFbxLayerContainer
class  KFbxNodeFinderDuplicateName

Properties

KFbxTypedProperty< fbxReference * >  Roots

Document Member Manager

virtual void  Clear ()
  Remove document members and restore default settings.
void  AddRootMember (KFbxObject *pMember)
  Add a member object and connect it to Roots.
void  RootRootRemoveMember (KFbxObject *pMember)
  Remove a member object from the document.
template<class T >
T *  FindRootMember (T const *pfbxType, char *pName)
  Find a member object in the document, that has the given type and name.
int  GetRootMemberCount () const
  Return the number of objects in the document.
template<class T >
int  GetRootMemberCount (T const *pFBX_TYPE) const
  Return the number of objects of class T in the document.
int  GetRootMemberCount (KFbxCriteria pCriteria) const
  Return the number of objects of the document that satisfy the given criteria.
KFbxObject GetRootMember (int pIndex=0) const
  Return the member of the document at given index.
template<class T >
T *  GetRootMember (T const *pFBX_TYPE, int pIndex=0) const
  Return the member of class T of the document at given index.
KFbxObject GetRootMember (KFbxCriteria pCriteria, int pIndex=0) const
  Return the document member which satisfies given criteria, for given index.
virtual bool  IsRootMember (KFbxObject *pMember) const
  Is an object part of the document.

Document information

KFbxDocumentInfo GetDocumentInfo () const
  Get the document information.
void  SetDocumentInfo (KFbxDocumentInfo *pSceneInfo)
  Set the document information.

Offloading management

Documents manage peripherals to load and unload objects (see class KFbxPeripheral).A peripheral manipulates the content of an object. For instance, a peripheral can load the connections of an object on demand.The document does not own the peripheral therefore it will not attempt to delete it at destruction time. Cloning the document will share the pointer to the peripheral across the cloned objects. The assignment operator has a similar behavior.
void  SetPeripheral (KFbxPeripheral *pPeripheral)
  Set the current peripheral to be used to load or unload objects from this document.
virtual KFbxPeripheral GetPeripheral ()
  Retrieve the current peripheral of the document.
int  UnloadContent ()
  Unload all the unloadable objects contained in the document using the currently set peripheral.
int  LoadContent ()
  Load all the objects contained in the document with the data from the currently set peripheral.

Referencing management

int  GetReferencingDocuments (KArrayTemplate< KFbxDocument * > &pReferencingDocuments) const
  Fills an array of pointers to documents that reference objects in this document.
int  GetReferencingObjects (KFbxDocument const *pFromDoc, KArrayTemplate< KFbxObject * > &pReferencingObjects) const
  Fills an array of pointers to objects in a given document (pFromDoc) that reference objects in this document.
int  GetReferencedDocuments (KArrayTemplate< KFbxDocument * > &pReferencedDocuments) const
  Fills an array of pointers to documents that are referenced by objects in this document.
int  GetReferencedObjects (KFbxDocument const *pToDoc, KArrayTemplate< KFbxObject * > &pReferencedObjects) const
  Fills an array of pointers to objects in a given document (pToDoc) that are referenced by objects in this document.
KString  GetPathToRootDocument (void) const
  Gets the path string to the root document, if the current document is contained in another document.
void  GetDocumentPathToRootDocument (KArrayTemplate< KFbxDocument * > &pDocumentPath, bool pFirstCall=true) const
  Gets the document path to the root document as an array of documents, if the current document is contained in another document.
bool  IsARootDocument (void)
  Tells if this document is a root document.

Animation Stack Management

Remarks:
Animation stacks replaces the deprecated takes.

KFbxTypedProperty< fbxString ActiveAnimStackName
  Holds the name of the KFbxAnimStack that the application uses for animation in this document.
bool  CreateAnimStack (const char *pName)
  Adds a new animation stack object to this document.
bool  RemoveAnimStack (const char *pName)
  Destroy the animation stack object identified by pName from this document.
void  FillAnimStackNameArray (KArrayTemplate< KString * > &pNameArray)
  Fill a string array with all existing animation stack names.

Animation Stack Information Management

Remarks:
Although takes are deprecated, class KFbxTakeInfo is not deprecated and now contains animation stack information.

bool  SetTakeInfo (const KFbxTakeInfo &pTakeInfo)
  Set information about an animation stack.
KFbxTakeInfo GetTakeInfo (const KString &pTakeName) const
  Get information about an animation stack.

Error Management

The same error object is shared among instances of this class.
enum   EError {
  eTAKE_ERROR, eKFBX_OBJECT_IS_NULL, eKFBX_OBJECT_ALREADY_OWNED, eKFBX_OBJECT_UNKNOWN,
  eKFBX_MISSING_PERIPHERAL, eKFBX_OBJECT_PERIPHERAL_FAILURE, eERROR_COUNT
}
 

Error identifiers.

More...
KError GetError ()
  Retrieve error object for error inspection.
EError  GetLastErrorID () const
  Get last error code.
const char *  GetLastErrorString () const
  Get last error string.

Member Enumeration Documentation

enum EError

Error identifiers.

Most of these are only used internally.

Enumerator:
eTAKE_ERROR 

Could not create animation stack.

eKFBX_OBJECT_IS_NULL 

Null object.

eKFBX_OBJECT_ALREADY_OWNED 

Object is already owned by the document.

eKFBX_OBJECT_UNKNOWN 

Object does not belong to the document.

eKFBX_MISSING_PERIPHERAL 

Could not find offload peripheral associated to this document.

eKFBX_OBJECT_PERIPHERAL_FAILURE 

Peripheral failed to offload one or more objects.

eERROR_COUNT 

Number of errors.

Definition at line 327 of file kfbxdocument.h.


Constructor & Destructor Documentation

KFbxDocument ( KFbxSdkManager pManager,
char const *  pName 
) [protected]

Member Function Documentation

virtual void Clear ( ) [virtual]

Remove document members and restore default settings.

Reimplemented from KFbxCollection.

Reimplemented in KFbxScene.

void AddRootMember ( KFbxObject pMember ) [inline]

Add a member object and connect it to Roots.

Parameters:
pMember Object to add to the document.
Examples:
ExportDocument/main.cxx.

Definition at line 92 of file kfbxdocument.h.

{ AddMember(pMember); Roots.ConnectSrcObject(pMember); }
void RootRootRemoveMember ( KFbxObject pMember ) [inline]

Remove a member object from the document.

Parameters:
pMember Object to remove from the document.

Definition at line 96 of file kfbxdocument.h.

{ RemoveMember(pMember); Roots.DisconnectSrcObject(pMember); }
T* FindRootMember ( T const *  pfbxType,
char *  pName 
) [inline]

Find a member object in the document, that has the given type and name.

Parameters:
pfbxType Type information.
pName Member name.

Definition at line 101 of file kfbxdocument.h.

{ return Roots.FindSrcObject(pfbxType, pName); }
int GetRootMemberCount ( ) const [inline]

Return the number of objects in the document.

Examples:
ExportDocument/main.cxx.

Definition at line 104 of file kfbxdocument.h.

{ return Roots.GetSrcObjectCount(); }
int GetRootMemberCount ( T const *  pFBX_TYPE ) const [inline]

Return the number of objects of class T in the document.

Parameters:
pFBX_TYPE Type information.
Returns:
The number of objects of class T in the document.

Definition at line 109 of file kfbxdocument.h.

{ return Roots.GetSrcObjectCount(T::ClassId); }
int GetRootMemberCount ( KFbxCriteria  pCriteria ) const

Return the number of objects of the document that satisfy the given criteria.

Parameters:
pCriteria Criteria for selecting objects.
Returns:
The number of objects satisfying the given criteria.
KFbxObject* GetRootMember ( int  pIndex = 0 ) const [inline]

Return the member of the document at given index.

Parameters:
pIndex Selection index.

Definition at line 119 of file kfbxdocument.h.

{ return Roots.GetSrcObject(pIndex); }
T* GetRootMember ( T const *  pFBX_TYPE,
int  pIndex = 0 
) const [inline]

Return the member of class T of the document at given index.

Parameters:
pFBX_TYPE Type information.
pIndex Selection index.

Definition at line 124 of file kfbxdocument.h.

{ return (T *)Roots.GetSrcObject(T::ClassId,pIndex); }
KFbxObject* GetRootMember ( KFbxCriteria  pCriteria,
int  pIndex = 0 
) const

Return the document member which satisfies given criteria, for given index.

Parameters:
pCriteria Criteria for selecting objects.
pIndex Selection index.
virtual bool IsRootMember ( KFbxObject pMember ) const [virtual]

Is an object part of the document.

Parameters:
pMember Queried object.
Returns:
true if pMember is an object part of the document, false otherwise.
KFbxDocumentInfo* GetDocumentInfo ( ) const

Get the document information.

Returns:
Pointer to the document information object.
void SetDocumentInfo ( KFbxDocumentInfo pSceneInfo )

Set the document information.

Parameters:
pSceneInfo Pointer to the document information object.
Examples:
ExportDocument/main.cxx.
void SetPeripheral ( KFbxPeripheral pPeripheral )

Set the current peripheral to be used to load or unload objects from this document.

Parameters:
pPeripheral The peripheral to be set.
virtual KFbxPeripheral* GetPeripheral ( ) [virtual]

Retrieve the current peripheral of the document.

Returns:
Current peripheral.

Reimplemented from KFbxObject.

int UnloadContent ( )

Unload all the unloadable objects contained in the document using the currently set peripheral.

Errors that occurred during the operation can be inspected using the GetError() method.

Returns:
The number of objects that the document has been able to unload.
int LoadContent ( )

Load all the objects contained in the document with the data from the currently set peripheral.

Errors that occurred during the operation can be inspected using the GetError() method.

Returns:
The number of loaded objects.
int GetReferencingDocuments ( KArrayTemplate< KFbxDocument * > &  pReferencingDocuments ) const

Fills an array of pointers to documents that reference objects in this document.

Parameters:
pReferencingDocuments Array of pointers to documents.
Returns:
Number of documents that reference objects in this document.
int GetReferencingObjects ( KFbxDocument const *  pFromDoc,
KArrayTemplate< KFbxObject * > &  pReferencingObjects 
) const

Fills an array of pointers to objects in a given document (pFromDoc) that reference objects in this document.

Parameters:
pFromDoc Pointer to the document containing referencing objects.
pReferencingObjects Array of pointers to referencing objects.
Returns:
Number of objects that reference objects in this document.
int GetReferencedDocuments ( KArrayTemplate< KFbxDocument * > &  pReferencedDocuments ) const

Fills an array of pointers to documents that are referenced by objects in this document.

Parameters:
pReferencedDocuments Array of pointers to documents.
Returns:
Number of documents that are referenced by objects in this document.
int GetReferencedObjects ( KFbxDocument const *  pToDoc,
KArrayTemplate< KFbxObject * > &  pReferencedObjects 
) const

Fills an array of pointers to objects in a given document (pToDoc) that are referenced by objects in this document.

Parameters:
pToDoc Pointer to the document containing referenced objects.
pReferencedObjects Array of pointers to referenced objects.
Returns:
Number of objects that are referenced by objects in this document.
KString GetPathToRootDocument ( void  ) const

Gets the path string to the root document, if the current document is contained in another document.

Returns:
Path to the root document.
void GetDocumentPathToRootDocument ( KArrayTemplate< KFbxDocument * > &  pDocumentPath,
bool  pFirstCall = true 
) const

Gets the document path to the root document as an array of documents, if the current document is contained in another document.

Parameters:
pDocumentPath Array of KFbxDocument to store the document path.
pFirstCall Recursive flag: always use pFirstCall = true.
bool IsARootDocument ( void  ) [inline]

Tells if this document is a root document.

Returns:
false if the current document is contained in another document, true otherwise.

Definition at line 254 of file kfbxdocument.h.

{ return (NULL == GetDocument()); }
bool CreateAnimStack ( const char *  pName )

Adds a new animation stack object to this document.

In case of error, KFbxDocument::GetLastErrorID() will return eTAKE_ERROR.

Parameters:
pName Animation stack name.
Returns:
true if a new KFbxAnimStack has been successfully created, false if an error occurred or if the specified name defines a KFbxAnimStack that already exists in the document.
Examples:
ExportDocument/main.cxx.
bool RemoveAnimStack ( const char *  pName )

Destroy the animation stack object identified by pName from this document.

Parameters:
pName Name of the animation stack to be deleted.
Returns:
true if the KFbxAnimStack has been destroyed and false otherwise.
void FillAnimStackNameArray ( KArrayTemplate< KString * > &  pNameArray )

Fill a string array with all existing animation stack names.

The array of string is cleared before it is used

Parameters:
pNameArray An array of string objects.
Examples:
ViewScene/main.cxx.
bool SetTakeInfo ( const KFbxTakeInfo pTakeInfo )

Set information about an animation stack.

Parameters:
pTakeInfo Animation stack information. Field KFbxTakeInfo::mName specifies the targeted animation stack.
Returns:
true if animation stack is found with this name, and if information is set.
KFbxTakeInfo* GetTakeInfo ( const KString pTakeName ) const

Get information about an animation stack.

Parameters:
pTakeName Name of the targeted animation stack.
Returns:
Animation stack information, or NULL if animation stack isn't found or has no information set for this document.
Examples:
ViewScene/main.cxx.
KError& GetError ( )

Retrieve error object for error inspection.

Returns:
Reference to error object.
EError GetLastErrorID ( ) const

Get last error code.

Returns:
Last error code.
const char* GetLastErrorString ( ) const

Get last error string.

Returns:
Textual description of the last error.
virtual KFbxObject& Copy ( const KFbxObject pObject ) [virtual]

Copy an object content into this object.

Parameters:
pObject The source object to copy data from.
Returns:
Returns the destination object being modified by the source.
Remarks:
This function replace the assignment operator (operator=). It will copy all property values and the name. Connections are NOT copied.

Reimplemented from KFbxObject.

Reimplemented in KFbxScene.

virtual void Construct ( const KFbxDocument pFrom ) [protected, virtual]
virtual void Destruct ( bool  pRecursive,
bool  pDependents 
) [protected, virtual]

Reimplemented from KFbxObject.

Reimplemented in KFbxLibrary.

bool ConstructProperties ( bool  pForceSet ) [protected, virtual]
virtual bool ConnecNotify ( KFbxConnectEvent const &  pEvent ) [protected, virtual]
virtual void SetDocument ( KFbxDocument pDocument ) [protected, virtual]
void ConnectVideos ( )
bool FindTakeName ( const KString pTakeName ) [protected]

Friends And Related Function Documentation

friend class KFbxLayerContainer [friend]

Reimplemented in KFbxScene.

Definition at line 397 of file kfbxdocument.h.

friend class KFbxNodeFinderDuplicateName [friend]

Reimplemented in KFbxScene.

Definition at line 398 of file kfbxdocument.h.


Member Data Documentation

Definition at line 80 of file kfbxdocument.h.

Holds the name of the KFbxAnimStack that the application uses for animation in this document.

Examples:
ViewScene/main.cxx.

Definition at line 264 of file kfbxdocument.h.

Definition at line 389 of file kfbxdocument.h.

Definition at line 390 of file kfbxdocument.h.

Definition at line 391 of file kfbxdocument.h.

KError mError [protected]

Definition at line 392 of file kfbxdocument.h.

Definition at line 393 of file kfbxdocument.h.


The documentation for this class was generated from the following file:

KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument
KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument KFbxDocument