Browse Source

Improve Plasma RT Lamps.

This improves the panel layout and fixes the issue in which
`plShadowMaster` exported with `maxSize` == 0, causing crappy shadows
in PotS and generally no shadows in MOUL.
pull/162/head
Adam Johnson 5 years ago
parent
commit
eaf9386c82
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 9
      korman/exporter/rtlight.py
  2. 8
      korman/properties/prop_lamp.py
  3. 31
      korman/ui/ui_lamp.py

9
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)

8
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",

31
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"""

Loading…
Cancel
Save