HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_AgentDefinition Class Reference

#include <GU_AgentDefinition.h>

+ Inheritance diagram for GU_AgentDefinition:

Public Types

using CustomDataItemConstructor = UT_Function< GU_AgentCustomDataItemPtr(const GU_AgentDefinition &)>
 

Public Member Functions

 GU_AgentDefinition ()
 
 GU_AgentDefinition (const GU_AgentRigConstPtr &rig, const GU_AgentShapeLibConstPtr &shapelib)
 
 GU_AgentDefinition (const GU_AgentDefinition &src_defn, const GU_AgentShapeLibConstPtr &new_shapelib, const GU_AgentRigConstPtr &new_rig=nullptr)
 
int64 getMemoryUsage (bool inclusive) const
 
bool load (UT_JSONParser &p)
 
bool save (UT_JSONWriter &w) const
 
const GU_AgentRigConstPtrrig () const
 
const GU_AgentShapeLibConstPtrshapeLibrary () const
 
void addLayer (const GU_AgentLayerConstPtr &layer)
 
void removeLayer (const UT_StringRef &name)
 Remove a layer from the agent definition by name. More...
 
const UT_Array
< GU_AgentLayerConstPtr > & 
layers () const
 Return the list of layers. More...
 
const GU_AgentLayerlayer (const UT_StringRef &name) const
 Get a pointer to a specfic layer. This may be a NULL pointer. More...
 
exint layerIndex (const UT_StringRef &name) const
 Get the index of a layer, or -1 if it does not exist. More...
 
const GU_AgentLayerlayer (exint i) const
 Get a reference to the ith layer. More...
 
exint numLayers () const
 Return the layer count. More...
 
void sortLayersIfNeeded ()
 
void addClip (const GU_AgentClipConstPtr &clip)
 
void removeClip (const UT_StringRef &name)
 Remove a clip from the agent definition by name. More...
 
const UT_Array
< GU_AgentClipConstPtr > & 
clips () const
 Return the list of clips. More...
 
const GU_AgentClipclip (const UT_StringRef &name) const
 Get a pointer to a specfic clip. This may be a NULL pointer. More...
 
exint clipIndex (const UT_StringRef &name) const
 Get the index of a clip, or -1 if it does not exist. More...
 
const GU_AgentClipclip (exint i) const
 Get a reference to the ith clip. More...
 
exint numClips () const
 Return the clip count. More...
 
void sortClipsIfNeeded ()
 
void addTransformGroup (const GU_AgentTransformGroupConstPtr &group)
 
void removeTransformGroup (const UT_StringRef &name)
 Remove a transform group from the agent definition by name. More...
 
const UT_Array
< GU_AgentTransformGroupConstPtr > & 
transformGroups () const
 Return the list of groups. More...
 
const GU_AgentTransformGrouptransformGroup (const UT_StringRef &name) const
 Get a pointer to a specfic group. This may be a NULL pointer. More...
 
exint transformGroupIndex (const UT_StringRef &name) const
 Get the index of a transform group, or -1 if it does not exist. More...
 
const GU_AgentTransformGroupdefaultTransformGroup () const
 
const GU_AgentTransformGrouptransformGroup (exint i) const
 Get a reference to the ith group. More...
 
exint numTransformGroups () const
 Return the transform group count. More...
 
void sortTransformGroupsIfNeeded ()
 
const GU_AgentMetadataConstPtrmetadata () const
 Return the metadata dictionary. This may be a nullptr. More...
 
void setMetadata (const GU_AgentMetadataConstPtr &data)
 Replace the metadata dictionary. More...
 
void addCustomDataItem (const GU_AgentCustomDataItemConstPtr &data)
 
void removeCustomDataItem (const UT_StringRef &name)
 Remove a custom data item from the agent definition by name. More...
 
const UT_Array
< GU_AgentCustomDataItemConstPtr > & 
customDataItems () const
 Return the list of custom data items. More...
 
const GU_AgentCustomDataItemcustomDataItem (const UT_StringRef &name) const
 
const GU_AgentCustomDataItemcustomDataItem (exint i) const
 Get a reference to the ith custom data item. More...
 
exint numCustomDataItems () const
 Return the number of custom data items. More...
 
void sortCustomDataItemsIfNeeded ()
 
void sortItemsIfNeeded ()
 
- Public Member Functions inherited from UT_IntrusiveRefCounter< GU_AgentDefinition >
SYS_FORCE_INLINE UT_IntrusiveRefCounter () noexcept
 Default constructor: Sets counter to 0. More...
 
SYS_FORCE_INLINE UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &) noexcept
 Copy constructor: Sets counter to 0. More...
 
