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

#include <houdiniXformCommonAPI.h>

+ Inheritance diagram for UsdHoudiniHoudiniXformCommonAPI:

Classes

struct  Ops
 
class  Rotation
 

Public Types

enum  RotationOrder {
  RotationOrderXYZ, RotationOrderXZY, RotationOrderYXZ, RotationOrderYZX,
  RotationOrderZXY, RotationOrderZYX
}
 Enumerates the rotation order of the 3-angle Euler rotation. More...
 
enum  OpFlags {
  OpNone = 0, OpTranslate = 1, OpPivot = 2, OpRotate = 4,
  OpScale = 8, OpShear = 16, OpPivotRotate = 32, OpOrient = 64
}
 

Public Member Functions

 UsdHoudiniHoudiniXformCommonAPI (const UsdPrim &prim=UsdPrim())
 
 UsdHoudiniHoudiniXformCommonAPI (const UsdSchemaBase &schemaObj)
 
virtual ~UsdHoudiniHoudiniXformCommonAPI () override
 Destructor. More...
 
bool SetXformVectors (const GfVec3d &translation, const Rotation &rotation, const GfVec3f &scale, const GfVec3f &shear, const GfVec3f &pivot, const GfVec3f &pivotRotate, const UsdTimeCode time) const
 
bool GetXformVectors (GfVec3d *translation, Rotation *rotation, GfVec3f *scale, GfVec3f *shear, GfVec3f *pivot, GfVec3f *pivotRot, const UsdTimeCode time) const
 
bool GetXformVectorsByAccumulation (GfVec3d *translation, Rotation *rotation, GfVec3f *scale, GfVec3f *shear, GfVec3f *pivot, GfVec3f *pivotRotate, const UsdTimeCode time) const
 
bool GetResetXformStack () const
 
API for setting individual ops independently.

bool SetTranslate (const GfVec3d &translation, const UsdTimeCode time=UsdTimeCode::Default()) const
 Set translation at time to translation. More...
 
bool SetPivot (const GfVec3f &pivot, const UsdTimeCode time=UsdTimeCode::Default()) const
 Set pivot position at time to pivot. More...
 
bool SetPivotRotate (const GfVec3f &pivotRotate, const UsdTimeCode time=UsdTimeCode::Default()) const
 Set pivot rotation at time to pivot. More...
 
bool SetRotate (const Rotation &rotation, const UsdTimeCode time=UsdTimeCode::Default()) const
 
bool SetShear (const GfVec3f &shear, const UsdTimeCode time=UsdTimeCode::Default()) const
 Set shear at time to shear. More...
 
bool SetScale (const GfVec3f &scale, const UsdTimeCode time=UsdTimeCode::Default()) const
 Set scale at time to scale. More...
 
bool SetResetXformStack (bool resetXformStack) const
 
Ops CreateXformOps (UsdHoudiniHoudiniXformCommonAPI::RotationOrder rotOrder, OpFlags op1=OpNone, OpFlags op2=OpNone, OpFlags op3=OpNone, OpFlags op4=OpNone, OpFlags op5=OpNone, OpFlags op6=OpNone) const
 
Ops CreateXformOps (OpFlags op1=OpNone, OpFlags op2=OpNone, OpFlags op3=OpNone, OpFlags op4=OpNone, OpFlags op5=OpNone, OpFlags op6=OpNone) const
 
- Public Member Functions inherited from UsdAPISchemaBase
 UsdAPISchemaBase (const UsdPrim &prim=UsdPrim())
 
 UsdAPISchemaBase (const UsdSchemaBase &schemaObj)
 
virtual USD_API ~UsdAPISchemaBase ()=0
 Destructor. More...
 
- Public Member Functions inherited from UsdSchemaBase
bool IsConcrete () const
 
bool IsTyped () const
 
bool IsAPISchema () const
 Returns whether this is an API schema or not. More...
 
bool IsAppliedAPISchema () const
 
bool IsMultipleApplyAPISchema () const
 
UsdSchemaKind GetSchemaKind () const
 Returns the kind of schema this class is. More...
 
