Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions

FbxCloneManager Class Reference

Search for all occurrences

Detailed Description

The clone manager is a utility for cloning entire networks of FbxObject.

Options are available for specifying how the clones inherit the connections of the original.

Networks of FbxObject (inter-connected objects by OO, OP, PO or PP connections) can be cloned. How the connections of clones are handled depends on mSrcPolicy and mExternalDstPolicy.

To clone FbxObject instances and their dependents, put them into a CloneSet and pass the CloneSet to this class:

 FbxCloneManager                  cloneManager;
 FbxCloneManager::CloneSet        cloneSet;
 FbxCloneManager::CloneSetElement defaultCloneOptions(FbxCloneManager::sConnectToClone,
                                       FbxCloneManager::sConnectToOriginal, FbxObject::eDeepClone);
 cloneSet.Insert(someObject, defaultCloneOptions);
 cloneManager.AddDependents(cloneSet, someObject, defaultCloneOptions);
 cloneManager.Clone(cloneSet, scene)
See also:
FbxCloneManager::CloneSetElement
FbxCloneManager::CloneSet

Definition at line 46 of file fbxclonemanager.h.

#include <fbxclonemanager.h>

List of all members.

Classes

struct  CloneSetElement
 This represents an element in FbxCloneManager::CloneSet to be cloned. More...
class  ObjectCompare
 Functor to compare object pointers. More...

Public Types

typedef FbxMap< FbxObject
*, CloneSetElement,
ObjectCompare
CloneSet
 The CloneSet is a collection of pointers to objects that will be cloned in Clone() Attached to each object is a CloneSetElement.

Public Member Functions

 FbxCloneManager ()
 Constructor.
virtual ~FbxCloneManager ()
 Destructor.
virtual bool Clone (CloneSet &pSet, FbxObject *pContainer=NULL) const
 Clone all objects in the set using the given policies for duplication of connections.
virtual void AddDependents (CloneSet &pSet, const FbxObject *pObject, const CloneSetElement &pCloneOptions=CloneSetElement(), FbxCriteria pTypes=FbxCriteria::ObjectType(FbxObject::ClassId), int pDepth=sMaximumCloneDepth) const
 Add all dependents of the given object to the CloneSet.

Static Public Member Functions

static FbxObjectClone (const FbxObject *pObject, FbxObject *pContainer=NULL)
 This function simplifies the process of cloning one object and all its depedency graph by automatically preparing the CloneSet and calling the Clone method using the code below:

Static Public Attributes

static const int sMaximumCloneDepth
 Maximum depth to clone dependents.
static const int sConnectToOriginal
 Connect to objects that are connected to original object.
static const int sConnectToClone
 Connect to clones of objects that are connected to original object.

Protected Member Functions

bool CloneConnections (CloneSet::RecordType *pIterator, const CloneSet &pSet) const

Member Typedef Documentation

The CloneSet is a collection of pointers to objects that will be cloned in Clone() Attached to each object is a CloneSetElement.

Its member variables dictate how the corresponding object will be cloned, and how it will inherit connections on the original object.

Definition at line 124 of file fbxclonemanager.h.


Constructor & Destructor Documentation

Constructor.

virtual ~FbxCloneManager ( ) [virtual]

Destructor.


Member Function Documentation

static FbxObject* Clone ( const FbxObject pObject,
FbxObject pContainer = NULL 
) [static]

This function simplifies the process of cloning one object and all its depedency graph by automatically preparing the CloneSet and calling the Clone method using the code below:

 FbxCloneManager                  cloneManager;
 FbxCloneManager::CloneSet        cloneSet;
 FbxCloneManager::CloneSetElement defaultCloneOptions(FbxCloneManager::sConnectToClone,
                                                      0, 
                                                      FbxObject::eDeepClone);
 cloneSet.Insert(pObject, defaultCloneOptions);
 cloneManager.AddDependents(cloneSet, pObject, defaultCloneOptions);
 cloneManager.Clone(cloneSet, pContainer)
Parameters:
pObjectObject to clone.
pContainerThis object (typically a scene or document) will contain the new clones.
Returns:
The clone of pObject if all its depedency graph have been cloned successfully, NULL otherwise.
Remarks:
pContainer should not be an FbxNode used to group the cloned dependency graph. All the cloned objects of the graph will also connect to pContainer so all the node attributes will be interpreted as instances since they will connect to, at least, two FbxNodes. Also, if is left NULL the cloned object should be manually connected to the scene if it is to be saved to disk.

For example:

     FbxNode* lN = FbxNode::Create(lScene, "Clone");
     if (lN)
     {
         lN->LclTranslation.Set(FbxDouble3(50,0,0));
         lScene->GetRootNode()->AddChild(lN);

         FbxObject* cn = NULL;
         FbxObject* n = lScene->FindSrcObject("Mesh");
         if (n) cn = FbxCloneManager::Clone(n, lN);
     }

will generate the following (unexpected) dependency graph:

             "Clone" (FbxNode) 
                /   \               
               /      \
    "Mesh" (FbxNode) -- mesh (FbxNodeAttribute)

To generate the (expected) graph:

             "Clone" (FbxNode) 
                |
             "Mesh" (FbxNode) 
                |
              mesh (FbxNodeAttribute)

The correct code to use is:

     FbxNode* lN = FbxNode::Create(lScene, "Clone");
     if (lN)
     {
         lN->LclTranslation.Set(FbxDouble3(50,0,0));
         lScene->GetRootNode()->AddChild(lN);

         FbxObject* cn = NULL;
         FbxObject* n = lScene->FindSrcObject("Mesh");
         if (n) cn = FbxCloneManager::Clone(n);
         if (cn) lN->AddChild((FbxNode*)cn);
     }
virtual bool Clone ( CloneSet pSet,
FbxObject pContainer = NULL 
) const [virtual]

Clone all objects in the set using the given policies for duplication of connections.

Each CloneSetElement in the set will have its mObjectClone pointer set to the newly created clone.

Parameters:
pSetSet of objects to clone
pContainerThis object (typically a scene or document) will contain the new clones
Returns:
true if all objects were cloned, false otherwise.
virtual void AddDependents ( CloneSet pSet,
const FbxObject pObject,
const CloneSetElement pCloneOptions = CloneSetElement(),
FbxCriteria  pTypes = FbxCriteria::ObjectType(FbxObject::ClassId),
int  pDepth = sMaximumCloneDepth 
) const [virtual]

Add all dependents of the given object to the CloneSet.

Dependents of items already in the set are ignored to prevent infinite recursion on cyclic dependencies.

Parameters:
pSetThe set to add items.
pObjectObject to add dependents to
pCloneOptions
pTypesTypes of dependent objects to consider
pDepthMaximum recursive depth. Valid range is [0,sMaximumCloneDepth]
bool CloneConnections ( CloneSet::RecordType pIterator,
const CloneSet pSet 
) const [protected]

Member Data Documentation

const int sMaximumCloneDepth [static]

Maximum depth to clone dependents.

Definition at line 51 of file fbxclonemanager.h.

const int sConnectToOriginal [static]

Connect to objects that are connected to original object.

This is a flag to mSrcPolicy or mExternalDstPolicy.

Definition at line 56 of file fbxclonemanager.h.

const int sConnectToClone [static]

Connect to clones of objects that are connected to original object.

(only if those original objects are also in the clone set) This is a flag to mSrcPolicy.

Definition at line 62 of file fbxclonemanager.h.


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

FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager
FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager FbxCloneManager