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

#include <GU_AgentLayer.h>

+ Inheritance diagram for GU_AgentLayer:

Classes

struct  LayerData
 Used to store the result of parsing a layer from a JSON file. More...
 
class  ShapeBinding
 
struct  ShapeBindingData
 Used to store the result of parsing a shape binding from a JSON file. More...
 

Public Types

typedef UT_StringHolder NameType
 
typedef GU_AgentShapeLib::ShapePtr ShapePtr
 
typedef UT_Array< ShapeBindingShapeArray
 
typedef ShapeArray::const_iterator const_iterator
 

Public Member Functions

 ~GU_AgentLayer ()
 
bool construct (const UT_StringArray &shape_names, const UT_Array< exint > &transforms, const UT_Array< GU_AgentShapeDeformerConstPtr > &deformers, const UT_Array< UT_Vector3F > &bounds_scales, UT_StringArray *errors=nullptr)
 
bool construct (const UT_StringArray &shape_names, const UT_IntArray &transforms, const UT_Array< GU_AgentShapeDeformerConstPtr > &deformers, const UT_FprealArray *bounds_scales=nullptr, UT_StringArray *errors=nullptr)
 
bool construct (const UT_StringArray &shape_names, const UT_IntArray &transforms, const UT_Array< bool > &deforming, const UT_FprealArray *bounds_scales=nullptr, UT_StringArray *errors=nullptr)
 
bool copyShapeBindings (const GU_AgentLayer &source)
 Add the shape bindings from another layer. More...
 
int64 getMemoryUsage (bool inclusive) const
 
const NameTypeuniqueName () const
 
bool isFile () const
 Return whether the layer was loaded from disk. More...
 
void clearIsFile ()
 Clear the flag marking that the layer references a file on disk. More...
 
const GU_AgentRigrig () const
 Return the rig associated with the layer. More...
 
GU_ConstDetailHandle detail () const
 Return the underlying geometry. More...
 
const GU_AgentShapeLibshapeLib () const
 Return the shape library for the layer. More...
 
exint numBoundShapes (exint xform_idx) const
 Return the number of shapes bound to a specific transform. More...
 
bool save (UT_JSONWriter &w) const
 
bool load (UT_JSONParser &p)
 Load the layer from a JSON file. More...
 
void clear ()
 Clear the layer. More...
 
const ShapeBindingshape (exint i) const
 Get binding information for the given shape. More...
 
const ShapeBindingboundShape (exint transform, exint i) const
 
const UT_IntArraygetStatic () const
 
const UT_IntArraygetDeforming () const
 
GU_ConstDetailHandle shapeGeometry (const ShapeBinding &shape_binding) const
 Get the geometry for the given shape binding. More...
 
GU_ConstDetailHandle shapeGeometry (exint i) const
 Get the geometry for the given shape index. More...
 
void updateShapes ()
 Update the shape bindings when the shape library gets modified. More...
 
void enlargeBounds (UT_BoundingBox &box, const GU_Agent &agent, const UT_Array< UT_Matrix4F > &xforms) const
 
bool expandVelocityRange (UT_Vector3 &vmin, UT_Vector3 &vmax) const
 Expand the given velocity range using the v attributes in the shapes. More...
 
bool unpackToDetail (GU_Detail &dest, const GU_PrimPacked *prim, const GU_Agent &agent, const GU_AgentRig &rig, const UT_Array< UT_Matrix4F > &xforms, STY_StylerGroup *prim_styler_group, const STY_Styler *parent_styler, const UT_Matrix4D *transform) const
 
const NameTypename () const
 
void setName (const NameType &name)
 
exint entries () const
 
exint staticEntries () const
 
exint deformingEntries () const
 
bool unpackShapeToDetail (GU_Detail &dest, const ShapeBinding &binding, const GU_Agent &agent, const GU_AgentRig &rig, const UT_Array< UT_Matrix4F > &xforms, bool apply_joint_xform=true) const
 
bool unpackShapeToDetail (GU_Detail &dest, exint shape_i, const GU_Agent &agent, const GU_AgentRig &rig, const UT_Array< UT_Matrix4F > &xforms) const
 
const_iterator begin () const
 
const_iterator end () const
 
- Public Member Functions inherited from UT_IntrusiveRefCounter< GU_AgentLayer >
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_AgentLayerPtr addLayer (const UT_StringHolder &unique_name, const GU_AgentRigConstPtr &rig, const GU_AgentShapeLibConstPtr &shapelib)
 
