usdrt::UsdAttribute

Defined in usdrt/scenegraph/usd/usd/impl/usd_decl.h

Functions

class UsdAttribute

Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.

Allowed value types for attributes are defined by SdfValueTypeNames.

Public Functions

bool HasValue() const

Check if this attribute has an authored default value, authored time samples or a fallback value provided by a schema.

First check Fabric for a value, then fall back to USD.

Returns

Return true if this attribute has an authored default value, authored time samples or a fallback value provided by a schema, and false otherwise.

bool HasAuthoredValue() const

Check if this attribute has an authored default value, authored time samples.

First check Fabric for a value, than fall back to USD.

Returns

Return true if this attribute has an authored default value, authored time samples, and false otherwise.

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

Perform value resolution to fetch the value of this attribute at the requested UsdTimeCode time.

Note

Current implementation ignores timecode.

Template Parameters

typename – A valid type specified by SdfValueTypeNames.

Parameters
  • value[out] This attribute’s value.

  • time[in] UsdTimeCode Default is UsdTimeCode::Default().

Returns

Return true if a value of type T was successfully read, and false otherwise.

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

Fetch the value of this attribute at in fabric.

Note

Current implementation ignores timecode.

Template Parameters

typename – Vt container for a valid type specified by SdfValueTypeNames.

Parameters
  • value[out] Vt container for this attribute’s value.

  • time[in] UsdTimeCode Default is UsdTimeCode::Default().

Returns

Return true if a value of type T was successfully read, and false otherwise.

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

Set the value of this attribute in fabric.

Note

Current implementation ignores timecode.

Template Parameters

typename – A valid type specified by SdfValueTypeNames.

Parameters
  • value – This attribute’s new value to set.

  • time – UsdTimeCode Default is UsdTimeCode::Default().

Returns

Return true if a value of type T was successfully set, and false otherwise.

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

Set the array value of this attribute in fabric.

Note

Current implementation ignores timecode.

Template Parameters

typename – A valid type specified by SdfValueTypeNames.

Parameters
  • value – This attribute’s new value to set.

  • time – UsdTimeCode Default is UsdTimeCode::Default().

Returns

Return true if a value of type T was successfully set, and false otherwise.

SdfValueTypeName GetTypeName() const

Get the SdfValueTypeName for this attribute.

Returns

Return the value type name for this attribute.

bool IsValid() const

Check if the attribute is valid (i.e exists in fabric).

Returns

Return true if the attribute exists in fabric, and false otherise.

UsdStageRefPtr GetStage() const

Get the fabric stage holding this UsdAttribute.

Returns

Return a pointer to the fabric stage that contains this attribute.

UsdPrim GetPrim() const

Get the prim associated with this attribute on the existing fabric stage.

Returns

Return a pointer to the prim that has this attribute.

const TfToken GetName() const

Get this attribute’s name.

Returns

Return this attributes name as a TfToken.

SdfPath GetPath() const

Get the path to this attribute.

Returns

Return the SdfPath path to this attribute.

const SdfPath GetPrimPath() const

Get the path to the prim that has this attribute.

Returns

Return the SdfPath to the prim that has this attribute.

explicit operator bool() const

Check if this attribute is valid. See UsdAttribute::IsValid.

Returns

Return true if this attribute is valid, and false otherwise.

TfToken GetBaseName() const

Get this property’s name with all namespace prefixes removed.

Returns

Return this property’s name with all namespace prefixes removed as a TfToken.

TfToken GetNamespace() const

Get this property’s complete namespace prefix.

Returns

Return this property’s complete namespace prefix as a TfToken. Empty token if not a namespaced property.

std::vector<std::string> SplitName() const

Get this property’s name elements including namespaces and its base name as the final element.

Returns

this property’s name elements including namespaces and its base name as the final element.

bool AddConnection(const SdfPath &source, UsdListPosition position = UsdListPositionBackOfPrependList) const

Add source to list of connections based on the specified UsdListPosition heuristic.

Note

Multiple connection sources not supported in fabric. Adding a new source to will override any previously set source.

Parameters
  • source – SdfPath to the new connection to add.

  • position – UsdListPosition heuristic for where to add the new connection. This is ignored for now since fabric does not support a list of sources.

Returns

Return true if the new connection source has been set. False otherwise.

bool RemoveConnection(const SdfPath &source) const

Remove source from the list of connections.

Note

Note. Multiple connection sourced not supported in fabric. The requested source to remove must match the current set value. Trying to remove a source that does not match current is a no-op.

Parameters

source – SdfPath to the connection to remove. This must match the current set connection value.

Returns

Return true if the connection has been removed. False otherwise.

bool BlockConnections() const

Clear all connections. TODO oops we didn’t implement this… have this call remove connection.

bool SetConnections(const SdfPathVector &sources) const

Explicitly set a new list of connection sources.

Note

Multiple sources not supported in fabric. For now, only a vector of size 1 is accepted.

Parameters

sources – A vector of SdfPaths to set as the new list of connections. Only a vector of size 1 is accepted.

Returns

Return true if the new connection source has been set. False otherwise.

bool ClearConnections() const

Remove all targets from the list of connections.

Note

Note. Multiple connection sourced not supported in fabric. This assumes one connection.

Returns

Return true if the connection has been removed. False otherwise.

bool GetConnections(SdfPathVector *sources) const

Get a list of connection sources.

Note

Multiple sources not supported in fabric. Result sources will be a vector of size 1.

Parameters

sources[out] The list of connections as an SdfPathVector. Result will be a vector of size 1.

Returns

Return true if the list of connections has been successfully fetched. False otherwise.

bool HasAuthoredConnections() const

Check if this attribute has any authored connections.

Note

This diverges from the USD behavior. USD checks for authored opinions that add or remove connections in the current edit target layer. These concepts don’t apply to Fabric, so we only check if there is currently a connection set.

Returns

Return true if this attribute has any authored conneections.

bool IsCpuDataValid() const

Check if Fabric CPU data is currently valid.

Returns

true if CPU memory for this attribute value is valid

bool IsGpuDataValid() const

Check if Fabric GPU data is currently valid.

Returns

true if GPU memory for this attribute value is valid

bool SyncDataToGpu() const

Force a sync to GPU memory from CPU memory.

Causes Fabric to synchronize data from CPU to GPU if GPU data is not currently valid. For debugging and testing.

Returns

true if GPU data was made valid

bool SyncDataToCpu() const

Force a sync to CPU memory from GPU memory.

Causes Fabric to synchronize data from GPU to CPU if CPU data is not currently valid. For debugging and testing.

Returns

true if CPU data was made valid

bool InvalidateGpuData() const

Invalidate GPU data.

Gets a write handle to CPU data, causing Fabric to mark GPU data as invalid.

For debugging and testing.

Returns

true if GPU data was made invalid

bool InvalidateCpuData() const

Invalidate CPU data.

Gets a write handle to GPU data, causing Fabric to mark CPU data as invalid.

For debugging and testing.

Returns

true if CPU data was made invalid