From aeade3cb95588a7f83aabab1bae153c0955a14f5 Mon Sep 17 00:00:00 2001 From: Vasyl-Pidhirskyi Date: Fri, 28 Jul 2023 16:14:41 +0300 Subject: [PATCH] Implemented UI panel STORM_HYDRA_RENDER_PT_shadows. Implemented UI panel STORM_HYDRA_RENDER_PT_light_shadows Reuse Eevee properties "shadow_buffer_bias", "shadow_cascade_max_distance", "shadow_cascade_fade", "shadow_cascade_size" to be able to set up shadows. --- hydra_storm/ui.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index fb5c42bf9..46fc2a560 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -6,7 +6,6 @@ import bpy from .engine import StormHydraRenderEngine -from .preferences import addon_preferences class Panel(bpy.types.Panel): @@ -98,6 +97,7 @@ class STORM_HYDRA_RENDER_PT_volume_viewport(bpy.types.Panel): class STORM_HYDRA_LIGHT_PT_light(Panel): """Physical light sources""" + bl_idname = 'STORM_HYDRA_LIGHT_PT_light' bl_label = "Light" bl_context = 'data' @@ -163,13 +163,64 @@ class STORM_HYDRA_RENDER_PT_film(Panel): layout.prop(context.scene.render, "film_transparent", text="Transparent Background") +class STORM_HYDRA_RENDER_PT_light_shadows(Panel): + bl_parent_id = STORM_HYDRA_LIGHT_PT_light.bl_idname + bl_label = "Shadow" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + light = context.light + return ( + (light and light.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) + ) + + def draw_header(self, context): + light = context.light + self.layout.prop(light, "use_shadow", text="") + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + + light = context.light + + layout.active = light.use_shadow + + if light.type == 'SUN': + col = layout.column() + col.prop(light, "shadow_buffer_bias", text="Bias") + col.prop(light, "shadow_cascade_max_distance", text="Max Distance") + col.prop(light, "shadow_cascade_fade", text="Fade") + + +class STORM_HYDRA_RENDER_PT_shadows(Panel): + bl_label = "Shadows" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_options = {'DEFAULT_CLOSED'} + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + + props = context.scene.eevee + + col = layout.column() + col.prop(props, "shadow_cascade_size", text="Cascade Size") + + register_classes, unregister_classes = bpy.utils.register_classes_factory(( STORM_HYDRA_RENDER_PT_final, STORM_HYDRA_RENDER_PT_volume_final, STORM_HYDRA_RENDER_PT_viewport, STORM_HYDRA_RENDER_PT_volume_viewport, STORM_HYDRA_RENDER_PT_film, + STORM_HYDRA_RENDER_PT_shadows, STORM_HYDRA_LIGHT_PT_light, + STORM_HYDRA_RENDER_PT_light_shadows, )) -- 2.30.2