HDK
|
#include <GU_AgentLayer.h>
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< ShapeBinding > | ShapeArray |
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 NameType & | uniqueName () 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_AgentRig & | rig () const |
Return the rig associated with the layer. More... | |
GU_ConstDetailHandle | detail () const |
Return the underlying geometry. More... | |
const GU_AgentShapeLib & | shapeLib () 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 ShapeBinding & | shape (exint i) const |
Get binding information for the given shape. More... | |
const ShapeBinding & | boundShape (exint transform, exint i) const |
const UT_IntArray & | getStatic () const |
const UT_IntArray & | getDeforming () 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 NameType & | name () 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_IntrusiveRefCounter & | operator= (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 |
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... | |
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:
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.
Definition at line 144 of file GU_AgentLayer.h.
Definition at line 48 of file GU_AgentLayer.h.
Definition at line 143 of file GU_AgentLayer.h.
Definition at line 49 of file GU_AgentLayer.h.
GU_AgentLayer::~GU_AgentLayer | ( | ) |
|
static |
|
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 |
|
inline |
Iterators
Definition at line 338 of file GU_AgentLayer.h.
|
inline |
Get binding information for the ith shape bound to the given transform.
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.
|
inline |
Shape count
Definition at line 242 of file GU_AgentLayer.h.
|
inline |
Return the underlying geometry.
Definition at line 231 of file GU_AgentLayer.h.
|
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.
|
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 |
Return the deformer with the given name, or nullptr.
|
static |
Returns the blendshape deformer that is composed with the specified skinning method.
|
static |
Returns the blendshape deformer (no skinning is performed).
|
inline |
Return the indices of the deforming shapes in the layer.
Definition at line 279 of file GU_AgentLayer.h.
|
inlinestatic |
Convenience method to return the blended dual quaternion skinning deformer.
Definition at line 379 of file GU_AgentLayer.h.
|
inlinestatic |
Convenience method to return the dual quaternion skinning deformer.
Definition at line 371 of file GU_AgentLayer.h.
|
static |
Return the deformer for the specified skinning method. Defaults to normal linear skinning.
int64 GU_AgentLayer::getMemoryUsage | ( | bool | inclusive | ) | const |
|
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.
|
inline |
Return the indices of the static shapes in the layer.
Definition at line 275 of file GU_AgentLayer.h.
|
static |
Called by GU_Agent during startup to register default deformers and load any custom deformers.
|
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 |
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.
|
inline |
Name accessor
Definition at line 218 of file GU_AgentLayer.h.
Return the number of shapes bound to a specific transform.
Definition at line 247 of file GU_AgentLayer.h.
|
static |
Register a new shape deformer.
|
static |
Return a list of the registered deformers.
|
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 |
Name accessor
Definition at line 219 of file GU_AgentLayer.h.
|
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.
|
inline |
Get the geometry for the given shape index.
Definition at line 284 of file GU_AgentLayer.h.
|
inline |
Return the shape library for the layer.
Definition at line 234 of file GU_AgentLayer.h.
|
inline |
Shape count
Definition at line 240 of file GU_AgentLayer.h.
|
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.
|
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.