7#ifndef PXR_USD_USD_ATTRIBUTE_H
8#define PXR_USD_USD_ATTRIBUTE_H
11#include "pxr/usd/usd/api.h"
13#include "pxr/usd/usd/property.h"
16#include "pxr/usd/sdf/abstractData.h"
17#include "pxr/usd/sdf/path.h"
19#include "pxr/base/vt/value.h"
26PXR_NAMESPACE_OPEN_SCOPE
33typedef std::vector<UsdAttribute> UsdAttributeVector;
250 std::vector<double>* times)
const;
272 std::vector<double> *times);
295 const std::vector<UsdAttribute> &attrs,
297 std::vector<double> *times);
340 bool* hasTimeSamples)
const;
419 template <
typename T>
421 static_assert(!std::is_const<T>::value,
"");
422 static_assert(SdfValueTypeTraits<T>::IsValueType,
"");
423 return _Get(value, time);
460 template <
typename T>
462 static_assert(!std::is_pointer<T>::value,
"");
463 static_assert(SdfValueTypeTraits<T>::IsValueType ||
464 std::is_same<T, SdfValueBlock>::value,
"");
465 return _Set(value, time);
652 friend class Usd_PrimData;
653 friend struct UsdPrim_AttrConnectionFinder;
658 :
UsdProperty(UsdTypeAttribute, prim, proxyPrimPath, attrName) {}
661 const Usd_PrimDataHandle &prim,
664 :
UsdProperty(objType, prim, proxyPrimPath, propName) {}
666 SdfAttributeSpecHandle
673 SdfAttributeSpecHandle _CreateSpec()
const;
678 template <
typename T>
681 template <
typename T>
685 _GetPathForAuthoring(
const SdfPath &path, std::string* whyNot)
const;
688PXR_NAMESPACE_CLOSE_SCOPE
A basic mathematical interval class.
A path value used to locate objects in layers or scenegraphs.
Represents a value type name, i.e.
Token for efficient comparison, assignment, and hashing of known strings.
A mathematical description of a curved function from time to value.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
USD_API bool GetTimeSamples(std::vector< double > *times) const
Populates a vector with authored sample times.
USD_API TfToken GetRoleName() const
Return the roleName for this attribute's typeName.
USD_API bool Set(const char *value, UsdTimeCode time=UsdTimeCode::Default()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
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.
USD_API UsdResolveInfo GetResolveInfo(UsdTimeCode time) const
Perform value resolution to determine the source of the resolved value of this attribute at the reque...
USD_API bool ClearDefault() const
Shorthand for ClearAtTime(UsdTimeCode::Default()).
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 GetTimeSamplesInInterval(const GfInterval &interval, std::vector< double > *times) const
Populates a vector with authored sample times in interval.
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 bool HasSpline() const
IN DEVELOPMENT.
USD_API bool HasAuthoredValueOpinion() const
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...
USD_API bool Set(const VtValue &value, UsdTimeCode time=UsdTimeCode::Default()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API UsdResolveInfo GetResolveInfo() const
Perform value resolution to determine the source of the resolved value of this attribute at any non-d...
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...
USD_API TfToken GetColorSpace() const
Gets the color space in which the attribute is authored if it has been explicitly set.
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,...
USD_API bool RemoveConnection(const SdfPath &source) const
Removes target from the list of targets.
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 bool ClearConnections() const
Remove all opinions about the connections list from the current edit target.
USD_API TsSpline GetSpline() const
IN DEVELOPMENT.
USD_API SdfVariability GetVariability() const
An attribute's variability expresses whether it is intended to have time-samples (SdfVariabilityVaryi...
USD_API bool HasValue() const
Return true if this attribute has an authored default value, authored time samples or a fallback valu...
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 SdfValueTypeName GetTypeName() const
Return the "scene description" value type name for this attribute.
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 void Block() const
Remove all time samples on an attribute and author a block default value.
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...
bool Get(T *value, UsdTimeCode time=UsdTimeCode::Default()) const
Perform value resolution to fetch the value of this attribute at the requested UsdTimeCode time,...
USD_API bool Get(VtValue *value, UsdTimeCode time=UsdTimeCode::Default()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USD_API bool SetSpline(const TsSpline &spline)
IN DEVELOPMENT.
USD_API bool HasColorSpace() const
Returns whether color space is authored on the attribute.
USD_API bool HasFallbackValue() const
Return true if this attribute has a fallback value provided by a registered schema.
USD_API bool GetConnections(SdfPathVector *sources) const
Compose this attribute's connections and fill sources with the result.
USD_API void SetColorSpace(const TfToken &colorSpace) const
Sets the color space of the attribute to colorSpace.
USD_API size_t GetNumTimeSamples() const
Returns the number of time samples that have been authored.
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 HasAuthoredValue() const
Return true if this attribute has either an authored default value or authored time samples.
UsdAttribute()
Construct an invalid attribute.
Object for efficiently making repeated queries for attribute values.
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 ...
Base class for UsdAttribute and UsdRelationship scenegraph objects.
Container for information about the source of an attribute's value, i.e.
The base class for all schema types in Usd.
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
UsdListPosition
Specifies a position to add items to lists.
@ UsdListPositionBackOfPrependList
The position at the back of the prepend list.
UsdObjType
Enum values to represent the various Usd object types.
SdfVariability
An enum that identifies variability types for attributes.