HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SdfSpec Class Reference

#include <spec.h>

+ Inheritance diagram for SdfSpec:

Public Member Functions

SDF_API SdfSpecoperator= (const SdfSpec &other)
 
SDF_API ~SdfSpec ()
 
SdSpec generic API
SDF_API const SdfSchemaBaseGetSchema () const
 Returns the SdfSchemaBase for the layer that owns this spec. More...
 
SDF_API SdfSpecType GetSpecType () const
 
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
 
SDF_API std::vector< TfTokenGetMetaDataInfoKeys () const
 
SDF_API TfToken GetMetaDataDisplayGroup (TfToken const &key) const
 
SDF_API VtValue GetInfo (const TfToken &key) const
 
SDF_API void SetInfo (const TfToken &key, const VtValue &value)
 
SDF_API void SetInfoDictionaryValue (const TfToken &dictionaryKey, const TfToken &entryKey, const VtValue &value)
 
SDF_API bool HasInfo (const TfToken &key) const
 
SDF_API void ClearInfo (const TfToken &key)
 
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
 
Field-based Generic API
SDF_API std::vector< TfTokenListFields () const
 Returns all fields with values. More...
 
SDF_API bool HasField (const TfToken &name) const
 
template<class T >
bool HasField (const TfToken &name, T *value) const
 
SDF_API VtValue GetField (const TfToken &name) const
 Returns a field value by name. More...
 
template<typename T >
T GetFieldAs (const TfToken &name, const T &defaultValue=T()) const
 
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 49 of file spec.h.

Constructor & Destructor Documentation

SDF_API SdfSpec::~SdfSpec ( )

Member Function Documentation

bool SdfSpec::_DeleteSpec ( const SdfPath path)
protected
bool SdfSpec::_MoveSpec ( const SdfPath oldPath,
const SdfPath newPath 
) const
protected
SDF_API bool SdfSpec::ClearField ( const TfToken name)

Clears a field.

SDF_API void SdfSpec::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.

SDF_API const VtValue& SdfSpec::GetFallbackForInfo ( const TfToken key) const

Returns the fallback for the info with the given key.

SDF_API VtValue SdfSpec::GetField ( const TfToken name) const

Returns a field value by name.

template<typename T >
T SdfSpec::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 222 of file spec.h.

SDF_API VtValue SdfSpec::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.

SDF_API SdfLayerHandle SdfSpec::GetLayer ( ) const

Returns the layer that this object belongs to.

SDF_API TfToken SdfSpec::GetMetaDataDisplayGroup ( TfToken const &  key) const

Returns this metadata key's displayGroup.

SDF_API std::vector<TfToken> SdfSpec::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.

SDF_API SdfPath SdfSpec::GetPath ( ) const

Returns the scene path of this object.

SDF_API const SdfSchemaBase& SdfSpec::GetSchema ( ) const

Returns the SdfSchemaBase for the layer that owns this spec.

SDF_API SdfSpecType SdfSpec::GetSpecType ( ) const

Returns the SdfSpecType specifying the spec type this object represents.

SDF_API TfType SdfSpec::GetTypeForInfo ( const TfToken key) const

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

SDF_API bool SdfSpec::HasField ( const TfToken name) const

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

template<class T >
bool SdfSpec::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 204 of file spec.h.

SDF_API bool SdfSpec::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.

SDF_API bool SdfSpec::IsDormant ( ) const

Returns true if this object is invalid or expired.

SDF_API bool SdfSpec::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.

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

Returns all fields with values.

SDF_API std::vector<TfToken> SdfSpec::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.
SDF_API bool SdfSpec::operator< ( const SdfSpec rhs) const
SDF_API SdfSpec& SdfSpec::operator= ( const SdfSpec other)
SDF_API bool SdfSpec::operator== ( const SdfSpec rhs) const
SDF_API bool SdfSpec::PermissionToEdit ( ) const

Returns whether this object's layer can be edited.

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

Sets a field value as a boxed VtValue.

template<typename T >
bool SdfSpec::SetField ( const TfToken name,
const T value 
)
inline

Sets a field value of type T.

Definition at line 236 of file spec.h.

SDF_API void SdfSpec::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.

SDF_API void SdfSpec::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 SdfSpec::WriteToStream ( std::ostream &  ,
size_t  indent = 0 
) const

Writes this spec to the given stream.

Friends And Related Function Documentation

template<class HashState >
void TfHashAppend ( HashState &  h,
const SdfSpec x 
)
friend

Hash.

Definition at line 272 of file spec.h.


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