KAZIK/tools/generators/refine_studio_v5_cameras.py

17 lines
1.1 KiB
Python

"""Apply the authored shot list to a saved set without re-running its physics."""
from pathlib import Path
import sys,bpy
sys.path.insert(0,str(Path(__file__).resolve().parent))
from build_studio_v5 import cameras
ROOT=Path(__file__).resolve().parents[2]
path=ROOT/'assets/cinematics/blender/eblan-workshop-v5.blend'
bpy.ops.wm.open_mainfile(filepath=str(path));scene=bpy.context.scene
for obj in list(scene.objects):
if obj.type=='CAMERA' or (obj.name.endswith(' / focal plane') and obj.name[:2] in ['01','02','03','04']):bpy.data.objects.remove(obj,do_unlink=True)
cameras();scene.frame_set(145);bpy.ops.wm.save_as_mainfile(filepath=str(path))
prefs=bpy.context.preferences.addons['cycles'].preferences;prefs.compute_device_type='OPTIX';prefs.get_devices()
for device in prefs.devices:device.use=device.type=='OPTIX'
scene.cycles.denoising_use_gpu=True;scene.cycles.device='GPU';scene.cycles.samples=64
scene.render.resolution_x=1280;scene.render.resolution_y=720
for frame in [320,370]:
scene.frame_set(frame);scene.render.filepath=str(ROOT/f'build/cinematic-v5/camera-proof-{frame:04d}.png');bpy.ops.render.render(write_still=True)