Add batch maker
This commit is contained in:
parent
1ce76164d1
commit
6e6d3da519
|
@ -46,6 +46,7 @@ from oscurart_tools.object import selection
|
|||
from oscurart_tools.object import search_and_select
|
||||
from oscurart_tools.mesh import apply_linked_meshes
|
||||
from oscurart_tools.render import render_tokens
|
||||
from oscurart_tools.render import batch_maker
|
||||
|
||||
from bpy.types import (
|
||||
AddonPreferences,
|
||||
|
@ -74,6 +75,7 @@ class VIEW3D_MT_edit_mesh_oscurarttools(Menu):
|
|||
layout.operator("image.reload_images_osc")
|
||||
layout.operator("file.save_incremental_backup")
|
||||
layout.operator("file.collect_all_images")
|
||||
layout.operator("file.create_batch_maker_osc")
|
||||
|
||||
def menu_funcMesh(self, context):
|
||||
self.layout.menu("VIEW3D_MT_edit_mesh_oscurarttools")
|
||||
|
@ -93,6 +95,7 @@ class IMAGE_MT_uvs_oscurarttools(Menu):
|
|||
layout.operator("image.reload_images_osc")
|
||||
layout.operator("file.save_incremental_backup")
|
||||
layout.operator("file.collect_all_images")
|
||||
layout.operator("file.create_batch_maker_osc")
|
||||
|
||||
def menu_funcImage(self, context):
|
||||
self.layout.menu("IMAGE_MT_uvs_oscurarttools")
|
||||
|
@ -114,6 +117,7 @@ class VIEW3D_MT_object_oscurarttools(Menu):
|
|||
layout.operator("image.reload_images_osc")
|
||||
layout.operator("file.save_incremental_backup")
|
||||
layout.operator("file.collect_all_images")
|
||||
layout.operator("file.create_batch_maker_osc")
|
||||
|
||||
def menu_funcObject(self, context):
|
||||
self.layout.menu("VIEW3D_MT_object_oscurarttools")
|
||||
|
@ -138,6 +142,7 @@ classes = (
|
|||
shapes_to_objects.ShapeToObjects,
|
||||
search_and_select.SearchAndSelectOt,
|
||||
apply_linked_meshes.ApplyLRT,
|
||||
batch_maker.oscBatchMaker
|
||||
)
|
||||
|
||||
def register():
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
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:
|
||||
FILE.writelines("%s -b %s --python-text Text -a" % (bpy.app.binary_path,bpy.data.filepath))
|
||||
else:
|
||||
FILE.writelines("blender -b %s --python-text Text -a" % (bpy.data.filepath))
|
||||
|
||||
|
||||
|
||||
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'}
|
||||
|
Loading…
Reference in New Issue