[Bf-extensions-cvs] [6e6d3da5] master: Add batch maker

Eugenio Pignataro noreply at git.blender.org
Tue Jan 1 16:37:32 CET 2019


Commit: 6e6d3da51975253ffa7f28a6b6593fc1f690d532
Author: Eugenio Pignataro
Date:   Tue Jan 1 12:37:25 2019 -0300
Branches: master
https://developer.blender.org/rBA6e6d3da51975253ffa7f28a6b6593fc1f690d532

Add batch maker

===================================================================

M	oscurart_tools/__init__.py
A	oscurart_tools/render/batch_maker.py

===================================================================

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'}
+



More information about the Bf-extensions-cvs mailing list