Browse Source

Allow soft volumes to be added to Lamps

pull/38/head
Adam Johnson 9 years ago
parent
commit
24f7442d88
  1. 15
      korman/exporter/rtlight.py
  2. 4
      korman/properties/prop_lamp.py
  3. 3
      korman/ui/ui_lamp.py

15
korman/exporter/rtlight.py

@ -13,6 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with Korman. If not, see <http://www.gnu.org/licenses/>.
import bpy
from PyHSPlasma import *
import weakref
@ -147,6 +148,20 @@ class LightConverter:
pl_light.lightToWorld = l2w
pl_light.worldToLight = l2w.inverse()
# Soft Volume science
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))
sv_mod = sv_bo.plasma_modifiers.softvolume
if not sv_mod.enabled:
raise ExportError("'{}': '{}' is not a SoftVolume".format(bo.name, rtlamp.soft_region))
sv_key = sv_mod.get_key(self._exporter())
pl_light.softVolume = sv_key
# *Sigh*
pl_light.sceneNode = self.mgr.get_scene_node(location=so.key.location)

4
korman/properties/prop_lamp.py

@ -28,3 +28,7 @@ class PlasmaLamp(bpy.types.PropertyGroup):
cast_shadows = BoolProperty(name="Cast RT Shadows",
description="This lamp casts runtime shadows",
default=True)
soft_region = StringProperty(name="Soft Volume",
description="Soft region this light is active inside",
options=set())

3
korman/ui/ui_lamp.py

@ -42,3 +42,6 @@ class PlasmaLampPanel(LampButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(rtlamp, "cast_shadows")
if not context.object.plasma_modifiers.softvolume.enabled:
layout.prop_search(rtlamp, "soft_region", bpy.data, "objects")

Loading…
Cancel
Save