24 #ifndef PXR_USD_USD_ATTRIBUTE_H
25 #define PXR_USD_USD_ATTRIBUTE_H
28 #include "pxr/usd/usd/api.h"
30 #include "pxr/usd/usd/property.h"
33 #include "pxr/usd/sdf/abstractData.h"
34 #include "pxr/usd/sdf/path.h"
36 #include "pxr/base/vt/value.h"
40 #include <type_traits>
43 PXR_NAMESPACE_OPEN_SCOPE
49 typedef std::vector<UsdAttribute> UsdAttributeVector;
266 std::vector<double>* times)
const;
288 std::vector<double> *times);
311 const std::vector<UsdAttribute> &attrs,
313 std::vector<double> *times);
356 bool* hasTimeSamples)
const;
430 template <
typename T>
432 static_assert(!std::is_const<T>::value,
"");
433 static_assert(SdfValueTypeTraits<T>::IsValueType,
"");
434 return _Get(value, time);
461 template <
typename T>
463 static_assert(!std::is_pointer<T>::value,
"");
464 static_assert(SdfValueTypeTraits<T>::IsValueType ||
465 std::is_same<T, SdfValueBlock>::value,
"");
466 return _Set(value, time);
624 friend class Usd_PrimData;
625 friend struct UsdPrim_AttrConnectionFinder;
630 :
UsdProperty(UsdTypeAttribute, prim, proxyPrimPath, attrName) {}
633 const Usd_PrimDataHandle &prim,
636 :
UsdProperty(objType, prim, proxyPrimPath, propName) {}
638 SdfAttributeSpecHandle
645 SdfAttributeSpecHandle _CreateSpec()
const;
650 template <
typename T>
653 template <
typename T>
657 _GetPathForAuthoring(
const SdfPath &path, std::string* whyNot)
const;
660 PXR_NAMESPACE_CLOSE_SCOPE
662 #endif // PXR_USD_USD_ATTRIBUTE_H
USD_API bool AddConnection(const SdfPath &source, UsdListPosition position=UsdListPositionBackOfPrependList) const
Adds source to the list of connections, in the position specified by position.
bool Set(const T &value, UsdTimeCode time=UsdTimeCode::Default()) const
Set the value of this attribute in the current UsdEditTarget to value at UsdTimeCode time...
USD_API bool SetVariability(SdfVariability variability) const
Set the value for variability at the current EditTarget, return true on success, false if the value c...
UsdObjType
Enum values to represent the various Usd object types.
UsdListPosition
Specifies a position to add items to lists.
USD_API bool SetTypeName(const SdfValueTypeName &typeName) const
Set the value for typeName at the current EditTarget, return true on success, false if the value can ...
USD_API UsdResolveInfo GetResolveInfo(UsdTimeCode time=UsdTimeCode::Default()) const
Perform value resolution to determine the source of the resolved value of this attribute at the reque...
USD_API SdfVariability GetVariability() const
An attribute's variability expresses whether it is intended to have time-samples (SdfVariabilityVaryi...
Object for efficiently making repeated queries for attribute values.
USD_API bool GetTimeSamplesInInterval(const GfInterval &interval, std::vector< double > *times) const
Populates a vector with authored sample times in interval.
Represents a value type name, i.e.
USD_API bool GetTimeSamples(std::vector< double > *times) const
Populates a vector with authored sample times.
USD_API bool GetBracketingTimeSamples(double desiredTime, double *lower, double *upper, bool *hasTimeSamples) const
Populate lower and upper with the next greater and lesser value relative to the desiredTime.
Container for information about the source of an attribute's value, i.e.
static USD_API bool GetUnionedTimeSamples(const std::vector< UsdAttribute > &attrs, std::vector< double > *times)
Populates the given vector, times with the union of all the authored sample times on all of the given...
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
UsdAttribute()
Construct an invalid attribute.
USD_API bool ClearConnections() const
Remove all opinions about the connections list from the current edit target.
USD_API bool ValueMightBeTimeVarying() const
Return true if it is possible, but not certain, that this attribute's value changes over time...
USD_API bool HasAuthoredValueOpinion() const
Token for efficient comparison, assignment, and hashing of known strings.
USD_API bool HasAuthoredConnections() const
Return true if this attribute has any authored opinions regarding connections.
USD_API bool ClearColorSpace() const
Clears authored color-space value on the attribute.
USD_API bool HasAuthoredValue() const
Return true if this attribute has either an authored default value or authored time samples...
USD_API bool GetConnections(SdfPathVector *sources) const
Compose this attribute's connections and fill sources with the result.
USD_API bool HasColorSpace() const
Returns whether color-space is authored on the attribute.
USD_API bool RemoveConnection(const SdfPath &source) const
Removes target from the list of targets.
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Base class for Usd scenegraph objects, providing common API.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
USD_API bool HasValue() const
Return true if this attribute has an authored default value, authored time samples or a fallback valu...
A basic mathematical interval class.
USD_API TfToken GetColorSpace() const
Gets the color space in which the attribute is authored.
A path value used to locate objects in layers or scenegraphs.
bool Get(T *value, UsdTimeCode time=UsdTimeCode::Default()) const
Perform value resolution to fetch the value of this attribute at the requested UsdTimeCode time...
SdfVariability
An enum that identifies variability types for attributes.
USD_API bool ClearAtTime(UsdTimeCode time) const
Clear the authored value for this attribute at the given time, at the current EditTarget and return t...
Base class for UsdAttribute and UsdRelationship scenegraph objects.
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
USD_API void SetColorSpace(const TfToken &colorSpace) const
Sets the color space of the attribute to colorSpace.
USD_API void Block() const
Remove all time samples on an attribute and author a block default value.
USD_API bool Clear() const
Clears the authored default value and all time samples for this attribute at the current EditTarget a...
USD_API bool HasFallbackValue() const
Return true if this attribute has a fallback value provided by a registered schema.
The position at the back of the prepend list.
The base class for all schema types in Usd.
USD_API bool ClearDefault() const
Shorthand for ClearAtTime(UsdTimeCode::Default()).
USD_API SdfValueTypeName GetTypeName() const
Return the "scene description" value type name for this attribute.
static USD_API bool GetUnionedTimeSamplesInInterval(const std::vector< UsdAttribute > &attrs, const GfInterval &interval, std::vector< double > *times)
Populates the given vector, times with the union of all the authored sample times in the GfInterval...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
USD_API bool SetConnections(const SdfPathVector &sources) const
Make the authoring layer's opinion of the connection list explicit, and set exactly to sources...
USD_API TfToken GetRoleName() const
Return the roleName for this attribute's typeName.
USD_API size_t GetNumTimeSamples() const
Returns the number of time samples that have been authored.