diff options
author | Lukas Stockner <lukasstockner97> | 2019-12-04 21:57:28 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-12-10 22:44:46 +0300 |
commit | e760972221e68d3c81f2ee3687cc71836dde8ae9 (patch) | |
tree | b1a2efbb17c05a429e4509d336a1eb14c73cfb8c /intern/cycles/blender/addon/properties.py | |
parent | 35b5888b157d05d378df3acc899d28856a9eb9a4 (diff) |
Cycles: support for custom shader AOVs
Custom render passes are added in the Shader AOVs panel in the view layer
settings, with a name and data type. In shader nodes, an AOV Output node
is then used to output either a value or color to the pass.
Arbitrary names can be used for these passes, as long as they don't conflict
with built-in passes that are enabled. The AOV Output node can be used in both
material and world shader nodes.
Implemented by Lukas, with tweaks by Brecht.
Differential Revision: https://developer.blender.org/D4837
Diffstat (limited to 'intern/cycles/blender/addon/properties.py')
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 26e1a6a223a..e09f15b46e8 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -19,6 +19,7 @@ import bpy from bpy.props import ( BoolProperty, + CollectionProperty, EnumProperty, FloatProperty, IntProperty, @@ -31,6 +32,7 @@ from math import pi # enums import _cycles +from . import engine enum_devices = ( ('CPU', "CPU", "Use CPU for rendering"), @@ -190,6 +192,10 @@ enum_view3d_shading_render_pass= ( ('MIST', "Mist", "Show the Mist render pass", 32), ) +enum_aov_types = ( + ('VALUE', "Value", "Write a Value pass", 0), + ('COLOR', "Color", "Write a Color pass", 1), +) class CyclesRenderSettings(bpy.types.PropertyGroup): @@ -1218,8 +1224,29 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup): def update_render_passes(self, context): view_layer = context.view_layer view_layer.update_render_passes() + engine.detect_conflicting_passes(view_layer) +class CyclesAOVPass(bpy.types.PropertyGroup): + name: StringProperty( + name="Name", + description="Name of the pass, to use in the AOV Output shader node", + update=update_render_passes, + default="AOV" + ) + type: EnumProperty( + name="Type", + description="Pass data type", + update=update_render_passes, + items=enum_aov_types, + default='COLOR' + ) + conflict: StringProperty( + name="Conflict", + description="If there is a conflict with another render passes, message explaining why", + default="" + ) + class CyclesRenderLayerSettings(bpy.types.PropertyGroup): pass_debug_bvh_traversed_nodes: BoolProperty( @@ -1378,6 +1405,15 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup): update=update_render_passes, ) + aovs: CollectionProperty( + type=CyclesAOVPass, + description="Custom render passes that can be output by shader nodes", + ) + active_aov: IntProperty( + default=0, + min=0 + ) + @classmethod def register(cls): bpy.types.ViewLayer.cycles = PointerProperty( @@ -1552,6 +1588,7 @@ def register(): bpy.utils.register_class(CyclesCurveRenderSettings) bpy.utils.register_class(CyclesDeviceSettings) bpy.utils.register_class(CyclesPreferences) + bpy.utils.register_class(CyclesAOVPass) bpy.utils.register_class(CyclesRenderLayerSettings) bpy.utils.register_class(CyclesView3DShadingSettings) @@ -1573,5 +1610,6 @@ def unregister(): bpy.utils.unregister_class(CyclesCurveRenderSettings) bpy.utils.unregister_class(CyclesDeviceSettings) bpy.utils.unregister_class(CyclesPreferences) + bpy.utils.unregister_class(CyclesAOVPass) bpy.utils.unregister_class(CyclesRenderLayerSettings) bpy.utils.unregister_class(CyclesView3DShadingSettings) |