2011-04-27 11:58:34 +00:00
|
|
|
#
|
|
|
|
|
# Copyright 2011, Blender Foundation.
|
|
|
|
|
#
|
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
#
|
|
|
|
|
|
2011-11-15 02:58:01 +00:00
|
|
|
# <pep8 compliant>
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
bl_info = {
|
|
|
|
|
"name": "Cycles Render Engine",
|
|
|
|
|
"author": "",
|
2012-04-30 19:52:07 +00:00
|
|
|
"blender": (2, 6, 3),
|
2011-04-27 11:58:34 +00:00
|
|
|
"location": "Info header, render engine menu",
|
2012-04-30 19:52:07 +00:00
|
|
|
"description": "Cycles Render Engine integration",
|
2011-04-27 11:58:34 +00:00
|
|
|
"warning": "",
|
2012-09-21 17:53:52 +00:00
|
|
|
"wiki_url": "http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles",
|
2011-04-27 11:58:34 +00:00
|
|
|
"tracker_url": "",
|
2011-11-13 10:05:07 +00:00
|
|
|
"support": 'OFFICIAL',
|
2011-04-27 11:58:34 +00:00
|
|
|
"category": "Render"}
|
|
|
|
|
|
|
|
|
|
import bpy
|
2011-12-01 16:33:21 +00:00
|
|
|
from . import ui, properties, engine, presets
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
class CyclesRender(bpy.types.RenderEngine):
|
2011-08-28 13:55:59 +00:00
|
|
|
bl_idname = 'CYCLES'
|
2011-11-21 16:28:19 +00:00
|
|
|
bl_label = "Cycles Render"
|
2011-10-11 17:19:55 +00:00
|
|
|
bl_use_shading_nodes = True
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
def __init__(self):
|
|
|
|
|
engine.init()
|
|
|
|
|
self.session = None
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
def __del__(self):
|
|
|
|
|
engine.free(self)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
# final render
|
|
|
|
|
def update(self, data, scene):
|
2012-11-09 08:46:53 +00:00
|
|
|
if not self.session:
|
|
|
|
|
engine.create(self, data, scene)
|
|
|
|
|
else:
|
|
|
|
|
engine.reset(self, data, scene)
|
|
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
engine.update(self, data, scene)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-02 15:15:45 +00:00
|
|
|
def render(self, scene):
|
2011-08-28 13:55:59 +00:00
|
|
|
engine.render(self)
|
2011-05-17 14:26:45 +00:00
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
# preview render
|
|
|
|
|
# def preview_update(self, context, id):
|
|
|
|
|
# pass
|
|
|
|
|
#
|
|
|
|
|
# def preview_render(self):
|
|
|
|
|
# pass
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
# viewport render
|
|
|
|
|
def view_update(self, context):
|
|
|
|
|
if not self.session:
|
|
|
|
|
engine.create(self, context.blend_data, context.scene,
|
|
|
|
|
context.region, context.space_data, context.region_data)
|
|
|
|
|
engine.update(self, context.blend_data, context.scene)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
def view_draw(self, context):
|
|
|
|
|
engine.draw(self, context.region, context.space_data, context.region_data)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2012-11-03 14:32:35 +00:00
|
|
|
def update_script_node(self, node):
|
|
|
|
|
if engine.with_osl():
|
|
|
|
|
from . import osl
|
|
|
|
|
osl.update_script_node(node, self.report)
|
|
|
|
|
else:
|
|
|
|
|
self.report({'ERROR'}, "OSL support disabled in this build.")
|
|
|
|
|
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
def register():
|
2011-08-28 13:55:59 +00:00
|
|
|
properties.register()
|
|
|
|
|
ui.register()
|
2011-08-29 17:55:14 +00:00
|
|
|
presets.register()
|
2011-08-28 13:55:59 +00:00
|
|
|
bpy.utils.register_module(__name__)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
def unregister():
|
2011-08-28 13:55:59 +00:00
|
|
|
ui.unregister()
|
|
|
|
|
properties.unregister()
|
2011-08-29 17:55:14 +00:00
|
|
|
presets.unregister()
|
2011-08-28 13:55:59 +00:00
|
|
|
bpy.utils.unregister_module(__name__)
|
2012-11-03 14:32:35 +00:00
|
|
|
|