![]() |
|
Represents a time offset and scale between layers. More...
#include <layerOffset.h>
Classes | |
| struct | Hash |
| Hash functor for hash maps and sets. More... | |
Public Member Functions | |
Constructors | |
| SdfLayerOffset (double offset=0.0, double scale=1.0) | |
| Constructs a new SdfLayerOffset instance. | |
Accessors | |
| double | GetOffset () const |
| Returns the time offset. | |
| double | GetScale () const |
| Returns the time scale factor. | |
| void | SetOffset (double newOffset) |
| Sets the time offset. | |
| void | SetScale (double newScale) |
| Sets the time scale factor. | |
| bool | IsIdentity () const |
Returns true if this is an identity transformation, with an offset of 0.0 and a scale of 1.0. | |
| SDF_API bool | IsValid () const |
Returns true if this offset is valid, i.e. | |
| SDF_API SdfLayerOffset | GetInverse () const |
| Gets the inverse offset, which performs the opposite transformation. | |
Operators | |
| SDF_API bool | operator== (const SdfLayerOffset &rhs) const |
| Returns whether the offsets are equal. | |
| bool | operator!= (const SdfLayerOffset &rhs) const |
| SDF_API bool | operator< (const SdfLayerOffset &rhs) const |
| Returns whether this offset is less than another. | |
| bool | operator> (const SdfLayerOffset &rhs) const |
| bool | operator>= (const SdfLayerOffset &rhs) const |
| bool | operator<= (const SdfLayerOffset &rhs) const |
| 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. | |
| SDF_API double | operator* (double rhs) const |
| Applies the offset to the given value. | |
| SDF_API SdfTimeCode | operator* (const SdfTimeCode &rhs) const |
| Applies the offset to the given value. | |
Hashing | |
| SDF_API size_t | GetHash () const |
| Returns hash for this offset. | |
| size_t | hash_value (const SdfLayerOffset &offset) |
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 43 of file layerOffset.h.
|
inlineexplicit |
Constructs a new SdfLayerOffset instance.
Definition at line 50 of file layerOffset.h.
| SDF_API size_t GetHash | ( | ) | const |
Returns hash for this offset.
| SDF_API SdfLayerOffset GetInverse | ( | ) | const |
Gets the inverse offset, which performs the opposite transformation.
|
inline |
Returns the time offset.
Definition at line 59 of file layerOffset.h.
|
inline |
Returns the time scale factor.
Definition at line 62 of file layerOffset.h.
|
inline |
Returns true if this is an identity transformation, with an offset of 0.0 and a scale of 1.0.
Note that for historical reasons this uses operator==() against a default-constructed instance, which, as noted in the documentation for equality comparison, is a "fuzzy" equality.
Definition at line 74 of file layerOffset.h.
| 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.
|
inline |
Definition at line 124 of file layerOffset.h.
| 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.
| SDF_API SdfTimeCode operator* | ( | const SdfTimeCode & | rhs | ) | const |
Applies the offset to the given value.
| SDF_API double operator* | ( | double | rhs | ) | const |
Applies the offset to the given value.
| SDF_API bool operator< | ( | const SdfLayerOffset & | rhs | ) | const |
Returns whether this offset is less than another.
The meaning of less than is somewhat arbitrary.
|
inline |
Definition at line 144 of file layerOffset.h.
| SDF_API bool operator== | ( | const SdfLayerOffset & | rhs | ) | const |
Returns whether the offsets are equal.
For historical reasons, this performs a "fuzzy" equality comparison. If neither *this nor rhs are valid by IsValid(), return true. If both are valid and their scales and offsets are within an implementation-defined epsilon, return true. Otherwise return false.
|
inline |
Definition at line 134 of file layerOffset.h.
|
inline |
Definition at line 139 of file layerOffset.h.
|
inline |
Sets the time offset.
Definition at line 65 of file layerOffset.h.
|
inline |
Sets the time scale factor.
Definition at line 68 of file layerOffset.h.
|
friend |
Definition at line 106 of file layerOffset.h.