Loading...
Searching...
No Matches
UsdGeomConstraintTarget Class Reference

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

#include <constraintTarget.h>

Public Member Functions

USDGEOM_API UsdGeomConstraintTarget (const UsdAttribute &attr)
 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.
 

Static Public Member Functions

static USDGEOM_API bool IsValid (const UsdAttribute &attr)
 Test whether a given UsdAttribute represents valid ConstraintTarget, which implies that creating a UsdGeomConstraintTarget from the attribute will succeed.
 

UsdAttribute API

 operator UsdAttribute const & () const
 Allow UsdGeomConstraintTarget to auto-convert to UsdAttribute, so you can pass a UsdGeomConstraintTarget to any function that accepts a UsdAttribute or const-ref thereto.
 
UsdAttribute const & GetAttr () const
 Explicit UsdAttribute extractor.
 
bool IsDefined () const
 Return true if the wrapped UsdAttribute::IsDefined(), and in addition the attribute is identified as a ConstraintTarget.
 
 operator bool () const
 Explicit bool conversion operator.
 
USDGEOM_API bool Get (GfMatrix4d *value, UsdTimeCode time=UsdTimeCode::Default()) const
 Get the attribute value of the ConstraintTarget at time.
 
USDGEOM_API bool Set (const GfMatrix4d &value, UsdTimeCode time=UsdTimeCode::Default()) const
 Set the attribute value of the ConstraintTarget at time.
 
USDGEOM_API TfToken GetIdentifier () const
 Get the stored identifier unique to the enclosing model's namespace for this constraint target.
 
USDGEOM_API void SetIdentifier (const TfToken &identifier)
 Explicitly sets the stored identifier to the given string.
 
USDGEOM_API GfMatrix4d ComputeInWorldSpace (UsdTimeCode time=UsdTimeCode::Default(), UsdGeomXformCache *xfCache=NULL) const
 Computes the value of the constraint target in world space.
 
static USDGEOM_API TfToken GetConstraintAttrName (const std::string &constraintName)
 Returns the fully namespaced constraint attribute name, given the constraint name.
 

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.

Definition at line 69 of file constraintTarget.h.

Constructor & Destructor Documentation

◆ UsdGeomConstraintTarget() [1/2]

Definition at line 75 of file constraintTarget.h.

◆ UsdGeomConstraintTarget() [2/2]

USDGEOM_API 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

◆ ComputeInWorldSpace()

USDGEOM_API GfMatrix4d 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.

◆ Get()

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

Get the attribute value of the ConstraintTarget at time.

◆ GetAttr()

UsdAttribute const & GetAttr ( ) const
inline

Explicit UsdAttribute extractor.

Definition at line 111 of file constraintTarget.h.

◆ GetConstraintAttrName()

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

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

◆ GetIdentifier()

USDGEOM_API TfToken GetIdentifier ( ) const

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

See also
SetIdentifier()

◆ IsDefined()

bool 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.

◆ IsValid()

static USDGEOM_API bool 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.

◆ operator bool()

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.

◆ operator UsdAttribute const &()

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.

◆ Set()

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

Set the attribute value of the ConstraintTarget at time.

◆ SetIdentifier()

USDGEOM_API void 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: