diff --git a/korman/exporter/rtlight.py b/korman/exporter/rtlight.py index daa6b76..58d8897 100644 --- a/korman/exporter/rtlight.py +++ b/korman/exporter/rtlight.py @@ -29,6 +29,13 @@ _BL2PL = { _FAR_POWER = 15.0 +SHADOW_RESOLUTION = { + "ABYSMAL": 64, + "LOW": 128, + "NORMAL": 256, + "HIGH": 512, +} + class LightConverter: def __init__(self, exporter): self._exporter = weakref.ref(exporter) @@ -235,6 +242,8 @@ class LightConverter: shadow.attenDist = rtlamp.shadow_falloff shadow.maxDist = rtlamp.shadow_distance shadow.minDist = rtlamp.shadow_distance * 0.75 + shadow.maxSize = SHADOW_RESOLUTION[rtlamp.shadow_quality] + # NOTE: minSize appears to be unused. shadow.power = rtlamp.shadow_power / 100.0 shadow.setProperty(plShadowMaster.kSelfShadow, rtlamp.shadow_self) diff --git a/korman/properties/prop_lamp.py b/korman/properties/prop_lamp.py index 61a5a7a..c1c4d33 100644 --- a/korman/properties/prop_lamp.py +++ b/korman/properties/prop_lamp.py @@ -44,6 +44,14 @@ class PlasmaLamp(idprops.IDPropObjectMixin, bpy.types.PropertyGroup): description="This light can cause objects to cast shadows on themselves", default=False, options=set()) + shadow_quality = EnumProperty(name="Shadow Quality", + description="Maximum resolution the shadow is rendered", + items=[("ABYSMAL", "Abysmal Quality", "64x64 pixels"), + ("LOW", "Low Quality", "128x128 pixels"), + ("NORMAL", "Normal Quality", "256x256 pixels"), + ("HIGH", "High Quality", "512x512 pixels")], + default="NORMAL", + options=set()) lamp_region = PointerProperty(name="Soft Volume", description="Soft region this light is active inside", diff --git a/korman/ui/ui_lamp.py b/korman/ui/ui_lamp.py index bb043c7..7c89b82 100644 --- a/korman/ui/ui_lamp.py +++ b/korman/ui/ui_lamp.py @@ -29,7 +29,7 @@ class LampButtonsPanel: class PlasmaLampPanel(LampButtonsPanel, bpy.types.Panel): bl_label = "Plasma RT Lamp" - def draw (self, context): + def draw(self, context): layout = self.layout rtlamp = context.lamp.plasma_lamp @@ -41,20 +41,33 @@ class PlasmaLampPanel(LampButtonsPanel, bpy.types.Panel): row.prop(rtlamp, "affect_characters") col = split.column() - col.label("RT Shadow:") - col.prop(rtlamp, "cast_shadows") + col.label("Soft Volume:") + col.active = not context.object.plasma_modifiers.softvolume.enabled + col.prop(rtlamp, "lamp_region", text="") - col = col.column() - col.active = rtlamp.cast_shadows + +class PlasmaShadowPanel(LampButtonsPanel, bpy.types.Panel): + bl_label = "Plasma RT Shadow" + + def draw_header(self, context): + self.layout.prop(context.lamp.plasma_lamp, "cast_shadows", text="") + + def draw(self, context): + layout = self.layout + rtlamp = context.lamp.plasma_lamp + layout.active = rtlamp.cast_shadows + + split = layout.split() + col = split.column() + col.prop(rtlamp, "shadow_quality", text="") + col.separator() col.prop(rtlamp, "shadow_self") + + col = split.column() col.prop(rtlamp, "shadow_power") col.prop(rtlamp, "shadow_falloff") col.prop(rtlamp, "shadow_distance") - if not context.object.plasma_modifiers.softvolume.enabled: - layout.separator() - layout.prop(rtlamp, "lamp_region") - def _draw_area_lamp(self, context): """Draw dispatch function for DATA_PT_area"""