Browse Source

Update RT Lights to IDProps

pull/56/head
Adam Johnson 8 years ago
parent
commit
6c5dff5d56
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 8
      korman/exporter/rtlight.py
  2. 15
      korman/properties/prop_lamp.py
  3. 2
      korman/ui/ui_lamp.py

8
korman/exporter/rtlight.py

@ -171,13 +171,11 @@ class LightConverter:
sv_mod, sv_key = bo.plasma_modifiers.softvolume, None
if sv_mod.enabled:
sv_key = sv_mod.get_key(self._exporter())
elif rtlamp.soft_region:
sv_bo = bpy.data.objects.get(rtlamp.soft_region, None)
if sv_bo is None:
raise ExportError("'{}': Invalid object for Lamp soft volume '{}'".format(bo.name, rtlamp.soft_region))
elif rtlamp.lamp_region:
sv_bo = rtlamp.lamp_region
sv_mod = sv_bo.plasma_modifiers.softvolume
if not sv_mod.enabled:
raise ExportError("'{}': '{}' is not a SoftVolume".format(bo.name, rtlamp.soft_region))
raise ExportError("'{}': '{}' is not a SoftVolume".format(bo.name, sv_bo.name))
sv_key = sv_mod.get_key(self._exporter())
pl_light.softVolume = sv_key

15
korman/properties/prop_lamp.py

@ -16,7 +16,9 @@
import bpy
from bpy.props import *
class PlasmaLamp(bpy.types.PropertyGroup):
from .. import idprops
class PlasmaLamp(idprops.IDPropObjectMixin, bpy.types.PropertyGroup):
affect_characters = BoolProperty(name="Affect Avatars",
description="This lamp affects avatars",
options=set(),
@ -43,9 +45,10 @@ class PlasmaLamp(bpy.types.PropertyGroup):
default=False,
options=set())
soft_region = StringProperty(name="Soft Volume",
description="Soft region this light is active inside",
options=set())
lamp_region = PointerProperty(name="Soft Volume",
description="Soft region this light is active inside",
type=bpy.types.Object,
poll=idprops.poll_softvolume_objects)
# For LimitedDirLights
size_height = FloatProperty(name="Height",
@ -55,3 +58,7 @@ class PlasmaLamp(bpy.types.PropertyGroup):
def has_light_group(self, bo):
return bool(bo.users_group)
@classmethod
def _idprop_mapping(cls):
return {"lamp_region": "soft_region"}

2
korman/ui/ui_lamp.py

@ -53,7 +53,7 @@ class PlasmaLampPanel(LampButtonsPanel, bpy.types.Panel):
if not context.object.plasma_modifiers.softvolume.enabled:
layout.separator()
layout.prop_search(rtlamp, "soft_region", bpy.data, "objects")
layout.prop(rtlamp, "lamp_region")
def _draw_area_lamp(self, context):

Loading…
Cancel
Save