This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SdfAttributeSpec Class Reference

A subclass of SdfPropertySpec that holds typed data. More...

#include <attributeSpec.h>

+ Inheritance diagram for SdfAttributeSpec:

Public Types

typedef SdfAttributeSpec This
 
typedef SdfPropertySpec Parent
 

Public Member Functions

Connections
SDF_API SdfConnectionsProxy GetConnectionPathList () const
 Returns a proxy for editing the attribute's connection paths.
 
SDF_API bool HasConnectionPaths () const
 Returns true if any connection paths are set on this attribute.
 
SDF_API void ClearConnectionPaths ()
 Clears the connection paths for this attribute.
 
Attribute value API
SDF_API VtTokenArray GetAllowedTokens () const
 Returns the allowed tokens metadata for this attribute.
 
SDF_API void SetAllowedTokens (const VtTokenArray &allowedTokens)
 Sets the allowed tokens metadata for this attribute.
 
SDF_API bool HasAllowedTokens () const
 Returns true if allowed tokens metadata is set for this attribute.
 
SDF_API void ClearAllowedTokens ()
 Clears the allowed tokens metadata for this attribute.
 
SDF_API TfEnum GetDisplayUnit () const
 Returns the display unit of the attribute.
 
SDF_API void SetDisplayUnit (const TfEnum &displayUnit)
 Sets the display unit of the attribute.
 
SDF_API bool HasDisplayUnit () const
 Returns true if a display unit is set for this attribute.
 
SDF_API void ClearDisplayUnit ()
 Clears the display unit of the attribute.
 
SDF_API TfToken GetColorSpace () const
 Returns the color space in which a color or texture valued attribute is authored.
 
SDF_API void SetColorSpace (const TfToken &colorSpace)
 Sets the color space in which a color or texture valued attribute is authored.
 
SDF_API bool HasColorSpace () const
 Returns true if this attribute has a colorSpace value authored.
 
SDF_API void ClearColorSpace ()
 Clears the colorSpace metadata value set on this attribute.
 
Spec properties
SDF_API TfToken GetRoleName () const
 Returns the roleName for this attribute's typeName.
 
Time-sample API

Returns the entire set of time samples.

SDF_API SdfTimeSampleMap GetTimeSampleMap () const
 
SDF_API std::set< double > ListTimeSamples () const
 
SDF_API size_t GetNumTimeSamples () const
 
SDF_API bool GetBracketingTimeSamples (double time, double *tLower, double *tUpper) const
 
SDF_API bool QueryTimeSample (double time, VtValue *value=NULL) const
 
SDF_API bool QueryTimeSample (double time, SdfAbstractDataValue *value) const
 
template<class T >
bool QueryTimeSample (double time, T *data) const
 
SDF_API void SetTimeSample (double time, const VtValue &value)
 
SDF_API void SetTimeSample (double time, const SdfAbstractDataConstValue &value)
 
template<class T >
void SetTimeSample (double time, const T &value)
 
SDF_API void EraseTimeSample (double time)
 
- Public Member Functions inherited from SdfPropertySpec
SDF_API SdfSpecHandle GetOwner () const
 Returns the owner prim or relationship of this property.
 
SDF_API SdfDictionaryProxy GetCustomData () const
 Returns the property's custom data.
 
SDF_API SdfDictionaryProxy GetAssetInfo () const
 Returns the asset info dictionary for this property.
 
SDF_API void SetCustomData (const std::string &name, const VtValue &value)
 Sets a property custom data entry.
 
SDF_API void SetAssetInfo (const std::string &name, const VtValue &value)
 Sets a asset info entry for this property.
 
SDF_API std::string GetDisplayGroup () const
 Returns the displayGroup string for this property spec.
 
SDF_API void SetDisplayGroup (const std::string &value)
 Sets the displayGroup string for this property spec.
 
SDF_API std::string GetDisplayName () const
 Returns the displayName string for this property spec.
 
SDF_API void SetDisplayName (const std::string &value)
 Sets the displayName string for this property spec.
 
SDF_API std::string GetDocumentation () const
 Returns the documentation string for this property spec.
 
SDF_API void SetDocumentation (const std::string &value)
 Sets the documentation string for this property spec.
 
SDF_API bool GetHidden () const
 Returns whether this property spec will be hidden in browsers.
 
SDF_API void SetHidden (bool value)
 Sets whether this property spec will be hidden in browsers.
 
SDF_API SdfPermission GetPermission () const
 Returns the property's permission restriction.
 
SDF_API void SetPermission (SdfPermission value)
 Sets the property's permission restriction.
 
SDF_API std::string GetPrefix () const
 Returns the prefix string for this property spec.
 
SDF_API void SetPrefix (const std::string &value)
 Sets the prefix string for this property spec.
 
SDF_API std::string GetSuffix () const
 Returns the suffix string for this property spec.
 
SDF_API void SetSuffix (const std::string &value)
 Sets the suffix string for this property spec.
 
SDF_API std::string GetSymmetricPeer () const
 Returns the property's symmetric peer.
 