static GU_AgentLayerPtr addLayerFromFile (const UT_StringHolder &filename, const GU_AgentRigConstPtr &rig, const GU_AgentShapeLibConstPtr &shapelib, UT_StringArray &errors)
 
static GU_AgentLayerPtr addLayerCopy (const GU_AgentLayer &src, const GU_AgentRigConstPtr &rig, const GU_AgentShapeLibConstPtr &shapelib, bool copy_external_ref)
 
static void registerDeformer (const GU_AgentShapeDeformerConstPtr &deformer)
 Register a new shape deformer. More...
 
static
GU_AgentShapeDeformerConstPtr 
findDeformer (const UT_StringRef &name)
 Return the deformer with the given name, or nullptr. More...
 
static UT_Array
< GU_AgentShapeDeformerConstPtr
registeredDeformers ()
 Return a list of the registered deformers. More...
 
static void installDeformers ()
 
static
GU_AgentShapeDeformerConstPtr 
getLinearSkinDeformer (GU_AgentLinearSkinDeformer::Method method=GU_AgentLinearSkinDeformer::Method::Linear)
 
static
GU_AgentShapeDeformerConstPtr 
getBlendShapeDeformer ()
 Returns the blendshape deformer (no skinning is performed). More...
 
static
GU_AgentShapeDeformerConstPtr 
getBlendShapeAndSkinDeformer (GU_AgentLinearSkinDeformer::Method skinning_method=GU_AgentLinearSkinDeformer::Method::Linear)
 
static
GU_AgentShapeDeformerConstPtr 
getDualQuatSkinDeformer ()
 Convenience method to return the dual quaternion skinning deformer. More...
 
static
GU_AgentShapeDeformerConstPtr 
getDualQuatBlendSkinDeformer ()
 
static
GU_AgentShapeDeformerConstPtr 
getStandardDeformer (const UT_Optional< GU_AgentLinearSkinDeformer::Method > &skinning_method, bool has_blendshapes)
 
static bool load (UT_JSONParser &p, LayerData &data)
 
bool load (const LayerData &data, UT_StringArray &errors)
 

Additional Inherited Members

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

Detailed Description

A packed agent

The agent is composed of multiple named layers. Each layer consists of zero or more shapes.

All agents must have a default layer. This is the layer used when a specific layer isn't found. Example layers might be:

  • "default": The default layer
  • "low": Low resolution representation
  • "medium": Medium resolution
  • "high": High resolution
  • "collision": Used for collision detection

The packed agent conforms to the GU_PackedImpl API, but also provides access to the layers/shapes.

Definition at line 45 of file GU_AgentLayer.h.

Member Typedef Documentation

Definition at line 48 of file GU_AgentLayer.h.

Definition at line 143 of file GU_AgentLayer.h.

Constructor & Destructor Documentation

GU_AgentLayer::~GU_AgentLayer ( )

Member Function Documentation

static GU_AgentLayerPtr GU_AgentLayer::addLayer ( const UT_StringHolder unique_name,
const GU_AgentRigConstPtr rig,
const GU_AgentShapeLibConstPtr shapelib 
)
static
static GU_AgentLayerPtr GU_AgentLayer::addLayerCopy ( const GU_AgentLayer src,
const GU_AgentRigConstPtr rig,
const GU_AgentShapeLibConstPtr shapelib,
bool  copy_external_ref 
)
static

Create a clone of a layer, referencing the specified rig and shape library. 'copy_external_ref' should be disabled if the new layer will have its bindings changed.

static GU_AgentLayerPtr GU_AgentLayer::addLayerFromFile ( const UT_StringHolder filename,
const GU_AgentRigConstPtr rig,
const GU_AgentShapeLibConstPtr shapelib,
UT_StringArray errors 
)
static
const_iterator GU_AgentLayer::begin ( void  ) const
inline

Iterators

Definition at line 338 of file GU_AgentLayer.h.

const ShapeBinding& GU_AgentLayer::boundShape ( exint  transform,
exint  i 
) const
inline

Get binding information for the ith shape bound to the given transform.

See Also
numBoundShapes

Definition at line 270 of file GU_AgentLayer.h.

void GU_AgentLayer::clear ( )

Clear the layer.

void GU_AgentLayer::clearIsFile ( )

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

bool GU_AgentLayer::construct ( const UT_StringArray shape_names,
const UT_Array< exint > &  transforms,
const UT_Array< GU_AgentShapeDeformerConstPtr > &  deformers,
const UT_Array< UT_Vector3F > &  bounds_scales,
UT_StringArray errors = nullptr 
)

