HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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)
 
typedef GU_LinearSkinDeformerSource DeformerSource
 

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. 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 DeformerSourcegetDeformerSource (const GU_ConstDetailHandle &gdh) const
 
bool isEmpty () const
 
exint entries () const
 
const UT_StringHoldername () const
 
void setName (const UT_StringHolder &name)
 
const char * label () const
 
void setLabel (const char *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 ()
 Default constructor: Sets counter to 0. More...
 
SYS_FORCE_INLINE UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &)
 Copy constructor: Sets counter to 0. More...
 
UT_IntrusiveRefCounteroperator= (const UT_IntrusiveRefCounter &)
 Assignment operator: Does not modify counter. More...
 
SYS_FORCE_INLINE uint32 use_count () const
 Return current counter. More...
 

Static Public Member Functions

static GU_AgentShapeLibPtr addLibrary (const char *name)
 Create a new library using the given name. More...
 
static GU_AgentShapeLibPtr addLibraryFromFile (const char *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.

Definition at line 44 of file GU_AgentShapeLib.h.

Member Typedef Documentation

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

Definition at line 53 of file GU_AgentShapeLib.h.

Constructor & Destructor Documentation

GU_AgentShapeLib::~GU_AgentShapeLib ( )

Member Function Documentation

static GU_AgentShapeLibPtr GU_AgentShapeLib::addLibrary ( const char *  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 char *  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.

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 119 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 ( void  ) const
inline

Query information

Definition at line 114 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 DeformerSource& GU_AgentShapeLib::getDeformerSource ( const GU_ConstDetailHandle gdh) const
inline

Get a GU_LinearSkinDeformerSource given the detail handle for this shape.

Precondition
gdh.isValid()

Definition at line 232 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 112 of file GU_AgentShapeLib.h.

bool GU_AgentShapeLib::isFile ( ) const
inline

Return whether the library was loaded from disk.

Definition at line 132 of file GU_AgentShapeLib.h.

const char* 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.

const UT_StringHolder& GU_AgentShapeLib::name ( void  ) const
inline

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

Definition at line 126 of file GU_AgentShapeLib.h.

GA_Offset GU_AgentShapeLib::offset ( ) const
inline

Definition at line 219 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 char *  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 127 of file GU_AgentShapeLib.h.

void GU_AgentShapeLib::setOffset ( GA_Offset  offset)
inline

Definition at line 220 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 221 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: