Loading...
Searching...
No Matches
UsdGeomXformCache Class Reference

A caching mechanism for transform matrices. More...

#include <xformCache.h>

Public Member Functions

USDGEOM_API UsdGeomXformCache (const UsdTimeCode time)
 Construct a new XformCache for the specified time.
 
USDGEOM_API UsdGeomXformCache ()
 Construct a new XformCache for UsdTimeCode::Default().
 
USDGEOM_API GfMatrix4d GetLocalToWorldTransform (const UsdPrim &prim)
 Compute the transformation matrix for the given prim, including the transform authored on the Prim itself, if present.
 
USDGEOM_API GfMatrix4d GetParentToWorldTransform (const UsdPrim &prim)
 Compute the transformation matrix for the given prim, but do NOT include the transform authored on the prim itself.
 
USDGEOM_API GfMatrix4d GetLocalTransformation (const UsdPrim &prim, bool *resetsXformStack)
 Returns the local transformation of the prim.
 
USDGEOM_API GfMatrix4d ComputeRelativeTransform (const UsdPrim &prim, const UsdPrim &ancestor, bool *resetXformStack)
 Returns the result of concatenating all transforms beneath ancestor that affect prim.
 
USDGEOM_API bool IsAttributeIncludedInLocalTransform (const UsdPrim &prim, const TfToken &attrName)
 Whether the attribute named attrName, belonging to the given prim affects the local transform value at the prim.
 
USDGEOM_API bool TransformMightBeTimeVarying (const UsdPrim &prim)
 Whether the local transformation value at the prim may vary over time.
 
USDGEOM_API bool GetResetXformStack (const UsdPrim &prim)
 Whether the xform stack is reset at the given prim.
 
USDGEOM_API void Clear ()
 Clears all pre-cached values.
 
USDGEOM_API void SetTime (UsdTimeCode time)
 Use the new time when computing values and may clear any existing values cached for the previous time.
 
UsdTimeCode GetTime ()
 Get the current time from which this cache is reading values.
 
USDGEOM_API void Swap (UsdGeomXformCache &other)
 Swap the contents of this XformCache with other.
 

Detailed Description

A caching mechanism for transform matrices.

For best performance, this object should be reused for multiple CTM queries.

Instances of this type can be copied, though using Swap() may result in better performance.

It is valid to cache prims from multiple stages in a single XformCache.

WARNING: this class does not automatically invalidate cached values based on changes to the stage from which values were cached. Additionally, a separate instance of this class should be used per-thread, calling the Get* methods from multiple threads is not safe, as they mutate internal state.

Definition at line 57 of file xformCache.h.

Constructor & Destructor Documentation

◆ UsdGeomXformCache() [1/2]

USDGEOM_API UsdGeomXformCache ( const UsdTimeCode  time)
explicit

Construct a new XformCache for the specified time.

◆ UsdGeomXformCache() [2/2]

USDGEOM_API UsdGeomXformCache ( )

Construct a new XformCache for UsdTimeCode::Default().

Member Function Documentation

◆ Clear()

USDGEOM_API void Clear ( )

Clears all pre-cached values.

◆ ComputeRelativeTransform()

USDGEOM_API GfMatrix4d ComputeRelativeTransform ( const UsdPrim prim,
const UsdPrim ancestor,
bool *  resetXformStack 
)

Returns the result of concatenating all transforms beneath ancestor that affect prim.

This includes the local transform of prim itself, but not the local transform of ancestor. If ancestor is not an ancestor of prim, the resulting transform is the local-to-world transformation of prim.
The resetXformTsack pointer must be valid. If any intermediate prims reset the transform stack, resetXformStack will be set to true. Intermediate transforms are cached, but the result of this call itself is not cached.

◆ GetLocalToWorldTransform()

USDGEOM_API GfMatrix4d GetLocalToWorldTransform ( const UsdPrim prim)

Compute the transformation matrix for the given prim, including the transform authored on the Prim itself, if present.

Note
This method may mutate internal cache state and is not thread safe.

◆ GetLocalTransformation()

USDGEOM_API GfMatrix4d GetLocalTransformation ( const UsdPrim prim,
bool *  resetsXformStack 
)

Returns the local transformation of the prim.

Uses the cached XformQuery to compute the result quickly. The resetsXformStack pointer must be valid. It will be set to true if prim resets the transform stack. The result of this call is cached.

◆ GetParentToWorldTransform()

USDGEOM_API GfMatrix4d GetParentToWorldTransform ( const UsdPrim prim)

Compute the transformation matrix for the given prim, but do NOT include the transform authored on the prim itself.

Note
This method may mutate internal cache state and is not thread safe.

◆ GetResetXformStack()

USDGEOM_API bool GetResetXformStack ( const UsdPrim prim)

Whether the xform stack is reset at the given prim.

Note
This method may mutate internal cache state and is not thread safe.

◆ GetTime()

UsdTimeCode GetTime ( )
inline

Get the current time from which this cache is reading values.

Definition at line 141 of file xformCache.h.

◆ IsAttributeIncludedInLocalTransform()

USDGEOM_API bool IsAttributeIncludedInLocalTransform ( const UsdPrim prim,
const TfToken attrName 
)

Whether the attribute named attrName, belonging to the given prim affects the local transform value at the prim.

Note
This method may mutate internal cache state and is not thread safe.

◆ SetTime()

USDGEOM_API void SetTime ( UsdTimeCode  time)

Use the new time when computing values and may clear any existing values cached for the previous time.

Setting time to the current time is a no-op.

◆ Swap()

USDGEOM_API void Swap ( UsdGeomXformCache other)

Swap the contents of this XformCache with other.

◆ TransformMightBeTimeVarying()

USDGEOM_API bool TransformMightBeTimeVarying ( const UsdPrim prim)

Whether the local transformation value at the prim may vary over time.

Note
This method may mutate internal cache state and is not thread safe.

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