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

View File

@ -11,8 +11,8 @@ import bpy_hydra
class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine): class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine):
bl_idname = 'StormHydraRenderEngine' bl_idname = 'StormHydraRenderEngine'
bl_label = "Hydra: Storm" bl_label = "Hydra Storm"
bl_info = "Hydra Storm (OpenGL) render delegate" bl_info = "USDs high performance rasterizing renderer"
bl_use_preview = False bl_use_preview = False
bl_use_gpu_context = True bl_use_gpu_context = True
@ -25,8 +25,9 @@ class StormHydraRenderEngine(bpy_hydra.HydraRenderEngine):
bpy_hydra.register_plugins([str(Path(__file__).parent / "plugin")]) bpy_hydra.register_plugins([str(Path(__file__).parent / "plugin")])
def get_delegate_settings(self, engine_type): def get_render_settings(self, engine_type):
settings = bpy.context.scene.hydra_storm settings = bpy.context.scene.hydra_storm.viewport if engine_type == 'VIEWPORT' else \
bpy.context.scene.hydra_storm.final
return { return {
'enableTinyPrimCulling': settings.enable_tiny_prim_culling, 'enableTinyPrimCulling': settings.enable_tiny_prim_culling,
'volumeRaymarchingStepSize': settings.volume_raymarching_step_size, '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): class Properties(bpy.types.PropertyGroup):
bl_type = None type = None
@classmethod @classmethod
def register(cls): def register(cls):
cls.bl_type.hydra_storm = bpy.props.PointerProperty( cls.type.hydra_storm = bpy.props.PointerProperty(
name="Hydra Storm", name="Hydra Storm",
description="Hydra Storm properties", description="Hydra Storm properties",
type=cls, type=cls,
@ -19,12 +19,10 @@ class Properties(bpy.types.PropertyGroup):
@classmethod @classmethod
def unregister(cls): def unregister(cls):
del cls.bl_type.hydra_storm del cls.type.hydra_storm
class SceneProperties(Properties): class RenderSettings(bpy.types.PropertyGroup):
bl_type = bpy.types.Scene
enable_tiny_prim_culling: bpy.props.BoolProperty( enable_tiny_prim_culling: bpy.props.BoolProperty(
name="Tiny Prim Culling", name="Tiny Prim Culling",
description="Enable Tiny Prim Culling", description="Enable Tiny Prim Culling",
@ -36,7 +34,7 @@ class SceneProperties(Properties):
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", name="Volume Raymarching Step Size Lighting",
description="Step size when raymarching volume for lighting computation", description="Step size when raymarching volume for lighting computation",
default=10.0, default=10.0,
) )
@ -48,10 +46,18 @@ class SceneProperties(Properties):
max_lights: bpy.props.IntProperty( max_lights: bpy.props.IntProperty(
name="Max Lights", name="Max Lights",
description="Maximum number of 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(( register, unregister = bpy.utils.register_classes_factory((
RenderSettings,
SceneProperties, SceneProperties,
)) ))

View File

@ -19,16 +19,32 @@ class Panel(bpy.types.Panel):
return context.engine in cls.COMPAT_ENGINES 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""" """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): def draw(self, context):
layout = self.layout layout = self.layout
layout.use_property_split = True layout.use_property_split = True
layout.use_property_decorate = False 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, 'enable_tiny_prim_culling')
layout.prop(settings, 'max_lights') 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(( 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, STORM_HYDRA_LIGHT_PT_light,
)) ))