SDF_API void SetSymmetricPeer (const std::string &peerName)
 Sets the property's symmetric peer.
 
SDF_API SdfDictionaryProxy GetSymmetryArguments () const
 Returns the property's symmetry arguments.
 
SDF_API void SetSymmetryArgument (const std::string &name, const VtValue &value)
 Sets a property symmetry argument.
 
SDF_API TfToken GetSymmetryFunction () const
 Returns the property's symmetry function.
 
SDF_API void SetSymmetryFunction (const TfToken &functionName)
 Sets the property's symmetry function.
 
SDF_API TfType GetValueType () const
 Returns the TfType representing the value type this property holds.
 
SDF_API SdfValueTypeName GetTypeName () const
 Returns the name of the value type that this property holds.
 
SDF_API VtValue GetDefaultValue () const
 Returns the attribute's default value.
 
SDF_API bool SetDefaultValue (const VtValue &defaultValue)
 Sets the attribute's default value.
 
SDF_API bool HasDefaultValue () const
 Returns true if a default value is set for this attribute.
 
SDF_API void ClearDefaultValue ()
 Clear the attribute's default value.
 
SDF_API std::string GetComment () const
 Returns the comment string for this property spec.
 
SDF_API void SetComment (const std::string &value)
 Sets the comment string for this property spec.
 
SDF_API bool IsCustom () const
 Returns true if this spec declares a custom property.
 
SDF_API void SetCustom (bool custom)
 Sets whether this spec declares a custom property.
 
SDF_API SdfVariability GetVariability () const
 Returns the variability of the property.
 
SDF_API bool HasOnlyRequiredFields () const
 Returns true if this PropertySpec has no significant data other than just what is necessary for instantiation.
 
SDF_API const std::string & GetName () const
 Returns the property's name.
 
SDF_API TfToken GetNameToken () const
 Returns the property's name, as a token.
 
SDF_API bool CanSetName (const std::string &newName, std::string *whyNot) const
 Returns true if setting the property spec's name to newName will succeed.
 
SDF_API bool SetName (const std::string &newName, bool validate=true)
 Sets the property's name.
 
- Public Member Functions inherited from SdfSpec
SDF_API SdfSpecoperator= (const SdfSpec &other)
 
SDF_API const SdfSchemaBaseGetSchema () const
 Returns the SdfSchemaBase for the layer that owns this spec.
 
SDF_API SdfSpecType GetSpecType () const
 Returns the SdfSpecType specifying the spec type this object represents.
 
SDF_API bool IsDormant () const
 Returns true if this object is invalid or expired.
 
SDF_API SdfLayerHandle GetLayer () const
 Returns the layer that this object belongs to.
 
SDF_API SdfPath GetPath () const
 Returns the scene path of this object.
 
SDF_API bool PermissionToEdit () const
 Returns whether this object's layer can be edited.
 
SDF_API std::vector< TfTokenListInfoKeys () const
 Returns the full list of info keys currently set on this object.
 
SDF_API std::vector< TfTokenGetMetaDataInfoKeys () const
 Returns the list of metadata info keys for this object.
 
SDF_API TfToken GetMetaDataDisplayGroup (TfToken const &key) const
 Returns this metadata key's displayGroup.
 
SDF_API VtValue GetInfo (const TfToken &key) const
 Gets the value for the given metadata key.
 
SDF_API void SetInfo (const TfToken &key, const VtValue &value)
 Sets the value for the given metadata key.
 
SDF_API void SetInfoDictionaryValue (const TfToken &dictionaryKey, const TfToken &entryKey, const VtValue &value)
 Sets the value for entryKey to value within the dictionary with the given metadata key dictionaryKey.
 
SDF_API bool HasInfo (const TfToken &key) const
 Returns whether there is a setting for the scene spec info with the given key.
 
SDF_API void ClearInfo (const TfToken &key)
 Clears the value for scene spec info with the given key.
 
SDF_API TfType GetTypeForInfo (const TfToken &key) const
 Returns the data type for the info with the given key.
 
SDF_API const VtValueGetFallbackForInfo (const TfToken &key) const
 Returns the fallback for the info with the given key.
 
SDF_API bool WriteToStream (std::ostream &, size_t indent=0) const
 Writes this spec to the given stream.
 
SDF_API bool IsInert (bool ignoreChildren=false) const
 Returns whether this object has no significant data.
 
SDF_API std::vector< TfTokenListFields () const
 Returns all fields with values.
 
SDF_API bool HasField (const TfToken &name) const
 Returns true if the spec has a non-empty value with field name name.
 
template<class T >
bool HasField (const TfToken &name, T *value) const
 Returns true if the object has a non-empty value with name name and type T.
 
SDF_API VtValue GetField (const TfToken &name) const
 Returns a field value by name.
 
template<typename T >
GetFieldAs (const TfToken &name, const T &defaultValue=T()) const
 Returns a field value by name.
 
SDF_API bool SetField (const TfToken &name, const VtValue &value)
 Sets a field value as a boxed VtValue.
 
template<typename T >
bool SetField (const TfToken &name, const T &value)
 Sets a field value of type T.
 
