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" 37 #include <unordered_map> 39 PXR_NAMESPACE_OPEN_SCOPE
59 return _appliedAPISchemas;
67 if (
const SdfPath *path = _GetPropertySpecPath(propName)) {
70 return SdfSpecTypeUnknown;
78 if (
const SdfPath *path = _GetPropertySpecPath(propName)) {
89 if (
const SdfPath *path = _GetPropertySpecPath(attrName)) {
100 if (
const SdfPath *path = _GetPropertySpecPath(relName)) {
114 return _HasField(attrName, SdfFieldKeys->Default, value);
121 return _ListMetadataFields(
TfToken());
136 return _HasField(
TfToken(), key, value);
149 const TfToken &keyPath, T* value)
const 154 return _HasFieldDictKey(
TfToken(), key, keyPath, value);
184 return _HasField(propName, key, value);
198 const TfToken &keyPath, T* value)
const 203 return _HasFieldDictKey(propName, key, keyPath, value);
235 bool FlattenTo(
const SdfLayerHandle &layer,
237 SdfSpecifier newSpecSpecifier = SdfSpecifierOver)
const;
246 SdfSpecifier newSpecSpecifier = SdfSpecifierOver)
const;
253 SdfSpecifier newSpecSpecifier = SdfSpecifierOver)
const;
274 primDef._HasField(propName, fieldName, value) :
275 primDef._HasFieldDictKey(propName, fieldName, keyPath, value);
282 bool _HasField(
const TfToken& propName,
286 if (
const SdfPath *path = _GetPropertySpecPath(propName)) {
287 return _GetSchematics()->
HasField(*path, fieldName, value);
293 bool _HasFieldDictKey(
const TfToken& propName,
298 if (
const SdfPath *path = _GetPropertySpecPath(propName)) {
300 *path, fieldName, keyPath, value);
314 return UsdSchemaRegistry::GetInstance()._schematics;
318 const SdfPath *_GetPropertySpecPath(
const TfToken& propName)
const 334 std::vector<std::pair<TfToken, SdfPath>> &&propNameToPathVec);
337 void _ComposePropertiesFromPrimDef(
339 bool useWeakerPropertyForTypeConflict,
340 const std::string &instanceName =
"");
347 using _PrimTypePropNameToPathMap =
348 std::unordered_map<TfToken, SdfPath, TfToken::HashFunctor>;
349 _PrimTypePropNameToPathMap _propPathMap;
356 PXR_NAMESPACE_CLOSE_SCOPE
358 #endif //PXR_USD_USD_PRIM_DEFINITION_H bool IsEmpty() const
Returns true iff this token contains the empty string "".
const TfTokenVector & GetPropertyNames() const
Return the list of names of builtin properties for this prim definition.
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 ListPropertyMetadataFields(const TfToken &propName) const
Returns the list of names of metadata fields that are defined by this prim definition for property pr...
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.
SdfPropertySpecHandle GetSchemaPropertySpec(const TfToken &propName) const
Return the property spec that defines the fallback for the property named propName on prims of this p...
SDF_API SdfPropertySpecHandle GetPropertyAtPath(const SdfPath &path)
Returns a property at the given path.
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...
SdfRelationshipSpecHandle GetSchemaRelationshipSpec(const TfToken &relName) const
This is a convenience method.
USD_API std::string GetPropertyDocumentation(const TfToken &propName) const
Returns the documentation metadata defined by the prim definition for the property named propName if ...
Token for efficient comparison, assignment, and hashing of known strings.
const TfTokenVector & GetAppliedAPISchemas() const
Return the list of names of the API schemas that have been applied to this prim definition in order.
USD_API std::string GetDocumentation() const
Returns the documentation metadata defined by the prim definition for the prim itself.
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.
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.
A path value used to locate objects in layers or scenegraphs.
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 GetMetadata(const TfToken &key, T *value) const
Retrieves the fallback value for the metadata field named key, that is defined by this prim definitio...
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.
SdfAttributeSpecHandle GetSchemaAttributeSpec(const TfToken &attrName) const
This is a convenience method.
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.
TfTokenVector ListMetadataFields() const
Returns the list of names of metadata fields that are defined by this prim definition for the prim it...
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.
SDF_API SdfSpecType GetSpecType(const SdfPath &path) const
Return the spec type for path.
bool GetAttributeFallbackValue(const TfToken &attrName, T *value) const
Retrieves the fallback value for the attribute named attrName and stores it in value if possible.