Add shape bindings to a layer.

  • shape_names: The shape name for each shape binding.
  • transforms: The transform index for each shape binding.
  • deformers: A GU_AgentShapeDeformer for each shape binding, or nullptr for static shapes.
  • bounds_scales: Scales for the bounding boxes.
bool GU_AgentLayer::construct ( const UT_StringArray shape_names,
const UT_IntArray transforms,
const UT_Array< GU_AgentShapeDeformerConstPtr > &  deformers,
const UT_FprealArray bounds_scales = nullptr,
UT_StringArray errors = nullptr 
)

Add shape bindings to a layer.

  • shape_names: The shape name for each shape binding.
  • transforms: The transform index for each shape binding.
  • deformers: A GU_AgentShapeDeformer for each shape binding, or nullptr for static shapes.
  • bounds_scales: Optional scale for the bounding boxes.
bool GU_AgentLayer::construct ( const UT_StringArray shape_names,
const UT_IntArray transforms,
const UT_Array< bool > &  deforming,
const UT_FprealArray bounds_scales = nullptr,
UT_StringArray errors = nullptr 
)

Add shape bindings to a layer.

  • shape_names: The shape name for each shape binding.
  • transforms: The transform index for each shape binding.
  • deforming: Whether each shape is static or deforming.
  • bounds_scales: Optional scale for the bounding boxes.
bool GU_AgentLayer::copyShapeBindings ( const GU_AgentLayer source)

Add the shape bindings from another layer.

exint GU_AgentLayer::deformingEntries ( ) const
inline

Shape count

Definition at line 242 of file GU_AgentLayer.h.

GU_ConstDetailHandle GU_AgentLayer::detail ( ) const
inline

Return the underlying geometry.

Definition at line 231 of file GU_AgentLayer.h.

const_iterator GU_AgentLayer::end ( void  ) const
inline

Iterators

Definition at line 339 of file GU_AgentLayer.h.

void GU_AgentLayer::enlargeBounds ( UT_BoundingBox box,
const GU_Agent agent,
const UT_Array< UT_Matrix4F > &  xforms 
) const

Enlarge bounding box based on the shapes inside along with the transform array.

exint GU_AgentLayer::entries ( ) const
inline

Shape count

Definition at line 238 of file GU_AgentLayer.h.

bool GU_AgentLayer::expandVelocityRange ( UT_Vector3 vmin,
UT_Vector3 vmax 
) const

Expand the given velocity range using the v attributes in the shapes.

static GU_AgentShapeDeformerConstPtr GU_AgentLayer::findDeformer ( const UT_StringRef name)
static

Return the deformer with the given name, or nullptr.

static GU_AgentShapeDeformerConstPtr GU_AgentLayer::getBlendShapeAndSkinDeformer ( GU_AgentLinearSkinDeformer::Method  skinning_method = GU_AgentLinearSkinDeformer::Method::Linear)
static

Returns the blendshape deformer that is composed with the specified skinning method.

Examples:
SOP/SOP_BouncyAgent.C.
static GU_AgentShapeDeformerConstPtr GU_AgentLayer::getBlendShapeDeformer ( )
static

Returns the blendshape deformer (no skinning is performed).

const UT_IntArray& GU_AgentLayer::getDeforming ( ) const
inline

Return the indices of the deforming shapes in the layer.

See Also
shape

Definition at line 279 of file GU_AgentLayer.h.

static GU_AgentShapeDeformerConstPtr GU_AgentLayer::getDualQuatBlendSkinDeformer ( )
inlinestatic

Convenience method to return the blended dual quaternion skinning deformer.

Definition at line 379 of file GU_AgentLayer.h.

static GU_AgentShapeDeformerConstPtr GU_AgentLayer::getDualQuatSkinDeformer ( )
inlinestatic

Convenience method to return the dual quaternion skinning deformer.

Definition at line 371 of file GU_AgentLayer.h.

Return the deformer for the specified skinning method. Defaults to normal linear skinning.

Examples:
SOP/SOP_BouncyAgent.C.
int64 GU_AgentLayer::getMemoryUsage ( bool  inclusive) const
static GU_AgentShapeDeformerConstPtr GU_AgentLayer::getStandardDeformer ( const UT_Optional< GU_AgentLinearSkinDeformer::Method > &  skinning_method,
bool  has_blendshapes 
)
static

Returns the appropriate built-in agent shape deformer based on the presence of akinning and/or blendshapes. Returns nullptr if skinning and blendshapes are both disabled.

