HDK
|
#include <collectionAPI.h>
Public Types | |
using | MembershipQuery = UsdCollectionMembershipQuery |
Static Public Attributes | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::MultipleApplyAPI |
![]() | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
![]() | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
Protected Member Functions | |
USD_API UsdSchemaKind | _GetSchemaKind () const override |
![]() | |
UsdAPISchemaBase (const UsdPrim &prim, const TfToken &instanceName) | |
UsdAPISchemaBase (const UsdSchemaBase &schemaObj, const TfToken &instanceName) | |
const TfToken & | _GetInstanceName () const |
USD_API bool | _IsCompatible () const override |
![]() | |
virtual UsdSchemaKind | _GetSchemaType () const |
const TfType & | _GetType () const |
USD_API UsdAttribute | _CreateAttr (TfToken const &attrName, SdfValueTypeName const &typeName, bool custom, SdfVariability variability, VtValue const &defaultValue, bool writeSparsely) const |
Friends | |
class | UsdSchemaRegistry |
This is a general purpose API schema, used to describe a collection of heterogeneous objects within the scene. "Objects" here may be prims or properties belonging to prims or other collections. It's an add-on schema that can be applied many times to a prim with different collection names.
A collection allows an enumeration of a set of paths to include and a set of paths to exclude. Whether the descendants of an included path are members of a collection are decided by its expansion rule (see below). If the collection excludes paths that are not descendents of included paths, the collection implicitly includes the root path </>. If such a collection also includes paths that are not descendants of the excluded paths, it is considered invalid, since the intention is ambiguous.
All the properties authored by the schema are namespaced under "collection:". The given name of the collection provides additional namespacing for the various per-collection properties, which include the following:
Implicit inclusion
In some scenarios it is useful to express a collection that includes everything except certain paths. To support this, a collection that has an exclude that is not a descendent of any include will include the root path </>.
Creating collections in C++
For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdTokens. So to set an attribute to the value "rightHanded", use UsdTokens->rightHanded as the value.
Definition at line 152 of file collectionAPI.h.
Definition at line 450 of file collectionAPI.h.
|
inlineexplicit |
Construct a UsdCollectionAPI on UsdPrim prim
with name name
. Equivalent to UsdCollectionAPI::Get( prim.GetStage(), prim.GetPath().AppendProperty( "collection:name"));
for a valid prim
, but will not immediately throw an error for an invalid prim
Definition at line 169 of file collectionAPI.h.
|
inlineexplicit |
Construct a UsdCollectionAPI on the prim held by schemaObj
with name name
. Should be preferred over UsdCollectionAPI(schemaObj.GetPrim(), name), as it preserves SchemaBase state.
Definition at line 178 of file collectionAPI.h.
|
virtual |
Destructor.
|
overrideprotectedvirtual |
Returns the kind of schema this class belongs to.
Reimplemented from UsdAPISchemaBase.
|
static |
Applies this multiple-apply API schema to the given prim
along with the given instance name, name
.
This information is stored by adding "CollectionAPI:<i>name</i>" to the token-valued, listOp metadata apiSchemas on the prim. For example, if name
is 'instance1', the token 'CollectionAPI:instance1' is added to 'apiSchemas'.
USD_API bool UsdCollectionAPI::BlockCollection | ( | ) | const |
Blocks the targets of the includes and excludes relationships of the collection, making it <* empty if "includeRoot" is false (or unset) or
|
static |
Returns true if this multiple-apply API schema can be applied, with the given instance name, name
, to the given prim
. If this schema can not be a applied the prim, this returns false and, if provided, populates whyNot
with the reason it can not be applied.
Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema.
Test whether a given name
contains the "collection:" prefix
|
static |
Returns all the usd objects that satisfy the predicate, pred
in the collection represented by the UsdCollectionMembershipQuery object, query
.
The results depends on the load state of the UsdStage, stage
.
|
static |
Returns all the paths that satisfy the predicate, pred
in the collection represented by the UsdCollectionMembershipQuery object, query
.
The result depends on the load state of the UsdStage, stage
.
USD_API UsdCollectionMembershipQuery UsdCollectionAPI::ComputeMembershipQuery | ( | ) | const |
Computes and returns a UsdCollectionMembershipQuery object which can be used to query inclusion or exclusion of paths in the collection.
USD_API void UsdCollectionAPI::ComputeMembershipQuery | ( | UsdCollectionMembershipQuery * | query | ) | const |
Populates the UsdCollectionMembershipQuery object with data from this collection, so it can be used to query inclusion or exclusion of paths.
USD_API UsdRelationship UsdCollectionAPI::CreateExcludesRel | ( | ) | const |
See GetExcludesRel(), and also Usd_Create_Or_Get_Property for when to use Get vs Create
USD_API UsdAttribute UsdCollectionAPI::CreateExpansionRuleAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetExpansionRuleAttr(), and also Usd_Create_Or_Get_Property for when to use Get vs Create. If specified, author defaultValue
as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely
is true
- the default for writeSparsely
is false
.
USD_API UsdAttribute UsdCollectionAPI::CreateIncludeRootAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetIncludeRootAttr(), and also Usd_Create_Or_Get_Property for when to use Get vs Create. If specified, author defaultValue
as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely
is true
- the default for writeSparsely
is false
.
USD_API UsdRelationship UsdCollectionAPI::CreateIncludesRel | ( | ) | const |
See GetIncludesRel(), and also Usd_Create_Or_Get_Property for when to use Get vs Create
Excludes or removes the given path, pathToExclude
from the collection.
If the collection is empty, the collection becomes one that includes all paths except the givne path. Otherwise, this does nothing if the path is not included in the collection.
This does not modify the expansion-rule of the collection. Hence, if the expansionRule is expandPrims or expandPrimsAndProperties, then the descendants of pathToExclude
will also be excluded from the collection, unless explicitly included.
|
static |
Return a UsdCollectionAPI holding the prim adhering to this schema at path
on stage
. If no prim exists at path
on stage
, or if the prim at that path does not adhere to this schema, return an invalid schema object. path
must be of the format <path>.collection:name .
This is shorthand for the following:
|
static |
Return a UsdCollectionAPI with name name
holding the prim prim
. Shorthand for UsdCollectionAPI(prim, name);
|
static |
Returns all the named collections on the given USD prim.
|
static |
Returns the collection represented by the given collection path, collectionPath
on the given USD stage.
|
static |
Returns the schema object representing a collection named name
on the given prim
.
Returns the canonical path that represents this collection. This points to a property named "collection:{collectionName}" on the prim defining the collection (which won't really exist as a property on the UsdStage, but will be used to refer to the collection). This is the path to be used to "include" this collection in another collection.
USD_API UsdRelationship UsdCollectionAPI::GetExcludesRel | ( | ) | const |
Specifies a list of targets that are excluded below the included paths in this collection. This can target prims or properties directly, but cannot target another collection. This is to keep the membership determining logic simple, efficient and easier to reason about. Finally, it is invalid for a collection to exclude paths that are not included in it. The presence of such "orphaned" excluded paths will not affect the set of paths included in the collection, but may affect the performance of querying membership of a path in the collection (see UsdCollectionAPI::MembershipQuery::IsPathIncluded) or of enumerating the objects belonging to the collection (see UsdCollectionAPI::GetIncludedObjects).
USD_API UsdAttribute UsdCollectionAPI::GetExpansionRuleAttr | ( | ) | const |
Specifies how the paths that are included in the collection must be expanded to determine its members.
Declaration | uniform token expansionRule = "expandPrims" |
C++ Type | TfToken |
Usd Type | SdfValueTypeNames->Token |
Variability | SdfVariabilityUniform |
Allowed Values | explicitOnly, expandPrims, expandPrimsAndProperties |
USD_API UsdAttribute UsdCollectionAPI::GetIncludeRootAttr | ( | ) | const |
Boolean attribute indicating whether the pseudo-root path </> should be counted as one of the included target paths. The fallback is false. This separate attribute is required because relationships cannot directly target the root.
Declaration | uniform bool includeRoot |
C++ Type | bool |
Usd Type | SdfValueTypeNames->Bool |
Variability | SdfVariabilityUniform |
USD_API UsdRelationship UsdCollectionAPI::GetIncludesRel | ( | ) | const |
Specifies a list of targets that are included in the collection. This can target prims or properties directly. A collection can insert the rules of another collection by making its includes relationship target the collection:{collectionName} property on the owning prim of the collection to be included
|
inline |
Returns the name of this multiple-apply schema instance.
Definition at line 204 of file collectionAPI.h.
|
static |
Returns the canonical path to the collection named, name
on the given prim, prim
.
|
static |
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved.
|
static |
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes for a given instance name. Does not include attributes that may be authored by custom/extended methods of the schemas involved. The names returned will have the proper namespace prefix.
USD_API bool UsdCollectionAPI::HasNoIncludedPaths | ( | ) | const |
Returns true if the collection has nothing included in it. This requires both that the includes relationship have no target paths, and that the includeRoot attribute be false. Note that there may be cases where the collection has no objects included in it even when HasNoIncludedPaths() returns false. For example, if the included objects are unloaded or if the included objects are also excluded.
Includes or adds the given path, pathToInclude
in the collection.
This does nothing if the path is already included in the collection.
This does not modify the expansion-rule of the collection. Hence, if the expansionRule is expandPrims or expandPrimsAndProperties, then the descendants of pathToInclude
will be also included in the collection unless explicitly excluded.
|
static |
Checks if the given path path
is of an API schema of type CollectionAPI. If so, it stores the instance name of the schema in name
and returns true. Otherwise, it returns false.
Checks if the given name baseName
is the base name of a property of CollectionAPI.
USD_API bool UsdCollectionAPI::ResetCollection | ( | ) | const |
Resets the collection by clearing both the includes and excludes targets of the collection in the current UsdEditTarget.
USD_API bool UsdCollectionAPI::Validate | ( | std::string * | reason | ) | const |
Validates the collection by checking the following rules:
|
friend |
Definition at line 298 of file collectionAPI.h.
|
static |
Compile time constant representing what kind of schema this class is.
Definition at line 158 of file collectionAPI.h.