Unable to execute MoviePipelineQueue from Python

I was able to finally figure out the problem. The main issue was that specifying a map reference requires you to specify the world in the map as well.

umap = ‘/Game/NewMap’

Should be

umap = ‘/Game/NewMap.NewMap’

I also found out how to interface with the editor queue as well through the subsystem. This is useful if you want to inspect the generated queue from the GUI.

Here is a complete script.

import unreal
import os

umap = '/Game/NewMap.NewMap'
level_sequence='/Game/NewLevelSequence'
outdir=os.path.abspath(os.path.join(unreal.Paths().project_dir(),'out'))
fps=60
frame_count = 120

#Get movie queue subsystem for editor.
subsystem=unreal.get_editor_subsystem(unreal.MoviePipelineQueueSubsystem)
q=subsystem.get_queue()
executor=unreal.MoviePipelinePIEExecutor()

#Optional: empty queue first.
for j in q.get_jobs():
    q.delete_job(j)

#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))

c=job.get_configuration()
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)

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 = subsystem.render_queue_with_executor(unreal.MoviePipelinePIEExecutor)
if executor:
    executor.set_editor_property('on_executor_errored_delegate',error_callback)
    executor.set_editor_property('on_executor_finished_delegate',finished_callback)
4 Likes