SDF_API bool ClearField (const TfToken &name)
 Clears a field.
 
SDF_API bool operator== (const SdfSpec &rhs) const
 
SDF_API bool operator< (const SdfSpec &rhs) const
 

Static Public Member Functions

Spec construction
static SDF_API SdfAttributeSpecHandle New (const SdfPrimSpecHandle &owner, const std::string &name, const SdfValueTypeName &typeName, SdfVariability variability=SdfVariabilityVarying, bool custom=false)
 Constructs a new prim attribute instance.
 
- Static Public Member Functions inherited from SdfPropertySpec
static SDF_API bool IsValidName (const std::string &name)
 Returns true if the given name is considered a valid name for a property.
 

Additional Inherited Members

- Protected Member Functions inherited from SdfSpec
bool _MoveSpec (const SdfPath &oldPath, const SdfPath &newPath) const
 
bool _DeleteSpec (const SdfPath &path)
 

Detailed Description

A subclass of SdfPropertySpec that holds typed data.

Attributes are typed data containers that can optionally hold any and all of the following:

  • A single default value.
  • An array of knot values describing how the value varies over time.
  • A dictionary of posed values, indexed by name.

The values contained in an attribute must all be of the same type. In the Python API the typeName property holds the attribute type. In the C++ API, you can get the attribute type using the GetTypeName() method. In addition, all values, including all knot values, must be the same shape. For information on shapes, see the VtShape class reference in the C++ documentation.

Definition at line 39 of file attributeSpec.h.

Member Typedef Documentation

◆ Parent

Definition at line 45 of file attributeSpec.h.

◆ This

Definition at line 44 of file attributeSpec.h.

Member Function Documentation

◆ ClearAllowedTokens()

SDF_API void ClearAllowedTokens ( )

Clears the allowed tokens metadata for this attribute.

◆ ClearColorSpace()

SDF_API void ClearColorSpace ( )

Clears the colorSpace metadata value set on this attribute.

◆ ClearConnectionPaths()

SDF_API void ClearConnectionPaths ( )

Clears the connection paths for this attribute.

◆ ClearDisplayUnit()

SDF_API void ClearDisplayUnit ( )

Clears the display unit of the attribute.

◆ GetAllowedTokens()

SDF_API VtTokenArray GetAllowedTokens ( ) const

Returns the allowed tokens metadata for this attribute.

Consumers may use this metadata to define a set of predefined options for this attribute's value. However, this metadata is purely advisory. It is up to the consumer to perform any validation against this set of tokens, if desired.

◆ GetColorSpace()

SDF_API TfToken GetColorSpace ( ) const

Returns the color space in which a color or texture valued attribute is authored.

Refer to GfColorSpaceNames for the list of built in color spaces.

◆ GetConnectionPathList()

SDF_API SdfConnectionsProxy GetConnectionPathList ( ) const

Returns a proxy for editing the attribute's connection paths.

The returned proxy, which is an SdfListEditorProxy, modifies the SdfListOp that represents this attribute's connections.

◆ GetDisplayUnit()

SDF_API TfEnum GetDisplayUnit ( ) const

Returns the display unit of the attribute.

◆ GetRoleName()

SDF_API TfToken GetRoleName ( ) const

Returns the roleName for this attribute's typeName.

If the typeName has no roleName, return empty token.

◆ HasAllowedTokens()

SDF_API bool HasAllowedTokens ( ) const

Returns true if allowed tokens metadata is set for this attribute.

◆ HasColorSpace()

SDF_API bool HasColorSpace ( ) const

Returns true if this attribute has a colorSpace value authored.

◆ HasConnectionPaths()

SDF_API bool HasConnectionPaths ( ) const

Returns true if any connection paths are set on this attribute.

◆ HasDisplayUnit()

SDF_API bool HasDisplayUnit ( ) const

Returns true if a display unit is set for this attribute.

◆ New()

static SDF_API SdfAttributeSpecHandle New ( const SdfPrimSpecHandle &  owner,
const std::string &  name,
const SdfValueTypeName typeName,
SdfVariability  variability = SdfVariabilityVarying,
bool  custom = false 
)
static

Constructs a new prim attribute instance.

Creates and returns a new attribute for the given prim. The owner will own the newly created attribute.

◆ QueryTimeSample()

bool QueryTimeSample ( double  time,
T *  data 
) const
inline

Definition at line 175 of file attributeSpec.h.

◆ SetAllowedTokens()

SDF_API void SetAllowedTokens ( const VtTokenArray &  allowedTokens)

Sets the allowed tokens metadata for this attribute.

◆ SetColorSpace()

SDF_API void SetColorSpace ( const TfToken colorSpace)

Sets the color space in which a color or texture valued attribute is authored.

◆ SetDisplayUnit()

SDF_API void SetDisplayUnit ( const TfEnum displayUnit)

Sets the display unit of the attribute.

◆ SetTimeSample()

void SetTimeSample ( double  time,
const T &  value 
)
inline

Definition at line 198 of file attributeSpec.h.


The documentation for this class was generated from the following file: