2 # Copyright 2011-2013 Blender Foundation
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
20 "name": "Cycles Render Engine",
22 "blender": (2, 80, 0),
23 "location": "Info header, render engine menu",
24 "description": "Cycles Render Engine integration",
26 "wiki_url": "https://docs.blender.org/manual/en/dev/render/cycles/",
28 "support": 'OFFICIAL',
31 # Support 'reload' case.
34 if "engine" in locals():
35 importlib.reload(engine)
36 if "version_update" in locals():
37 importlib.reload(version_update)
40 if "properties" in locals():
41 importlib.reload(properties)
42 if "presets" in locals():
43 importlib.reload(presets)
53 class CyclesRender(bpy.types.RenderEngine):
55 bl_label = "Cycles Render"
56 bl_use_shading_nodes = True
58 bl_use_exclude_layers = True
59 bl_use_save_buffers = True
60 bl_use_spherical_stereo = True
69 def update(self, data, scene):
72 cscene = bpy.context.scene.cycles
73 use_osl = cscene.shading_system and cscene.device == 'CPU'
75 engine.create(self, data, scene,
76 None, None, None, use_osl)
78 engine.create(self, data, scene)
80 engine.reset(self, data, scene)
82 def render_to_image(self, depsgraph):
83 engine.render(self, depsgraph)
85 def bake(self, depsgraph, scene, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result):
86 engine.bake(self, depsgraph, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result)
89 def view_update(self, context):
91 engine.create(self, context.blend_data, context.scene,
92 context.region, context.space_data, context.region_data)
93 engine.update(self, context.depsgraph, context.blend_data, context.scene)
95 def render_to_view(self, context):
96 engine.draw(self, context.depsgraph, context.region, context.space_data, context.region_data)
98 def update_script_node(self, node):
101 osl.update_script_node(node, self.report)
103 self.report({'ERROR'}, "OSL support disabled in this build.")
105 def update_render_passes(self, scene, srl):
106 engine.register_passes(self, scene, srl)
119 from bpy.utils import register_class
121 from . import properties
122 from . import presets
125 # Make sure we only registered the callback once.
126 atexit.unregister(engine_exit)
127 atexit.register(engine_exit)
131 properties.register()
138 bpy.app.handlers.version_update.append(version_update.do_versions)
142 from bpy.utils import unregister_class
144 from . import properties
145 from . import presets
148 bpy.app.handlers.version_update.remove(version_update.do_versions)
151 properties.unregister()
155 unregister_class(cls)