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);
471 template <
typename T>
473 static_assert(!std::is_pointer<T>::value,
"");
474 static_assert(SdfValueTypeTraits<T>::IsValueType ||
475 std::is_same<T, SdfValueBlock>::value,
"");
476 return _Set(value, time);
634 friend class Usd_PrimData;
635 friend struct UsdPrim_AttrConnectionFinder;
640 :
UsdProperty(UsdTypeAttribute, prim, proxyPrimPath, attrName) {}
643 const Usd_PrimDataHandle &prim,
646 :
UsdProperty(objType, prim, proxyPrimPath, propName) {}
648 SdfAttributeSpecHandle
655 SdfAttributeSpecHandle _CreateSpec()
const;
660 template <
typename T>
663 template <
typename T>
667 _GetPathForAuthoring(
const SdfPath &path, std::string* whyNot)
const;
670 PXR_NAMESPACE_CLOSE_SCOPE
672 #endif // PXR_USD_USD_ATTRIBUTE_H 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 SdfVariability GetVariability() const
An attribute's variability expresses whether it is intended to have time-samples (SdfVariabilityVaryi...
bool Get(T *value, UsdTimeCode time=UsdTimeCode::Default()) const
Perform value resolution to fetch the value of this attribute at the requested UsdTimeCode time,...
UsdObjType
Enum values to represent the various Usd object types.
UsdListPosition
Specifies a position to add items to lists.
USD_API bool AddConnection(const SdfPath &source, UsdListPosition position=UsdListPositionBackOfPrependList) const
Adds source to the list of connections, in the position specified by position.
USD_API bool SetConnections(const SdfPathVector &sources) const
Make the authoring layer's opinion of the connection list explicit, and set exactly to sources.
Object for efficiently making repeated queries for attribute values.
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 HasAuthoredConnections() const
Return true if this attribute has any authored opinions regarding connections.
USD_API TfToken GetColorSpace() const
Gets the color space in which the attribute is authored.
Represents a value type name, i.e.
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.
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,...
UsdAttribute()
Construct an invalid attribute.
USD_API TfToken GetRoleName() const
Return the roleName for this attribute's typeName.
USD_API bool ClearDefault() const
Shorthand for ClearAtTime(UsdTimeCode::Default()).
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...
USD_API bool ClearColorSpace() const
Clears authored color-space value on the attribute.
Token for efficient comparison, assignment, and hashing of known strings.
USD_API bool HasAuthoredValueOpinion() const
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 ...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
USD_API bool GetTimeSamplesInInterval(const GfInterval &interval, std::vector< double > *times) const
Populates a vector with authored sample times in interval.
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 ...
A basic mathematical interval class.
A path value used to locate objects in layers or scenegraphs.
USD_API void SetColorSpace(const TfToken &colorSpace) const
Sets the color space of the attribute to colorSpace.
USD_API bool GetTimeSamples(std::vector< double > *times) const
Populates a vector with authored sample times.
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 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.
SdfVariability
An enum that identifies variability types for attributes.
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 GetConnections(SdfPathVector *sources) const
Compose this attribute's connections and fill sources with the result.
USD_API void Block() const
Remove all time samples on an attribute and author a block default value.
USD_API bool HasFallbackValue() const
Return true if this attribute has a fallback value provided by a registered schema.
Base class for UsdAttribute and UsdRelationship scenegraph objects.
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
USD_API size_t GetNumTimeSamples() const
Returns the number of time samples that have been authored.
USD_API UsdResolveInfo GetResolveInfo() const
Perform value resolution to determine the source of the resolved value of this attribute at any non-d...
The position at the back of the prepend list.
USD_API bool ClearConnections() const
Remove all opinions about the connections list from the current edit target.
USD_API SdfValueTypeName GetTypeName() const
Return the "scene description" value type name for this attribute.
The base class for all schema types in Usd.
USD_API bool HasAuthoredValue() const
Return true if this attribute has either an authored default value or authored time samples.
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 Clear() const
Clears the authored default value and all time samples for this attribute at the current EditTarget a...