unreal.EditorValidatorSubsystem

class unreal.EditorValidatorSubsystem(outer: Object | None = None, name: Name | str = 'None')

Bases: EditorSubsystem

UEditorValidatorSubsystem manages all the asset validation in the engine.

The first validation handled is UObject::IsDataValid and its overridden functions. Those validations require custom classes and are most suited to project-specific classes.

The next validation set is of all registered UEditorValidationBases. These validators have a function to determine if they can validate a given asset, and if they are currently enabled. They are good candidates for validating engine classes or very specific project logic.

Finally, this subsystem may be subclassed to change the overally behavior of validation in your project. If a subclass exist in your project module, it will supercede the engine validation subsystem.

C++ Source:

  • Plugin: DataValidation

  • Module: DataValidation

  • File: EditorValidatorSubsystem.h

Editor Properties: (see get_editor_property/set_editor_property)

  • validate_on_save (bool): [Read-Write] Whether it should validate assets on save inside the editor deprecated: Use bValidateOnSave on UDataValidationSettings instead.

add_validator(validator) None
  • Adds a validator to the list, making sure it is a unique instance

Parameters:

validator (EditorValidatorBase) –

is_asset_valid(asset_data, validation_usecase) -> (DataValidationResult, validation_errors=Array[Text], validation_warnings=Array[Text])

Loads the object referred to by the provided AssetData and runs registered validators on it. Does not add anything to any FMessageLog tabs.

Parameters:
Returns:

Returns Valid if the object pointed to by AssetData contains valid data; returns Invalid if the object contains invalid data or does not exist; returns NotValidated if no validations was performed on the object

validation_errors (Array[Text]):

validation_warnings (Array[Text]):

Return type:

tuple

is_object_valid(object, validation_usecase) -> (DataValidationResult, validation_errors=Array[Text], validation_warnings=Array[Text])

Runs registered validators on the provided object. Does not add anything to any FMessageLog tabs.

Parameters:
Returns:

Returns Valid if the object contains valid data; returns Invalid if the object contains invalid data; returns NotValidated if no validations was performed on the object

validation_errors (Array[Text]):

validation_warnings (Array[Text]):

Return type:

tuple

remove_validator(validator) None
  • Removes a validator

  • Should be called during module shutdown if a validator was added.

Parameters:

validator (EditorValidatorBase) –

validate_assets_with_settings(asset_data_list) -> (int32, settings=ValidateAssetsSettings, out_results=ValidateAssetsResults)

Called to validate assets from either the UI or a commandlet. Loads the specified assets and runs all registered validators on them. Populates the message log with errors and warnings with clickable links.

Parameters:

asset_data_list (Array[AssetData]) –

Returns:

Number of assets with validation failures or warnings

settings (ValidateAssetsSettings): Structure passing context and settings for ValidateAssetsWithSettings

out_results (ValidateAssetsResults): More detailed information about the results of the validate assets command

Return type:

tuple

validate_changelist(changelist, settings) -> (DataValidationResult, out_results=ValidateAssetsResults)

Called to validate assets from either the UI or a commandlet. Loads the specified assets and runs all registered validators on them. Populates the message log with errors and warnings with clickable links.

Parameters:
Returns:

Validation results for the changelist object itself

out_results (ValidateAssetsResults): More detailed information about the results of the validate assets command

Return type:

ValidateAssetsResults

validate_changelists(changelists, settings) -> (DataValidationResult, out_results=ValidateAssetsResults)

Validate Changelists

Parameters:
Returns:

out_results (ValidateAssetsResults):

Return type:

ValidateAssetsResults

property validate_on_save: bool

[Read-Write] Whether it should validate assets on save inside the editor deprecated: Use bValidateOnSave on UDataValidationSettings instead.

Type:

(bool)