2 # Copyright 2011, Blender Foundation.
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 import libcycles_blender as lib
25 path = os.path.dirname(__file__)
26 user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', '')))
28 lib.init(path, user_path)
30 def create(engine, data, scene, region = 0, v3d = 0, rv3d = 0):
31 import libcycles_blender as lib
33 data = data.as_pointer()
34 scene = scene.as_pointer()
36 region = region.as_pointer()
38 v3d = v3d.as_pointer()
40 rv3d = rv3d.as_pointer()
42 engine.session = lib.create(engine.as_pointer(), data, scene, region, v3d, rv3d)
45 if "session" in dir(engine):
47 import libcycles_blender as lib
48 lib.free(engine.session)
52 import libcycles_blender as lib
53 lib.render(engine.session)
55 def update(engine, data, scene):
56 import libcycles_blender as lib
57 lib.sync(engine.session)
59 def draw(engine, region, v3d, rv3d):
60 import libcycles_blender as lib
61 v3d = v3d.as_pointer()
62 rv3d = rv3d.as_pointer()
65 lib.draw(engine.session, v3d, rv3d)
67 def available_devices():
68 import libcycles_blender as lib
69 return lib.available_devices()
72 import libcycles_blender as lib