Hello everyone
So, while working on a pipeline that uses the Movie Render Graph I noticed something: I could render everything to a local directory, but not to our server. It would render but nothing would be saved.
I added an exposed variable to the graph called āOutputDirā, but didnāt connect it to anything.
Next, I created a Callback for the on_job_finished function in the init_unreal.py and after one day of search (because there is no documentationā¦) I found out how to get to the variables from the editor overwrites!
From the job, use the get_or_create_variable_overrides(GraphHere) and in this container, you can search for everything you need. Only thing: For the path you need to use the serialized_string function, else it will be empty. Hope that helps someone!
def get_output_dir(job):
"""
Extracts the OutputDir path from a Movie Render Pipeline job.
Returns the clean path as a string without any wrapper syntax.
"""
try:
# Get the graph preset and find the OutputDir variable
graph = job.get_graph_preset()
if not graph:
return None
output_dir_var = None
for variable in graph.get_variables():
if variable.get_member_name() == "OutputDir":
output_dir_var = variable
break
if not output_dir_var:
return None
# Get the variable assignment container and check if OutputDir is overridden
var_assignment_container = job.get_or_create_variable_overrides(graph)
if not var_assignment_container:
return None
# Make sure overrides are up to date
if hasattr(var_assignment_container, "update_graph_variable_overrides"):
var_assignment_container.update_graph_variable_overrides()
# Check if OutputDir override is enabled
is_enabled = var_assignment_container.get_variable_assignment_enable_state(output_dir_var)
if is_enabled:
# Get the serialized value and extract the path
serialized = var_assignment_container.get_value_serialized_string(output_dir_var)
# Extract using regex
match = re.search(r'Path="([^"]+)"', serialized)
if match:
return match.group(1)
else:
# Fallback extraction
return serialized.replace('(Path="', '').replace('")', '')
except Exception as e:
unreal.log(f"Error extracting OutputDir: {str(e)}")
return None