27 lines
1.2 KiB
Python
27 lines
1.2 KiB
Python
"""Resume the identical saved camera animation after the last complete PNG."""
|
|
from pathlib import Path
|
|
import argparse,sys
|
|
import bpy
|
|
|
|
ROOT=Path(__file__).resolve().parents[2]
|
|
SOURCE=ROOT/'assets/cinematics/blender/eblan-workshop-v4.blend'
|
|
FRAMES=ROOT/'build/cinematic-v4/workshop-clutter'
|
|
parser=argparse.ArgumentParser();parser.add_argument('--from-start',action='store_true')
|
|
args=parser.parse_args(sys.argv[sys.argv.index('--')+1:] if '--' in sys.argv else [])
|
|
bpy.ops.wm.open_mainfile(filepath=str(SOURCE))
|
|
scene=bpy.context.scene
|
|
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.device='GPU';scene.cycles.denoising_use_gpu=True
|
|
scene.frame_start=1;scene.frame_set(24)
|
|
bpy.ops.wm.save_as_mainfile(filepath=str(SOURCE))
|
|
start=1
|
|
while not args.from_start and start<=192:
|
|
path=FRAMES/f'frame_{start:04d}.png'
|
|
if not path.exists() or not path.read_bytes().endswith(b'IEND\xaeB`\x82'):break
|
|
start+=1
|
|
print('RESUME_FULL_HD_AT_FRAME',start,flush=True)
|
|
if start<=192:
|
|
scene.frame_start=start;scene.render.filepath=str(FRAMES/'frame_')
|
|
bpy.ops.render.render(animation=True)
|