|
HDK
|
#include <attributeLimits.h>
Classes | |
| class | ValidationResult |
Public Member Functions | |
| UsdAttributeLimits ()=default | |
| USD_API | UsdAttributeLimits (const UsdAttribute &attr, const TfToken &subDictKey) |
| operator bool () const | |
| bool | operator== (const UsdAttributeLimits &rhs) const |
| Equality operator. More... | |
| bool | operator!= (const UsdAttributeLimits &rhs) const |
| Inequality operator. More... | |
Object Information | |
Information about the limits object itself. | |
| USD_API bool | IsValid () const |
| USD_API UsdAttribute | GetAttribute () const |
| Return the limits object's attribute. More... | |
| USD_API TfToken | GetSubDictKey () const |
| Return the sub-dictionary key the limits object is using. More... | |
Opinions API | |
API for determining whether authored opinions exist, and clearing them. | |
| USD_API bool | HasAuthored () const |
| USD_API bool | Clear () |
| USD_API bool | HasAuthored (const TfToken &key) const |
| USD_API bool | Clear (const TfToken &key) |
| USD_API bool | HasAuthoredMinimum () const |
| USD_API bool | ClearMinimum () |
| USD_API bool | HasAuthoredMaximum () const |
| USD_API bool | ClearMaximum () |
Sub-dictionary Operations | |
Operations related to the entire limits sub-dictionary. | |
| USD_API bool | Validate (const VtDictionary &subDict, ValidationResult *result=nullptr) const |
| USD_API bool | Set (const VtDictionary &subDict) |
Typed Value API | |
Templated API for retrieving and authoring individual limits values. | |
| template<typename T > | |
| std::optional< T > | Get (const TfToken &key) const |
| template<typename T > | |
| T | GetOr (const TfToken &key, const T &defaultValue) const |
| template<typename T > | |
| bool | Set (const TfToken &key, const T &value) |
| template<typename T > | |
| std::optional< T > | GetMinimum () const |
| template<typename T > | |
| T | GetMinimumOr (const T &defaultValue) const |
| template<typename T > | |
| bool | SetMinimum (const T &value) |
| template<typename T > | |
| std::optional< T > | GetMaximum () const |
| template<typename T > | |
| T | GetMaximumOr (const T &defaultValue) const |
| template<typename T > | |
| bool | SetMaximum (const T &value) |
Type-erased Value API | |
VtValue-based overloads, mainly for use by the Python wrapping. | |
| USD_API VtValue | Get (const TfToken &key) const |
| USD_API bool | Set (const TfToken &key, const VtValue &value) |
| USD_API VtValue | GetMinimum () const |
| USD_API bool | SetMinimum (const VtValue &value) |
| USD_API VtValue | GetMaximum () const |
| USD_API bool | SetMaximum (const VtValue &value) |
Provides API for retrieving and authoring values within a particular sub-dictionary of the limits dictionary metadata field on a UsdAttribute instance. Within a given sub-dictionary, minimum and maximum values are encoded under the UsdLimitsKeys->Minimum and UsdLimitsKeys->Maximum keys, respectively.
For example, to express that an attribute's typical useful value range is between 5 and 10 (the "soft limits"), but that it must be between 0 and 15 (the "hard limits"), a typical limits dictionary might look like the following:
To work with these values, use the UsdAttributeLimits objects returned by UsdAttribute::GetSoftLimits() and UsdAttribute::GetHardLimits(), which edit and interpret the "soft" and "hard" sub-dictionaries, respectively.
You can also create custom sub-dictionaries:
Combined with the starting limits dictionary above, this would produce:
Definition at line 107 of file attributeLimits.h.
|
default |
Construct an invalid limits object.
Calling "set" operations on an invalid limits object will post errors. "Get" operations will return empty.
| USD_API UsdAttributeLimits::UsdAttributeLimits | ( | const UsdAttribute & | attr, |
| const TfToken & | subDictKey | ||
| ) |
Construct a limits object for the sub-dictionary given by subDictKey in attr's limits dictionary.
| USD_API bool UsdAttributeLimits::Clear | ( | ) |
Clear all authored opinions for the limits sub-dictionary at the current edit target. Return true if successful.
Clear the authored opinion for key in the limits sub-dictionary. Return true if successful.
| USD_API bool UsdAttributeLimits::ClearMaximum | ( | ) |
Clear the authored maximum value opinion in the limits sub-dictionary. Return true if successful.
| USD_API bool UsdAttributeLimits::ClearMinimum | ( | ) |
Clear the authored minimum value opinion in the limits sub-dictionary. Return true if successful.
|
inline |
Return the value encoded under key in the limits sub-dictionary. Return an empty std::optional if no authored or fallback value is present, or if the template type T does not match the type of the stored value.
Definition at line 430 of file attributeLimits.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| USD_API UsdAttribute UsdAttributeLimits::GetAttribute | ( | ) | const |
Return the limits object's attribute.
|
inline |
Return the maximum value from the limits sub-dictionary. Return an empty std::optional if no authored or fallback value is present, or if the template type T does not match the type of the stored value.
Definition at line 498 of file attributeLimits.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Return the maximum value from the limits sub-dictionary. Return defaultValue if no authored or fallback value is present, or if the template type T does not match the type of the stored value.
Definition at line 505 of file attributeLimits.h.
|
inline |
Return the minimum value from the limits sub-dictionary. Return an empty std::optional if no authored or fallback value is present, or if the template type T does not match the type of the stored value.
Definition at line 477 of file attributeLimits.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Return the minimum value from the limits sub-dictionary. Return defaultValue if no authored or fallback value is present, or if the template type T does not match the type of the stored value.
Definition at line 484 of file attributeLimits.h.
|
inline |
Return the value encoded under key in the limits sub-dictionary. Return defaultValue if no authored or fallback value is present, or if the template type T does not match the type of the stored value.
Definition at line 448 of file attributeLimits.h.
Return the sub-dictionary key the limits object is using.
| USD_API bool UsdAttributeLimits::HasAuthored | ( | ) | const |
Return whether any authored opinions exist for the limits sub-dictionary.
Return whether an authored opinion for key exists in the limits sub-dictionary.
| USD_API bool UsdAttributeLimits::HasAuthoredMaximum | ( | ) | const |
Return whether an authored maximum value opinion exists in the limits sub-dictionary.
| USD_API bool UsdAttributeLimits::HasAuthoredMinimum | ( | ) | const |
Return whether an authored minimum value opinion exists in the limits sub-dictionary.
| USD_API bool UsdAttributeLimits::IsValid | ( | ) | const |
Return whether the limits object is valid.
Calling "set" operations on an invalid limits object will post errors. "Get" operations will return empty.
|
inlineexplicit |
Return true if this limits object is valid.
Definition at line 405 of file attributeLimits.h.
|
inline |
Inequality operator.
Definition at line 415 of file attributeLimits.h.
|
inline |
Equality operator.
Definition at line 410 of file attributeLimits.h.
| USD_API bool UsdAttributeLimits::Set | ( | const VtDictionary & | subDict | ) |
Set the entire limits sub-dictionary to subDict. Return true if successful.
The types of encoded minimum and maximum values must match the value type of the attribute.
Set the value encoded under key in the limits sub-dictionary to value. Return true if successful.
Definition at line 468 of file attributeLimits.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Set the maximum value in the limits sub-dictionary. Return true if successful.
The type of value must match the attribute's value type.
Definition at line 512 of file attributeLimits.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Set the minimum value in the limits sub-dictionary. Return true if successful.
The type of value must match the attribute's value type.
Definition at line 491 of file attributeLimits.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| USD_API bool UsdAttributeLimits::Validate | ( | const VtDictionary & | subDict, |
| ValidationResult * | result = nullptr |
||
| ) | const |
Return whether subDict is a valid limits sub-dictionary. If result is provided, fill it in. To be valid, the types of encoded minimum and maximum values must match the value type of the attribute.