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