Files
test/tests/files/render/util/render_denoise.py
Sergey Sharybin bbfc97ad6f Move tests/data and assets to the main repository
This change moves the tests data files and publish folder of assets
repository to the main blender.git repository as LFS files.

The goal of this change is to eliminate toil of modifying tests,
cherry-picking changes to LFS branches, adding tests as part of a
PR which brings new features or fixes.

More detailed explanation and conversation can be found in the
design task.

Ref #137215

Pull Request: https://projects.blender.org/blender/blender/pulls/137219
2025-05-05 15:10:22 +02:00

46 lines
1.1 KiB
Python

# SPDX-FileCopyrightText: 2024 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
# Test for denoising Python API.
import bpy
import os
def denoise(context):
scene = context.scene
filepath = bpy.data.filepath
output_filepath = filepath + ".output.exr"
if os.path.basename(filepath).find("merge") != -1:
# Merge Images
input_filepath1 = filepath + ".input1.exr"
input_filepath2 = filepath + ".input2.exr"
bpy.ops.cycles.merge_images(
input_filepath1=input_filepath1,
input_filepath2=input_filepath2,
output_filepath=output_filepath)
input_filepath = output_filepath
else:
input_filepath = filepath + ".input.exr"
if os.path.basename(filepath).find("denoise") != -1:
# Denoise
bpy.ops.cycles.denoise_animation(
input_filepath=input_filepath,
output_filepath=output_filepath)
image = bpy.data.images.load(filepath=output_filepath)
image.save_render(scene.render.filepath + '0001.png', scene=scene)
os.remove(output_filepath)
if __name__ == "__main__":
denoise(bpy.context)