Skip to content
Snippets Groups Projects
Commit e7ee79f7 authored by florianfelix's avatar florianfelix
Browse files

Render Auto Save: Cleanup, formatting, add docstrings

parent 311b03bd
Branches
No related tags found
No related merge requests found
...@@ -99,16 +99,20 @@ def auto_save_render(scene): ...@@ -99,16 +99,20 @@ def auto_save_render(scene):
if not exists(filepath): if not exists(filepath):
mkdir(filepath) mkdir(filepath)
#imagefiles starting with the blendname # imagefiles starting with the blendname
files = [f for f in listdir(filepath) files = [f for f in listdir(filepath)
if f.startswith(blendname) if f.startswith(blendname)
and f.lower().endswith(IMAGE_EXTENSIONS)] and f.lower().endswith(IMAGE_EXTENSIONS)]
def save_number_from_files(files): def save_number_from_files(files):
'''
Returns the new highest count number from file names
as 3 digit string.
'''
highest = 0 highest = 0
if files: if files:
for f in files: for f in files:
#find last numbers in the filename # find last numbers in the filename
suffix = findall(r'\d+', f.split(blendname)[-1]) suffix = findall(r'\d+', f.split(blendname)[-1])
if suffix: if suffix:
if int(suffix[-1]) > highest: if int(suffix[-1]) > highest:
...@@ -116,6 +120,9 @@ def auto_save_render(scene): ...@@ -116,6 +120,9 @@ def auto_save_render(scene):
return str(highest+1).zfill(3) return str(highest+1).zfill(3)
def this_frame_files(files): def this_frame_files(files):
'''
Filters out files which have the current frame number in the file name
'''
match_files = [] match_files = []
frame_pattern = r'_f[0-9]{4}_' frame_pattern = r'_f[0-9]{4}_'
for file in files: for file in files:
...@@ -172,7 +179,6 @@ class RENDER_PT_render_auto_save(Panel): ...@@ -172,7 +179,6 @@ class RENDER_PT_render_auto_save(Panel):
return (context.engine in cls.COMPAT_ENGINES) return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context): def draw_header(self, context):
rd = context.scene.render
self.layout.prop(context.scene, 'auto_save_after_render', text="") self.layout.prop(context.scene, 'auto_save_after_render', text="")
def draw(self, context): def draw(self, context):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment