forked from blender/blender-addons
Add possibility to render USD file for testing purposes #14
@ -21,16 +21,18 @@ bl_info = {
|
||||
}
|
||||
|
||||
|
||||
from . import engine, properties, ui
|
||||
from . import engine, properties, ui, preferences
|
||||
|
||||
|
||||
def register():
|
||||
engine.register()
|
||||
properties.register()
|
||||
ui.register()
|
||||
preferences.register()
|
||||
|
||||
|
||||
def unregister():
|
||||
preferences.unregister()
|
||||
ui.unregister()
|
||||
properties.unregister()
|
||||
engine.unregister()
|
||||
|
30
hydra_storm/preferences.py
Normal file
30
hydra_storm/preferences.py
Normal 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,
|
||||
])
|
@ -22,6 +22,22 @@ class Properties(bpy.types.PropertyGroup):
|
||||
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):
|
||||
bl_type = bpy.types.Scene
|
||||
|
||||
@ -51,7 +67,10 @@ class SceneProperties(Properties):
|
||||
default=16, min=0,
|
||||
)
|
||||
|
||||
dev: bpy.props.PointerProperty(type=DevProperties)
|
||||
|
||||
|
||||
register, unregister = bpy.utils.register_classes_factory((
|
||||
DevProperties,
|
||||
SceneProperties,
|
||||
))
|
||||
|
@ -6,6 +6,7 @@
|
||||
import bpy
|
||||
|
||||
from .engine import StormHydraRenderEngine
|
||||
from .preferences import addon_preferences
|
||||
|
||||
|
||||
class Panel(bpy.types.Panel):
|
||||
@ -88,10 +89,30 @@ class STORM_HYDRA_LIGHT_PT_light(Panel):
|
||||
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((
|
||||
STORM_HYDRA_RENDER_PT_render_settings,
|
||||
|
||||
STORM_HYDRA_LIGHT_PT_light,
|
||||
STORM_HYDRA_PT_dev,
|
||||
))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user