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

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

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

USDGEOM_API UsdGeomXformOp (const UsdAttribute &attr, bool isInverseOp=false)
 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. More...
 
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
 Returns the opName as it appears in the xformOpOrder attribute. More...
 
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)
 Test whether a given UsdAttribute represents valid XformOp, which implies that creating a UsdGeomXformOp from the attribute will succeed. More...
 
static USDGEOM_API bool IsXformOp (const TfToken &attrName)
 Test whether a given attrbute name represents a valid XformOp, which implies that creating a UsdGeomXformOp from the corresponding UsdAttribute will succeed. More...
 
static USDGEOM_API TfToken const & GetOpTypeToken (Type const opType)
 Returns the TfToken used to encode the given opType. More...
 
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)
 Returns the value typeName token that corresponds to the given combination of opType and precision. More...
 
static USDGEOM_API TfToken GetOpName (const Type opType, const TfToken &opSuffix=TfToken(), bool inverse=false)
 Returns the xformOp's name as it appears in xformOpOrder, given the opType, the (optional) suffix and whether it is an inverse operation. More...
 

Computing with Ops

template<typename T >
bool GetAs (T *value, UsdTimeCode time) const
 We allow ops to be encoded with varying degrees of precision, depending on the clients needs and constraints. More...
 
USDGEOM_API GfMatrix4d GetOpTransform (UsdTimeCode time) const
 Return the 4x4 matrix that applies the transformation encoded in this op at time. More...
 
bool MightBeTimeVarying () const
 Determine whether there is any possibility that this op's value may vary over time. More...
 
static USDGEOM_API GfMatrix4d GetOpTransform (Type const opType, VtValue const &opVal, bool isInverseOp=false)
 Return the 4x4 matrix that applies the transformation encoded by op opType and data value opVal. More...
 

UsdAttribute API

class UsdGeomXformable
 
 operator UsdAttribute const & () const
 Allow UsdGeomXformOp to auto-convert to UsdAttribute, so you can pass a UsdGeomXformOp to any function that accepts a UsdAttribute or const-ref thereto. More...
 
UsdAttribute const & GetAttr () const
 Explicit UsdAttribute extractor. More...
 
bool IsDefined () const
 Return true if the wrapped UsdAttribute::IsDefined(), and in addition the attribute is identified as a XformOp. More...
 
 operator bool () const
 
TfToken const & GetName () const
 
TfToken GetBaseName () const
 
TfToken GetNamespace () const
 
std::vector< std::string > SplitName () const
 
SdfValueTypeName GetTypeName () const
 
template<typename T >
bool Get (T *value, UsdTimeCode time=UsdTimeCode::Default()) const
 Get the attribute value of the XformOp at time. More...
 
template<typename T >
bool Set (T const &value, UsdTimeCode time=UsdTimeCode::Default()) const
 Set the attribute value of the XformOp at time. More...
 
bool GetTimeSamples (std::vector< double > *times) const
 Populates the list of time samples at which the associated attribute is authored. More...
 
bool GetTimeSamplesInInterval (const GfInterval &interval, std::vector< double > *times) const
 Populates the list of time samples within the given interval, at which the associated attribute is authored. More...
 
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

enum Precision

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.

enum Type

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

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

Member Function Documentation

bool 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 368 of file xformOp.h.

bool 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 266 of file xformOp.h.

UsdAttribute const& GetAttr ( ) const
inline

Explicit UsdAttribute extractor.

Definition at line 330 of file xformOp.h.

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

Definition at line 352 of file xformOp.h.

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

Definition at line 349 of file xformOp.h.

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

Definition at line 355 of file xformOp.h.

size_t GetNumTimeSamples ( ) const
inline

Returns the number of time samples authored for this xformOp.

Definition at line 407 of file xformOp.h.

static USDGEOM_API TfToken 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 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 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 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 GetOpType ( ) const
inline

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

Definition at line 221 of file xformOp.h.

static USDGEOM_API Type GetOpTypeEnum ( TfToken const &  opTypeToken)
static

Returns the Type enum associated with the given opTypeToken.

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

Returns the TfToken used to encode the given opType.

USDGEOM_API Precision GetPrecision ( ) const

Returns the precision level of the xform op.

static USDGEOM_API Precision GetPrecisionFromValueTypeName ( const SdfValueTypeName typeName)
static

Returns the precision corresponding to the given value typeName.

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

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

Definition at line 394 of file xformOp.h.

bool 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 400 of file xformOp.h.

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

Definition at line 361 of file xformOp.h.

static USDGEOM_API const SdfValueTypeName& 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 HasSuffix ( TfToken const &  suffix) const

Does this op have the given suffix in its name.

bool IsDefined ( ) const
inline

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

Definition at line 336 of file xformOp.h.

bool IsInverseOp ( ) const
inline

Returns whether the xformOp represents an inverse operation.

Definition at line 230 of file xformOp.h.

static USDGEOM_API bool 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 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 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 316 of file xformOp.h.

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 344 of file xformOp.h.

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 327 of file xformOp.h.

bool 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 379 of file xformOp.h.

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

Definition at line 358 of file xformOp.h.


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