UT_IntrusiveRefCounteroperator= (const UT_IntrusiveRefCounter &) noexcept
 Assignment operator: Does not modify counter. More...
 
SYS_FORCE_INLINE uint32 use_count () const noexcept
 Return current counter. More...
 
SYS_FORCE_INLINE bool conditionalAddRef () noexcept
 

Static Public Member Functions

static void registerCustomDataItemType (const UT_StringHolder &dataitemtype, CustomDataItemConstructor constructor)
 Register a new custom data item type. More...
 
static void installCustomDataItemTypes ()
 Called by GU_Agent during startup to register custom data item types. More...
 

Additional Inherited Members

- Protected Member Functions inherited from UT_IntrusiveRefCounter< GU_AgentDefinition >
SYS_FORCE_INLINE ~UT_IntrusiveRefCounter ()
 Destructor: Only derived classes can destruct this. More...
 

Detailed Description

An agent definition contains a rig, a shape library, a set of available clips, a set of available layers, and a set of transform groups.

Examples:
SOP/SOP_BouncyAgent.C.

Definition at line 35 of file GU_AgentDefinition.h.

Member Typedef Documentation

Constructs a new instance of a GU_AgentCustomDataItem. The provided agent definition can be used if the data item requires references to the rig, shape library, etc.

Definition at line 188 of file GU_AgentDefinition.h.

Constructor & Destructor Documentation

GU_AgentDefinition::GU_AgentDefinition ( )
GU_AgentDefinition::GU_AgentDefinition ( const GU_AgentRigConstPtr rig,
const GU_AgentShapeLibConstPtr shapelib 
)
GU_AgentDefinition::GU_AgentDefinition ( const GU_AgentDefinition src_defn,
const GU_AgentShapeLibConstPtr new_shapelib,
const GU_AgentRigConstPtr new_rig = nullptr 
)

Create a copy of the given agent definition, but referencing a new version of the shape library and/or rig.

Member Function Documentation

void GU_AgentDefinition::addClip ( const GU_AgentClipConstPtr clip)

Add a clip to the agent definition. Replaces any pre-existing clip of the same name.

void GU_AgentDefinition::addCustomDataItem ( const GU_AgentCustomDataItemConstPtr data)

Add a custom data item to the agent definition. Replaces any pre-existing item of the same name.

void GU_AgentDefinition::addLayer ( const GU_AgentLayerConstPtr layer)

Add a layer to the agent definition. Replaces any pre-existing layer of the same name.

void GU_AgentDefinition::addTransformGroup ( const GU_AgentTransformGroupConstPtr group)

Add a transform group to the agent definition. Replaces any pre-existing group of the same name.

const GU_AgentClip * GU_AgentDefinition::clip ( const UT_StringRef name) const
inline

Get a pointer to a specfic clip. This may be a NULL pointer.

Definition at line 241 of file GU_AgentDefinition.h.

const GU_AgentClip& GU_AgentDefinition::clip ( exint  i) const
inline

Get a reference to the ith clip.

Definition at line 108 of file GU_AgentDefinition.h.

exint GU_AgentDefinition::clipIndex ( const UT_StringRef name) const
inline

Get the index of a clip, or -1 if it does not exist.

Definition at line 104 of file GU_AgentDefinition.h.

const UT_Array<GU_AgentClipConstPtr>& GU_AgentDefinition::clips ( ) const
inline

Return the list of clips.

Definition at line 98 of file GU_AgentDefinition.h.

const GU_AgentCustomDataItem * GU_AgentDefinition::customDataItem ( const UT_StringRef name) const
inline

Get a pointer to a specfic data item by name. This may be a NULL pointer.

Definition at line 255 of file GU_AgentDefinition.h.

const GU_AgentCustomDataItem& GU_AgentDefinition::customDataItem ( exint  i) const
inline

Get a reference to the ith custom data item.

Definition at line 174 of file GU_AgentDefinition.h.

const UT_Array<GU_AgentCustomDataItemConstPtr>& GU_AgentDefinition::customDataItems ( ) const
inline

Return the list of custom data items.

Definition at line 166 of file GU_AgentDefinition.h.

const GU_AgentTransformGroup& GU_AgentDefinition::defaultTransformGroup ( ) const
inline

Get the default transform group, which contains all transforms in the rig.

Definition at line 137 of file GU_AgentDefinition.h.

int64 GU_AgentDefinition::getMemoryUsage ( bool  inclusive) const
static void GU_AgentDefinition::installCustomDataItemTypes ( )
static

Called by GU_Agent during startup to register custom data item types.

const GU_AgentLayer * GU_AgentDefinition::layer ( const UT_StringRef name) const
inline

Get a pointer to a specfic layer. This may be a NULL pointer.