USD_API UsdSchemaBase (const UsdPrim &prim=UsdPrim())
 Construct and store prim as the held prim. More...
 
USD_API UsdSchemaBase (const UsdSchemaBase &otherSchema)
 Construct and store for the same prim held by otherSchema. More...
 
virtual USD_API ~UsdSchemaBase ()
 Destructor. More...
 
USD_API operator bool () const
 
UsdPrim GetPrim () const
 Return this schema object's held prim. More...
 
SdfPath GetPath () const
 Shorthand for GetPrim()->GetPath(). More...
 
USD_API const UsdPrimDefinitionGetSchemaClassPrimDefinition () const
 

Static Public Member Functions

static const TfTokenVectorGetSchemaAttributeNames (bool includeInherited=true)
 
static
UsdHoudiniHoudiniXformCommonAPI 
Get (const UsdStagePtr &stage, const SdfPath &path)
 
static UsdGeomXformOp::Type ConvertRotationOrderToOpType (UsdHoudiniHoudiniXformCommonAPI::RotationOrder rotOrder)
 
static
UsdHoudiniHoudiniXformCommonAPI::RotationOrder 
ConvertOpTypeToRotationOrder (UsdGeomXformOp::Type opType)
 
static bool CanConvertOpTypeToRotationOrder (UsdGeomXformOp::Type opType)
 
Computing transforms
static GfMatrix4d GetRotationTransform (const GfVec3f &rotation, const UsdHoudiniHoudiniXformCommonAPI::RotationOrder rotationOrder)
 
- Static Public Member Functions inherited from UsdAPISchemaBase
static USD_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 
- Static Public Member Functions inherited from UsdSchemaBase
static const TfTokenVectorGetSchemaAttributeNames (bool includeInherited=true)
 

Static Public Attributes

static const UsdSchemaKind schemaKind = UsdSchemaKind::NonAppliedAPI
 
- Static Public Attributes inherited from UsdAPISchemaBase
static const UsdSchemaKind schemaKind = UsdSchemaKind::AbstractBase
 
- Static Public Attributes inherited from UsdSchemaBase
static const UsdSchemaKind schemaKind = UsdSchemaKind::AbstractBase
 

Protected Member Functions

UsdSchemaKind _GetSchemaKind () const override
 
bool _IsCompatible () const override
 Returns whether the underlying xformable is compatible with the API. More...
 
- Protected Member Functions inherited from UsdAPISchemaBase
USD_API UsdSchemaKind _GetSchemaKind () const override
 
 UsdAPISchemaBase (const UsdPrim &prim, const TfToken &instanceName)
 
 UsdAPISchemaBase (const UsdSchemaBase &schemaObj, const TfToken &instanceName)
 
const TfToken_GetInstanceName () const
 
USD_API bool _IsCompatible () const override
 
- Protected Member Functions inherited from UsdSchemaBase
virtual UsdSchemaKind _GetSchemaType () const
 
const TfType_GetType () const
 
USD_API UsdAttribute _CreateAttr (TfToken const &attrName, SdfValueTypeName const &typeName, bool custom, SdfVariability variability, VtValue const &defaultValue, bool writeSparsely) const
 

Friends

class UsdSchemaRegistry
 

Additional Inherited Members

- Static Protected Member Functions inherited from UsdAPISchemaBase
static USD_API TfTokenVector _GetMultipleApplyInstanceNames (const UsdPrim &prim, const TfType &schemaType)
 

Detailed Description

This class provides API for authoring and retrieving a standard set of component transformations which include a scale, a rotation, a scale-rotate pivot and a translation. The goal of the API is to enhance component-wise interchange. It achieves this by limiting the set of allowed basic ops and by specifying the order in which they are applied. In addition to the basic set of ops, the 'resetXformStack' bit can also be set to indicate whether the underlying xformable resets the parent transformation (i.e. does not inherit it's parent's transformation).

See Also
UsdHoudiniHoudiniXformCommonAPI::GetResetXformStack()
UsdHoudiniHoudiniXformCommonAPI::SetResetXformStack()

