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

#include <constraintTarget.h>

Public Member Functions

 UsdGeomConstraintTarget ()
 
USDGEOM_API UsdGeomConstraintTarget (const UsdAttribute &attr)
 

Static Public Member Functions

static USDGEOM_API bool IsValid (const UsdAttribute &attr)
 

UsdAttribute API

 operator UsdAttribute const & () const
 
UsdAttribute const & GetAttr () const
 Explicit UsdAttribute extractor. More...
 
bool IsDefined () const
 
 operator bool () const
 
USDGEOM_API bool Get (GfMatrix4d *value, UsdTimeCode time=UsdTimeCode::Default()) const
 Get the attribute value of the ConstraintTarget at time. More...
 
USDGEOM_API bool Set (const GfMatrix4d &value, UsdTimeCode time=UsdTimeCode::Default()) const
 Set the attribute value of the ConstraintTarget at time. More...
 
USDGEOM_API TfToken GetIdentifier () const
 
USDGEOM_API void SetIdentifier (const TfToken &identifier)
 
USDGEOM_API GfMatrix4d ComputeInWorldSpace (UsdTimeCode time=UsdTimeCode::Default(), UsdGeomXformCache *xfCache=NULL) const
 
static USDGEOM_API TfToken GetConstraintAttrName (const std::string &constraintName)
 

Detailed Description

Schema wrapper for UsdAttribute for authoring and introspecting attributes that are constraint targets.

Constraint targets correspond roughly to what some DCC's call locators. They are coordinate frames, represented as (animated or static) GfMatrix4d values. We represent them as attributes in USD rather than transformable prims because generally we require no other coordinated information about a constraint target other than its name and its matrix value, and because attributes are more concise than prims.

Because consumer clients often care only about the identity and value of constraint targets and may be able to usefully consume them without caring about the actual geometry with which they may logically correspond, UsdGeom aggregates all constraint targets onto a model's root prim, assuming that an exporter will use property namespacing within the constraint target attribute's name to indicate a path to a prim within the model with which the constraint target may correspond.

To facilitate instancing, and also position-tweaking of baked assets, we stipulate that constraint target values always be recorded in model-relative transformation space. In other words, to get the world-space value of a constraint target, transform it by the local-to-world transformation of the prim on which it is recorded. ComputeInWorldSpace() will perform this calculation.

Todo:
Provide API for extracting prim or property path from a target's namespaced name.

Definition at line 69 of file constraintTarget.h.

Constructor & Destructor Documentation

UsdGeomConstraintTarget::UsdGeomConstraintTarget ( )
inline

Definition at line 75 of file constraintTarget.h.

USDGEOM_API UsdGeomConstraintTarget::UsdGeomConstraintTarget ( const UsdAttribute attr)
explicit

Speculative constructor that will produce a valid UsdGeomConstraintTarget when attr already represents an attribute that is a UsdGeomConstraintTarget, and produces an invalid UsdGeomConstraintTarget otherwise (i.e. UsdGeomConstraintTarget_explicit_bool will return false).

Calling UsdGeomConstraintTarget::IsValid(attr) will return the same truth value as the object returned by this constructor, but if you plan to subsequently use the ConstraintTarget anyways, just construct the object and bool-evaluate it before proceeding.

Member Function Documentation

USDGEOM_API GfMatrix4d UsdGeomConstraintTarget::ComputeInWorldSpace ( UsdTimeCode  time = UsdTimeCode::Default(),
UsdGeomXformCache xfCache = NULL 
) const

Computes the value of the constraint target in world space.

If a valid UsdGeomXformCache is provided in the argument xfCache, it is used to evaluate the CTM of the model to which the constraint target belongs.

To get the constraint value in model-space (or local space), simply use UsdGeomConstraintTarget::Get(), since the authored values must already be in model-space.

USDGEOM_API bool UsdGeomConstraintTarget::Get ( GfMatrix4d value,
UsdTimeCode  time = UsdTimeCode::Default() 
) const

Get the attribute value of the ConstraintTarget at time.

UsdAttribute const& UsdGeomConstraintTarget::GetAttr ( ) const
inline

Explicit UsdAttribute extractor.

Definition at line 111 of file constraintTarget.h.

static USDGEOM_API TfToken UsdGeomConstraintTarget::GetConstraintAttrName ( const std::string constraintName)
static

Returns the fully namespaced constraint attribute name, given the constraint name.

USDGEOM_API TfToken UsdGeomConstraintTarget::GetIdentifier ( ) const

Get the stored identifier unique to the enclosing model's namespace for this constraint target.

See Also
SetIdentifier()
bool UsdGeomConstraintTarget::IsDefined ( ) const
inline

Return true if the wrapped UsdAttribute::IsDefined(), and in addition the attribute is identified as a ConstraintTarget.

Definition at line 115 of file constraintTarget.h.

static USDGEOM_API bool UsdGeomConstraintTarget::IsValid ( const UsdAttribute attr)
static

Test whether a given UsdAttribute represents valid ConstraintTarget, which implies that creating a UsdGeomConstraintTarget from the attribute will succeed.

Success implies that attr.IsDefined() is true.

UsdGeomConstraintTarget::operator bool ( ) const
inlineexplicit

Explicit bool conversion operator. A ConstraintTarget object converts to true iff it is valid for querying and authoring values and metadata (which is identically equivalent to IsDefined()). It converts to false otherwise.

Definition at line 123 of file constraintTarget.h.

UsdGeomConstraintTarget::operator UsdAttribute const & ( ) const
inline

Allow UsdGeomConstraintTarget to auto-convert to UsdAttribute, so you can pass a UsdGeomConstraintTarget to any function that accepts a UsdAttribute or const-ref thereto.

Definition at line 108 of file constraintTarget.h.

USDGEOM_API bool UsdGeomConstraintTarget::Set ( const GfMatrix4d value,
UsdTimeCode  time = UsdTimeCode::Default() 
) const

Set the attribute value of the ConstraintTarget at time.

USDGEOM_API void UsdGeomConstraintTarget::SetIdentifier ( const TfToken identifier)

Explicitly sets the stored identifier to the given string. Clients are responsible for ensuring the uniqueness of this identifier within the enclosing model's namespace.


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