Skip to content

Instantly share code, notes, and snippets.

@bdancer
Last active August 29, 2015 14:20
Show Gist options
  • Save bdancer/40a8d9acc23f00cf0d61 to your computer and use it in GitHub Desktop.
Save bdancer/40a8d9acc23f00cf0d61 to your computer and use it in GitHub Desktop.
#
# V-Ray For Blender Batch Render
#
# http://chaosgroup.com
#
# Author: Andrei Izrantcev
# E-Mail: andrei.izrantcev@chaosgroup.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# All Rights Reserved. V-Ray(R) is a registered trademark of Chaos Software.
#
import bpy
import os
import sys
# OPTIONS
#
DISPLAY_VFB = '--show_vfb' in sys.argv
OVERRIVE_OUTPUT_DIR = '--override_output' in sys.argv
OUTPUT_DIR = ""
if OVERRIVE_OUTPUT_DIR:
OUTPUT_DIR = os.path.normpath(sys.argv[sys.argv.index('--override_output') + 1].split('=')[1].strip())
# RENDER
#
VRayScene = bpy.context.scene.vray
VRayExporter = VRayScene.Exporter
# Activate autosave
VRayExporter.auto_save_render = True
# Wait for render end
VRayExporter.wait = True
# Autoclose V-Ray on render end
VRayExporter.autoclose = True
# Force run
VRayExporter.autorun = True
if hasattr(VRayExporter, 'display_vfb_in_batch'):
VRayExporter.display_vfb_in_batch = DISPLAY_VFB
if OVERRIVE_OUTPUT_DIR:
VRayScene.SettingsOutput.img_dir = OUTPUT_DIR
# Render
bpy.ops.render.render()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment