![]() |
|
Provides API for retrieving and authoring values within a particular sub-dictionary of the limits dictionary metadata field on a UsdAttribute instance.
More...
#include <attributeLimits.h>
Classes | |
| class | ValidationResult |
| Validation information for a limits sub-dictionary. More... | |
Public Member Functions | |
| UsdAttributeLimits ()=default | |
| Construct an invalid limits object. | |
| USD_API | UsdAttributeLimits (const UsdAttribute &attr, const TfToken &subDictKey) |
Construct a limits object for the sub-dictionary given by subDictKey in attr's limits dictionary. | |
| operator bool () const | |
Return true if this limits object is valid. | |
| bool | operator== (const UsdAttributeLimits &rhs) const |
| Equality operator. | |
| bool | operator!= (const UsdAttributeLimits &rhs) const |
| Inequality operator. | |
Object Information | |
Information about the limits object itself. | |
| USD_API bool | IsValid () const |
| Return whether the limits object is valid. | |
| USD_API UsdAttribute | GetAttribute () const |
| Return the limits object's attribute. | |
| USD_API TfToken | GetSubDictKey () const |
| Return the sub-dictionary key the limits object is using. | |
Opinions API | |
API for determining whether authored opinions exist, and clearing them. | |
| USD_API bool | HasAuthored () const |
| Return whether any authored opinions exist for the limits sub-dictionary. | |
| USD_API bool | Clear () |
| Clear all authored opinions for the limits sub-dictionary at the current edit target. | |
| USD_API bool | HasAuthored (const TfToken &key) const |
Return whether an authored opinion for key exists in the limits sub-dictionary. | |
| USD_API bool | Clear (const TfToken &key) |
Clear the authored opinion for key in the limits sub-dictionary. | |
| USD_API bool | HasAuthoredMinimum () const |
| Return whether an authored minimum value opinion exists in the limits sub-dictionary. | |
| USD_API bool | ClearMinimum () |
| Clear the authored minimum value opinion in the limits sub-dictionary. | |
| USD_API bool | HasAuthoredMaximum () const |
| Return whether an authored maximum value opinion exists in the limits sub-dictionary. | |
| USD_API bool | ClearMaximum () |
| Clear the authored maximum value opinion in the limits sub-dictionary. | |
Sub-dictionary Operations | |
Operations related to the entire limits sub-dictionary. | |
| USD_API bool | Validate (const VtDictionary &subDict, ValidationResult *result=nullptr) const |
Return whether subDict is a valid limits sub-dictionary. | |
| USD_API bool | Set (const VtDictionary &subDict) |
Set the entire limits sub-dictionary to subDict. | |
Typed Value API | |
Templated API for retrieving and authoring individual limits values. | |
| template<typename T > | |
| std::optional< T > | Get (const TfToken &key) const |
Return the value encoded under key in the limits sub-dictionary. | |
| template<typename T > | |
| T | GetOr (const TfToken &key, const T &defaultValue) const |
Return the value encoded under key in the limits sub-dictionary. | |
| template<typename T > | |
| bool | Set (const TfToken &key, const T &value) |
Set the value encoded under key in the limits sub-dictionary to value. | |
| template<typename T > | |
| std::optional< T > | GetMinimum () const |
| Return the minimum value from the limits sub-dictionary. | |
| template<typename T > | |
| T | GetMinimumOr (const T &defaultValue) const |
| Return the minimum value from the limits sub-dictionary. | |
| template<typename T > | |
| bool | SetMinimum (const T &value) |
| Set the minimum value in the limits sub-dictionary. | |
| template<typename T > | |
| std::optional< T > | GetMaximum () const |
| Return the maximum value from the limits sub-dictionary. | |
| template<typename T > | |
| T | GetMaximumOr (const T &defaultValue) const |
| Return the maximum value from the limits sub-dictionary. | |
| template<typename T > | |
| bool | SetMaximum (const T &value) |
| Set the maximum value in the limits sub-dictionary. | |
Type-erased Value API | |
VtValue-based overloads, mainly for use by the Python wrapping. | |
| USD_API VtValue | Get (const TfToken &key) const |
| 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 | Set (const TfToken &key, const VtValue &value) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| USD_API VtValue | GetMinimum () const |
| 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 | SetMinimum (const VtValue &value) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| USD_API VtValue | GetMaximum () const |
| 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 | SetMaximum (const VtValue &value) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
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 | ( | 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 Clear | ( | ) |
Clear all authored opinions for the limits sub-dictionary at the current edit target.
Return true if successful.
| USD_API bool Clear | ( | const TfToken & | key | ) |
Clear the authored opinion for key in the limits sub-dictionary.
Return true if successful.
| USD_API bool ClearMaximum | ( | ) |
Clear the authored maximum value opinion in the limits sub-dictionary.
Return true if successful.
| USD_API bool 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 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.
| USD_API VtValue GetMaximum | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
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.
| USD_API VtValue GetMinimum | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
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.
| USD_API TfToken GetSubDictKey | ( | ) | const |
Return the sub-dictionary key the limits object is using.
| USD_API bool HasAuthored | ( | ) | const |
Return whether any authored opinions exist for the limits sub-dictionary.
| USD_API bool HasAuthored | ( | const TfToken & | key | ) | const |
Return whether an authored opinion for key exists in the limits sub-dictionary.
| USD_API bool HasAuthoredMaximum | ( | ) | const |
Return whether an authored maximum value opinion exists in the limits sub-dictionary.
| USD_API bool HasAuthoredMinimum | ( | ) | const |
Return whether an authored minimum value opinion exists in the limits sub-dictionary.
| USD_API bool 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.
|
inline |
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.
| USD_API bool 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.
|
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.
| USD_API bool SetMaximum | ( | const VtValue & | value | ) |
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.
| USD_API bool SetMinimum | ( | const VtValue & | value | ) |
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 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.