The operator-bool for the class will inform you whether an existing xformable is compatible with this API.

The scale-rotate pivot is represented by a pair of (translate, inverse-translate) xformOps around the scale and rotate operations. The rotation operation can be any of the six allowed Euler angle sets, or a quaternion orientation (xformOp:orient).

See Also
UsdGeomXformOp::Type.

This class is essentially a copy of UsdGeomXformCommonAPI, but with the addition of an optional shear component (expressed as a GfMatrx4d in the xformOp stack) and a "pivot rotate" component which, like the pivot, is applied before the t/r/s operations, and inverted after these operations. Whenever possible, this class will not author these Houdini-specific ops, and remain compatible with UsdGeomXformCommonAPI.

The xformOpOrder of an xformable that has all of the supported basic ops is as follows: ["xformOp:translate:pivot", "xformOp:rotateXYZ:pivot", "xformOp:translate", "xformOp:rotateXYZ", "xformOp:transform:shear", "xformOp:scale", "!invert!xformOp:rotateXYZ:pivot", "!invert!xformOp:translate:pivot"].

It is worth noting that all of the ops are optional. For example, an xformable may have only a translate or a rotate. It would still be considered as compatible with this API. Individual SetTranslate(), SetRotate(), SetScale() and SetPivot() methods are provided by this API to allow such sparse authoring.

Definition at line 87 of file houdiniXformCommonAPI.h.

Member Enumeration Documentation

Enumerates the categories of ops that can be handled by XformCommonAPI. For use with CreateXformOps().

Enumerator
OpNone 
OpTranslate 
OpPivot 
OpRotate 
OpScale 
OpShear 
OpPivotRotate 
OpOrient 

Definition at line 223 of file houdiniXformCommonAPI.h.

Enumerates the rotation order of the 3-angle Euler rotation.

Enumerator
RotationOrderXYZ 
RotationOrderXZY 
RotationOrderYXZ 
RotationOrderYZX 
RotationOrderZXY 
RotationOrderZYX 

Definition at line 164 of file houdiniXformCommonAPI.h.

Constructor & Destructor Documentation

UsdHoudiniHoudiniXformCommonAPI::UsdHoudiniHoudiniXformCommonAPI ( const UsdPrim prim = UsdPrim())
inlineexplicit

Construct a UsdHoudiniHoudiniXformCommonAPI on UsdPrim prim . Equivalent to UsdHoudiniHoudiniXformCommonAPI::Get(prim.GetStage(), prim.GetPath()) for a valid prim, but will not immediately throw an error for an invalid prim

Definition at line 101 of file houdiniXformCommonAPI.h.

UsdHoudiniHoudiniXformCommonAPI::UsdHoudiniHoudiniXformCommonAPI ( const UsdSchemaBase schemaObj)
inlineexplicit

Construct a UsdHoudiniHoudiniXformCommonAPI on the prim held by schemaObj . Should be preferred over UsdHoudiniHoudiniXformCommonAPI(schemaObj.GetPrim()), as it preserves SchemaBase state.

Definition at line 109 of file houdiniXformCommonAPI.h.

virtual UsdHoudiniHoudiniXformCommonAPI::~UsdHoudiniHoudiniXformCommonAPI ( )
overridevirtual

Destructor.

Member Function Documentation

UsdSchemaKind UsdHoudiniHoudiniXformCommonAPI::_GetSchemaKind ( ) const
overrideprotectedvirtual

Returns the kind of schema this class belongs to.

See Also
UsdSchemaKind

Reimplemented from UsdSchemaBase.

bool UsdHoudiniHoudiniXformCommonAPI::_IsCompatible ( ) const
overrideprotectedvirtual

Returns whether the underlying xformable is compatible with the API.

Reimplemented from UsdSchemaBase.

static bool UsdHoudiniHoudiniXformCommonAPI::CanConvertOpTypeToRotationOrder ( UsdGeomXformOp::Type  opType)
static

Whether the given opType has a corresponding value in the UsdHoudiniHoudiniXformCommonAPI::RotationOrder enum (i.e., whether it is a three-axis rotation).

