SdfSpec Class Reference

Base class for all Sdf spec classes. More...

+ Inheritance diagram for SdfSpec:

Public Member Functions

SDF_API SdfSpecoperator= (const SdfSpec &other)
 
SdSpec generic API
SDF_API const SdfSchemaBaseGetSchema () const
 Returns the SdfSchemaBase for the layer that owns this spec. More...
 
SDF_API SdfSpecType GetSpecType () const
 Returns the SdfSpecType specifying the spec type this object represents. More...
 
SDF_API bool IsDormant () const
 Returns true if this object is invalid or expired. More...
 
SDF_API SdfLayerHandle GetLayer () const
 Returns the layer that this object belongs to. More...
 
SDF_API SdfPath GetPath () const
 Returns the scene path of this object. More...
 
SDF_API bool PermissionToEdit () const
 Returns whether this object's layer can be edited. More...
 
SDF_API std::vector< TfTokenListInfoKeys () const
 Returns the full list of info keys currently set on this object. More...
 
SDF_API std::vector< TfTokenGetMetaDataInfoKeys () const
 Returns the list of metadata info keys for this object. More...
 
SDF_API TfToken GetMetaDataDisplayGroup (TfToken const &key) const
 Returns this metadata key's displayGroup. More...
 
SDF_API VtValue GetInfo (const TfToken &key) const
 Gets the value for the given metadata key. More...
 
SDF_API void SetInfo (const TfToken &key, const VtValue &value)
 Sets the value for the given metadata key. More...
 
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. More...
 
SDF_API bool HasInfo (const TfToken &key) const
 Returns whether there is a setting for the scene spec info with the given key. More...
 
SDF_API void ClearInfo (const TfToken &key)
 Clears the value for scene spec info with the given key. More...
 
SDF_API TfType GetTypeForInfo (const TfToken &key) const
 Returns the data type for the info with the given key. More...
 
SDF_API const VtValueGetFallbackForInfo (const TfToken &key) const
 Returns the fallback for the info with the given key. More...
 
SDF_API bool WriteToStream (std::ostream &, size_t indent=0) const
 Writes this spec to the given stream. More...
 
SDF_API bool IsInert (bool ignoreChildren=false) const
 Returns whether this object has no significant data. More...
 
Field-based Generic API
SDF_API std::vector< TfTokenListFields () const
 Returns all fields with values. More...
 
SDF_API bool HasField (const TfToken &name) const
 Returns true if the spec has a non-empty value with field name name. More...
 
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. More...
 
SDF_API VtValue GetField (const TfToken &name) const
 Returns a field value by name. More...
 
template<typename T >
GetFieldAs (const TfToken &name, const T &defaultValue=T()) const
 Returns a field value by name. More...
 
SDF_API bool SetField (const TfToken &name, const VtValue &value)
 Sets a field value as a boxed VtValue. More...
 
template<typename T >
bool SetField (const TfToken &name, const T &value)
 Sets a field value of type T. More...
 
SDF_API bool ClearField (const TfToken &name)
 Clears a field. More...
 
Comparison operators
SDF_API bool operator== (const SdfSpec &rhs) const
 
SDF_API bool operator< (const SdfSpec &rhs) const
 

Protected Member Functions

bool _MoveSpec (const SdfPath &oldPath, const SdfPath &newPath) const
 
bool _DeleteSpec (const SdfPath &path)
 

Friends

template<class HashState >
void TfHashAppend (HashState &h, const SdfSpec &x)
 Hash. More...
 

Detailed Description

Base class for all Sdf spec classes.

Definition at line 52 of file spec.h.

Member Function Documentation

◆ ClearField()

SDF_API bool ClearField ( const TfToken name)

Clears a field.

◆ ClearInfo()

SDF_API void ClearInfo ( const TfToken key)

Clears the value for scene spec info with the given key.

After calling this, HasInfo() will return false. To make HasInfo() return true just set a value for that scene spec info.

This is interim API which is likely to change. Only editors with an immediate specific need (like the Inspector) should use this API.

◆ GetFallbackForInfo()

SDF_API const VtValue& GetFallbackForInfo ( const TfToken key) const

Returns the fallback for the info with the given key.

◆ GetField()

SDF_API VtValue GetField ( const TfToken name) const

Returns a field value by name.

◆ GetFieldAs()

T GetFieldAs ( const TfToken name,
const T &  defaultValue = T() 
) const
inline

Returns a field value by name.

