Cleanup: tabs -> spaces
[blender-addons.git] / oscurart_tools / render / batch_maker.py
blobca386546f11396401dbf70c66ff8b4adc6612ec9
1 import bpy
2 import os
4 # ---------------------------BATCH MAKER------------------
7 def batchMaker(BIN):
9 if os.name == "nt":
10 print("PLATFORM: WINDOWS")
11 SYSBAR = os.sep
12 EXTSYS = ".bat"
13 QUOTES = '"'
14 else:
15 print("PLATFORM:LINUX")
16 SYSBAR = os.sep
17 EXTSYS = ".sh"
18 QUOTES = ''
20 FILENAME = bpy.data.filepath.rpartition(SYSBAR)[-1].rpartition(".")[0]
21 BINDIR = bpy.app[4]
22 SHFILE = os.path.join(
23 bpy.data.filepath.rpartition(SYSBAR)[0],
24 FILENAME + EXTSYS)
26 renpath = bpy.context.scene.render.filepath
28 with open(SHFILE, "w") as FILE:
29 if not BIN:
30 for scene in bpy.data.scenes:
31 FILE.writelines("'%s' -b '%s' --scene %s --python-text Text -a \n" % (bpy.app.binary_path,bpy.data.filepath,scene.name))
32 else:
33 for scene in bpy.data.scenes:
34 FILE.writelines("blender -b '%s' --scene %s --python-text Text -a \n" % (bpy.data.filepath,scene.name))
38 class oscBatchMaker (bpy.types.Operator):
39 """It creates .bat(win) or .sh(unix) file, to execute and render from Console/Terminal"""
40 bl_idname = "file.create_batch_maker_osc"
41 bl_label = "Make render batch"
42 bl_options = {'REGISTER', 'UNDO'}
44 bin : bpy.props.BoolProperty(
45 default=False,
46 name="Use Environment Variable")
48 def execute(self, context):
49 batchMaker(self.bin)
50 return {'FINISHED'}