Add possibility to render USD file for testing purposes #14

Merged
Bogdan Nagirniak merged 6 commits from BLEN-428 into storm-hydra-addon 2023-06-02 15:55:44 +02:00
4 changed files with 74 additions and 2 deletions
Showing only changes of commit 12827cda7e - Show all commits

View File

@ -21,16 +21,18 @@ bl_info = {
} }
from . import engine, properties, ui from . import engine, properties, ui, preferences
def register(): def register():
engine.register() engine.register()
properties.register() properties.register()
ui.register() ui.register()
preferences.register()
def unregister(): def unregister():
preferences.unregister()
ui.unregister() ui.unregister()
properties.unregister() properties.unregister()
engine.unregister() engine.unregister()

View File

@ -0,0 +1,30 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2022, AMD
import bpy
class AddonPreferences(bpy.types.AddonPreferences):
bl_idname = 'hydra_storm'
dev_tools: bpy.props.BoolProperty(
name="Developer Tools",
description="Enable developer tools",
default=False,
)
def draw(self, context):
layout = self.layout
layout.prop(self, "dev_tools")
def addon_preferences():
if 'hydra_storm' not in bpy.context.preferences.addons:
return None
return bpy.context.preferences.addons['hydra_storm'].preferences
register, unregister = bpy.utils.register_classes_factory([
AddonPreferences,
])

View File

@ -22,6 +22,22 @@ class Properties(bpy.types.PropertyGroup):
del cls.bl_type.hydra_storm del cls.bl_type.hydra_storm
class DevProperties(bpy.types.PropertyGroup):
render_data: bpy.props.EnumProperty(
name="Render Data",
description="Select data to render",
items=(('BLENDER', "Blender", "Render Blender scene"),
('USD', "USD", "Render USD file"),
('ALL', "All", "Render Blender scene and USD file")),
default='BLENDER',
)
usd_file: bpy.props.StringProperty(
name="USD File",
description="Select data to render",
subtype='DIR_PATH',
)
class SceneProperties(Properties): class SceneProperties(Properties):
bl_type = bpy.types.Scene bl_type = bpy.types.Scene
@ -51,7 +67,10 @@ class SceneProperties(Properties):
default=16, min=0, default=16, min=0,
) )
dev: bpy.props.PointerProperty(type=DevProperties)
register, unregister = bpy.utils.register_classes_factory(( register, unregister = bpy.utils.register_classes_factory((
DevProperties,
SceneProperties, SceneProperties,
)) ))

View File

@ -6,6 +6,7 @@
import bpy import bpy
from .engine import StormHydraRenderEngine from .engine import StormHydraRenderEngine
from .preferences import addon_preferences
class Panel(bpy.types.Panel): class Panel(bpy.types.Panel):
@ -88,10 +89,30 @@ class STORM_HYDRA_LIGHT_PT_light(Panel):
main_col.prop(light, 'size') main_col.prop(light, 'size')
class STORM_HYDRA_PT_dev(Panel):
"""Final render delegate and settings"""
bl_label = "Dev"
@classmethod
def poll(cls, context):
preferences = addon_preferences()
return preferences.dev_tools if preferences else True
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
settings = context.scene.hydra_storm.dev
layout.prop(settings, 'render_data')
if settings.render_data in ('USD', 'ALL'):
layout.prop(settings, 'usd_file')
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_render_settings,
STORM_HYDRA_LIGHT_PT_light, STORM_HYDRA_LIGHT_PT_light,
STORM_HYDRA_PT_dev,
)) ))