From a1fe1b31a448488d4d3f7f4f7d49f74767898957 Mon Sep 17 00:00:00 2001 From: Vasyl-Pidhirskyi Date: Fri, 21 Jul 2023 17:37:55 +0300 Subject: [PATCH 1/3] Implemented get_sync_settings. Implemented property enable_alpha. Implemented STORM_HYDRA_RENDER_PT_film_viewport, STORM_HYDRA_RENDER_PT_film_final. --- hydra_storm/engine.py | 8 ++++++++ hydra_storm/properties.py | 5 +++++ hydra_storm/ui.py | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 7b3fd02f1..6d2a50839 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -33,6 +33,14 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): 'maxLights': settings.max_lights, } + def get_sync_settings(self, engine_type): + settings = bpy.context.scene.hydra_storm.viewport if engine_type == 'VIEWPORT' else \ + bpy.context.scene.hydra_storm.final + return { + 'enableAlpha': settings.enable_alpha, + } + + register, unregister = bpy.utils.register_classes_factory(( StormHydraRenderEngine, )) diff --git a/hydra_storm/properties.py b/hydra_storm/properties.py index ad29a5c40..bac78327e 100644 --- a/hydra_storm/properties.py +++ b/hydra_storm/properties.py @@ -48,6 +48,11 @@ class RenderProperties(bpy.types.PropertyGroup): description="Limit maximum number of lights", default=16, min=0, max=16, ) + enable_alpha: bpy.props.BoolProperty( + name="Enable Color Alpha", + description="World background is transparent, for compositing the render over another background", + default=False, + ) class SceneProperties(Properties): diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index 649e777a7..fba59ca23 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -58,6 +58,21 @@ class STORM_HYDRA_RENDER_PT_volume_final(bpy.types.Panel): col.prop(settings, "volume_max_texture_memory_per_field") +class STORM_HYDRA_RENDER_PT_film_final(bpy.types.Panel): + bl_parent_id = STORM_HYDRA_RENDER_PT_final.bl_idname + bl_label = "Film" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_options = {'DEFAULT_CLOSED'} + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + layout.prop(context.scene.hydra_storm.final, "enable_alpha", text="Transparent Background") + + # # VIEWPORT RENDER SETTINGS # @@ -96,6 +111,21 @@ class STORM_HYDRA_RENDER_PT_volume_viewport(bpy.types.Panel): col.prop(settings, "volume_max_texture_memory_per_field") +class STORM_HYDRA_RENDER_PT_film_viewport(bpy.types.Panel): + bl_parent_id = STORM_HYDRA_RENDER_PT_viewport.bl_idname + bl_label = "Film" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_options = {'DEFAULT_CLOSED'} + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + layout.prop(context.scene.hydra_storm.viewport, "enable_alpha", text="Transparent Background") + + class STORM_HYDRA_LIGHT_PT_light(Panel): """Physical light sources""" bl_label = "Light" @@ -152,8 +182,11 @@ class STORM_HYDRA_LIGHT_PT_light(Panel): register_classes, unregister_classes = bpy.utils.register_classes_factory(( STORM_HYDRA_RENDER_PT_final, STORM_HYDRA_RENDER_PT_volume_final, + STORM_HYDRA_RENDER_PT_film_final, STORM_HYDRA_RENDER_PT_viewport, STORM_HYDRA_RENDER_PT_volume_viewport, + STORM_HYDRA_RENDER_PT_film_viewport, + STORM_HYDRA_LIGHT_PT_light, )) -- 2.30.2 From b216fe22c405c0fdefcc7231d7d5cd15aa9a5035 Mon Sep 17 00:00:00 2001 From: Vasyl-Pidhirskyi Date: Sun, 23 Jul 2023 17:45:11 +0300 Subject: [PATCH 2/3] Reverted changes. Utilized film_transparent property to manage background alpha. --- hydra_storm/engine.py | 7 ------ hydra_storm/properties.py | 5 ---- hydra_storm/ui.py | 49 ++++++++++++--------------------------- 3 files changed, 15 insertions(+), 46 deletions(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 6d2a50839..497f2e62a 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -33,13 +33,6 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): 'maxLights': settings.max_lights, } - def get_sync_settings(self, engine_type): - settings = bpy.context.scene.hydra_storm.viewport if engine_type == 'VIEWPORT' else \ - bpy.context.scene.hydra_storm.final - return { - 'enableAlpha': settings.enable_alpha, - } - register, unregister = bpy.utils.register_classes_factory(( StormHydraRenderEngine, diff --git a/hydra_storm/properties.py b/hydra_storm/properties.py index bac78327e..ad29a5c40 100644 --- a/hydra_storm/properties.py +++ b/hydra_storm/properties.py @@ -48,11 +48,6 @@ class RenderProperties(bpy.types.PropertyGroup): description="Limit maximum number of lights", default=16, min=0, max=16, ) - enable_alpha: bpy.props.BoolProperty( - name="Enable Color Alpha", - description="World background is transparent, for compositing the render over another background", - default=False, - ) class SceneProperties(Properties): diff --git a/hydra_storm/ui.py b/hydra_storm/ui.py index fba59ca23..379f2cf2a 100644 --- a/hydra_storm/ui.py +++ b/hydra_storm/ui.py @@ -58,21 +58,6 @@ class STORM_HYDRA_RENDER_PT_volume_final(bpy.types.Panel): col.prop(settings, "volume_max_texture_memory_per_field") -class STORM_HYDRA_RENDER_PT_film_final(bpy.types.Panel): - bl_parent_id = STORM_HYDRA_RENDER_PT_final.bl_idname - bl_label = "Film" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_options = {'DEFAULT_CLOSED'} - - def draw(self, context): - layout = self.layout - layout.use_property_split = True - layout.use_property_decorate = False - - layout.prop(context.scene.hydra_storm.final, "enable_alpha", text="Transparent Background") - - # # VIEWPORT RENDER SETTINGS # @@ -111,21 +96,6 @@ class STORM_HYDRA_RENDER_PT_volume_viewport(bpy.types.Panel): col.prop(settings, "volume_max_texture_memory_per_field") -class STORM_HYDRA_RENDER_PT_film_viewport(bpy.types.Panel): - bl_parent_id = STORM_HYDRA_RENDER_PT_viewport.bl_idname - bl_label = "Film" - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_options = {'DEFAULT_CLOSED'} - - def draw(self, context): - layout = self.layout - layout.use_property_split = True - layout.use_property_decorate = False - - layout.prop(context.scene.hydra_storm.viewport, "enable_alpha", text="Transparent Background") - - class STORM_HYDRA_LIGHT_PT_light(Panel): """Physical light sources""" bl_label = "Light" @@ -179,15 +149,26 @@ class STORM_HYDRA_LIGHT_PT_light(Panel): main_col.prop(light, 'size') +class STORM_HYDRA_RENDER_PT_film(bpy.types.Panel): + bl_label = "Film" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_options = {'DEFAULT_CLOSED'} + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + layout.prop(context.scene.render, "film_transparent", text="Transparent Background") + + register_classes, unregister_classes = bpy.utils.register_classes_factory(( STORM_HYDRA_RENDER_PT_final, STORM_HYDRA_RENDER_PT_volume_final, - STORM_HYDRA_RENDER_PT_film_final, STORM_HYDRA_RENDER_PT_viewport, STORM_HYDRA_RENDER_PT_volume_viewport, - STORM_HYDRA_RENDER_PT_film_viewport, - - + STORM_HYDRA_RENDER_PT_film, STORM_HYDRA_LIGHT_PT_light, )) -- 2.30.2 From 5b6386233b7da5b4bf7c539178820015e6040106 Mon Sep 17 00:00:00 2001 From: Vasyl-Pidhirskyi Date: Sun, 23 Jul 2023 17:47:53 +0300 Subject: [PATCH 3/3] Removed redundant imports. --- hydra_storm/engine.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hydra_storm/engine.py b/hydra_storm/engine.py index 497f2e62a..c1a8551e0 100644 --- a/hydra_storm/engine.py +++ b/hydra_storm/engine.py @@ -5,11 +5,6 @@ import bpy import bpy_hydra -import _bpy_hydra - -from pxr import Usd - -from .preferences import addon_preferences class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): -- 2.30.2