Batch-previews generation: add option to control whether we save backup .blend1 file or not.

Requested by Aaron Carlisle (@blendify) over IRC.
This commit is contained in:
Bastien Montagne
2016-03-01 17:46:21 +01:00
parent 50500a4399
commit 449fbde7d1
2 changed files with 33 additions and 4 deletions

View File

@@ -86,6 +86,11 @@ class WM_OT_previews_batch_generate(Operator):
name="Trusted Blend Files",
description="Enable python evaluation for selected files",
)
use_backups = BoolProperty(
default=True,
name="Save Backups",
description="Keep a backup (.blend1) version of the files when saving with generated previews",
)
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
@@ -126,6 +131,8 @@ class WM_OT_previews_batch_generate(Operator):
cmd.append('--no_objects')
if not self.use_intern_data:
cmd.append('--no_data_intern')
if not self.use_backups:
cmd.append("--no_backups")
if subprocess.call(cmd):
self.report({'ERROR'}, "Previews generation process failed for file '%s'!" % blen_path)
context.window_manager.progress_end()
@@ -192,6 +199,11 @@ class WM_OT_previews_batch_clear(Operator):
name="Trusted Blend Files",
description="Enable python evaluation for selected files",
)
use_backups = BoolProperty(
default=True,
name="Save Backups",
description="Keep a backup (.blend1) version of the files when saving with cleared previews",
)
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
@@ -233,6 +245,8 @@ class WM_OT_previews_batch_clear(Operator):
cmd.append('--no_objects')
if not self.use_intern_data:
cmd.append('--no_data_intern')
if not self.use_backups:
cmd.append("--no_backups")
if subprocess.call(cmd):
self.report({'ERROR'}, "Previews clear process failed for file '%s'!" % blen_path)
context.window_manager.progress_end()