7#ifndef PXR_USD_SDF_SPEC_H
8#define PXR_USD_SDF_SPEC_H
13#include "pxr/usd/sdf/api.h"
14#include "pxr/usd/sdf/abstractData.h"
15#include "pxr/usd/sdf/identity.h"
16#include "pxr/usd/sdf/declareSpec.h"
17#include "pxr/usd/sdf/schema.h"
19#include "pxr/base/vt/value.h"
22#include "pxr/base/tf/type.h"
26PXR_NAMESPACE_OPEN_SCOPE
167 bool IsInert(
bool ignoreChildren =
false)
const;
194 return _HasField(name, &outValue);
204 template <
typename T>
218 template <
typename T>
233 SDF_API
bool operator==(
const SdfSpec& rhs)
const;
234 SDF_API
bool operator<(
const SdfSpec& rhs)
const;
239 template <
class HashState>
247 bool _MoveSpec(
const SdfPath &oldPath,
const SdfPath &newPath)
const;
248 bool _DeleteSpec(
const SdfPath &path);
254template <
class HashState>
255void TfHashAppend(HashState &h,
const SdfSpec& x) {
256 h.Append(x._id.get());
259inline size_t hash_value(
const SdfSpec &x) {
263PXR_NAMESPACE_CLOSE_SCOPE
The fully-typed container for a field value in an SdfAbstractData.
A type-erased container for a field value in an SdfAbstractData.
A path value used to locate objects in layers or scenegraphs.
Generic class that provides information about scene description fields but doesn't actually provide a...
Base class for all Sdf spec classes.
T GetFieldAs(const TfToken &name, const T &defaultValue=T()) const
Returns a field value by name.
SDF_API bool HasField(const TfToken &name) const
Returns true if the spec has a non-empty value with field name name.
SDF_API bool IsDormant() const
Returns true if this object is invalid or expired.
friend void TfHashAppend(HashState &h, const SdfSpec &x)
Hash.
SDF_API bool IsInert(bool ignoreChildren=false) const
Returns whether this object has no significant data.
SDF_API const VtValue & GetFallbackForInfo(const TfToken &key) const
Returns the fallback for the info with the given key.
SDF_API VtValue GetField(const TfToken &name) const
Returns a field value by name.
SDF_API const SdfSchemaBase & GetSchema() const
Returns the SdfSchemaBase for the layer that owns this spec.
SDF_API std::vector< TfToken > ListFields() const
Returns all fields with values.
SDF_API bool WriteToStream(std::ostream &, size_t indent=0) const
Writes this spec to the given stream.
bool SetField(const TfToken &name, const T &value)
Sets a field value of type T.
SDF_API SdfLayerHandle GetLayer() const
Returns the layer that this object belongs to.
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 bool ClearField(const TfToken &name)
Clears a field.
SDF_API TfToken GetMetaDataDisplayGroup(TfToken const &key) const
Returns this metadata key's displayGroup.
SDF_API std::vector< TfToken > GetMetaDataInfoKeys() const
Returns the list of metadata info keys for this object.
SDF_API SdfPath GetPath() const
Returns the scene path of this object.
SDF_API bool SetField(const TfToken &name, const VtValue &value)
Sets a field value as a boxed VtValue.
SDF_API SdfSpecType GetSpecType() const
Returns the SdfSpecType specifying the spec type this object represents.
SDF_API VtValue GetInfo(const TfToken &key) const
Gets the value for the given metadata key.
SDF_API TfType GetTypeForInfo(const TfToken &key) const
Returns the data type for the info with the given key.
SDF_API bool PermissionToEdit() const
Returns whether this object's layer can be edited.
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 std::vector< TfToken > ListInfoKeys() const
Returns the full list of info keys currently set on this object.
SDF_API void SetInfo(const TfToken &key, const VtValue &value)
Sets the value for the given metadata key.
SDF_API void ClearInfo(const TfToken &key)
Clears the value for scene spec info with the given key.
SDF_API bool HasInfo(const TfToken &key) const
Returns whether there is a setting for the scene spec info with the given key.
A user-extensible hashing mechanism for use with runtime hash tables.
Token for efficient comparison, assignment, and hashing of known strings.
TfType represents a dynamic runtime type.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
bool IsEmpty() const
Returns true iff this value is empty.
bool IsHolding() const
Return true if this value is holding an object of type T, false otherwise.
T const & UncheckedGet() const &
Returns a const reference to the held object if the held object is of type T.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
SdfSpecType
An enum that specifies the type of an object.