HDK
|
#include <context.h>
UsdValidationContext provides an interface for managing and running validators on USD layers, stages, or prims.
The UsdValidationContext can be constructed using various methods to select validators by keywords, schema types, plugins, or pre-selected sets of validatorMetadata or validators.
Pre-selected set of UsdValidationValidatorMetadata or UsdValidationValidators can be gathered using various UsdValidationRegistry APIs. For example, a client can construct a validation context by providing validator metadata for all usdGeom plugin validators but excluding all validators metadata belonging to a specific schemaType like UsdGeomPoints.
When schema type validators are provided, an appropriate hierarchy of schema validators are included in the selected list of validators. For example, if UsdGeomSphere schema type is provided, validators for UsdGeomGprim, UsdGeomBoundable, UsdGeomXformable, and UsdGeomImageable are also included.
Clients can also provide includeAllAncestors
flag (defaults to true) to also select validators from all ancestor TfType for any selected schemaType validator when initializing a UsdValidationContext using keywords
and of the provided schemaType(s) validators.metadata
constructors.
Once a context is created and the list of validators to be run is populated, clients can simply run the validators on a layer, stage or a set of prims. All validators with UsdValidateLayerTaskFn, UsdValidateStageTaskFn or UsdValidatePrimTaskFn will be run in a parallel and UsdValidationError will be collected for each validator.
Note that initializing a UsdValidationContext can result in loading new plugins, if the validators are not already loaded.
UsdValidationContext::Validate() call could initiate a stage traversal, and appropriately call various validation tasks on the validators.
UsdValidationContext does not hold any state about the validation errors collected during validation. The errors are returned as a vector of UsdValidationError when Validate() is called.
|
explicit |
Create a UsdValidationContext by collecting validators using the specified keywords.
keywords | A vector of keywords to select validators from. All validators having these keywords will get loaded and included in the selected group of validators to be run for validation. It will also collect validators from a UsdValidationValidatorSuite if the suite also contains the specified keywords. |
includeAllAncestors | An optional parameter to include all validators from ancestor TfTypes for any schema type validators found, default is true . |
|
explicit |
Create a UsdValidationContext by collecting validators using the specified vector of plugins.
plugins | A vector of plugins to select validators from. All validators belonging to the specified plugins will get loaded and included in the selected group of validators to be run for validation. It will also collect validators from a UsdValidationValidatorSuite if the suite belongs to the specified plugins |
includeAllAncestors | An optional parameter to include all validators from ancestor TfTypes for any schema type validators found, default is true . |
|
explicit |
Create a UsdValidationContext by collecting validators using the specified vector of validator metadata.
metadata | A vector of validator metadata. All validators corresponding to the metadata will get loaded and included in the selected group of validators to be run for validation. It will also collect validators from a UsdValidationValidatorSuite if a metadata has isSuite set to true. |
includeAllAncestors | An optional parameter to include all validators from ancestor TfTypes for any schema type validators found, default is true . |
|
explicit |
Create a UsdValidationContext by collecting validators using the specified schema types.
schemaTypes | A vector of schema types to select validators from. All validators corresponding to the provided schemaTypes are included in the selected group of validators to be run for validation. |
Note that all validators corresponding to the ancestor TfTypes for the provided schemaTypes are included in the selected group of validators.
|
explicit |
Create a UsdValidationContext by collecting validators using the specified vector of validators.
validators | A vector of explicit validators. |
|
explicit |
Create a UsdValidationContext by collecting validators from the specified vector of validator suites.
suites | A vector of validator suites. |
USDVALIDATION_API UsdValidationErrorVector UsdValidationContext::Validate | ( | const SdfLayerHandle & | layer | ) | const |
Run validation on the given valid layer
by executing the selected validators for this UsdValidationContext; Returns a vector of errors collected during validation.
Only layer validators in the selected group of validators will be run on the given layer.
All the validators run in parallel. Any resulting errors are collected in the returned vector.
Note that it's the responsibility of the caller to maintain the lifetime of the layer during the lifetime of the this validation context. UsdValidationErrorSites in the returned vector will reference the layer and hence are valid only as long as the layer is valid.
A coding error is issued if the layer being validated is not valid.
USDVALIDATION_API UsdValidationErrorVector UsdValidationContext::Validate | ( | const UsdStagePtr & | stage, |
const Usd_PrimFlagsPredicate & | predicate, | ||
const UsdValidationTimeRange & | timeRange | ||
) | const |
Run validation on the given valid stage
by executing the selected validators for this UsdValidationContext; Returns a vector of errors
Any Layer validators in the selected group of validators will be run on the layers reachable from the stage. In addition to that any Stage validators will also be run on the given stage. The stage will also be traversed to run prim and schema type validators on all the prims in the stage. predicate
will be used to traverse the prims to be validated.
PrimValidators and StageValidators will be passed the provided timeRange
.
All the validators run in parallel. Any resulting errors are collected in the returned vector.
Note that it's the responsibility of the caller to maintain the lifetime of the stage during the lifetime of the this validation context. UsdValidationErrorSites in the returned vector will reference the stage and hence are valid only as long as the stage is valid.
A coding error is issued if the stage being validated is not valid.
USDVALIDATION_API UsdValidationErrorVector UsdValidationContext::Validate | ( | const UsdStagePtr & | stage, |
const Usd_PrimFlagsPredicate & | predicate | ||
) | const |
Run validation on the given valid stage
by executing the selected validators for this UsdValidationContext; Returns a vector of errors
StageValidators and PrimValidators will also be passed the default UsdValidationTimeRange, which uses GfInterval::GetFullInterval() as the time interval.
USDVALIDATION_API UsdValidationErrorVector UsdValidationContext::Validate | ( | const UsdStagePtr & | stage | ) | const |
Run validation on the given valid stage
by executing the selected validators for this UsdValidationContext; Returns a vector of errors
Instance Proxy predicate is used to traverse the prims to be validated in this overload.
StageValidators and PrimValidators will also be passed the default UsdValidationTimeRange, which uses GfInterval::GetFullInterval() as the time interval.
USDVALIDATION_API UsdValidationErrorVector UsdValidationContext::Validate | ( | const UsdStagePtr & | stage, |
const UsdValidationTimeRange & | timeRange | ||
) | const |
Run validation on the given valid stage
by executing the selected validators for this UsdValidationContext; Returns a vector of errors
PrimValidators and StageValidators will be passed the provided timeRange
.
Instance Proxy predicate is used to traverse the prims to be validated in this overload.
USDVALIDATION_API UsdValidationErrorVector UsdValidationContext::Validate | ( | const UsdStagePtr & | stage, |
const Usd_PrimFlagsPredicate & | predicate, | ||
const std::vector< UsdTimeCode > & | timeCodes | ||
) | const |
Run validation on the given valid stage
by executing the selected validators for this UsdValidationContext; Returns a vector of errors
PrimValidators and StageValidators will be run on all timeCodes
. If timeCodes
is empty, then no validation will be performed.
Note that non-time dependent validators will be run only once and time dependent validators will be run at all the provided timeCodes.
USDVALIDATION_API UsdValidationErrorVector UsdValidationContext::Validate | ( | const UsdStagePtr & | stage, |
const std::vector< UsdTimeCode > & | timeCodes | ||
) | const |
Run validation on the given valid stage
by executing the selected validators for this UsdValidationContext; Returns a vector of errors
PrimValidators and StageValidators will be run on all timeCodes
. If timeCodes
is empty, then no validation will be performed.
Note that non-time dependent validators will be run only once and time dependent validators will be run at all the provided timeCodes.
Instance Proxy predicate is used to traverse the prims to be validated in this overload.
USDVALIDATION_API UsdValidationErrorVector UsdValidationContext::Validate | ( | const std::vector< UsdPrim > & | prims, |
const UsdValidationTimeRange & | timeRange = {} |
||
) | const |
Run validation on the given valid prims
by executing the selected validators for this UsdValidationContext; Returns a vector of errors collected during validation.
Prim and Schema type validators will be run on the given prims using UsdValidationTimeRange(), if timeRange
is not provided.
All the validators run in parallel. Any resulting errors are collected in the returned vector.
Note that it's the responsibility of the caller to maintain the lifetime of the stage that the prims belong to, during the lifetime of the this validation context.
A coding error is issued if any of the prims being validated are invalid.
USDVALIDATION_API UsdValidationErrorVector UsdValidationContext::Validate | ( | const UsdPrimRange & | prims, |
const UsdValidationTimeRange & | timeRange = {} |
||
) | const |
Run validation on the given valid prims
by executing the selected validators for this UsdValidationContext; Returns a vector of errors collected during validation.
Prim and Schema type validators will be run on the given prims using UsdValidationTimeRange(), if timeRange
is not provided.
Note that it's the responsibility of the caller to maintain the lifetime of the stage that the prims belong to, during the lifetime of the this validation context.
All the validators run in parallel. Any resulting errors are collected in the returned vector.
A coding error is issued if any of the prims being validated are invalid.
USDVALIDATION_API UsdValidationErrorVector UsdValidationContext::Validate | ( | const std::vector< UsdPrim > & | prims, |
const std::vector< UsdTimeCode > & | timeCodes | ||
) | const |
Run validation on the given valid prims
by executing the selected validators for this UsdValidationContext; Returns a vector of errors collected during validation.
Prim and Schema type validators will be run on all timeCodes
. If timeCodes
is empty, then no validation will be performed.
Note that non-time dependent validators will be run only once and time dependent validators will be run at all the provided timeCodes.
USDVALIDATION_API UsdValidationErrorVector UsdValidationContext::Validate | ( | const UsdPrimRange & | prims, |
const std::vector< UsdTimeCode > & | timeCodes | ||
) | const |
Run validation on the given valid prims
by executing the selected validators for this UsdValidationContext; Returns a vector of errors collected during validation.
Prim and Schema type validators will be run on all timeCodes
. If timeCodes
is empty, then no validation will be performed.
Note that non-time dependent validators will be run only once and time dependent validators will be run at all the provided timeCodes.