Unable to execute MoviePipelineQueue from Python

Mentin
Fri, 26 Jun 2020 01:45:38 +0000
Editor Scripting

I am interested in generating a movie pipeline queue dynamically from python. I was able to figure out all the necessary pieces. However, when using the executor on the queue it will not execute. I’ve tried 3 different executors.

This executor Doesn’t have any error. However, it never actually renders the movie.
executor=unreal.MoviePipelineInProcessExecutor()

The following two complain that the map associated with the job has not been saved. However, made sure it is saved. I have also tried with the target map loaded and not loaded.

executor=unreal.MoviePipelineNewProcessExecutor()

executor=unreal.MoviePipelinePIEExecutor()

ERROR Message:
Message dialog closed, result: Ok, title: Message, text: One or more jobs in the queue have an unsaved map as their target map. Maps must be saved at least once before rendering.

To confirm, I am able to successfully add the sequence to the MovieRenderQueue through the UI. And and render from UI.

Below is a sample script to test.

import unreal

umap = '/Game/NewMap'
level_sequence='/Game/NewLevelSequence'
outdir='out'
fps=60
frame_count = 120

q = unreal.MoviePipelineQueue()
#executor=unreal.MoviePipelineInProcessExecutor()
#executor=unreal.MoviePipelineNewProcessExecutor()
executor=unreal.MoviePipelinePIEExecutor()

#Create new movie pipeline job
job = q.allocate_new_job()
#job.set_editor_property('map',unreal.SoftObjectPath(umap))
#job.set_editor_property('sequence',unreal.SoftObjectPath(level_sequence))
job.map=unreal.SoftObjectPath(umap)
job.sequence=unreal.SoftObjectPath(level_sequence)

c=job.get_configuration()
#c=unreal.MoviePipelineMasterConfig()
render_pass_settings=c.find_or_add_setting_by_class(unreal.MoviePipelineDeferredPassBase)
output_setting=c.find_or_add_setting_by_class(unreal.MoviePipelineOutputSetting)
output_setting.output_directory=unreal.DirectoryPath(outdir)
png_setting=c.find_or_add_setting_by_class(unreal.MoviePipelineImageSequenceOutput_PNG)
#job.set_configuration(c)

error_callback=unreal.OnMoviePipelineExecutorErrored()
def movie_error(pipeline_executor,pipeline_with_error,is_fatal,error_text):
    print(pipeline_executor)
    print(pipeline_with_error)
    print(is_fatal)
    print(error_text)
error_callback.add_callable(movie_error)
def movie_finished(pipeline_executor,success):
    print(pipeline_executor)
    print(success)
finished_callback=unreal.OnMoviePipelineExecutorFinished()
finished_callback.add_callable(movie_finished)

executor.set_editor_property('on_executor_errored_delegate',error_callback)
executor.set_editor_property('on_executor_finished_delegate',finished_callback)
executor.execute(q)

Regards

21 posts - 15 participants