If the object is invalid, or the value doesn't exist, isn't set, or isn't of the given type then returns defaultValue.

Definition at line 225 of file spec.h.

◆ GetInfo()

SDF_API VtValue GetInfo ( const TfToken key) const

Gets the value for the given metadata key.

This is interim API which is likely to change. Only editors with an immediate specific need (like the Inspector) should use this API.

◆ GetLayer()

SDF_API SdfLayerHandle GetLayer ( ) const

Returns the layer that this object belongs to.

◆ GetMetaDataDisplayGroup()

SDF_API TfToken GetMetaDataDisplayGroup ( TfToken const &  key) const

Returns this metadata key's displayGroup.

◆ GetMetaDataInfoKeys()

SDF_API std::vector<TfToken> GetMetaDataInfoKeys ( ) const

Returns the list of metadata info keys for this object.

This is not the complete list of keys, it is only those that should be considered to be metadata by inspectors or other presentation UI.

This is interim API which is likely to change. Only editors with an immediate specific need (like the Inspector) should use this API.

◆ GetPath()

SDF_API SdfPath GetPath ( ) const

Returns the scene path of this object.

◆ GetSchema()

SDF_API const SdfSchemaBase& GetSchema ( ) const

Returns the SdfSchemaBase for the layer that owns this spec.

◆ GetSpecType()

SDF_API SdfSpecType GetSpecType ( ) const

Returns the SdfSpecType specifying the spec type this object represents.

◆ GetTypeForInfo()

SDF_API TfType GetTypeForInfo ( const TfToken key) const

Returns the data type for the info with the given key.

◆ HasField() [1/2]

SDF_API bool HasField ( const TfToken name) const

Returns true if the spec has a non-empty value with field name name.

◆ HasField() [2/2]

bool HasField ( const TfToken name,
T *  value 
) const
inline

Returns true if the object has a non-empty value with name name and type T.

If value ptr is provided, returns the value found.

Definition at line 207 of file spec.h.

◆ HasInfo()

SDF_API bool HasInfo ( const TfToken key) const

Returns whether there is a setting for the scene spec info with the given key.

When asked for a value for one of its scene spec info, a valid value will always be returned. But if this API returns false for a scene spec info, the value of that info will be the defined default value.

When dealing with a composedLayer, it is not necessary to worry about whether a scene spec info "has a value" because the composed layer will always have a valid value, even if it is the default.

A spec may or may not have an expressed value for some of its scene spec info.

This is interim API which is likely to change. Only editors with an immediate specific need (like the Inspector) should use this API.

◆ IsDormant()

SDF_API bool IsDormant ( ) const

Returns true if this object is invalid or expired.

◆ IsInert()

SDF_API bool IsInert ( bool  ignoreChildren = false) const

Returns whether this object has no significant data.

"Significant" here means that the object contributes opinions to a scene. If this spec has any child scenegraph objects (e.g., prim or property spec), it will be considered significant even if those child objects are not. However, if ignoreChildren is true, these child objects will be ignored.

◆ ListFields()

SDF_API std::vector<TfToken> ListFields ( ) const

Returns all fields with values.

◆ ListInfoKeys()

SDF_API std::vector<TfToken> ListInfoKeys ( ) const

Returns the full list of info keys currently set on this object.

Note
This does not include fields that represent names of children.

◆ PermissionToEdit()

SDF_API bool PermissionToEdit ( ) const

Returns whether this object's layer can be edited.

◆ SetField() [1/2]

SDF_API bool SetField ( const TfToken name,
const VtValue value 
)

Sets a field value as a boxed VtValue.

◆ SetField() [2/2]

bool SetField ( const TfToken name,
const T &  value 
)
inline

Sets a field value of type T.

Definition at line 239 of file spec.h.

◆ SetInfo()

SDF_API void SetInfo ( const TfToken key,
const VtValue value 
)

Sets the value for the given metadata key.

It is an error to pass a value that is not the correct type for that given key.

This is interim API which is likely to change. Only editors with an immediate specific need (like the Inspector) should use this API.

◆ SetInfoDictionaryValue()

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.

◆ WriteToStream()

SDF_API bool WriteToStream ( std::ostream &  ,
size_t  indent = 0 
) const

Writes this spec to the given stream.

Friends And Related Function Documentation

◆ TfHashAppend

void TfHashAppend ( HashState &  h,
const SdfSpec x 
)
friend

Hash.

Definition at line 275 of file spec.h.


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