import unreal

import HyperTwistMoviePipelineReplayExecutor


def _register_hyper_twist_movie_pipeline_executor() -> None:
    executor_cdo = unreal.get_default_object(unreal.MoviePipelinePythonHostExecutor)
    executor_cdo.set_editor_property(
        "executor_class",
        HyperTwistMoviePipelineReplayExecutor.HyperTwistMoviePipelineReplayExecutor.static_class(),
    )
    unreal.log(
        "[HyperTwistMoviePipelineReplayExecutor] Registered Python host executor class."
    )


try:
    _register_hyper_twist_movie_pipeline_executor()
except Exception as error:
    unreal.log_error(
        "[HyperTwistMoviePipelineReplayExecutor] Failed to register Python host executor "
        f"class: {error}"
    )
