![]() |
|
UsdValidationRegistry manages and provides access to UsdValidationValidator / UsdValidationValidatorSuite for USD Validation. More...
#include <registry.h>
Public Member Functions | |
| USDVALIDATION_API void | RegisterPluginValidator (const TfToken &validatorName, const UsdValidateLayerTaskFn &layerTaskFn, std::vector< UsdValidationFixer > fixers={}) |
Register UsdValidationValidator defined in a plugin using validatorName and layerTaskFn with the UsdValidationRegistry. | |
| USDVALIDATION_API void | RegisterPluginValidator (const TfToken &validatorName, const UsdValidateStageTaskFn &stageTaskFn, std::vector< UsdValidationFixer > fixers={}) |
Register UsdValidationValidator defined in a plugin using validatorName and stageTaskFn with the UsdValidationRegistry. | |
| USDVALIDATION_API void | RegisterPluginValidator (const TfToken &validatorName, const UsdValidatePrimTaskFn &primTaskFn, std::vector< UsdValidationFixer > fixers={}) |
Register UsdValidationValidator defined in a plugin using validatorName and primTaskFn with the UsdValidationRegistry. | |
| USDVALIDATION_API void | RegisterValidator (const UsdValidationValidatorMetadata &metadata, const UsdValidateLayerTaskFn &layerTaskFn, std::vector< UsdValidationFixer > fixers={}) |
Register UsdValidationValidator using metadata and layerTaskFn with the UsdValidationRegistry. | |
| USDVALIDATION_API void | RegisterValidator (const UsdValidationValidatorMetadata &metadata, const UsdValidateStageTaskFn &stageTaskFn, std::vector< UsdValidationFixer > fixers={}) |
Register UsdValidationValidator using metadata and stageTaskFn with the UsdValidationRegistry. | |
| USDVALIDATION_API void | RegisterValidator (const UsdValidationValidatorMetadata &metadata, const UsdValidatePrimTaskFn &primTaskFn, std::vector< UsdValidationFixer > fixers={}) |
Register UsdValidationValidator using metadata and primTaskFn with the UsdValidationRegistry. | |
| USDVALIDATION_API void | RegisterPluginValidatorSuite (const TfToken &validatorSuiteName, const std::vector< const UsdValidationValidator * > &containedValidators) |
Register UsdValidationValidatorSuite defined in a plugin using validatorSuiteName and containedValidators with the UsdValidationRegistry. | |
| USDVALIDATION_API void | RegisterValidatorSuite (const UsdValidationValidatorMetadata &metadata, const std::vector< const UsdValidationValidator * > &containedValidators) |
Register UsdValidationValidatorSuite using metadata and containedValidators with the UsdValidationRegistry. | |
| USDVALIDATION_API bool | HasValidator (const TfToken &validatorName) const |
Return true if a UsdValidationValidator is registered with the name validatorName; false otherwise. | |
| USDVALIDATION_API bool | HasValidatorSuite (const TfToken &suiteName) const |
Return true if a UsdValidationValidatorSuite is registered with the name validatorSuiteName; false otherwise. | |
| USDVALIDATION_API std::vector< const UsdValidationValidator * > | GetOrLoadAllValidators () |
| Returns a vector of const pointer to UsdValidationValidator corresponding to all validators registered in the UsdValidationRegistry. | |
| USDVALIDATION_API const UsdValidationValidator * | GetOrLoadValidatorByName (const TfToken &validatorName) |
Returns a const pointer to UsdValidationValidator if validatorName is found in the registry. | |
| USDVALIDATION_API std::vector< const UsdValidationValidator * > | GetOrLoadValidatorsByName (const TfTokenVector &validatorNames) |
Returns a vector of const pointer to UsdValidationValidator corresponding to validatorNames found in the registry. | |
| USDVALIDATION_API std::vector< const UsdValidationValidatorSuite * > | GetOrLoadAllValidatorSuites () |
| Returns a vector of const pointer to UsdValidationValidatorSuite corresponding to all validator suites registered in the UsdValidationRegistry. | |
| USDVALIDATION_API const UsdValidationValidatorSuite * | GetOrLoadValidatorSuiteByName (const TfToken &suiteName) |
Returns a const pointer to UsdValidationValidatorSuite if suiteName is found in the registry. | |
| USDVALIDATION_API std::vector< const UsdValidationValidatorSuite * > | GetOrLoadValidatorSuitesByName (const TfTokenVector &suiteNames) |
Returns a vector of const pointer to UsdValidationValidatorSuite corresponding to suiteNames found in the registry. | |
| USDVALIDATION_API bool | GetValidatorMetadata (const TfToken &name, UsdValidationValidatorMetadata *metadata) const |
| Returns true if metadata is found in the _validatorNameToMetadata for a validator/suite name, false otherwise. | |
| USDVALIDATION_API UsdValidationValidatorMetadataVector | GetAllValidatorMetadata () const |
| Return vector of all UsdValidationValidatorMetadata known to the registry. | |
| USDVALIDATION_API UsdValidationValidatorMetadataVector | GetValidatorMetadataForPlugin (const TfToken &pluginName) const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which belong to the pluginName. | |
| USDVALIDATION_API UsdValidationValidatorMetadataVector | GetValidatorMetadataForKeyword (const TfToken &keyword) const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which has the keyword. | |
| USDVALIDATION_API UsdValidationValidatorMetadataVector | GetValidatorMetadataForSchemaType (const TfToken &schemaType) const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which has the schemaType. | |
| USDVALIDATION_API UsdValidationValidatorMetadataVector | GetValidatorMetadataForPlugins (const TfTokenVector &pluginNames) const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which belong to the pluginNames. | |
| USDVALIDATION_API UsdValidationValidatorMetadataVector | GetValidatorMetadataForKeywords (const TfTokenVector &keywords) const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which has at least one of the keywords. | |
| USDVALIDATION_API UsdValidationValidatorMetadataVector | GetValidatorMetadataForSchemaTypes (const TfTokenVector &schemaTypes) const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which has at least one of the schameTypes. | |
Static Public Member Functions | |
| static USDVALIDATION_API UsdValidationRegistry & | GetInstance () |
Friends | |
| class | TfSingleton< UsdValidationRegistry > |
UsdValidationRegistry manages and provides access to UsdValidationValidator / UsdValidationValidatorSuite for USD Validation.
UsdValidationRegistry is a singleton class, which serves as a central registry to hold / own all validators and validatorSuites by their names. UsdValidationRegistry is also immortal and its singleton instance is never destroyed. This is to ensure that all validators and suites registered with the registry are available throughout the lifetime of the application.
Both Core USD and client-provided validators are registered with the registry. Validators can be registered and retrieved dynamically, supporting complex validation scenarios across different modules or plugins.
Clients of USD can register validators either via plugin infrastructure, which results in lazy loading of the validators, or explicitly register validators in their code via appropriate APIs.
As discussed in UsdValidationValidator, validators are associated with UsdValidateLayerTaskFn, UsdValidateStageTaskFn or UsdValidatePrimTaskFn, which govern how a layer, stage or a prim needs to be validated. UsdValidationValidator / UsdValidationValidatorSuite also have metadata, which can either be provided in the plugInfo.json when registering the validators via plugin mechanism, or by providing metadata field when registering validators.
Example of registering a validator named "StageMetadataValidator" with doc metadata using plufInfo.json:
The above example can then be registered in the plugin:
Clients can also register validators by explicitly providing UsdValidationValidatorMetadata, instead of relying on plugInfo.json for the same. Though it's recommended to use appropriate APIs when validator metadata is being provided in the plugInfo.json.
Example of validator registration by explicitly providing metadata, when it's not available in the plugInfo.json:
Usage:
As shown above, UsdValidationValidator or UsdValidationValidatorSuite can be registered using specific metadata or names, and retrieved by their name. The registry also provides functionality to check the existence of a validator / suite, load validators / suites dynamically if they are not in the registry.
Clients can also retrieve metadata for validators associated with a specific plugin, keywords or schemaTypes, this can help clients filter out relevant validators they need to validate their context / scene.
Note that this class is designed to be thread-safe: Querying of validator metadata, registering new validator (hence mutating the registry) or retrieving previously registered validator are designed to be thread-safe.
Validators may also have a number of fixers associated with them, which can provide potential fixes for various validation errors associated with a validation task. Fixers can be retrieved from the UsdValidationValidator or the UsdValidationError itself. Note that UsdValidationRegistry does not manage fixers directly, and these are held by respective UsdValidationValidator(s). It's the responsibility of the client to retrieve appropriate fixers for a given error and apply them, on a provided UsdEditTarget. UsdValidationErrorSite(s) associated with a validation error provide the context of the error, which may be used while applying a fix on a UsdEditTarget, or a stronger layer can be used as an edit target to apply the fix.
Definition at line 165 of file registry.h.
| USDVALIDATION_API UsdValidationValidatorMetadataVector GetAllValidatorMetadata | ( | ) | const |
Return vector of all UsdValidationValidatorMetadata known to the registry.
|
inlinestatic |
Definition at line 172 of file registry.h.
| USDVALIDATION_API std::vector< const UsdValidationValidator * > GetOrLoadAllValidators | ( | ) |
Returns a vector of const pointer to UsdValidationValidator corresponding to all validators registered in the UsdValidationRegistry.
If a validator is not found in the registry, this method will load appropriate plugins, if the validator is made available via a plugin.
Note that this call will load in many plugins which provide a UsdValidationValidator, if not already loaded. Also note that returned validators will only include validators defined in plugins or any explicitly registered validators before this call.
| USDVALIDATION_API std::vector< const UsdValidationValidatorSuite * > GetOrLoadAllValidatorSuites | ( | ) |
Returns a vector of const pointer to UsdValidationValidatorSuite corresponding to all validator suites registered in the UsdValidationRegistry.
If a suite is not found in the registry, this method will load appropriate plugins, if the suite is made available via a plugin.
Note that this call might load in many plugins which provide a UsdValidationValidatorSuite, if not already loaded. Also note that returned suites will only include suites defined in plugins or any explicitly registered suites before this call.
| USDVALIDATION_API const UsdValidationValidator * GetOrLoadValidatorByName | ( | const TfToken & | validatorName | ) |
Returns a const pointer to UsdValidationValidator if validatorName is found in the registry.
If a validator is not found in the registry, this method will load appropriate plugins, if the validator is made available via a plugin.
Returns a nullptr if no validator is found.
| USDVALIDATION_API std::vector< const UsdValidationValidator * > GetOrLoadValidatorsByName | ( | const TfTokenVector & | validatorNames | ) |
Returns a vector of const pointer to UsdValidationValidator corresponding to validatorNames found in the registry.
If a validator is not found in the registry, this method will load appropriate plugins, if the validator is made available via a plugin.
Size of returned vector might be less than the size of the input validatorNames, in case of missing validators.
| USDVALIDATION_API const UsdValidationValidatorSuite * GetOrLoadValidatorSuiteByName | ( | const TfToken & | suiteName | ) |
Returns a const pointer to UsdValidationValidatorSuite if suiteName is found in the registry.
If a suite is not found in the registry, this method will load appropriate plugins, if the suite is made available via a plugin.
Returns a nullptr if no validator is found.
| USDVALIDATION_API std::vector< const UsdValidationValidatorSuite * > GetOrLoadValidatorSuitesByName | ( | const TfTokenVector & | suiteNames | ) |
Returns a vector of const pointer to UsdValidationValidatorSuite corresponding to suiteNames found in the registry.
If a suite is not found in the registry, this method will load appropriate plugins, if the suite is made available via a plugin.
Size of returned vector might be less than the size of the input suiteNames, in case of missing validators.
| USDVALIDATION_API bool GetValidatorMetadata | ( | const TfToken & | name, |
| UsdValidationValidatorMetadata * | metadata | ||
| ) | const |
Returns true if metadata is found in the _validatorNameToMetadata for a validator/suite name, false otherwise.
metadata parameter is used as an out parameter here.
| USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForKeyword | ( | const TfToken & | keyword | ) | const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which has the keyword.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForKeywords | ( | const TfTokenVector & | keywords | ) | const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which has at least one of the keywords.
The returned vector is a union of all UsdValidationValidatorMetadata associated with the keywords.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForPlugin | ( | const TfToken & | pluginName | ) | const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which belong to the pluginName.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForPlugins | ( | const TfTokenVector & | pluginNames | ) | const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which belong to the pluginNames.
The returned vector is a union of all UsdValidationValidatorMetadata associated with the plugins.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForSchemaType | ( | const TfToken & | schemaType | ) | const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which has the schemaType.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| USDVALIDATION_API UsdValidationValidatorMetadataVector GetValidatorMetadataForSchemaTypes | ( | const TfTokenVector & | schemaTypes | ) | const |
Returns vector of UsdValidationValidatorMetadata associated with the Validators which has at least one of the schameTypes.
The returned vector is a union of all UsdValidationValidatorMetadata associated with the schemaTypes.
This API can be used to curate a vector of validator metadata, that clients may want to load and use in their validation context.
Note that this method does not result in any plugins to be loaded.
| USDVALIDATION_API bool HasValidator | ( | const TfToken & | validatorName | ) | const |
Return true if a UsdValidationValidator is registered with the name validatorName; false otherwise.
| USDVALIDATION_API bool HasValidatorSuite | ( | const TfToken & | suiteName | ) | const |
Return true if a UsdValidationValidatorSuite is registered with the name validatorSuiteName; false otherwise.
| USDVALIDATION_API void RegisterPluginValidator | ( | const TfToken & | validatorName, |
| const UsdValidateLayerTaskFn & | layerTaskFn, | ||
| std::vector< UsdValidationFixer > | fixers = {} |
||
| ) |
Register UsdValidationValidator defined in a plugin using validatorName and layerTaskFn with the UsdValidationRegistry.
Here validatorName should include the name of the plugin the validator belongs to, delimited by ":".
Note calling RegisterPluginValidator with a validatorName which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
fixers can be provided to associate fixers with the validator.
| USDVALIDATION_API void RegisterPluginValidator | ( | const TfToken & | validatorName, |
| const UsdValidatePrimTaskFn & | primTaskFn, | ||
| std::vector< UsdValidationFixer > | fixers = {} |
||
| ) |
Register UsdValidationValidator defined in a plugin using validatorName and primTaskFn with the UsdValidationRegistry.
Here validatorName should include the name of the plugin the validator belongs to, delimited by ":".
Note calling RegisterPluginValidator with a validatorName which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
fixers can be provided to associate fixers with the validator.
| USDVALIDATION_API void RegisterPluginValidator | ( | const TfToken & | validatorName, |
| const UsdValidateStageTaskFn & | stageTaskFn, | ||
| std::vector< UsdValidationFixer > | fixers = {} |
||
| ) |
Register UsdValidationValidator defined in a plugin using validatorName and stageTaskFn with the UsdValidationRegistry.
Here validatorName should include the name of the plugin the validator belongs to, delimited by ":".
Note calling RegisterPluginValidator with a validatorName which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
fixers can be provided to associate fixers with the validator.
| USDVALIDATION_API void RegisterPluginValidatorSuite | ( | const TfToken & | validatorSuiteName, |
| const std::vector< const UsdValidationValidator * > & | containedValidators | ||
| ) |
Register UsdValidationValidatorSuite defined in a plugin using validatorSuiteName and containedValidators with the UsdValidationRegistry.
Here validatorSuiteName should include the name of the plugin the validator belongs to, delimited by ":".
Note UsdValidationValidatorMetadata::isSuite must be set to true in the plugInfo, else the validatorSuite will not be registered.
Note calling RegisterPluginValidatorSuite with a validatorSuiteName which is already registered will result in a coding error. HasValidatorSuite can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
| USDVALIDATION_API void RegisterValidator | ( | const UsdValidationValidatorMetadata & | metadata, |
| const UsdValidateLayerTaskFn & | layerTaskFn, | ||
| std::vector< UsdValidationFixer > | fixers = {} |
||
| ) |
Register UsdValidationValidator using metadata and layerTaskFn with the UsdValidationRegistry.
Clients can explicitly provide validator metadata, which is then used to register a validator and associate it with name metadata. The metadata here is not specified in a plugInfo.
Note calling RegisterValidator with a validator name which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
fixers can be provided to associate fixers with the validator.
| USDVALIDATION_API void RegisterValidator | ( | const UsdValidationValidatorMetadata & | metadata, |
| const UsdValidatePrimTaskFn & | primTaskFn, | ||
| std::vector< UsdValidationFixer > | fixers = {} |
||
| ) |
Register UsdValidationValidator using metadata and primTaskFn with the UsdValidationRegistry.
Clients can explicitly provide validator metadata, which is then used to register a validator and associate it with name metadata. The metadata here is not specified in a plugInfo.
Note calling RegisterValidator with a validator name which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
fixers can be provided to associate fixers with the validator.
| USDVALIDATION_API void RegisterValidator | ( | const UsdValidationValidatorMetadata & | metadata, |
| const UsdValidateStageTaskFn & | stageTaskFn, | ||
| std::vector< UsdValidationFixer > | fixers = {} |
||
| ) |
Register UsdValidationValidator using metadata and stageTaskFn with the UsdValidationRegistry.
Clients can explicitly provide validator metadata, which is then used to register a validator and associate it with name metadata. The metadata here is not specified in a plugInfo.
Note calling RegisterValidator with a validator name which is already registered will result in a coding error. HasValidator can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
fixers can be provided to associate fixers with the validator.
| USDVALIDATION_API void RegisterValidatorSuite | ( | const UsdValidationValidatorMetadata & | metadata, |
| const std::vector< const UsdValidationValidator * > & | containedValidators | ||
| ) |
Register UsdValidationValidatorSuite using metadata and containedValidators with the UsdValidationRegistry.
Clients can explicitly provide validator metadata, which is then used to register a suite and associate it with name metadata. The metadata here is not specified in a plugInfo.
Note UsdValidationValidatorMetadata::isSuite must be set to true in the plugInfo, else the validatorSuite will not be registered.
Note calling RegisterPluginValidatorSuite with a validatorSuiteName which is already registered will result in a coding error. HasValidatorSuite can be used to determine if a validator is already registered and associated with validatorName.
Also note any other failure to register a validator results in a coding error.
|
friend |
Definition at line 530 of file registry.h.