HDK
|
#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 const & | GetOpTypeToken (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 const & | GetAttr () const |
Explicit UsdAttribute extractor. More... | |
bool | IsDefined () const |
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 |
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) |
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.
enum UsdGeomXformOp::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. |
|
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.
|
inline |
|
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.
T
must be constructable by assignment
|
inline |
Explicit UsdAttribute extractor.
|
inline |
|
inline |
|
inline |
|
inline |
|
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 |
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.
|
inline |
Return the operation type of this op, one of UsdGeomXformOp::Type.
|
static |
Returns the Type enum associated with the given opTypeToken
.
|
static |
USDGEOM_API Precision UsdGeomXformOp::GetPrecision | ( | ) | const |
Returns the precision level of the xform op.
|
static |
Returns the precision corresponding to the given value typeName.
|
inline |
|
inline |
|
inline |
|
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.
|
inline |
Return true if the wrapped UsdAttribute::IsDefined(), and in addition the attribute is identified as a XformOp.
|
inline |
|
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 |
Test whether a given attrbute name represents a valid XformOp, which implies that creating a UsdGeomXformOp from the corresponding UsdAttribute will succeed.
|
inline |
|
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.
|
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.
|
inline |
|
inline |
|
friend |
Inequality comparison. Return false if lhs and rhs represent the same underlying UsdAttribute, true otherwise.
|
friend |
Equality comparison. Return true if lhs and rhs represent the same underlying UsdAttribute, false otherwise.
|
friend |
Equality comparison. Return true if lhs and rhs represent the same underlying UsdAttribute, false otherwise.