SdfLayerOffset Class Reference

Represents a time offset and scale between layers. More...

Inherits totally_ordered< SdfLayerOffset >.

Classes

struct  Hash
 Hash functor for hash maps and sets. More...
 

Public Member Functions

Constructors
SDF_API SdfLayerOffset (double offset=0.0, double scale=1.0)
 Constructs a new SdfLayerOffset instance. More...
 
Accessors
double GetOffset () const
 Returns the time offset. More...
 
double GetScale () const
 Returns the time scale factor. More...
 
void SetOffset (double newOffset)
 Sets the time offset. More...
 
void SetScale (double newScale)
 Sets the time scale factor. More...
 
SDF_API bool IsIdentity () const
 Returns true if this is an identity transformation, with an offset of 0.0 and a scale of 1.0. More...
 
SDF_API bool IsValid () const
 Returns true if this offset is valid, i.e. More...
 
SDF_API SdfLayerOffset GetInverse () const
 Gets the inverse offset, which performs the opposite transformation. More...
 
Operators
SDF_API bool operator== (const SdfLayerOffset &rhs) const
 Returns whether the offsets are equal. More...
 
SDF_API bool operator< (const SdfLayerOffset &rhs) const
 Returns whether this offset is less than another. More...
 
SDF_API SdfLayerOffset operator* (const SdfLayerOffset &rhs) const
 Composes this with the offset rhs, such that the resulting offset is equivalent to first applying rhs and then *this. More...
 
SDF_API double operator* (double rhs) const
 Applies the offset to the given value. More...
 
SDF_API SdfTimeCode operator* (const SdfTimeCode &rhs) const
 Applies the offset to the given value. More...
 

Hashing

SDF_API size_t GetHash () const
 Returns hash for this offset. More...
 
size_t hash_value (const SdfLayerOffset &offset)
 

Detailed Description

Represents a time offset and scale between layers.

The SdfLayerOffset class is an affine transform, providing both a scale and a translate. It supports vector algebra semantics for composing SdfLayerOffsets together via multiplication. The SdfLayerOffset class is unitless: it does not refer to seconds or frames.

For example, suppose layer A uses layer B, with an offset of X:
when bringing animation from B into A, you first apply the scale of X, and then the offset. Suppose you have a scale of 2 and an offset of 24: first multiply B's frame numbers by 2, and then add 24. The animation from B as seen in A will take twice as long and start 24 frames later.

Offsets are typically used in either sublayers or prim references. For more information, see the SetSubLayerOffset() method of the SdfLayer class (the subLayerOffsets property in Python), as well as the SetReference() and GetReferenceLayerOffset() methods (the latter is the referenceLayerOffset property in Python) of the SdfPrimSpec class.

Definition at line 61 of file layerOffset.h.

Constructor & Destructor Documentation

◆ SdfLayerOffset()

SDF_API SdfLayerOffset ( double  offset = 0.0,
double  scale = 1.0 
)
explicit

Constructs a new SdfLayerOffset instance.

Member Function Documentation

◆ GetHash()

SDF_API size_t GetHash ( ) const

Returns hash for this offset.

◆ GetInverse()

SDF_API SdfLayerOffset GetInverse ( ) const

Gets the inverse offset, which performs the opposite transformation.

◆ GetOffset()

double GetOffset ( ) const
inline

Returns the time offset.

Definition at line 77 of file layerOffset.h.

◆ GetScale()

double GetScale ( ) const
inline

Returns the time scale factor.

Definition at line 80 of file layerOffset.h.

◆ IsIdentity()

SDF_API bool IsIdentity ( ) const

Returns true if this is an identity transformation, with an offset of 0.0 and a scale of 1.0.

◆ IsValid()

SDF_API bool IsValid ( ) const

Returns true if this offset is valid, i.e.

both the offset and scale are finite (not infinite or NaN). Note that a valid layer offset's inverse may be invalid.

◆ operator*() [1/3]

SDF_API SdfLayerOffset operator* ( const SdfLayerOffset rhs) const

Composes this with the offset rhs, such that the resulting offset is equivalent to first applying rhs and then *this.

◆ operator*() [2/3]

SDF_API double operator* ( double  rhs) const

Applies the offset to the given value.

◆ operator*() [3/3]

SDF_API SdfTimeCode operator* ( const SdfTimeCode rhs) const

Applies the offset to the given value.

◆ operator<()

SDF_API bool operator< ( const SdfLayerOffset rhs) const

Returns whether this offset is less than another.

The meaning of less than is somewhat arbitrary.

◆ operator==()

SDF_API bool operator== ( const SdfLayerOffset rhs) const

Returns whether the offsets are equal.

◆ SetOffset()

void SetOffset ( double  newOffset)
inline

Sets the time offset.

Definition at line 83 of file layerOffset.h.

◆ SetScale()

void SetScale ( double  newScale)
inline

Sets the time scale factor.

Definition at line 86 of file layerOffset.h.


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