Skip to content

Instantly share code, notes, and snippets.

@DashW
Last active November 4, 2020 12:44
Show Gist options
  • Save DashW/289fe98d89ee45a01814f1d7224b7751 to your computer and use it in GitHub Desktop.
Save DashW/289fe98d89ee45a01814f1d7224b7751 to your computer and use it in GitHub Desktop.
Unreal Editor Validator Concrete Implementation in Python
import unreal
@unreal.uclass()
class EditorValidatorConcrete(ue.EditorValidatorBase):
def __init__(self, *arg, **kwds):
super(EditorValidatorConcrete, self).__init__(*arg, **kwds)
@unreal.ufunction(override=True)
def validate_loaded_asset(self, asset, validation_errors):
self.asset_fails(asset, "asset failed", validation_errors)
return (unreal.DataValidationResult.INVALID, validation_errors)
@unreal.ufunction(override=True)
def can_validate_asset(self, asset):
return True
if __name__ == "__main__":
editor_validator_subsystem = unreal.get_editor_subsystem(unreal.EditorValidatorSubsystem)
validator = EditorValidatorConcrete()
editor_validator_subsystem.add_validator(validator)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment