Browse Source

More lamp powah

pull/23/head
Adam Johnson 9 years ago
parent
commit
d814d4343a
  1. 16
      korman/exporter/rtlight.py
  2. 2
      korman/properties/__init__.py
  3. 9
      korman/render.py
  4. 1
      korman/ui/__init__.py

16
korman/exporter/rtlight.py

@ -112,14 +112,17 @@ class LightConverter:
color_str = "({:.4f}, {:.4f}, {:.4f})".format(color[0], color[1], color[2])
color.append(1.0)
# Do we *only* want a shadow?
shadow_only = bl_light.shadow_method != "NOSHADOW" and bl_light.use_only_shadow
# Apply the colors
if bl_light.use_diffuse:
if bl_light.use_diffuse and not shadow_only:
print(" Diffuse: {}".format(color_str))
pl_light.diffuse = hsColorRGBA(*color)
else:
print(" Diffuse: OFF")
pl_light.diffuse = hsColorRGBA(0.0, 0.0, 0.0, 1.0)
if bl_light.use_specular:
if bl_light.use_specular and not shadow_only:
print(" Specular: {}".format(color_str))
pl_light.setProperty(plLightInfo.kLPHasSpecular, True)
pl_light.specular = hsColorRGBA(*color)
@ -127,6 +130,15 @@ class LightConverter:
print(" Specular: OFF")
pl_light.specular = hsColorRGBA(0.0, 0.0, 0.0, 1.0)
# Crazy flags
rtlamp = bl_light.plasma_lamp
if rtlamp.light_group:
pl_light.setProperty(plLightInfo.kLPHasIncludes, True)
pl_light.setProperty(plLightInfo.kLPIncludesChars, rtlamp.affect_characters)
if rtlamp.cast_shadows:
pl_light.setProperty(plLightInfo.kLPShadowLightGroup, True)
pl_light.setProperty(plLightInfo.kLPShadowOnly, shadow_only)
# AFAICT ambient lighting is never set in PlasmaMax...
# If you can think of a compelling reason to support it, be my guest.
pl_light.ambient = hsColorRGBA(0.0, 0.0, 0.0, 1.0)

2
korman/properties/__init__.py

@ -15,6 +15,7 @@
import bpy
from .prop_lamp import *
from . import modifiers
from .prop_object import *
from .prop_texture import *
@ -22,6 +23,7 @@ from .prop_world import *
def register():
bpy.types.Lamp.plasma_lamp = bpy.props.PointerProperty(type=PlasmaLamp)
bpy.types.Object.plasma_net = bpy.props.PointerProperty(type=PlasmaNet)
bpy.types.Object.plasma_object = bpy.props.PointerProperty(type=PlasmaObject)
bpy.types.Texture.plasma_layer = bpy.props.PointerProperty(type=PlasmaLayer)

9
korman/render.py

@ -46,7 +46,14 @@ def _whitelist_all(mod):
getattr(attr, "COMPAT_ENGINES").add("PLASMA_GAME")
from bl_ui import properties_data_lamp
_whitelist_all(properties_data_lamp)
properties_data_lamp.DATA_PT_context_lamp.COMPAT_ENGINES.add("PLASMA_GAME")
properties_data_lamp.DATA_PT_preview.COMPAT_ENGINES.add("PLASMA_GAME")
properties_data_lamp.DATA_PT_lamp.COMPAT_ENGINES.add("PLASMA_GAME")
properties_data_lamp.DATA_PT_shadow.COMPAT_ENGINES.add("PLASMA_GAME")
properties_data_lamp.DATA_PT_area.COMPAT_ENGINES.add("PLASMA_GAME")
properties_data_lamp.DATA_PT_spot.COMPAT_ENGINES.add("PLASMA_GAME")
properties_data_lamp.DATA_PT_falloff_curve.COMPAT_ENGINES.add("PLASMA_GAME")
properties_data_lamp.DATA_PT_custom_props_lamp.COMPAT_ENGINES.add("PLASMA_GAME")
del properties_data_lamp
from bl_ui import properties_render

1
korman/ui/__init__.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/>.
from .ui_lamp import *
from .ui_modifiers import *
from .ui_object import *
from .ui_texture import *

Loading…
Cancel
Save