1 # SPDX-FileCopyrightText: 2011-2022 Blender Foundation
3 # SPDX-License-Identifier: Apache-2.0
7 from .engine
import StormHydraRenderEngine
10 class Panel(bpy
.types
.Panel
):
11 bl_space_type
= 'PROPERTIES'
12 bl_region_type
= 'WINDOW'
14 COMPAT_ENGINES
= {StormHydraRenderEngine
.bl_idname
}
17 def poll(cls
, context
):
18 return context
.engine
in cls
.COMPAT_ENGINES
22 # Quality render settings
24 class STORM_HYDRA_RENDER_PT_quality(Panel
):
27 def draw(self
, layout
):
31 class STORM_HYDRA_RENDER_PT_quality_viewport(Panel
):
33 bl_parent_id
= "STORM_HYDRA_RENDER_PT_quality"
35 def draw(self
, context
):
37 layout
.use_property_split
= True
38 layout
.use_property_decorate
= False
40 settings
= context
.scene
.hydra_storm
.viewport
41 layout
.prop(settings
, 'max_lights')
42 layout
.prop(settings
, 'use_tiny_prim_culling')
45 class STORM_HYDRA_RENDER_PT_quality_render(Panel
):
47 bl_parent_id
= "STORM_HYDRA_RENDER_PT_quality"
49 def draw(self
, context
):
51 layout
.use_property_split
= True
52 layout
.use_property_decorate
= False
54 settings
= context
.scene
.hydra_storm
.final
55 layout
.prop(settings
, 'max_lights')
56 layout
.prop(settings
, 'use_tiny_prim_culling')
60 # Volume render settings
62 class STORM_HYDRA_RENDER_PT_volumes(Panel
):
64 bl_options
= {'DEFAULT_CLOSED'}
66 def draw(self
, layout
):
70 class STORM_HYDRA_RENDER_PT_volumes_viewport(Panel
):
72 bl_parent_id
= "STORM_HYDRA_RENDER_PT_volumes"
74 def draw(self
, context
):
76 layout
.use_property_split
= True
77 layout
.use_property_decorate
= False
79 settings
= context
.scene
.hydra_storm
.viewport
81 col
= layout
.column(align
=True)
82 col
.prop(settings
, "volume_raymarching_step_size", text
="Step Size")
83 col
.prop(settings
, "volume_raymarching_step_size_lighting", text
="Step Size Lightning")
84 col
.prop(settings
, "volume_max_texture_memory_per_field")
87 class STORM_HYDRA_RENDER_PT_volumes_render(Panel
):
89 bl_parent_id
= "STORM_HYDRA_RENDER_PT_volumes"
91 def draw(self
, context
):
93 layout
.use_property_split
= True
94 layout
.use_property_decorate
= False
96 settings
= context
.scene
.hydra_storm
.final
98 col
= layout
.column(align
=True)
99 col
.prop(settings
, "volume_raymarching_step_size", text
="Step Size")
100 col
.prop(settings
, "volume_raymarching_step_size_lighting", text
="Step Size Lightning")
101 col
.prop(settings
, "volume_max_texture_memory_per_field")
107 class STORM_HYDRA_RENDER_PT_film(Panel
):
109 bl_options
= {'DEFAULT_CLOSED'}
111 def draw(self
, context
):
113 layout
.use_property_split
= True
114 layout
.use_property_decorate
= False
116 layout
.prop(context
.scene
.render
, "film_transparent", text
="Transparent Background")
120 # View layer settings
122 class STORM_HYDRA_RENDER_PT_passes(Panel
):
124 bl_context
= "view_layer"
126 def draw(self
, context
):
130 class STORM_HYDRA_RENDER_PT_passes_data(Panel
):
132 bl_context
= "view_layer"
133 bl_parent_id
= "STORM_HYDRA_RENDER_PT_passes"
135 def draw(self
, context
):
137 layout
.use_property_split
= True
138 layout
.use_property_decorate
= False
140 view_layer
= context
.view_layer
142 col
= layout
.column(heading
="Include", align
=True)
143 col
.prop(view_layer
, "use_pass_combined")
144 col
.prop(view_layer
, "use_pass_z")
150 class STORM_HYDRA_LIGHT_PT_light(Panel
):
151 """Physical light sources"""
156 def poll(cls
, context
):
157 return super().poll(context
) and context
.light
159 def draw(self
, context
):
162 light
= context
.light
164 layout
.prop(light
, "type", expand
=True)
166 layout
.use_property_split
= True
167 layout
.use_property_decorate
= False
169 main_col
= layout
.column()
171 main_col
.prop(light
, "color")
172 main_col
.prop(light
, "energy")
175 if light
.type == 'POINT':
176 row
= main_col
.row(align
=True)
177 row
.prop(light
, "shadow_soft_size", text
="Radius")
179 elif light
.type == 'SPOT':
180 col
= main_col
.column(align
=True)
181 col
.prop(light
, 'spot_size', slider
=True)
182 col
.prop(light
, 'spot_blend', slider
=True)
184 main_col
.prop(light
, 'show_cone')
186 elif light
.type == 'SUN':
187 main_col
.prop(light
, "angle")
189 elif light
.type == 'AREA':
190 main_col
.prop(light
, "shape", text
="Shape")
191 sub
= main_col
.column(align
=True)
193 if light
.shape
in {'SQUARE', 'DISK'}:
194 sub
.prop(light
, "size")
195 elif light
.shape
in {'RECTANGLE', 'ELLIPSE'}:
196 sub
.prop(light
, "size", text
="Size X")
197 sub
.prop(light
, "size_y", text
="Y")
200 main_col
.prop(light
, 'size')
203 register_classes
, unregister_classes
= bpy
.utils
.register_classes_factory((
204 STORM_HYDRA_RENDER_PT_quality
,
205 STORM_HYDRA_RENDER_PT_quality_viewport
,
206 STORM_HYDRA_RENDER_PT_quality_render
,
207 STORM_HYDRA_RENDER_PT_volumes
,
208 STORM_HYDRA_RENDER_PT_volumes_viewport
,
209 STORM_HYDRA_RENDER_PT_volumes_render
,
210 STORM_HYDRA_RENDER_PT_film
,
211 STORM_HYDRA_LIGHT_PT_light
,
212 STORM_HYDRA_RENDER_PT_passes
,
213 STORM_HYDRA_RENDER_PT_passes_data
,
218 # Follow the Cycles model of excluding panels we don't want.
223 'NODE_DATA_PT_light',
224 'DATA_PT_falloff_curve',
225 'RENDER_PT_post_processing',
226 'RENDER_PT_simplify',
228 'RENDER_PT_freestyle'
230 include_eevee_panels
= {
231 'MATERIAL_PT_preview',
232 'EEVEE_MATERIAL_PT_context_material',
233 'EEVEE_MATERIAL_PT_surface',
234 'EEVEE_MATERIAL_PT_volume',
235 'EEVEE_MATERIAL_PT_settings',
236 'EEVEE_WORLD_PT_surface',
239 for panel_cls
in bpy
.types
.Panel
.__subclasses
__():
240 if hasattr(panel_cls
, 'COMPAT_ENGINES') and (
241 ('BLENDER_RENDER' in panel_cls
.COMPAT_ENGINES
and panel_cls
.__name
__ not in exclude_panels
) or
242 ('BLENDER_EEVEE' in panel_cls
.COMPAT_ENGINES
and panel_cls
.__name
__ in include_eevee_panels
)
250 for panel_cls
in get_panels():
251 panel_cls
.COMPAT_ENGINES
.add(StormHydraRenderEngine
.bl_idname
)
257 for panel_cls
in get_panels():
258 if StormHydraRenderEngine
.bl_idname
in panel_cls
.COMPAT_ENGINES
:
259 panel_cls
.COMPAT_ENGINES
.remove(StormHydraRenderEngine
.bl_idname
)