fix: filepath

This commit is contained in:
Swann 2021-12-11 17:57:09 +01:00
parent 8cb40b2d60
commit d78c42b02f

View File

@ -59,7 +59,7 @@ deleyables = []
stop_modal_executor = False stop_modal_executor = False
CLEARED_DATABLOCKS = ['actions', 'armatures', 'cache_files', 'cameras', CLEARED_DATABLOCKS = ['actions', 'armatures', 'cache_files', 'cameras',
'collections', 'curves', 'filepath', 'fonts', 'collections', 'curves', 'fonts',
'grease_pencils', 'images', 'lattices', 'libraries', 'grease_pencils', 'images', 'lattices', 'libraries',
'lightprobes', 'lights', 'linestyles', 'masks', 'lightprobes', 'lights', 'linestyles', 'masks',
'materials', 'meshes', 'metaballs', 'movieclips', 'materials', 'meshes', 'metaballs', 'movieclips',
@ -1033,6 +1033,26 @@ class SessionStopAutoSaveOperator(bpy.types.Operator):
return {'FINISHED'} return {'FINISHED'}
class SessionRenderReplay(bpy.types.Operator):
bl_idname = "session.render_replay"
bl_label = "Render Replay"
bl_description = "Render Replay"
@classmethod
def poll(cls, context):
return context.window_manager.session.replay_files
def execute(self, context):
base_path = str(context.scene.render.filepath)
for frame in range(0,context.scene.frame_end):
logging.info(f"Rendering frame {frame} to {base_path}_{frame}.png")
context.scene.frame_current = frame
filename = Path(bpy.context.window_manager.session.replay_files[context.scene.active_replay_file].name)
context.scene.render.filepath = f"{base_path}{frame}_{filename.stem}"
bpy.ops.render.render(write_still=True)
context.scene.render.filepath = base_path
return {'FINISHED'}
class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper): class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper):
bl_idname = "session.load" bl_idname = "session.load"
@ -1214,6 +1234,7 @@ class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper):
runtime_settings.replay_camera: runtime_settings.replay_camera:
bpy.context.scene.camera = runtime_settings.replay_camera bpy.context.scene.camera = runtime_settings.replay_camera
bpy.context.scene.eevee.use_bloom = False
return {'FINISHED'} return {'FINISHED'}
@ -1243,6 +1264,7 @@ classes = (
SessionLoadSaveOperator, SessionLoadSaveOperator,
SessionStopAutoSaveOperator, SessionStopAutoSaveOperator,
SessionPurgeOperator, SessionPurgeOperator,
SessionRenderReplay
) )
def update_external_dependencies(): def update_external_dependencies():