Browse Source

Allow configuration of environment map colors

pull/10/head
Adam Johnson 10 years ago
parent
commit
a99728c241
  1. 7
      korman/exporter/material.py
  2. 7
      korman/properties/prop_texture.py
  3. 6
      korman/ui/ui_texture.py

7
korman/exporter/material.py

@ -370,7 +370,7 @@ class MaterialConverter:
pl_env = plDynamicCamMap
else:
pl_env = plDynamicEnvMap
pl_env = self._export_dynamic_env(bo, hsgmat, layer, bl_env, pl_env)
pl_env = self._export_dynamic_env(bo, hsgmat, layer, texture, pl_env)
else:
# We should really export a CubicEnvMap here, but we have a good setup for DynamicEnvMaps
# that create themselves when the explorer links in, so really... who cares about CEMs?
@ -379,9 +379,10 @@ class MaterialConverter:
layer.state.shadeFlags |= hsGMatState.kShadeEnvironMap
layer.texture = pl_env
def _export_dynamic_env(self, bo, hsgmat, layer, bl_env, pl_class):
def _export_dynamic_env(self, bo, hsgmat, layer, texture, pl_class):
# To protect the user from themselves, let's check to make sure that a DEM/DCM matching this
# viewpoint object has not already been exported...
bl_env = texture.environment_map
viewpt = bl_env.viewpoint_object
name = "{}_DynEnvMap".format(viewpt.name)
pl_env = self._mgr.find_key(pl_class, bl=bo, name=name)
@ -415,7 +416,7 @@ class MaterialConverter:
# Perhaps the DEM/DCM fog should be separately configurable at some point?
pl_fog = bpy.context.scene.world.plasma_fni
pl_env.color = utils.color(pl_fog.fog_color)
pl_env.color = utils.color(texture.plasma_layer.envmap_color)
pl_env.fogStart = pl_fog.fog_start
if isinstance(pl_env, plDynamicCamMap):

7
korman/properties/prop_texture.py

@ -26,6 +26,13 @@ class PlasmaLayer(bpy.types.PropertyGroup):
max=100,
subtype="PERCENTAGE")
envmap_color = FloatVectorProperty(name="Environment Map Color",
description="The default background color rendered onto the Environment Map",
min=0.0,
max=1.0,
default=(1.0, 1.0, 1.0),
subtype="COLOR")
anim_auto_start = BoolProperty(name="Auto Start",
description="Automatically start layer animation",
default=True)

6
korman/ui/ui_texture.py

@ -28,7 +28,8 @@ class PlasmaLayerPanel(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Plasma Layer Options"
def draw(self, context):
layer_props = context.texture.plasma_layer
texture = context.texture
layer_props = texture.plasma_layer
layout = self.layout
split = layout.split()
@ -42,3 +43,6 @@ class PlasmaLayerPanel(TextureButtonsPanel, bpy.types.Panel):
col = split.column()
col.label("General:")
col.prop(layer_props, "opacity", text="Opacity")
col = col.column()
col.enabled = texture.type == "ENVIRONMENT_MAP"
col.prop(layer_props, "envmap_color")

Loading…
Cancel
Save