24 #ifndef PXR_USD_USD_PRIM_DEFINITION_H
25 #define PXR_USD_USD_PRIM_DEFINITION_H
28 #include "pxr/usd/usd/api.h"
29 #include "pxr/usd/usd/schemaRegistry.h"
36 #include "pxr/base/tf/hashmap.h"
38 PXR_NAMESPACE_OPEN_SCOPE
58 return _appliedAPISchemas;
69 return SdfSpecTypeUnknown;
113 return _HasField(attrName, SdfFieldKeys->Default, value);
120 return _ListMetadataFields(
TfToken());
135 return _HasField(
TfToken(), key, value);
148 const TfToken &keyPath, T* value)
const
153 return _HasFieldDictKey(
TfToken(), key, keyPath, value);
183 return _HasField(propName, key, value);
197 const TfToken &keyPath, T* value)
const
202 return _HasFieldDictKey(propName, key, keyPath, value);
234 bool FlattenTo(
const SdfLayerHandle &layer,
236 SdfSpecifier newSpecSpecifier = SdfSpecifierOver)
const;
245 SdfSpecifier newSpecSpecifier = SdfSpecifierOver)
const;
252 SdfSpecifier newSpecSpecifier = SdfSpecifierOver)
const;
273 primDef._HasField(propName, fieldName, value) :
274 primDef._HasFieldDictKey(propName, fieldName, keyPath, value);
281 bool _HasField(
const TfToken& propName,
286 return _GetSchematics()->
HasField(*path, fieldName, value);
292 bool _HasFieldDictKey(
const TfToken& propName,
299 *path, fieldName, keyPath, value);
310 return UsdSchemaRegistry::GetInstance()._schematics;
318 void _SetPrimSpec(
const SdfPrimSpecHandle &primSpec,
319 bool providesPrimMetadata);
323 const std::string &propPrefix =
"");
331 auto it = _propPathMap.insert(std::make_pair(name, schemaPath));
333 _properties.push_back(name);
335 it.first->second = schemaPath;
339 SdfPrimSpecHandle _primSpec;
343 using _PrimTypePropNameToPathMap =
344 TfHashMap<TfToken, SdfPath, TfToken::HashFunctor>;
345 _PrimTypePropNameToPathMap _propPathMap;
352 PXR_NAMESPACE_CLOSE_SCOPE
354 #endif //PXR_USD_USD_PRIM_DEFINITION_H
SDF_API bool HasField(const SdfPath &path, const TfToken &fieldName, VtValue *value=NULL) const
Return whether a value exists for the given path and fieldName.
USD_API bool FlattenTo(const SdfLayerHandle &layer, const SdfPath &path, SdfSpecifier newSpecSpecifier=SdfSpecifierOver) const
Copies the contents of this prim definition to a prim spec on the given layer at the given path...
SDF_API bool HasFieldDictKey(const SdfPath &path, const TfToken &fieldName, const TfToken &keyPath, VtValue *value=NULL) const
Return whether a value exists for the given path and fieldName and keyPath.
SDF_API SdfSpecType GetSpecType(const SdfPath &path) const
Return the spec type for path.
SDF_API SdfPropertySpecHandle GetPropertyAtPath(const SdfPath &path)
Returns a property at the given path.
USD_API std::string GetPropertyDocumentation(const TfToken &propName) const
Returns the documentation metadata defined by the prim definition for the property named propName if ...
SdfAttributeSpecHandle GetSchemaAttributeSpec(const TfToken &attrName) const
This is a convenience method.
USD_API std::string GetDocumentation() const
Returns the documentation metadata defined by the prim definition for the prim itself.
SdfSpecType GetSpecType(const TfToken &propName) const
Return the SdfSpecType for propName if it is a builtin property of the prim type represented by this ...
TfTokenVector ListMetadataFields() const
Returns the list of names of metadata fields that are defined by this prim definition for the prim it...
bool GetMetadataByDictKey(const TfToken &key, const TfToken &keyPath, T *value) const
Retrieves the value at keyPath from the fallback dictionary value for the dictionary metadata field n...
bool GetPropertyMetadataByDictKey(const TfToken &propName, const TfToken &key, const TfToken &keyPath, T *value) const
Retrieves the value at keyPath from the fallback dictionary value for the dictionary metadata field n...
Token for efficient comparison, assignment, and hashing of known strings.
const TfTokenVector & GetPropertyNames() const
Return the list of names of builtin properties for this prim definition.
bool GetPropertyMetadata(const TfToken &propName, const TfToken &key, T *value) const
Retrieves the fallback value for the metadata field named key, that is defined by this prim definitio...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
SdfSpecifier
An enum that identifies the possible specifiers for an SdfPrimSpec.
std::vector< TfToken > TfTokenVector
Convenience types.
SDF_API SdfRelationshipSpecHandle GetRelationshipAtPath(const SdfPath &path)
Returns a relationship at the given path.
SdfRelationshipSpecHandle GetSchemaRelationshipSpec(const TfToken &relName) const
This is a convenience method.
A path value used to locate objects in layers or scenegraphs.
bool GetAttributeFallbackValue(const TfToken &attrName, T *value) const
Retrieves the fallback value for the attribute named attrName and stores it in value if possible...
static USD_API bool IsDisallowedField(const TfToken &fieldName)
Returns true if the field fieldName cannot have fallback values specified in schemas.
SdfSpecType
An enum that specifies the type of an object.
TfTokenVector ListPropertyMetadataFields(const TfToken &propName) const
Returns the list of names of metadata fields that are defined by this prim definition for property pr...
Class representing the builtin definition of a prim given the schemas registered in the schema regist...
Container::mapped_type * TfMapLookupPtr(Container &map, Key const &key)
Checks if an item exists in a map or TfHashMap, without copying it.
SdfPropertySpecHandle GetSchemaPropertySpec(const TfToken &propName) const
Return the property spec that defines the fallback for the property named propName on prims of this p...
bool IsEmpty() const
Returns true iff this token contains the empty string "".
const TfTokenVector & GetAppliedAPISchemas() const
Return the list of names of the API schemas that have been applied to this prim definition in order...
bool GetMetadata(const TfToken &key, T *value) const
Retrieves the fallback value for the metadata field named key, that is defined by this prim definitio...
Singleton registry that provides access to schema type information and the prim definitions for regis...
SDF_API SdfAttributeSpecHandle GetAttributeAtPath(const SdfPath &path)
Returns an attribute at the given path.