const UT_IntArray& GU_AgentLayer::getStatic ( ) const
inline

Return the indices of the static shapes in the layer.

See Also
shape

Definition at line 275 of file GU_AgentLayer.h.

static void GU_AgentLayer::installDeformers ( )
static

Called by GU_Agent during startup to register default deformers and load any custom deformers.

bool GU_AgentLayer::isFile ( ) const
inline

Return whether the layer was loaded from disk.

Definition at line 223 of file GU_AgentLayer.h.

bool GU_AgentLayer::load ( UT_JSONParser p)

Load the layer from a JSON file.

static bool GU_AgentLayer::load ( UT_JSONParser p,
LayerData data 
)
static

Parse the JSON file into an intermediate format, which can be used to load the layer at a later time.

bool GU_AgentLayer::load ( const LayerData data,
UT_StringArray errors 
)

Parse the JSON file into an intermediate format, which can be used to load the layer at a later time.

const NameType& GU_AgentLayer::name ( ) const
inline

Name accessor

Definition at line 218 of file GU_AgentLayer.h.

exint GU_AgentLayer::numBoundShapes ( exint  xform_idx) const
inline

Return the number of shapes bound to a specific transform.

Definition at line 247 of file GU_AgentLayer.h.

static void GU_AgentLayer::registerDeformer ( const GU_AgentShapeDeformerConstPtr deformer)
static

Register a new shape deformer.

static UT_Array<GU_AgentShapeDeformerConstPtr> GU_AgentLayer::registeredDeformers ( )
static

Return a list of the registered deformers.

const GU_AgentRig& GU_AgentLayer::rig ( ) const
inline

Return the rig associated with the layer.

Definition at line 228 of file GU_AgentLayer.h.

bool GU_AgentLayer::save ( UT_JSONWriter w) const
void GU_AgentLayer::setName ( const NameType name)
inline

Name accessor

Definition at line 219 of file GU_AgentLayer.h.

const ShapeBinding& GU_AgentLayer::shape ( exint  i) const
inline

Get binding information for the given shape.

Definition at line 266 of file GU_AgentLayer.h.

GU_ConstDetailHandle GU_AgentLayer::shapeGeometry ( const ShapeBinding shape_binding) const

Get the geometry for the given shape binding.

GU_ConstDetailHandle GU_AgentLayer::shapeGeometry ( exint  i) const
inline

Get the geometry for the given shape index.

Definition at line 284 of file GU_AgentLayer.h.

const GU_AgentShapeLib& GU_AgentLayer::shapeLib ( ) const
inline

Return the shape library for the layer.

Definition at line 234 of file GU_AgentLayer.h.

exint GU_AgentLayer::staticEntries ( ) const
inline

Shape count

Definition at line 240 of file GU_AgentLayer.h.

const NameType& GU_AgentLayer::uniqueName ( ) const
inline

Return a unique name for the layer. This is the filename if the layer was loaded from disk.

Definition at line 214 of file GU_AgentLayer.h.

bool GU_AgentLayer::unpackShapeToDetail ( GU_Detail dest,
const ShapeBinding binding,
const GU_Agent agent,
const GU_AgentRig rig,
const UT_Array< UT_Matrix4F > &  xforms,
bool  apply_joint_xform = true 
) const

Unpack a specific shape into a detail. NOTE: This does not transform the geometry by the agent's xform. The apply_joint_xform flag controls whether the transform from the shape binding's joint is applied.

bool GU_AgentLayer::unpackShapeToDetail ( GU_Detail dest,
exint  shape_i,
const GU_Agent agent,
const GU_AgentRig rig,
const UT_Array< UT_Matrix4F > &  xforms 
) const
inline

Unpack a specific shape into a detail. NOTE: This does not transform the geometry by the agent's xform. The apply_joint_xform flag controls whether the transform from the shape binding's joint is applied.

Definition at line 323 of file GU_AgentLayer.h.

bool GU_AgentLayer::unpackToDetail ( GU_Detail dest,
const GU_PrimPacked prim,
const GU_Agent agent,
const GU_AgentRig rig,
const UT_Array< UT_Matrix4F > &  xforms,
STY_StylerGroup prim_styler_group,
const STY_Styler parent_styler,
const UT_Matrix4D transform 
) const

Unpack geometry into a detail NOTE: This transforms the unpacked geometry by the agent's xform.

void GU_AgentLayer::updateShapes ( )

Update the shape bindings when the shape library gets modified.


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