unreal.EditorValidatorBase

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

Bases: Object

  • The EditorValidatorBase is a class which verifies that an asset meets a specific ruleset.

  • It should be used when checking engine-level classes, as UObject::IsDataValid requires

  • overriding the base class. You can create project-specific version of the validator base,

  • with custom logging and enabled logic.

  • C++ and Blueprint validators will be gathered on editor start, while python validators need

  • to register themselves

C++ Source:

  • Plugin: DataValidation

  • Module: DataValidation

  • File: EditorValidatorBase.h

Editor Properties: (see get_editor_property/set_editor_property)

  • is_enabled (bool): [Read-Write]

  • only_print_custom_message (bool): [Read-Write] Whether we should also print out the source validator when printing validation errors.

asset_fails(asset, message) None

Marks the validation as failed and adds an error message.

Parameters:
asset_passes(asset) None

Marks the validation as successful. Failure to call this will report the validator as not having checked the asset.

Parameters:

asset (Object) –

asset_warning(asset, message) None

Adds a message to this validation but doesn’t mark it as failed.

Parameters:
can_validate(usecase: DataValidationUsecase) bool

deprecated: ‘can_validate’ was renamed to ‘k2_can_validate’.

can_validate_asset(asset: Object) bool

deprecated: ‘can_validate_asset’ was renamed to ‘k2_can_validate_asset’.

get_validation_result() DataValidationResult

Get Validation Result

Return type:

DataValidationResult

k2_can_validate(usecase) bool

Override this to determine whether or not you can use this validator given this usecase

Parameters:

usecase (DataValidationUsecase) –

Return type:

bool

k2_can_validate_asset(asset) bool

Override this to determine whether or not you can validate a given asset with this validator

Parameters:

asset (Object) –

Return type:

bool

k2_validate_loaded_asset(asset) DataValidationResult

Override this in blueprint to validate assets

Parameters:

asset (Object) –

Return type:

DataValidationResult

validate_loaded_asset(asset: Object) DataValidationResult

deprecated: ‘validate_loaded_asset’ was renamed to ‘k2_validate_loaded_asset’.