Definition at line 234 of file GU_AgentDefinition.h.

const GU_AgentLayer& GU_AgentDefinition::layer ( exint  i) const
inline

Get a reference to the ith layer.

Definition at line 81 of file GU_AgentDefinition.h.

exint GU_AgentDefinition::layerIndex ( const UT_StringRef name) const
inline

Get the index of a layer, or -1 if it does not exist.

Definition at line 77 of file GU_AgentDefinition.h.

const UT_Array<GU_AgentLayerConstPtr>& GU_AgentDefinition::layers ( ) const
inline

Return the list of layers.

Definition at line 71 of file GU_AgentDefinition.h.

bool GU_AgentDefinition::load ( UT_JSONParser p)

Loads the agent definition from JSON. Used when loading agent primitives from a geometry file.

const GU_AgentMetadataConstPtr& GU_AgentDefinition::metadata ( ) const
inline

Return the metadata dictionary. This may be a nullptr.

Definition at line 152 of file GU_AgentDefinition.h.

exint GU_AgentDefinition::numClips ( ) const
inline

Return the clip count.

Definition at line 111 of file GU_AgentDefinition.h.

exint GU_AgentDefinition::numCustomDataItems ( ) const
inline

Return the number of custom data items.

Definition at line 178 of file GU_AgentDefinition.h.

exint GU_AgentDefinition::numLayers ( ) const
inline

Return the layer count.

Definition at line 84 of file GU_AgentDefinition.h.

exint GU_AgentDefinition::numTransformGroups ( ) const
inline

Return the transform group count.

Definition at line 145 of file GU_AgentDefinition.h.

static void GU_AgentDefinition::registerCustomDataItemType ( const UT_StringHolder dataitemtype,
CustomDataItemConstructor  constructor 
)
static

Register a new custom data item type.

Examples:
SOP/SOP_BouncyAgent.C.
void GU_AgentDefinition::removeClip ( const UT_StringRef name)

Remove a clip from the agent definition by name.

void GU_AgentDefinition::removeCustomDataItem ( const UT_StringRef name)

Remove a custom data item from the agent definition by name.

void GU_AgentDefinition::removeLayer ( const UT_StringRef name)

Remove a layer from the agent definition by name.

void GU_AgentDefinition::removeTransformGroup ( const UT_StringRef name)

Remove a transform group from the agent definition by name.

const GU_AgentRigConstPtr& GU_AgentDefinition::rig ( ) const
inline

Definition at line 60 of file GU_AgentDefinition.h.

bool GU_AgentDefinition::save ( UT_JSONWriter w) const

Saves the agent definition to JSON. Used when saving agent primitives to a geometry file.

void GU_AgentDefinition::setMetadata ( const GU_AgentMetadataConstPtr data)
inline

Replace the metadata dictionary.

Definition at line 155 of file GU_AgentDefinition.h.

const GU_AgentShapeLibConstPtr& GU_AgentDefinition::shapeLibrary ( ) const
inline

Definition at line 61 of file GU_AgentDefinition.h.

void GU_AgentDefinition::sortClipsIfNeeded ( )

Sorts the clips by name, if any clips have been added or removed since the last sort.

void GU_AgentDefinition::sortCustomDataItemsIfNeeded ( )

Sorts the custom data items by name, if any items have been added or removed since the last sort.

void GU_AgentDefinition::sortItemsIfNeeded ( )

Sorts the clips, layers, transform groups, and custom data items by name, if any items have been added or removed since the last sort. This is equivalent to individually calling sortClipsIfNeeded() and similar methods.

void GU_AgentDefinition::sortLayersIfNeeded ( )

Sorts the layers by name, if any layers have been added or removed since the last sort.

void GU_AgentDefinition::sortTransformGroupsIfNeeded ( )

Sorts the transform groups by name, if any groups have been added or removed since the last sort.

const GU_AgentTransformGroup * GU_AgentDefinition::transformGroup ( const UT_StringRef name) const
inline

Get a pointer to a specfic group. This may be a NULL pointer.

Definition at line 248 of file GU_AgentDefinition.h.

const GU_AgentTransformGroup& GU_AgentDefinition::transformGroup ( exint  i) const
inline

Get a reference to the ith group.

Definition at line 141 of file GU_AgentDefinition.h.

exint GU_AgentDefinition::transformGroupIndex ( const UT_StringRef name) const
inline

Get the index of a transform group, or -1 if it does not exist.

Definition at line 132 of file GU_AgentDefinition.h.

const UT_Array<GU_AgentTransformGroupConstPtr>& GU_AgentDefinition::transformGroups ( ) const
inline

Return the list of groups.

Definition at line 125 of file GU_AgentDefinition.h.


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