diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-09-05 13:47:20 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-09-11 13:19:44 +0300 |
commit | 7e61e597253f3ca75f2fb86a57212ca750ffbbe8 (patch) | |
tree | 6dbe0bf05fc3380f9729bf719ed1223997d5b0e3 /intern/cycles/blender/addon | |
parent | d4f8bc80a4bd69707a92e7141a2fb67d3f668c58 (diff) |
Cycles: Display RenderPass in Viewport
This change allows the user to select a renderpass in the 3d viewport.
Added support for external renderers to extend the `View3DShading` struct.
This way Blender doesn't need to know the features an external render engine wants to support.
Note that the View3DShading is also available in the scene->display.shading; although this is
supported, it does not make sense for render engines to put something here as it is really
scene/workbench related.
Currently cycles assumes that it always needs to calculate the combined pass; it ignores the
`pass_flag` in KernelFilm. We could optimize this but that was not in scope of this change
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D5689
Diffstat (limited to 'intern/cycles/blender/addon')
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 54 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 20 |
2 files changed, 74 insertions, 0 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 3acdfc391a6..93f8f76cd6a 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -151,6 +151,44 @@ enum_texture_limit = ( ('8192', "8192", "Limit texture size to 8192 pixels", 7), ) +enum_view3d_shading_render_pass= ( + ('', "General", ""), + + ('COMBINED', "Combined", "Show the Combined Render pass", 1), + ('EMISSION', "Emission", "Show the Emission render pass", 33), + ('BACKGROUND', "Background", "Show the Background render pass", 34), + ('AO', "Ambient Occlusion", "Show the Ambient Occlusion render pass", 35), + + ('', "Light", ""), + + ('DIFFUSE_DIRECT', "Diffuse Direct", "Show the Diffuse Direct render pass", 38), + ('DIFFUSE_INDIRECT', "Diffuse Indirect", "Show the Diffuse Indirect render pass", 39), + ('DIFFUSE_COLOR', "Diffuse Color", "Show the Diffuse Color render pass", 40), + + ('GLOSSY_DIRECT', "Glossy Direct", "Show the Glossy Direct render pass", 41), + ('GLOSSY_INDIRECT', "Glossy Indirect", "Show the Glossy Indirect render pass", 42), + ('GLOSSY_COLOR', "Glossy Color", "Show the Glossy Color render pass", 43), + + ('', "", ""), + + ('TRANSMISSION_DIRECT', "Transmission Direct", "Show the Transmission Direct render pass", 44), + ('TRANSMISSION_INDIRECT', "Transmission Indirect", "Show the Transmission Indirect render pass", 45), + ('TRANSMISSION_COLOR', "Transmission Color", "Show the Transmission Color render pass", 46), + + ('SUBSURFACE_DIRECT', "Subsurface Direct", "Show the Subsurface Direct render pass", 47), + ('SUBSURFACE_INDIRECT', "Subsurface Indirect", "Show the Subsurface Indirect render pass", 48), + ('SUBSURFACE_COLOR', "Subsurface Color", "Show the Subsurface Color render pass", 49), + + ('VOLUME_DIRECT', "Volume Direct", "Show the Volume Direct render pass", 50), + ('VOLUME_INDIRECT', "Volume Indirect", "Show the Volume Indirect render pass", 51), + + ('', "Data", ""), + + ('NORMAL', "Normal", "Show the Normal render pass", 3), + ('UV', "UV", "Show the UV render pass", 4), + ('MIST', "Mist", "Show the Mist render pass", 32), +) + class CyclesRenderSettings(bpy.types.PropertyGroup): @@ -1475,6 +1513,15 @@ class CyclesPreferences(bpy.types.AddonPreferences): self.draw_impl(self.layout, context) +class CyclesView3DShadingSettings(bpy.types.PropertyGroup): + render_pass: EnumProperty( + name="Render Pass", + description="Render pass to show in the 3D Viewport", + items=enum_view3d_shading_render_pass, + default='COMBINED', + ) + + def register(): bpy.utils.register_class(CyclesRenderSettings) bpy.utils.register_class(CyclesCameraSettings) @@ -1488,6 +1535,12 @@ def register(): bpy.utils.register_class(CyclesDeviceSettings) bpy.utils.register_class(CyclesPreferences) bpy.utils.register_class(CyclesRenderLayerSettings) + bpy.utils.register_class(CyclesView3DShadingSettings) + + bpy.types.View3DShading.cycles = bpy.props.PointerProperty( + name="Cycles Settings", + type=CyclesView3DShadingSettings, + ) def unregister(): @@ -1503,3 +1556,4 @@ def unregister(): bpy.utils.unregister_class(CyclesDeviceSettings) bpy.utils.unregister_class(CyclesPreferences) bpy.utils.unregister_class(CyclesRenderLayerSettings) + bpy.utils.unregister_class(CyclesView3DShadingSettings) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 0af59411c5c..9028100ad7a 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -2050,6 +2050,25 @@ class CYCLES_RENDER_PT_simplify_culling(CyclesButtonsPanel, Panel): sub.prop(cscene, "distance_cull_margin", text="Distance") +class CYCLES_VIEW3D_PT_shading_render_pass(Panel): + bl_space_type = 'VIEW_3D' + bl_region_type = 'HEADER' + bl_label = "Render Pass" + bl_parent_id = 'VIEW3D_PT_shading' + COMPAT_ENGINES = {'CYCLES'} + + @classmethod + def poll(cls, context): + return (context.engine in cls.COMPAT_ENGINES + and context.space_data.shading.type == 'RENDERED') + + def draw(self, context): + shading = context.space_data.shading + + layout = self.layout + layout.prop(shading.cycles, "render_pass", text="") + + class CYCLES_VIEW3D_PT_shading_lighting(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' @@ -2172,6 +2191,7 @@ classes = ( CYCLES_RENDER_PT_simplify_render, CYCLES_RENDER_PT_simplify_culling, CYCLES_VIEW3D_PT_shading_lighting, + CYCLES_VIEW3D_PT_shading_render_pass, CYCLES_RENDER_PT_motion_blur, CYCLES_RENDER_PT_motion_blur_curve, CYCLES_RENDER_PT_film, |