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
7 changed files with 43 additions and 48 deletions
Showing only changes of commit 1718b113cd - Show all commits

View File

@ -5,18 +5,17 @@
bl_info = {
"name": "Hydra render engine: Storm",
"name": "Hydra Storm render engine",
"author": "AMD",
"version": (1, 0, 0),
"blender": (3, 5, 0),
"location": "Info header > Render engine menu",
"description": "Storm GL delegate for Hydra render engine",
"description": "USDs high performance rasterizing renderer",
"tracker_url": "",
"doc_url": "",
"community": "",
"downloads": "",
"main_web": "",
"support": 'TESTING',
"support": 'OFFICIAL',
"category": "Render"
}

View File

@ -11,8 +11,8 @@ import bpy_hydra
class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine):
bl_idname = 'StormHydraRenderEngine'
bl_label = "Hydra: Storm"
bl_info = "Hydra Storm (OpenGL) render delegate"
bl_label = "Hydra Storm"
bl_info = "USDs high performance rasterizing renderer"
bl_use_preview = False
bl_use_gpu_context = True
@ -25,8 +25,9 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine):
bpy_hydra.register_plugins([str(Path(__file__).parent / "plugin")])
def get_delegate_settings(self, engine_type):
settings = bpy.context.scene.hydra_storm
def get_render_settings(self, engine_type):
settings = bpy.context.scene.hydra_storm.viewport if engine_type == 'VIEWPORT' else \
bpy.context.scene.hydra_storm.final
return {
'enableTinyPrimCulling': settings.enable_tiny_prim_culling,
'volumeRaymarchingStepSize': settings.volume_raymarching_step_size,

View File

@ -1,3 +0,0 @@
{
"Includes": [ "usd/*/resources/" ]
}

View File

@ -1,22 +0,0 @@
{
"Plugins": [
{
"Info": {
"Types": {
"HdStormRendererPlugin": {
"bases": [
"HdRendererPlugin"
],
"displayName": "GL",
"priority": 0
}
}
},
"LibraryPath": "",
"Name": "hdStorm",
"ResourcePath": "resources",
"Root": "..",
"Type": "library"
}
]
}

View File

@ -1,3 +0,0 @@
{
"Includes": [ "*/resources/" ]
}

View File

@ -7,11 +7,11 @@ import bpy
class Properties(bpy.types.PropertyGroup):
bl_type = None
type = None
@classmethod
def register(cls):
cls.bl_type.hydra_storm = bpy.props.PointerProperty(
cls.type.hydra_storm = bpy.props.PointerProperty(
name="Hydra Storm",
description="Hydra Storm properties",
type=cls,
@ -19,12 +19,10 @@ class Properties(bpy.types.PropertyGroup):
@classmethod
def unregister(cls):
del cls.bl_type.hydra_storm
del cls.type.hydra_storm
class SceneProperties(Properties):
bl_type = bpy.types.Scene
class RenderSettings(bpy.types.PropertyGroup):
BogdanNagirniak marked this conversation as resolved Outdated

Rename to RenderProperties as more related

Rename to `RenderProperties` as more related
enable_tiny_prim_culling: bpy.props.BoolProperty(
name="Tiny Prim Culling",
description="Enable Tiny Prim Culling",
@ -36,7 +34,7 @@ class SceneProperties(Properties):
default=1.0,
)
volume_raymarching_step_size_lighting: bpy.props.FloatProperty(
name="Volume Raymarching Step Size",
name="Volume Raymarching 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",
default=10.0,
)
@ -48,10 +46,18 @@ class SceneProperties(Properties):
max_lights: bpy.props.IntProperty(
name="Max Lights",
description="Maximum number of lights",
default=16, min=0,
default=16, min=0, max=16,
)
class SceneProperties(Properties):
type = bpy.types.Scene
final: bpy.props.PointerProperty(type=RenderSettings)
viewport: bpy.props.PointerProperty(type=RenderSettings)
register, unregister = bpy.utils.register_classes_factory((
RenderSettings,
SceneProperties,
))

View File

@ -19,16 +19,32 @@ class Panel(bpy.types.Panel):
return context.engine in cls.COMPAT_ENGINES
class STORM_HYDRA_RENDER_PT_render_settings(Panel):
class STORM_HYDRA_RENDER_PT_final(Panel):
"""Final render delegate and settings"""
bl_label = "Storm Render Settings"
bl_idname = 'STORM_HYDRA_RENDER_PT_final'
bl_label = "Storm Final Settings"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
settings = context.scene.hydra_storm
settings = context.scene.hydra_storm.final
layout.prop(settings, 'enable_tiny_prim_culling')
layout.prop(settings, 'max_lights')
class STORM_HYDRA_RENDER_PT_viewport(Panel):
"""Viewport render delegate and settings"""
bl_idname = 'STORM_HYDRA_RENDER_PT_viewport'
bl_label = "Storm Viewport Settings"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
settings = context.scene.hydra_storm.viewport
layout.prop(settings, 'enable_tiny_prim_culling')
layout.prop(settings, 'max_lights')
@ -89,7 +105,8 @@ class STORM_HYDRA_LIGHT_PT_light(Panel):
register_classes, unregister_classes = bpy.utils.register_classes_factory((
STORM_HYDRA_RENDER_PT_render_settings,
STORM_HYDRA_RENDER_PT_final,
STORM_HYDRA_RENDER_PT_viewport,
STORM_HYDRA_LIGHT_PT_light,
))