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

#include <GU_AgentShapeLib.h>

+ Inheritance diagram for GU_AgentShapeLib:

Public Types

typedef UT_IntrusivePtr< const
Shape
ShapePtr
 
typedef UT_StringMap< ShapePtrShapeMap
 
typedef ShapeMap::const_iterator const_iterator
 
typedef ShapeMap::iterator iterator
 
typedef void(* ShapeRemovedCallback )(void *data, int shape_id)
 

Public Member Functions

 ~GU_AgentShapeLib ()
 
int64 getMemoryUsage (bool inclusive) const
 
bool save (UT_JSONWriter &w) const
 Save the shape library. More...
 
bool load (UT_JSONParser &p)
 Load a shape library from disk or a stream. More...
 
bool load (GU_DetailHandle gdh, UT_StringArray &errors)
 Load a shape library from the provided geometry. More...
 
bool addShape (const UT_StringHolder &key, const GU_ConstDetailHandle &gdp, bool replace_existing=true)
 Add entire geometry as a shape in the library. More...
 
bool addShape (const UT_StringHolder &key, const char *filename, bool replace_existing=true)
 Add a disk file as a shape. More...
 
bool removeShape (const UT_StringRef &key)
 Remove a shape from the library. More...
 
GU_ConstDetailHandle detail () const
 Get a reference to the underlying geometry (which holds all the shapes) More...
 
ShapePtr findShape (const UT_StringRef &key) const
 Find a shape. More...
 
bool isFile () const
 Return whether the library was loaded from disk. More...
 
void clearIsFile ()
 Clear the flag marking that the library references a file on disk. More...
 
void dump (std::ostream &os, const char *save_file=0) const
 
void getDanglingShapes (UT_SortedStringSet &names) const
 
 Shape (GA_Offset offset)
 
 Shape (const Shape &shape)
 
int64 getMemoryUsage (bool inclusive) const
 
GA_Offset offset () const
 
void setOffset (GA_Offset offset)
 
int uniqueId () const
 
GU_ConstDetailHandle shapeGeometry (const GU_AgentShapeLib &lib) const
 Given its owner shape library, return the geometry for this shape. More...
 
const
GU_LinearSkinDeformerSourceWeights
getLinearSkinDeformerSourceWeights (const GU_ConstDetailHandle &gdh) const
 
const
GU_LinearSkinDeformerSourceWeights
getLinearSkinDeformerSourceWeights (const GU_AgentShapeLib &shapelib) const
 
bool isEmpty () const
 
exint entries () const
 
const UT_StringHoldername () const
 
void setName (const UT_StringHolder &name)
 
const UT_StringHolderlabel () const
 
void setLabel (const UT_StringHolder &label)
 
const_iterator begin () const
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 
- Public Member Functions inherited from UT_IntrusiveRefCounter< GU_AgentShapeLib >
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 GU_AgentShapeLibPtr addLibrary (const UT_StringHolder &name)
 Create a new library using the given name. More...
 
static GU_AgentShapeLibPtr addLibraryFromFile (const UT_StringHolder &filename, UT_StringArray &errors)
 
static GU_AgentShapeLibPtr addLibraryCopy (const GU_AgentShapeLib &src, bool keep_external_ref)
 
static void registerShapeRemovedCallback (ShapeRemovedCallback cb, void *data=0)
 
static void unregisterShapeRemovedCallback (ShapeRemovedCallback cb, void *data=0)
 

Additional Inherited Members

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

Detailed Description

Library for Agent Shapes

An agent shape library stores multiple shapes. There are various ways to add shapes to the library (add a full piece of geometry, add geometry and a range of primitives, etc.).

Shapes are identified by "name" which must be unique within the library.

Examples:
SOP/SOP_BouncyAgent.C.

Definition at line 45 of file GU_AgentShapeLib.h.

Member Typedef Documentation

Definition at line 48 of file GU_AgentShapeLib.h.

typedef void(* GU_AgentShapeLib::ShapeRemovedCallback)(void *data, int shape_id)

Definition at line 54 of file GU_AgentShapeLib.h.

Constructor & Destructor Documentation

GU_AgentShapeLib::~GU_AgentShapeLib ( )

Member Function Documentation

static GU_AgentShapeLibPtr GU_AgentShapeLib::addLibrary ( const UT_StringHolder name)
static

Create a new library using the given name.

Examples:
SOP/SOP_BouncyAgent.C.
static GU_AgentShapeLibPtr GU_AgentShapeLib::addLibraryCopy ( const GU_AgentShapeLib src,
bool  keep_external_ref 
)
static

Create a clone of a library for modification. The clone will have isFile() return false. If keep_external_ref is true and the source library was a file reference, the source library will be marked as an included file of the new library. Otherwise, the new library will be standalone.

static GU_AgentShapeLibPtr GU_AgentShapeLib::addLibraryFromFile ( const UT_StringHolder filename,
UT_StringArray errors 
)
static

Load a new library from disk, named using the filename. Returns NULL if failed to load.