static UsdHoudiniHoudiniXformCommonAPI::RotationOrder UsdHoudiniHoudiniXformCommonAPI::ConvertOpTypeToRotationOrder ( UsdGeomXformOp::Type  opType)
static

Converts the given opType to the corresponding value in the UsdHoudiniHoudiniXformCommonAPI::RotationOrder enum. For example, TypeRotateYZX corresponds to RotationOrderYZX. Raises a coding error if opType is not convertible to RotationOrder (i.e., if it isn't a three-axis rotation) and returns the default RotationOrderXYZ instead.

static UsdGeomXformOp::Type UsdHoudiniHoudiniXformCommonAPI::ConvertRotationOrderToOpType ( UsdHoudiniHoudiniXformCommonAPI::RotationOrder  rotOrder)
static

Converts the given rotOrder to the corresponding value in the UsdGeomXformOp::Type enum. For example, RotationOrderYZX corresponds to TypeRotateYZX. Raises a coding error if rotOrder is not one of the named enumerators of RotationOrder.

Ops UsdHoudiniHoudiniXformCommonAPI::CreateXformOps ( UsdHoudiniHoudiniXformCommonAPI::RotationOrder  rotOrder,
OpFlags  op1 = OpNone,
OpFlags  op2 = OpNone,
OpFlags  op3 = OpNone,
OpFlags  op4 = OpNone,
OpFlags  op5 = OpNone,
OpFlags  op6 = OpNone 
) const

Creates the specified XformCommonAPI-compatible xform ops, or returns the existing ops if they already exist. If successful, returns an Ops object with all the ops on this prim, identified by type. If the requested xform ops couldn't be created or the prim is not XformCommonAPI-compatible, returns an Ops object with all invalid ops.

The rotOrder is only used if OpRotate is specified. Otherwise, it is ignored. (If you don't need to create a rotate op, you might find it helpful to use the other overload that takes no rotation order.)

Ops UsdHoudiniHoudiniXformCommonAPI::CreateXformOps ( OpFlags  op1 = OpNone,
OpFlags  op2 = OpNone,
OpFlags  op3 = OpNone,
OpFlags  op4 = OpNone,
OpFlags  op5 = OpNone,
OpFlags  op6 = OpNone 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This overload does not take a rotation order. If you specify OpRotate, then this overload assumes RotationOrderXYZ or the previously-authored rotation order. (If you do need to create a rotate op, you might find it helpful to use the other overload that explicitly takes a rotation order.)

static UsdHoudiniHoudiniXformCommonAPI UsdHoudiniHoudiniXformCommonAPI::Get ( const UsdStagePtr &  stage,
const SdfPath path 
)
static

Return a UsdHoudiniHoudiniXformCommonAPI holding the prim adhering to this schema at path on stage. If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:

UsdHoudiniHoudiniXformCommonAPI(stage->GetPrimAtPath(path));
bool UsdHoudiniHoudiniXformCommonAPI::GetResetXformStack ( ) const

Returns whether the xformable resets the transform stack. i.e., does not inherit the parent transformation.

static GfMatrix4d UsdHoudiniHoudiniXformCommonAPI::GetRotationTransform ( const GfVec3f rotation,
const UsdHoudiniHoudiniXformCommonAPI::RotationOrder  rotationOrder 
)
static

Return the 4x4 matrix that applies the rotation encoded by rotation vector rotation using the rotation order rotationOrder.

Deprecated:
Please use the result of ConvertRotationOrderToOpType() along with UsdGeomXformOp::GetOpTransform() instead.
static const TfTokenVector& UsdHoudiniHoudiniXformCommonAPI::GetSchemaAttributeNames ( bool  includeInherited = true)
static

Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved.

bool UsdHoudiniHoudiniXformCommonAPI::GetXformVectors ( GfVec3d translation,
Rotation rotation,
GfVec3f scale,
GfVec3f shear,
GfVec3f pivot,
GfVec3f pivotRot,
const UsdTimeCode  time 
) const

Retrieve values of the various component xformOps at a given time. Identity values are filled in for the component xformOps that don't exist or don't have an authored value.

The rotation output preserves the prim's native rotation representation: Euler angles if the prim has a rotateABC op, or quaternion if the prim has an orient op.

Note
This method works even on prims with an incompatible xform schema, i.e. when the bool operator returns false. When the underlying xformable has an incompatible xform schema, it performs a full-on matrix decomposition to XYZ Euler rotation order.
bool UsdHoudiniHoudiniXformCommonAPI::GetXformVectorsByAccumulation ( GfVec3d translation,
Rotation rotation,
GfVec3f scale,
GfVec3f shear,
GfVec3f pivot,
GfVec3f pivotRotate,
const UsdTimeCode  time 
) const

Retrieve values of the various component xformOps at a given time. Identity values are filled in for the component xformOps that don't exist or don't have an authored value.

This method allows some additional flexibility for xform schemas that do not strictly adhere to the xformCommonAPI. For incompatible schemas, this method will attempt to reduce the schema into one from which component vectors can be extracted by accumulating xformOp transforms of the common types.

Note
When the underlying xformable has a compatible xform schema, the usual component value extraction method is used instead. When the xform schema is incompatible and it cannot be reduced by accumulating transforms, it performs a full-on matrix decomposition to XYZ Euler rotation order.
bool UsdHoudiniHoudiniXformCommonAPI::SetPivot ( const GfVec3f pivot,
const UsdTimeCode  time = UsdTimeCode::Default() 
) const

Set pivot position at time to pivot.

bool UsdHoudiniHoudiniXformCommonAPI::SetPivotRotate ( const GfVec3f pivotRotate,
const UsdTimeCode  time = UsdTimeCode::Default() 
) const

Set pivot rotation at time to pivot.

bool UsdHoudiniHoudiniXformCommonAPI::SetResetXformStack ( bool  resetXformStack) const

Set whether the xformable resets the transform stack. i.e., does not inherit the parent transformation.

bool UsdHoudiniHoudiniXformCommonAPI::SetRotate ( const Rotation rotation,
const UsdTimeCode  time = UsdTimeCode::Default() 
) const

Set rotation at time to rotation. The rotation can be either Euler angles with a rotation order, or a quaternion orientation.

bool UsdHoudiniHoudiniXformCommonAPI::SetScale ( const GfVec3f scale,
const UsdTimeCode  time = UsdTimeCode::Default() 
) const

Set scale at time to scale.

bool UsdHoudiniHoudiniXformCommonAPI::SetShear ( const GfVec3f shear,
const UsdTimeCode  time = UsdTimeCode::Default() 
) const

Set shear at time to shear.

bool UsdHoudiniHoudiniXformCommonAPI::SetTranslate ( const GfVec3d translation,
const UsdTimeCode  time = UsdTimeCode::Default() 
) const

Set translation at time to translation.

bool UsdHoudiniHoudiniXformCommonAPI::SetXformVectors ( const GfVec3d translation,
const Rotation rotation,
const GfVec3f scale,
const GfVec3f shear,
const GfVec3f pivot,
const GfVec3f pivotRotate,
const UsdTimeCode  time 
) const

Set values for the various component xformOps at a given time.

Calling this method will call all of the supported ops to be created, even if they only contain default (identity) values.

To author individual operations selectively, use the Set[OpType]() API.

The rotation parameter encapsulates both the rotation value and its representation (Euler angles with rotation order, or quaternion).

Note
Once the rotation representation has been established for a given xformable (either because of an already defined (and compatible) rotate/orient op or from calling SetXformVectors() or SetRotate()), it cannot be changed.

Friends And Related Function Documentation

friend class UsdSchemaRegistry
friend

Definition at line 143 of file houdiniXformCommonAPI.h.

Member Data Documentation

const UsdSchemaKind UsdHoudiniHoudiniXformCommonAPI::schemaKind = UsdSchemaKind::NonAppliedAPI
static

Compile time constant representing what kind of schema this class is.

See Also
UsdSchemaKind

Definition at line 95 of file houdiniXformCommonAPI.h.


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