Using Render Graph in non-editor builds

Hello. I am trying to use new Render Graph functionality with Movie Render Pipeline in non-editor builds.

Basically I have a render graph with some configuration variables that control what and how we are rendering out. Unfortunately it does not work in non-editor builds because some functionality related to UMovieJobVariableAssignmentContainer is editor only and does not exist in non-editor builds. Specifically UpdateGraphVariableOverrides() function - resulting in empty property bag in non-editor builds and fail to use any of the SetValueXXX functions.

Am I doing this wrong or you are not really supposed to configure/override render graph parameters in non-editor builds?

Thanks

[Attachment Removed]

Setting and overriding variables in a runtime build should work correctly. However, adding/removing them is not supported due to the reason that was mentioned (UpdateGraphVariableOverrides() is only available in the editor). The graph and queue that the graph is being used in need to be saved in the editor to work around the UpdateGraphVariableOverrides() restriction.

One thing to note is that the override needs to be enabled via SetVariableAssignmentEnableState() on the UMovieJobVariableAssignmentContainer to ensure that the override takes effect. This could be part of the problem.

If you are currently only setting/overriding variable values and it’s breaking, we’d need more information about what their specific workflow is to determine if there’s a bug somewhere.

[Attachment Removed]

That is exactly what I am doing and it works perfectly if I run from editor. But in packaged build It always fails whenever I try to set any override value in UMovieJobVariableAssignmentContainer - it can’t find the property and shows the property bag to be empty.

Here is roughly the code I use:

Job->SetGraphPreset(MovieGraph);
UMovieJobVariableAssignmentContainer* VariableContainer = Job->GetOrCreateJobVariableAssignmentsForGraph( MovieGraph );
 
if (const UMovieGraphVariable* BoolVar = MovieGraph->GetVariableByName(VariableName))
{
	VariableContainer->SetVariableAssignmentEnableState(BoolVar, true); 
	if (!VariableContainer->SetValueBool(BoolVar, bValue)) // THIS FAILS in non-editor builds - it can't find the property
	{
		//Error in non-editor builds!
	}
}

[Attachment Removed]

I’m also experiencing this problem. in MoviePipelineUtils::GetOrCreateJobVariableAssignmentsForGraph if VariableAssignment->UpdateGraphVariableOverrides(); is not able to be run (ie. in a packaged build) then none of this works. Why is this editor only?

How is one supposed to be able to override variables in a Movie Render Graph? Is there some other approach?

I’m not really sure what you mean Sean by this comment that “The graph and queue that the graph is being used in need to be saved in the editor”. I have a MovieGraphConfig asset that I’m using in code.

UMoviePipelineExecutorJob* MRGJob = Queue->AllocateNewJob(UMoviePipelineExecutorJob::StaticClass());

            if (MRGJob)

            {

                MRGJob->Sequence = FSoftObjectPath(LoadedSequence);

                MRGJob->JobName = FPaths::GetBaseFilename(FilenamePath);

                MRGJob->SetGraphPreset(GraphPreset);

                OverrideOutputSettingsForMRG(MRGJob, ScreenshotConfig, FilenamePath);

This following OverrideOutputSettingsForMRG code, similar to the OP’s will not run.

UMovieGraphConfig* GraphConfig = Job->GetGraphPreset();

    if (!GraphConfig)

    {

        UE_LOG(LogImageGenUtility, Warning, TEXT("No graph preset on job, cannot override settings."));

        return;

    }




    // Get variable assignment container for the graph

    UMovieJobVariableAssignmentContainer* VarContainer = Job->GetOrCreateJobVariableAssignmentsForGraph(GraphConfig);

    if (!VarContainer)

    {

        UE_LOG(LogImageGenUtility, Warning, TEXT("Failed to get variable assignment container."));

        return;

    }




    // Override OutputDirectory variable (if exposed in graph)

    // Note: FDirectoryPath doesn't have full USTRUCT reflection, so we use serialized string format

    if (UMovieGraphVariable* OutputDirVar = GraphConfig->GetVariableByName(TEXT("OutputDirectory")))

    {

        FString DirectoryString = FString::Printf(TEXT("(Path=\"%s\")"), *FPaths::GetPath(FilenamePath));

        VarContainer->SetVariableAssignmentEnableState(OutputDirVar, true);

        bool success = VarContainer->SetValueSerializedString(OutputDirVar, DirectoryString);

        UE_LOG(LogImageGenUtility, Log, TEXT("Set MRG OutputDirectory to %s (success: %d)"), *FPaths::GetPath(FilenamePath), success);

    }

Variable overrides within the queue cannot be added/removed at runtime. The queue needs to: 1) have the graph assigned to the job within the editor, and 2) be saved within the editor. Then, at runtime, the overrides can be updated. Updating overrides is the only supported operation during runtime. This means that variable overrides will not work if a job has its graph config changed to a different asset during runtime.

I see. very helpful clarification! So it’s the dynamic building of the MoviePipelineExecutorJobs at runtime that is the problem.

That’s a tough problem because we don’t know how many jobs we’ll need so I cannot create the jobs in editor. It’s a system creating a number of images based on some input configuration loaded at runtime. The configuration could be asking for any number of images (jobs) to be created.

The reason I was keen to be able to have variable overrides is that I could include various things about the images being created in the input configuration (eg. image resolution, save path).

Can you think of another way to build such a system?

if variables cannot be overridden in scenarios where jobs are being created in code at runtime, then I suppose I’ll have to author multiple graph configuration files (with the variables like resolution hand set) and then set the right graph configuration based on the input configuration. (First thought that comes to mind. Maybe there’s a better way)

Thanks for any thoughts and advice.

Yeah, either multiple graphs or attempting to just override resolution via the already exposed variable at runtime.

Sorry could you clarify what you mean here?

I thought we established that it was not possible to override exposed variables in this scenario.

Do you mean more to rework the system to not dynamically create jobs, thus enabling one to use variables?

I can re-check with the dev but its my understanding you can oveeride existing variables. Not add or remove any.