Page MenuHome
Paste P673

Masterwork From Distant Lands
ActivePublic

Authored by Dalai Felinto (dfelinto) on May 4 2018, 5:27 PM.
# ##### 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
from bpy.types import Panel, UIList
from bpy.props import EnumProperty
class ViewLayerButtonsPanel:
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "view_layer"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
class VIEWLAYER_PT_layer(ViewLayerButtonsPanel, Panel):
bl_label = "View Layer"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'}
def draw(self, context):
layout = self.layout
scene = context.scene
rd = scene.render
layer = bpy.context.view_layer
layout.prop(layer, "use", text="Use for Rendering");
layout.prop(rd, "use_single_layer", text="Render Single Layer")
class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel):
bl_label = "Passes"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
def draw(self, context):
layout = self.layout
scene = context.scene
rd = scene.render
view_layer = context.view_layer
split = layout.split()
col = split.column()
col.prop(view_layer, "use_pass_combined")
col.prop(view_layer, "use_pass_z")
col.prop(view_layer, "use_pass_mist")
col.prop(view_layer, "use_pass_normal")
col.separator()
col.prop(view_layer, "use_pass_ambient_occlusion")
col = split.column()
col.label(text="Subsurface:")
row = col.row(align=True)
row.prop(view_layer, "use_pass_subsurface_direct", text="Direct", toggle=True)
row.prop(view_layer, "use_pass_subsurface_color", text="Color", toggle=True)
names = ["Clay Render", "Make Everything Green", "More", "Other"]
class VIEWLAYER_UL_override_sets(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
row = layout.row(align=True)
row.prop(item, "use", text="", index=index)
row.label(text=names[index])
class VIEWLAYER_UL_override_set_collections(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
layout.prop(item, "name", text="", emboss=False, icon_value=icon)
class VIEWLAYER_OT_overrides(ViewLayerButtonsPanel, Panel):
bl_label = "Overrides"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
layout = self.layout
scene = context.scene
view_layer = context.view_layer
ob = bpy.data.objects['Cube']
me = ob.data
row = layout.row(align=True)
row.prop(scene.render, "use_placeholder", icon='TRIA_DOWN' if scene.render.use_placeholder else 'TRIA_RIGHT', emboss=False, text="")
row.label(text="Override Sets")
if scene.render.use_placeholder:
row = layout.row()
col = row.column()
col.template_list("VIEWLAYER_UL_override_sets", "name", scene.render, "views", scene.render.views, "active_index", rows=1)
col = row.column(align=True)
col.operator("scene.view_layer_add", icon='ZOOMIN', text="")
col.operator("scene.view_layer_remove", icon='ZOOMOUT', text="")
row = layout.row(align=True)
row.prop(scene.render, "use_file_extension", icon='TRIA_DOWN' if scene.render.use_file_extension else 'TRIA_RIGHT', emboss=False, text="")
row.label(text="Scene Properties")
if scene.render.use_file_extension:
# Material, Emission
if scene.render.views.active_index == 0:
# Samples, ...
lamp = bpy.data.objects['Lamp']
box = layout.box()
row = box.row()
row.prop(scene.render, "use_stamp", text="")
subrow = row.row()
subrow.active = scene.render.use_stamp
subrow.label(text="Samples", icon='SCENE_DATA')
subrow.prop(lamp, "override_mode", text="")
subrow.prop(lamp, "pass_index", text="")
row.label(icon='ZOOMOUT')
else:
# Samples, ...
lamp = bpy.data.objects['Lamp']
box = layout.box()
row = box.row()
row.prop(scene.render, "use_stamp_labels", text="")
subrow = row.row()
subrow.active = scene.render.use_stamp_labels
subrow.label(text="World", icon='WORLD_DATA')
subrow.prop(bpy.data.scenes['Clay'], "background_set", text="", icon='WORLD')
row.label(icon='ZOOMOUT')
row = layout.row(align=True)
row.prop(scene.render, "use_overwrite", icon='TRIA_DOWN' if scene.render.use_overwrite else 'TRIA_RIGHT', emboss=False, text="")
row.label(text="Affected Collections")
if scene.render.use_overwrite:
row = layout.row()
col = row.column()
if scene.render.views.active_index == 0:
col.template_list("VIEWLAYER_UL_override_set_collections", "collections", view_layer, "collections", view_layer.collections, "active_index", rows=1)
else:
col.template_list("VIEWLAYER_UL_override_set_collections", "", me, "uv_layers", me.uv_layers, "active_index", rows=1)
col = row.column(align=True)
col.operator("scene.render_view_add", icon='ZOOMIN', text="")
col.operator("scene.render_view_add", icon='ZOOMOUT', text="")
row = layout.row(align=True)
row.prop(scene.render, "use_render_cache", icon='TRIA_DOWN' if scene.render.use_render_cache else 'TRIA_RIGHT', emboss=False, text="")
row.label(text="Collections Properties")
if scene.render.use_render_cache:
# Material, Emission
if scene.render.views.active_index == 0:
box = layout.box()
row = box.row()
row.prop(scene.render, "use_border", text="")
subrow = row.row()
subrow.active = scene.render.use_border
subrow.label(text="Material", icon='MATERIAL')
subrow.prop(scene, "background_set", text="", icon='MATERIAL')
row.label(icon='ZOOMOUT')
box = layout.box()
row = box.row()
row.prop(scene.render, "use_multiview", text="")
subrow = row.row()
subrow.active = scene.render.use_multiview
subrow.label(text="Emission", icon='LAMP')
subrow.prop(ob, "override_mode", text="")
subrow.prop(ob, "location", index=0, text="")
row.label(icon='ZOOMOUT')
else:
box = layout.box()
row = box.row()
row.prop(scene.render, "use_border", text="")
subrow = row.row()
subrow.active = scene.render.use_border
subrow.label(text="Material", icon='MATERIAL')
subrow.prop(scene, "active_clip", text="", icon='MATERIAL')
row.label(icon='ZOOMOUT')
classes = (
VIEWLAYER_PT_layer,
VIEWLAYER_PT_eevee_layer_passes,
VIEWLAYER_UL_override_sets,
VIEWLAYER_UL_override_set_collections,
VIEWLAYER_OT_overrides,
)
if __name__ == "__main__": # only for live edit.
from bpy.utils import register_class
for cls in classes:
register_class(cls)
bpy.types.Object.override_mode = EnumProperty(
name="Mode",
items=(
("REPLACE", "Replace", ''),
("MULTIPLY", "Multiply", ''),
),
)

Event Timeline

Dalai Felinto (dfelinto) changed the title of this paste from untitled to Masterwork From Distant Lands.
Dalai Felinto (dfelinto) updated the paste's language from autodetect to autodetect.