Created
December 11, 2018 15:03
-
-
Save cloutsocks/6f30950d1c4bc5a67057ce95c53dcc8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mark all scene devices as GPU for cycles | |
bpy.context.scene.cycles.device = 'GPU' | |
for scene in bpy.data.scenes: | |
scene.cycles.device = 'GPU' | |
# Enable CUDA | |
bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA' | |
# Enable and list all devices, or optionally disable CPU | |
for d in bpy.context.user_preferences.addons['cycles'].preferences.devices: | |
d.use = True | |
# if d.type == 'CPU': | |
# d.use = False | |
print("Device '{}' type {} : {}" . format(d.name, d.type, d.use)) | |
# Optionally set a filepath override, if you haven't already in your file or via adjust.py | |
# bpy.data.scenes["Scene"].render.filepath = "/tmp/output.png" | |
# write_still will save the rendered image to the given output path; not necessary for node based setups | |
bpy.ops.render.render(write_still=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment