Cycles: svn merge -r36352:36495 https://svn.blender.org/svnroot/bf-blender/trunk...
[blender.git] / intern / cycles / blender / addon / __init__.py
1 #
2 # Copyright 2011, Blender Foundation.
3 #
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.
8 #
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.
13 #
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.
17 #
18
19 bl_info = {
20     "name": "Cycles Render Engine",
21     "author": "",
22     "version": (0,0),
23     "blender": (2, 5, 6),
24     "api": 34462,
25     "location": "Info header, render engine menu",
26     "description": "Cycles Render Engine integration.",
27     "warning": "",
28     "wiki_url": "",
29     "tracker_url": "",
30     "category": "Render"}
31
32 import bpy
33
34 from cycles import ui
35 from cycles import properties
36 from cycles import xml
37 from cycles import engine
38
39 class CyclesRender(bpy.types.RenderEngine):
40         bl_idname = 'CYCLES'
41         bl_label = "Cycles"
42
43         def __init__(self):
44                 engine.init()
45                 self.session = None
46         
47         def __del__(self):
48                 engine.free(self)
49
50         def render(self, scene):
51                 scene.frame_set(scene.frame_current) # should this be done already?
52                 engine.create(self, scene, True)
53                 engine.render(self, scene)
54
55         def draw(self, scene):
56                 if not self.session:
57                         engine.create(self, scene, False)
58                 engine.draw(self, scene)
59
60         def update(self, scene):
61                 engine.update(self, scene)
62
63 def register():
64         properties.register()
65         ui.register()
66         xml.register()
67         bpy.utils.register_module(__name__)
68
69 def unregister():
70         xml.unregister()
71         ui.unregister()
72         properties.unregister()
73         bpy.utils.unregister_module(__name__)
74