Refactoring of Storm Hydra render addon #13

Merged
Bogdan Nagirniak merged 8 commits from BLEN-413 into storm-hydra-addon 2023-06-01 02:36:50 +02:00
2 changed files with 64 additions and 4 deletions
Showing only changes of commit 82711959af - Show all commits

View File

@ -29,23 +29,23 @@ class RenderSettings(bpy.types.PropertyGroup):
default=False, default=False,
) )
volume_raymarching_step_size: bpy.props.FloatProperty( volume_raymarching_step_size: bpy.props.FloatProperty(
name="Volume Raymarching Step Size", name="Step Size",
DagerD marked this conversation as resolved Outdated

I prefer the original name "Step size" is too generic.

I prefer the original name "Step size" is too generic.

I renamed it because it better fits UI. Long names are not good.

image

I renamed it because it better fits UI. Long names are not good. ![image](/attachments/ed5b9243-72bd-43d6-b97f-df8361355da3)

Agree, please use original name here. In UI change text as you want:
layout.prop(settings, 'volume_raymarching_step_size', text="Step Size")

Agree, please use original name here. In UI change text as you want: `layout.prop(settings, 'volume_raymarching_step_size', text="Step Size")`

Fixed.

Fixed.
description="Step size when raymarching volume", description="Step size when raymarching volume",
default=1.0, default=1.0,
) )
volume_raymarching_step_size_lighting: bpy.props.FloatProperty( volume_raymarching_step_size_lighting: bpy.props.FloatProperty(
name="Volume Raymarching Step Size Lighting", name="Step Size Lighting",
DagerD marked this conversation as resolved Outdated

Same as above.

Same as above.
description="Step size when raymarching volume for lighting computation", description="Step size when raymarching volume for lighting computation",
default=10.0, default=10.0,
) )
volume_max_texture_memory_per_field: bpy.props.FloatProperty( volume_max_texture_memory_per_field: bpy.props.FloatProperty(
name="Volume Max Texture Memory Per Field", name="Max Texture Memory Per Field",
description="Maximum memory for a volume field texture in Mb (unless overridden by field prim)", description="Maximum memory for a volume field texture in Mb (unless overridden by field prim)",
default=128.0, default=128.0,
) )
max_lights: bpy.props.IntProperty( max_lights: bpy.props.IntProperty(
name="Max Lights", name="Max Lights",
description="Maximum number of lights", description="Limit maximum number of lights",
default=16, min=0, max=16, default=16, min=0, max=16,
) )

View File

@ -19,6 +19,9 @@ class Panel(bpy.types.Panel):
return context.engine in cls.COMPAT_ENGINES return context.engine in cls.COMPAT_ENGINES
#
# FINAL RENDER SETTINGS
#
class STORM_HYDRA_RENDER_PT_final(Panel): class STORM_HYDRA_RENDER_PT_final(Panel):
"""Final render delegate and settings""" """Final render delegate and settings"""
bl_idname = 'STORM_HYDRA_RENDER_PT_final' bl_idname = 'STORM_HYDRA_RENDER_PT_final'
@ -34,6 +37,35 @@ class STORM_HYDRA_RENDER_PT_final(Panel):
layout.prop(settings, 'max_lights') layout.prop(settings, 'max_lights')
class FinalPanel(bpy.types.Panel):
bl_parent_id = STORM_HYDRA_RENDER_PT_final.bl_idname
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_options = {'DEFAULT_CLOSED'}
def settings(self, context):
return context.scene.hydra_storm.final
class STORM_HYDRA_RENDER_PT_volume_final(FinalPanel):
bl_label = "Volume Raymarching"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
settings = self.settings(context)
col = layout.column(align=True)
col.prop(settings, "volume_raymarching_step_size")
col.prop(settings, "volume_raymarching_step_size_lighting")
col.prop(settings, "volume_max_texture_memory_per_field")
#
# VIEWPORT RENDER SETTINGS
#
class STORM_HYDRA_RENDER_PT_viewport(Panel): class STORM_HYDRA_RENDER_PT_viewport(Panel):
"""Viewport render delegate and settings""" """Viewport render delegate and settings"""
bl_idname = 'STORM_HYDRA_RENDER_PT_viewport' bl_idname = 'STORM_HYDRA_RENDER_PT_viewport'
@ -49,6 +81,32 @@ class STORM_HYDRA_RENDER_PT_viewport(Panel):
layout.prop(settings, 'max_lights') layout.prop(settings, 'max_lights')
class ViewportPanel(bpy.types.Panel):
bl_parent_id = STORM_HYDRA_RENDER_PT_viewport.bl_idname
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_options = {'DEFAULT_CLOSED'}
def settings(self, context):
return context.scene.hydra_storm.viewport
class STORM_HYDRA_RENDER_PT_volume_viewport(ViewportPanel):
bl_label = "Volume Raymarching"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
settings = self.settings(context)
col = layout.column(align=True)
col.prop(settings, "volume_raymarching_step_size")
col.prop(settings, "volume_raymarching_step_size_lighting")
col.prop(settings, "volume_max_texture_memory_per_field")
class STORM_HYDRA_LIGHT_PT_light(Panel): class STORM_HYDRA_LIGHT_PT_light(Panel):
""" """
Physical light sources Physical light sources
@ -106,7 +164,9 @@ class STORM_HYDRA_LIGHT_PT_light(Panel):
register_classes, unregister_classes = bpy.utils.register_classes_factory(( register_classes, unregister_classes = bpy.utils.register_classes_factory((
STORM_HYDRA_RENDER_PT_final, STORM_HYDRA_RENDER_PT_final,
STORM_HYDRA_RENDER_PT_volume_final,
STORM_HYDRA_RENDER_PT_viewport, STORM_HYDRA_RENDER_PT_viewport,
STORM_HYDRA_RENDER_PT_volume_viewport,
STORM_HYDRA_LIGHT_PT_light, STORM_HYDRA_LIGHT_PT_light,
)) ))