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

#include <xformOp.h>

Public Types

enum  Type {
  TypeInvalid, TypeTranslate, TypeScale, TypeRotateX,
  TypeRotateY, TypeRotateZ, TypeRotateXYZ, TypeRotateXZY,
  TypeRotateYXZ, TypeRotateYZX, TypeRotateZXY, TypeRotateZYX,
  TypeOrient, TypeTransform
}
 Enumerates the set of all transformation operation types. More...
 
enum  Precision { PrecisionDouble, PrecisionFloat, PrecisionHalf }
 Precision with which the value of the tranformation operation is encoded. More...
 

Public Member Functions

 UsdGeomXformOp ()
 
USDGEOM_API UsdGeomXformOp (const UsdAttribute &attr, bool isInverseOp=false)
 
Data Encoding Queries
Type GetOpType () const
 Return the operation type of this op, one of UsdGeomXformOp::Type. More...
 
USDGEOM_API Precision GetPrecision () const
 Returns the precision level of the xform op. More...
 
bool IsInverseOp () const
 Returns whether the xformOp represents an inverse operation. More...
 
USDGEOM_API TfToken GetOpName () const
 
USDGEOM_API bool HasSuffix (TfToken const &suffix) const
 Does this op have the given suffix in its name. More...
 

Static Public Member Functions

Static Helper API
static USDGEOM_API bool IsXformOp (const UsdAttribute &attr)
 
static USDGEOM_API bool IsXformOp (const TfToken &attrName)
 
static USDGEOM_API TfToken constGetOpTypeToken (Type const opType)
 
static USDGEOM_API Type GetOpTypeEnum (TfToken const &opTypeToken)
 Returns the Type enum associated with the given opTypeToken. More...
 
static USDGEOM_API Precision GetPrecisionFromValueTypeName (const SdfValueTypeName &typeName)
 Returns the precision corresponding to the given value typeName. More...
 
static USDGEOM_API const
SdfValueTypeName
GetValueTypeName (const Type opType, const Precision precision)
 
static USDGEOM_API TfToken GetOpName (const Type opType, const TfToken &opSuffix=TfToken(), bool inverse=false)
 

Computing with Ops

template<typename T >
bool GetAs (T *value, UsdTimeCode time) const
 
USDGEOM_API GfMatrix4d GetOpTransform (UsdTimeCode time) const
 
bool MightBeTimeVarying () const
 
static USDGEOM_API GfMatrix4d GetOpTransform (Type const opType, VtValue const &opVal, bool isInverseOp=false)
 

UsdAttribute API

class UsdGeomXformable
 
bool operator== (const UsdGeomXformOp &lhs, const UsdGeomXformOp &rhs)
 
bool operator!= (const UsdGeomXformOp &lhs, const UsdGeomXformOp &rhs)
 
 operator UsdAttribute const & () const
 
UsdAttribute constGetAttr () const
 Explicit UsdAttribute extractor. More...
 
bool IsDefined () const
 
 operator bool () const
 
TfToken constGetName () const
 
TfToken GetBaseName () const
 
TfToken GetNamespace () const
 
std::vector< std::stringSplitName () const
 
SdfValueTypeName GetTypeName () const
 
template<typename T >
bool Get (T *value, UsdTimeCode time=UsdTimeCode::Default()) const
 
template<typename T >
bool Set (T const &value, UsdTimeCode time=UsdTimeCode::Default()) const
 
bool GetTimeSamples (std::vector< double > *times) const
 
bool GetTimeSamplesInInterval (const GfInterval &interval, std::vector< double > *times) const
 
size_t GetNumTimeSamples () const
 Returns the number of time samples authored for this xformOp. More...
 
USDGEOM_API UsdGeomXformOp (const UsdAttribute &attr, bool isInverseOp, _ValidAttributeTagType)
 
USDGEOM_API UsdGeomXformOp (UsdAttributeQuery &&query, bool isInverseOp, _ValidAttributeTagType)
 

Detailed Description

Schema wrapper for UsdAttribute for authoring and computing transformation operations, as consumed by UsdGeomXformable schema.

The semantics of an op are determined primarily by its name, which allows us to decode an op very efficiently. All ops are independent attributes, which must live in the "xformOp" property namespace. The op's primary name within the namespace must be one of UsdGeomXformOpTypes, which determines the type of transformation operation, and its secondary name (or suffix) within the namespace (which is not required to exist), can be any name that distinguishes it from other ops of the same type. Suffixes are generally imposed by higer level xform API schemas.

Note
On packing order of rotateABC triples
The order in which the axis rotations are recorded in a Vec3* for the six rotateABC Euler triples is always the same: vec[0] = X, vec[1] = Y, vec[2] = Z . The A, B, C in the op name dictate the order in which their corresponding elements are consumed by the rotation, not how they are laid out.

Definition at line 111 of file xformOp.h.

Member Enumeration Documentation

Precision with which the value of the tranformation operation is encoded.

Enumerator
PrecisionDouble 

Double precision.

PrecisionFloat 

Floating-point precision.

PrecisionHalf 

Half-float precision.

