The clone manager is a utility for cloning entire networks of KFbxObjects.
Options are available for specifying how the clones inherit the connections of the original.
Networks of KFbxObjects (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 KFbxObject instances and their dependents, put them into a CloneSet and pass the CloneSet to this class:
KFbxCloneManager cloneManager; KFbxCloneManager::CloneSet cloneSet; KFbxCloneManager::CloneSetElement defaultCloneOptions(KFbxCloneManager::sConnectToClone, KFbxCloneManager::sConnectToOriginal, KFbxObject::eDEEP_CLONE); cloneSet.Insert(someObject, defaultCloneOptions); cloneManager.AddDependents(cloneSet, someObject, defaultCloneOptions); cloneManager.Clone(cloneSet, scene)
Definition at line 51 of file kfbxclonemanager.h.
#include <kfbxclonemanager.h>
Classes |
|
struct | CloneSetElement |
This represents an element in
KFbxCloneManager::CloneSet to be cloned. More... |
|
class | KFbxObjectCompare |
Functor to compare object pointers. More... |
|
Public Types |
|
typedef
KMap< KFbxObject *, CloneSetElement, KFbxObjectCompare > |
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 |
|
KFbxCloneManager () | |
Constructor. |
|
virtual | ~KFbxCloneManager () |
Destructor. |
|
virtual bool | Clone (CloneSet &pSet, KFbxObject *pContainer=NULL) const |
Clone all objects in the set using the given
policies for duplication of connections. |
|
virtual void | AddDependents (CloneSet &pSet, const KFbxObject *pObject, const CloneSetElement &pCloneOptions=CloneSetElement(), KFbxCriteria pTypes=KFbxCriteria::ObjectType(KFbxObject::ClassId), int pDepth=sMaximumCloneDepth) const |
Add all dependents of the given object to
the CloneSet. |
|
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 |
typedef KMap<KFbxObject*,CloneSetElement,KFbxObjectCompare> CloneSet |
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 129 of file kfbxclonemanager.h.
KFbxCloneManager | ( | ) |
Constructor.
virtual ~KFbxCloneManager | ( | ) | [virtual] |
Destructor.
virtual bool Clone | ( | CloneSet & | pSet, |
KFbxObject * | 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.
pSet | Set of objects to clone |
pContainer | This object (typically a scene or document) will contain the new clones |
virtual void AddDependents | ( | CloneSet & | pSet, |
const KFbxObject * | pObject, | ||
const CloneSetElement & | pCloneOptions = CloneSetElement() , |
||
KFbxCriteria | pTypes =
KFbxCriteria::ObjectType(KFbxObject::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.
pSet | The set to add items. |
pObject | Object to add dependents to |
pCloneOptions | |
pTypes | Types of dependent objects to consider |
pDepth | Maximum recursive depth. Valid range is [0,sMaximumCloneDepth] |
bool CloneConnections | ( | CloneSet::RecordType * | pIterator, |
const CloneSet & | pSet | ||
) | const [protected] |
const int sMaximumCloneDepth
[static] |
Maximum depth to clone dependents.
Definition at line 56 of file kfbxclonemanager.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 61 of file kfbxclonemanager.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 67 of file kfbxclonemanager.h.