usdrt::RtXformable¶
Defined in usdrt/scenegraph/usd/rt/xformable.h
-
class
usdrt
::
RtXformable
¶ The RtXformable class provides a schema for reading and writing the OmniHydra and RT Scene Delegate transform attributes.
The OmniHydra scene delegate (active in Create and all other Kit-based applications) will query Fabric for changes to these special attributes when discovering transform data in the Hydra render index. This enables faster updates of prim transforms than USD and UsdImaging conventionally allow.
There are two ways to set transform data with this API:
world transform
local transform
If any world transform attribute is set on a prim in Fabric, it will take precedence over any other transform data from USD or Fabric. The world transform is specified in three parts.
Name
Fabric Attribute Name
Type
APIs
position
_worldPosition
double3
Create/GetWorldPositionAttr
orientation
_worldOrientation
quatf
Create/GetWorldOrientationAttr
scale
_worldScale
vec3f
Create/GetWorldScaleAttr
If only one or two of the world transform attributes exist in Fabric, OmniHydra will use default values for the remaining attributes.
If no world transform attributes are set in Fabric, a local transform may be specified for a prim. (If any world transform attribute is specified, a local transform is ignored). This local transform will take precedence over local transform data from USD for the prim, but otherwise continue to participate in the transform hierarchy - changes to parent prims will continue to affect the overall transform of the prim.
Name
Fabric Attribute Name
Type
APIs
localMatrix
_localMatrix
matrix4d
Create/GetLocalMatrixAttr
Helper methods are provided to set either the world-space transform attribute values or the local transform value in Fabric using the computed values from the USD prim:
Public Functions
-
inline
RtXformable
(const UsdPrim &prim = UsdPrim())¶ Construct a RtXformable instance from a UsdPrim. Providing an invalid UsdPrim will result in an invalid RtXformable.
- Parameters
prim – The prim to use to construct the RtXformable
-
RtXformable
(const RtXformable &xform) = default¶ Copy constructor.
-
inline UsdAttribute
GetWorldPositionAttr
() const¶ World Position is the absolute, world-space translation of the prim. If this attribute is set in Fabric, OmniHydra will disregard all other transform data for this prim and use this and any other world transform attributes in Fabric for the Hydra rprim.
C++ Type
GfVec3d
ValueTypeName
Double3
-
inline UsdAttribute
CreateWorldPositionAttr
(const GfVec3d &defaultValue = GfVec3d()) const¶ Create or get the existing world position attribute.
- Parameters
defaultValue – The value to set when creating the world position attribute in Fabric
-
inline UsdAttribute
GetWorldOrientationAttr
() const¶ World Orientation is the absolute, world-space rotation of the prim. If this attribute is set in Fabric, OmniHydra will disregard all other transform data for this prim and use this and any other world transform attributes in Fabric for the Hydra rprim.
C++ Type
GfQuatf
ValueTypeName
Quatf
-
inline UsdAttribute
CreateWorldOrientationAttr
(const GfQuatf &defaultValue = GfQuatf()) const¶ Create or get the existing world orientation attribute.
- Parameters
defaultValue – The value to set when creating the world orientation attribute in Fabric
-
inline UsdAttribute
GetWorldScaleAttr
() const¶ World Scale is the absolute, world-space scale of the prim. If this attribute is set in Fabric, OmniHydra will disregard all other transform data for this prim and use this and any other world transform attributes in Fabric for the Hydra rprim.
C++ Type
GfVec3f
ValueTypeName
Vector3f
-
inline UsdAttribute
CreateWorldScaleAttr
(const GfVec3f &defaultValue = GfVec3f()) const¶ Create or get the existing world scale attribute.
- Parameters
defaultValue – The value to set when creating the world scale attribute in Fabric
-
inline UsdAttribute
GetLocalMatrixAttr
() const¶ Local Matrix is the local transform of the prim, relative to its parent. Updates to ancestor transforms will continue to affect the overall transform of this prim in OmniHydra. If this attribute is set in Fabric, OmniHydra will disregard any local transform data for this prim in USD. If any world transform attributes are set for the prim in Fabric, this attribute will be ignored by OmniHydra.
C++ Type
GfMatrix4d
ValueTypeName
Matrix4d
-
inline UsdAttribute
CreateLocalMatrixAttr
(const GfMatrix4d &defaultValue = GfMatrix4d(1)) const¶ Create or get the existing local matrix attribute.
- Parameters
defaultValue – The value to set when creating the local matrix attribute in Fabric
-
inline bool
HasWorldXform
() const¶ Check if the Fabric prim has any world transform attributes.
- Returns
true if any world transform attributes exist in Fabric
-
inline bool
ClearWorldXform
()¶ Remove any world transform attributes from the Fabric prim.
- Returns
true if any world transform attributes existed and were removed
-
inline bool
SetWorldXformFromUsd
()¶ Set the world position, orientation, and scale from the underlying USD prim.
- Returns
true if all world transform attributes were created and set or updated from USD
-
inline bool
HasLocalXform
() const¶ Check if the Fabric prim has the local transform attribute set.
- Returns
true if the local transform attribute exists in Fabric
-
inline bool
ClearLocalXform
()¶ Remove the local transform attribute from the Fabric prim.
- Returns
true if the local transform attribute existed and was removed
-
inline bool
SetLocalXformFromUsd
() const¶ Set the local transform attribute in Fabric from the underlying USD prim’s local transform relative to its parent.
- Returns
true if the local transform attribute was created and set or updated from USD