Definition at line 140 of file xformOp.h.

Enumerates the set of all transformation operation types.

Enumerator
TypeInvalid 

Represents an invalid xformOp.

TypeTranslate 

XYZ translation.

TypeScale 

XYZ scale.

TypeRotateX 

Rotation about the X-axis, in degrees.

TypeRotateY 

Rotation about the Y-axis, in degrees.

TypeRotateZ 

Rotation about the Z-axis, in degrees.

TypeRotateXYZ 

Set of 3 canonical Euler rotations in XYZ order

TypeRotateXZY 

Set of 3 canonical Euler rotations in XZY order

TypeRotateYXZ 

Set of 3 canonical Euler rotations in YXZ order

TypeRotateYZX 

Set of 3 canonical Euler rotations in YZX order

TypeRotateZXY 

Set of 3 canonical Euler rotations in ZXY order

TypeRotateZYX 

Set of 3 canonical Euler rotations in ZYX order

TypeOrient 

Arbitrary axis/angle rotation, expressed as a quaternion.

TypeTransform 

A 4x4 matrix transformation.

Definition at line 116 of file xformOp.h.

Constructor & Destructor Documentation

UsdGeomXformOp::UsdGeomXformOp ( )
inline

Definition at line 148 of file xformOp.h.

USDGEOM_API UsdGeomXformOp::UsdGeomXformOp ( const UsdAttribute attr,
bool  isInverseOp = false 
)
explicit

Speculative constructor that will produce a valid UsdGeomXformOp when attr already represents an attribute that is XformOp, and produces an invalid XformOp otherwise (i.e. explicit-bool conversion operator will return false).

Calling UsdGeomXformOp::IsXformOp(attr) will return the same truth value as this constructor, but if you plan to subsequently use the XformOp anyways, just use this constructor.

isInverseOp is set to true to indicate an inverse transformation op.

This constructor exists mainly for internal use. Clients should use AddXformOp API (or one of Add*Op convenience API) to create and retain a copy of an UsdGeomXformOp object.

USDGEOM_API UsdGeomXformOp::UsdGeomXformOp ( const UsdAttribute attr,
bool  isInverseOp,
_ValidAttributeTagType   
)

Equality comparison. Return true if lhs and rhs represent the same underlying UsdAttribute, false otherwise.

USDGEOM_API UsdGeomXformOp::UsdGeomXformOp ( UsdAttributeQuery &&  query,
bool  isInverseOp,
_ValidAttributeTagType   
)

Equality comparison. Return true if lhs and rhs represent the same underlying UsdAttribute, false otherwise.

Member Function Documentation

template<typename T >
bool UsdGeomXformOp::Get ( T value,
UsdTimeCode  time = UsdTimeCode::Default() 
) const
inline

Get the attribute value of the XformOp at time.

Note
For inverted ops, this returns the raw, uninverted value.

Definition at line 383 of file xformOp.h.

template<typename T >
bool UsdGeomXformOp::GetAs ( T value,
UsdTimeCode  time 
) const
inline

We allow ops to be encoded with varying degrees of precision, depending on the clients needs and constraints. GetAs() will attempt to convert the stored data to the requested datatype.

Note this accessor incurs some overhead beyond Get()'ing the value as a VtValue and dealing with the results yourself.

Returns
true if a value was successfully read and converted to the requested datatype (see VtValue::Cast()), false otherwise. A problem reading or failure to convert will cause an error to be emitted.
Note
the requested type T must be constructable by assignment

Definition at line 267 of file xformOp.h.

UsdAttribute const& UsdGeomXformOp::GetAttr ( ) const
inline

Explicit UsdAttribute extractor.

Definition at line 331 of file xformOp.h.

TfToken UsdGeomXformOp::GetBaseName ( ) const
inline
See Also
UsdAttribute::GetBaseName()

Definition at line 367 of file xformOp.h.

TfToken const& UsdGeomXformOp::GetName ( ) const
inline
See Also
UsdAttribute::GetName()

Definition at line 364 of file xformOp.h.

TfToken UsdGeomXformOp::GetNamespace ( ) const
inline
See Also
UsdAttribute::GetNamespace()

Definition at line 370 of file xformOp.h.

size_t UsdGeomXformOp::GetNumTimeSamples ( ) const
inline

Returns the number of time samples authored for this xformOp.

Definition at line 422 of file xformOp.h.

static USDGEOM_API TfToken UsdGeomXformOp::GetOpName ( const Type  opType,
const TfToken opSuffix = TfToken(),
bool  inverse = false 
)
static

Returns the xformOp's name as it appears in xformOpOrder, given the opType, the (optional) suffix and whether it is an inverse operation.

USDGEOM_API TfToken UsdGeomXformOp::GetOpName ( ) const

Returns the opName as it appears in the xformOpOrder attribute.

This will begin with "!invert!:xformOp:" if it is an inverse xform operation. If it is not an inverse xformOp, it will begin with 'xformOp:'.

This will be empty for an invalid xformOp.

static USDGEOM_API GfMatrix4d UsdGeomXformOp::GetOpTransform ( Type const  opType,
VtValue const opVal,
bool  isInverseOp = false 
)
static