bool GU_AgentShapeLib::addShape ( const UT_StringHolder key,
const GU_ConstDetailHandle gdp,
bool  replace_existing = true 
)

Add entire geometry as a shape in the library.

Examples:
SOP/SOP_BouncyAgent.C.
bool GU_AgentShapeLib::addShape ( const UT_StringHolder key,
const char *  filename,
bool  replace_existing = true 
)

Add a disk file as a shape.

const_iterator GU_AgentShapeLib::begin ( ) const

Iterators

iterator GU_AgentShapeLib::begin ( )

Iterators

void GU_AgentShapeLib::clearIsFile ( )

Clear the flag marking that the library references a file on disk.

GU_ConstDetailHandle GU_AgentShapeLib::detail ( ) const
inline

Get a reference to the underlying geometry (which holds all the shapes)

Definition at line 123 of file GU_AgentShapeLib.h.

void GU_AgentShapeLib::dump ( std::ostream &  os,
const char *  save_file = 0 
) const

Dump the contents of this shape library for debugging purposes. If save_file is supplied, the shape library's geometry will be saved using that name.

const_iterator GU_AgentShapeLib::end ( ) const

Iterators

iterator GU_AgentShapeLib::end ( )

Iterators

exint GU_AgentShapeLib::entries ( ) const
inline

Query information

Definition at line 118 of file GU_AgentShapeLib.h.

ShapePtr GU_AgentShapeLib::findShape ( const UT_StringRef key) const

Find a shape.

void GU_AgentShapeLib::getDanglingShapes ( UT_SortedStringSet names) const

Get the names of each dangling shape in the shape library. A dangling shape is a shape that is only referenced by the shape library.

const GU_LinearSkinDeformerSourceWeights& GU_AgentShapeLib::getLinearSkinDeformerSourceWeights ( const GU_ConstDetailHandle gdh) const
inline

Get a GU_LinearSkinDeformerSourceWeights given the detail handle for this shape.

Precondition
gdh.isValid()

Definition at line 259 of file GU_AgentShapeLib.h.

const GU_LinearSkinDeformerSourceWeights& GU_AgentShapeLib::getLinearSkinDeformerSourceWeights ( const GU_AgentShapeLib shapelib) const
inline

Definition at line 265 of file GU_AgentShapeLib.h.

int64 GU_AgentShapeLib::getMemoryUsage ( bool  inclusive) const
int64 GU_AgentShapeLib::getMemoryUsage ( bool  inclusive) const
bool GU_AgentShapeLib::isEmpty ( ) const
inline

Query information

Definition at line 116 of file GU_AgentShapeLib.h.

bool GU_AgentShapeLib::isFile ( ) const
inline

Return whether the library was loaded from disk.

Definition at line 136 of file GU_AgentShapeLib.h.

const UT_StringHolder& GU_AgentShapeLib::label ( ) const

Set a user defined label for the library. This doesn't have to be unique across libraries.

bool GU_AgentShapeLib::load ( UT_JSONParser p)

Load a shape library from disk or a stream.

bool GU_AgentShapeLib::load ( GU_DetailHandle  gdh,
UT_StringArray errors 
)

Load a shape library from the provided geometry.

const UT_StringHolder& GU_AgentShapeLib::name ( ) const
inline

The name of the shape library (or filename, if loaded from disk).

Definition at line 130 of file GU_AgentShapeLib.h.

GA_Offset GU_AgentShapeLib::offset ( ) const
inline

Definition at line 248 of file GU_AgentShapeLib.h.

static void GU_AgentShapeLib::registerShapeRemovedCallback ( ShapeRemovedCallback  cb,
void data = 0 
)
static

Register a callback to be invoked when a shape is no longer referenced by any shape library.

bool GU_AgentShapeLib::removeShape ( const UT_StringRef key)

Remove a shape from the library.

bool GU_AgentShapeLib::save ( UT_JSONWriter w) const

Save the shape library.

void GU_AgentShapeLib::setLabel ( const UT_StringHolder label)

Set a user defined label for the library. This doesn't have to be unique across libraries.

void GU_AgentShapeLib::setName ( const UT_StringHolder name)
inline

The name of the shape library (or filename, if loaded from disk).

Definition at line 131 of file GU_AgentShapeLib.h.

void GU_AgentShapeLib::setOffset ( GA_Offset  offset)
inline

Definition at line 249 of file GU_AgentShapeLib.h.

GU_AgentShapeLib::Shape ( GA_Offset  offset)
GU_AgentShapeLib::Shape ( const Shape &  shape)
GU_ConstDetailHandle GU_AgentShapeLib::shapeGeometry ( const GU_AgentShapeLib lib) const

Given its owner shape library, return the geometry for this shape.

int GU_AgentShapeLib::uniqueId ( ) const
inline

Definition at line 250 of file GU_AgentShapeLib.h.

static void GU_AgentShapeLib::unregisterShapeRemovedCallback ( ShapeRemovedCallback  cb,
void data = 0 
)
static

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