Scripting in Blender with Python, and working on the API
Moderators: jesterKing, stiv
- Posts: 6
- Joined: Sat Mar 10, 2012 1:04 pm
I don't have any chance enabling gpu renderin gon my laptop. But I can take advantage of external compute power.
I would like to enable my .blend to have gpu rendering even if I cannot activate it on my laptop.
The following python code won't work :
Code: Select all
bpy.context.user_preferences.system.compute_device_type = 'CUDA'
How could I do this ?
I really need this, really.
- Posts: 15
- Joined: Mon Dec 10, 2007 1:52 am
- Location: arkansas
I think the problem is the order that scripts run at launch. Cycles is an addon -> addons are loaded after startup folder scripts.
Perhaps some way to delay until blender is finished launching, make sure cycles is loaded/activated, then try your line of code line?
I have my prefs set up in a startup script, all works except the enabling cuda part.
heres that prefs.py:
Code: Select all
AUTHOR = 'dust'
prefs = context.user_preferences
filepaths = prefs.filepaths
filepaths.font_directory = "/Library/Fonts/"
filepaths.animation_player_preset = "DJV"
filepaths.image_editor = '/Applications/GIMP.app'
filepaths.texture_directory = '/Users/dust/Pictures/texture/'
filepaths.render_output_directory = '/Users/dust/Desktop/'
filepaths.show_thumbnails = True
inputs = prefs.inputs
inputs.use_mouse_continuous = True
view = prefs.view
view.show_splash = False
view.use_auto_perspective = True
system = prefs.system
system.compute_device_type = 'CUDA'
system.author = AUTHOR
edit = prefs.edit
edit.use_enter_edit_mode = True
edit.object_align = 'VIEW'
if not bpy.context.user_preferences.system.author:
print('setting preferences for author:',AUTHOR)
if __name__ == "__main__":
Who is online
Users browsing this forum: No registered users and 3 guests