UsdGeomPrimvar#

Fully qualified name: usdrt::UsdGeomPrimvar

class UsdGeomPrimvar#

UsdAttribute API

inline operator const UsdAttribute&() const#

Allow UsdGeomPrimvar to auto-convert to UsdAttribute, so you can pass a UsdGeomPrimvar to any function that accepts a UsdAttribute or const-ref thereto.

inline const UsdAttribute &GetAttr() const#

Explicit UsdAttribute extractor.

inline bool IsDefined() const#

Return true if the underlying UsdAttribute::IsDefined(), and in addition the attribute is identified as a Primvar. Does not imply that the primvar provides a value.

inline bool HasValue() const#

Return true if the underlying attribute has a value, either from authored scene description or a fallback.

inline bool HasAuthoredValue() const#

Return true if the underlying attribute has an unblocked, authored value.

inline explicit operator bool() const#

Return true if this Primvar is valid for querying and authoring values and metadata, which is identically equivalent to IsDefined().

inline const TfToken GetName() const#

template<typename T>
inline bool Get(
T *value,
UsdTimeCode time = UsdTimeCode::Default(),
) const#

Get the attribute value of the Primvar at time .

See also

Usd_Handling_Indexed_Primvars for proper handling of indexed primvars

template<typename T>
inline bool Set(
const T &value,
UsdTimeCode time = UsdTimeCode::Default(),
) const#

Set the attribute value of the Primvar at time.

Public Functions

inline UsdGeomPrimvar()#
inline explicit UsdGeomPrimvar(const UsdAttribute &attr)#

Speculative constructor that will produce a valid UsdGeomPrimvar when attr already represents an attribute that is Primvar, and produces an invalid Primvar otherwise (i.e. operator bool() will return false).

Calling UsdGeomPrimvar::IsPrimvar(attr) will return the same truth value as this constructor, but if you plan to subsequently use the Primvar anyways, just use this constructor, as demonstrated in the class documentation.

inline TfToken GetInterpolation() const#

Return the Primvar’s interpolation, which is UsdGeomTokens->constant if unauthored.

Interpolation determines how the Primvar interpolates over a geometric primitive. See Usd_InterpolationVals

inline bool SetInterpolation(const TfToken &interpolation)#

Set the Primvar’s interpolation.

Returns false if interpolation is out of range as defined by IsValidInterpolation(). No attempt is made to validate that the Primvar’s value contains the right number of elements to match its interpolation to its topology.

See also

GetInterpolation(), Usd_InterpolationVals

inline bool HasAuthoredInterpolation() const#

Has interpolation been explicitly authored on this Primvar?

See also

GetInterpolationSize()

Public Static Functions

static inline bool IsPrimvar(const UsdAttribute &attr)#

Test whether a given UsdAttribute represents valid Primvar, which implies that creating a UsdGeomPrimvar from the attribute will succeed.

Success implies that attr.IsDefined() is true.

static inline bool IsValidPrimvarName(const TfToken &name)#

Test whether a given name represents a valid name of a primvar, which implies that creating a UsdGeomPrimvar with the given name will succeed.

static inline TfToken StripPrimvarsName(const TfToken &name)#

Returns the name, devoid of the “primvars:” token if present, otherwise returns the name unchanged.

static inline TfToken StripInterpolationName(const TfToken &name)#

Returns the name, devoid of the “:interpolation” token if present, otherwise returns the name unchanged.

static inline bool IsValidInterpolation(const TfToken &interpolation)#

Validate that the provided interpolation is a valid setting for interpolation as defined by Usd_InterpolationVals.

static inline bool IsValidInterpolationName(const TfToken &name)#

Validate that the provided name is a valid primvar interpolation attribute name.

static inline TfToken GetInterpolationName(const TfToken &name)#

Get the interpolation attribute name for the provided primvar name.