Return the 4x4 matrix that applies the transformation encoded by op opType and data value opVal.

If isInverseOp is true, then the inverse of the tranformation represented by the op/value pair is returned.

An error will be issued if opType is not one of the values in the enum UsdGeomXformOp::Type or if opVal cannot be converted to a suitable input to opType

USDGEOM_API GfMatrix4d UsdGeomXformOp::GetOpTransform ( UsdTimeCode  time) const

Return the 4x4 matrix that applies the transformation encoded in this op at time.

Returns the identity matrix and issues a coding error if the op is invalid.

If the op is valid, but has no authored value, the identity matrix is returned and no error is issued.

Type UsdGeomXformOp::GetOpType ( ) const
inline

Return the operation type of this op, one of UsdGeomXformOp::Type.

Definition at line 222 of file xformOp.h.

static USDGEOM_API Type UsdGeomXformOp::GetOpTypeEnum ( TfToken const opTypeToken)
static

Returns the Type enum associated with the given opTypeToken.

static USDGEOM_API TfToken const& UsdGeomXformOp::GetOpTypeToken ( Type const  opType)
static

Returns the TfToken used to encode the given opType. Note that an empty TfToken is used to represent TypeInvalid

USDGEOM_API Precision UsdGeomXformOp::GetPrecision ( ) const

Returns the precision level of the xform op.

static USDGEOM_API Precision UsdGeomXformOp::GetPrecisionFromValueTypeName ( const SdfValueTypeName typeName)
static

Returns the precision corresponding to the given value typeName.

bool UsdGeomXformOp::GetTimeSamples ( std::vector< double > *  times) const
inline

Populates the list of time samples at which the associated attribute is authored.

Definition at line 409 of file xformOp.h.

bool UsdGeomXformOp::GetTimeSamplesInInterval ( const GfInterval interval,
std::vector< double > *  times 
) const
inline

Populates the list of time samples within the given interval, at which the associated attribute is authored.

Definition at line 415 of file xformOp.h.

SdfValueTypeName UsdGeomXformOp::GetTypeName ( ) const
inline
See Also
UsdAttribute::GetTypeName()

Definition at line 376 of file xformOp.h.

static USDGEOM_API const SdfValueTypeName& UsdGeomXformOp::GetValueTypeName ( const Type  opType,
const Precision  precision 
)
static

Returns the value typeName token that corresponds to the given combination of opType and precision.

USDGEOM_API bool UsdGeomXformOp::HasSuffix ( TfToken const suffix) const

Does this op have the given suffix in its name.

bool UsdGeomXformOp::IsDefined ( ) const
inline

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

Definition at line 337 of file xformOp.h.

bool UsdGeomXformOp::IsInverseOp ( ) const
inline

Returns whether the xformOp represents an inverse operation.

Definition at line 231 of file xformOp.h.

static USDGEOM_API bool UsdGeomXformOp::IsXformOp ( const UsdAttribute attr)
static

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

Success implies that attr.IsDefined() is true.

static USDGEOM_API bool UsdGeomXformOp::IsXformOp ( const TfToken attrName)
static

Test whether a given attrbute name represents a valid XformOp, which implies that creating a UsdGeomXformOp from the corresponding UsdAttribute will succeed.

bool UsdGeomXformOp::MightBeTimeVarying ( ) const
inline

Determine whether there is any possibility that this op's value may vary over time.

The determination is based on a snapshot of the authored state of the op, and may become invalid in the face of further authoring.

Definition at line 317 of file xformOp.h.

UsdGeomXformOp::operator bool ( ) const
inlineexplicit

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

Definition at line 345 of file xformOp.h.

UsdGeomXformOp::operator UsdAttribute const & ( ) const
inline

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

Definition at line 328 of file xformOp.h.

template<typename T >
bool UsdGeomXformOp::Set ( T const value,
UsdTimeCode  time = UsdTimeCode::Default() 
) const
inline

Set the attribute value of the XformOp at time

Note
This only works on non-inverse operations. If invoked on an inverse xform operation, a coding error is issued and no value is authored.

Definition at line 394 of file xformOp.h.

std::vector<std::string> UsdGeomXformOp::SplitName ( ) const
inline
See Also
UsdAttribute::SplitName()

Definition at line 373 of file xformOp.h.

Friends And Related Function Documentation

bool operator!= ( const UsdGeomXformOp lhs,
const UsdGeomXformOp rhs 
)
friend

Inequality comparison. Return false if lhs and rhs represent the same underlying UsdAttribute, true otherwise.

Definition at line 358 of file xformOp.h.

bool operator== ( const UsdGeomXformOp lhs,
const UsdGeomXformOp rhs 
)
friend

Equality comparison. Return true if lhs and rhs represent the same underlying UsdAttribute, false otherwise.

Definition at line 351 of file xformOp.h.

friend class UsdGeomXformable
friend

Equality comparison. Return true if lhs and rhs represent the same underlying UsdAttribute, false otherwise.

Definition at line 439 of file xformOp.h.


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