Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugenio Pignataro <info@oscurart.com.ar>2019-01-01 18:37:25 +0300
committerEugenio Pignataro <info@oscurart.com.ar>2019-01-01 18:37:25 +0300
commit6e6d3da51975253ffa7f28a6b6593fc1f690d532 (patch)
treeb2154fb5dd51100e86746348fef3a03140609591 /oscurart_tools
parent1ce76164d18f21bb84dcc26970fddde7972f87a6 (diff)
Add batch maker
Diffstat (limited to 'oscurart_tools')
-rw-r--r--oscurart_tools/__init__.py5
-rw-r--r--oscurart_tools/render/batch_maker.py49
2 files changed, 54 insertions, 0 deletions
diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py
index 026acb6c..75362709 100644
--- a/oscurart_tools/__init__.py
+++ b/oscurart_tools/__init__.py
@@ -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():
diff --git a/oscurart_tools/render/batch_maker.py b/oscurart_tools/render/batch_maker.py
new file mode 100644
index 00000000..07c727d1
--- /dev/null
+++ b/oscurart_tools/render/batch_maker.py
@@ -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'}
+