2012-10-28 16:09:51 +00:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
|
|
|
|
# <pep8 compliant>
|
|
|
|
import bpy
|
2014-04-24 19:31:20 +00:00
|
|
|
from bpy.types import Panel, UIList
|
2012-10-28 16:09:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
class RenderLayerButtonsPanel():
|
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "render_layer"
|
|
|
|
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
scene = context.scene
|
|
|
|
return scene and (scene.render.engine in cls.COMPAT_ENGINES)
|
|
|
|
|
|
|
|
|
2013-01-05 22:24:05 +00:00
|
|
|
class RENDERLAYER_UL_renderlayers(UIList):
|
|
|
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
|
|
|
# assert(isinstance(item, bpy.types.SceneRenderLayer)
|
|
|
|
layer = item
|
|
|
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
2013-11-23 19:37:23 +00:00
|
|
|
layout.prop(layer, "name", text="", icon_value=icon, emboss=False)
|
2013-01-05 22:24:05 +00:00
|
|
|
layout.prop(layer, "use", text="", index=index)
|
|
|
|
elif self.layout_type in {'GRID'}:
|
|
|
|
layout.alignment = 'CENTER'
|
|
|
|
layout.label("", icon_value=icon)
|
|
|
|
|
|
|
|
|
2012-10-28 16:09:51 +00:00
|
|
|
class RENDERLAYER_PT_layers(RenderLayerButtonsPanel, Panel):
|
2013-04-06 23:05:32 +00:00
|
|
|
bl_label = "Layer List"
|
2012-10-29 23:11:55 +00:00
|
|
|
bl_options = {'HIDE_HEADER'}
|
2012-10-28 16:09:51 +00:00
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
scene = context.scene
|
|
|
|
rd = scene.render
|
|
|
|
|
|
|
|
row = layout.row()
|
2013-10-13 23:04:39 +00:00
|
|
|
col = row.column()
|
2013-11-24 13:25:38 +00:00
|
|
|
col.template_list("RENDERLAYER_UL_renderlayers", "", rd, "layers", rd.layers, "active_index", rows=2)
|
2012-10-28 16:09:51 +00:00
|
|
|
|
2013-11-24 13:25:38 +00:00
|
|
|
col = row.column()
|
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.operator("scene.render_layer_add", icon='ZOOMIN', text="")
|
|
|
|
sub.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
|
2014-01-30 05:31:57 +00:00
|
|
|
col.prop(rd, "use_single_layer", icon_only=True)
|
2012-10-28 16:09:51 +00:00
|
|
|
|
2012-10-29 23:11:55 +00:00
|
|
|
|
|
|
|
class RENDERLAYER_PT_layer_options(RenderLayerButtonsPanel, Panel):
|
|
|
|
bl_label = "Layer"
|
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
scene = context.scene
|
|
|
|
rd = scene.render
|
|
|
|
rl = rd.layers.active
|
|
|
|
|
2012-10-28 16:09:51 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.prop(scene, "layers", text="Scene")
|
2013-01-05 22:24:05 +00:00
|
|
|
col.label(text="")
|
2012-10-28 16:09:51 +00:00
|
|
|
col.prop(rl, "light_override", text="Light")
|
|
|
|
col.prop(rl, "material_override", text="Material")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.prop(rl, "layers", text="Layer")
|
2013-04-06 23:05:32 +00:00
|
|
|
col.prop(rl, "layers_zmask", text="Mask Layer")
|
2012-10-28 16:09:51 +00:00
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
layout.label(text="Include:")
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2013-01-05 22:24:05 +00:00
|
|
|
col.prop(rl, "use_zmask")
|
|
|
|
row = col.row()
|
|
|
|
row.prop(rl, "invert_zmask", text="Negate")
|
|
|
|
row.active = rl.use_zmask
|
2012-10-28 16:09:51 +00:00
|
|
|
col.prop(rl, "use_all_z")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.prop(rl, "use_solid")
|
|
|
|
col.prop(rl, "use_halo")
|
2013-01-05 22:24:05 +00:00
|
|
|
col.prop(rl, "use_ztransp")
|
2012-10-28 16:09:51 +00:00
|
|
|
|
|
|
|
col = split.column()
|
2012-12-20 07:57:26 +00:00
|
|
|
col.prop(rl, "use_sky")
|
2014-01-27 18:58:54 +00:00
|
|
|
col.prop(rl, "use_edge_enhance")
|
2013-01-05 22:24:05 +00:00
|
|
|
col.prop(rl, "use_strand")
|
|
|
|
if bpy.app.build_options.freestyle:
|
2012-12-20 07:57:26 +00:00
|
|
|
row = col.row()
|
|
|
|
row.prop(rl, "use_freestyle")
|
|
|
|
row.active = rd.use_freestyle
|
2012-10-28 16:09:51 +00:00
|
|
|
|
2012-10-29 23:11:55 +00:00
|
|
|
|
|
|
|
class RENDERLAYER_PT_layer_passes(RenderLayerButtonsPanel, Panel):
|
2013-04-30 18:57:04 +00:00
|
|
|
bl_label = "Passes"
|
2012-10-29 23:11:55 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
|
|
|
|
|
|
|
def draw_pass_type_buttons(self, box, rl, pass_type):
|
|
|
|
# property names
|
|
|
|
use_pass_type = "use_pass_" + pass_type
|
|
|
|
exclude_pass_type = "exclude_" + pass_type
|
|
|
|
# draw pass type buttons
|
|
|
|
row = box.row()
|
|
|
|
row.prop(rl, use_pass_type)
|
|
|
|
row.prop(rl, exclude_pass_type, text="")
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
scene = context.scene
|
|
|
|
rd = scene.render
|
|
|
|
rl = rd.layers.active
|
2012-10-28 16:09:51 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.prop(rl, "use_pass_combined")
|
|
|
|
col.prop(rl, "use_pass_z")
|
|
|
|
col.prop(rl, "use_pass_vector")
|
|
|
|
col.prop(rl, "use_pass_normal")
|
|
|
|
col.prop(rl, "use_pass_uv")
|
|
|
|
col.prop(rl, "use_pass_mist")
|
|
|
|
col.prop(rl, "use_pass_object_index")
|
|
|
|
col.prop(rl, "use_pass_material_index")
|
|
|
|
col.prop(rl, "use_pass_color")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.prop(rl, "use_pass_diffuse")
|
2012-10-29 23:11:55 +00:00
|
|
|
self.draw_pass_type_buttons(col, rl, "specular")
|
|
|
|
self.draw_pass_type_buttons(col, rl, "shadow")
|
|
|
|
self.draw_pass_type_buttons(col, rl, "emit")
|
|
|
|
self.draw_pass_type_buttons(col, rl, "ambient_occlusion")
|
|
|
|
self.draw_pass_type_buttons(col, rl, "environment")
|
|
|
|
self.draw_pass_type_buttons(col, rl, "indirect")
|
|
|
|
self.draw_pass_type_buttons(col, rl, "reflection")
|
|
|
|
self.draw_pass_type_buttons(col, rl, "refraction")
|
2012-10-28 16:09:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
|
|
bpy.utils.register_module(__name__)
|