Browse Source

Allow Z-flag toggling

Also, rearrange the layer panel to make a bit moar sense
pull/43/head
Adam Johnson 8 years ago
parent
commit
eefb40a30a
  1. 6
      korman/exporter/material.py
  2. 21
      korman/properties/prop_texture.py
  3. 36
      korman/ui/ui_texture.py

6
korman/exporter/material.py

@ -246,6 +246,12 @@ class MaterialConverter:
state.blendFlags |= hsGMatState.kBlendAlpha state.blendFlags |= hsGMatState.kBlendAlpha
if layer_props.alpha_halo: if layer_props.alpha_halo:
state.blendFlags |= hsGMatState.kBlendAlphaTestHigh state.blendFlags |= hsGMatState.kBlendAlphaTestHigh
if layer_props.z_bias:
state.zFlags |= hsGMatState.kZIncLayer
if layer_props.skip_depth_test:
state.zFlags |= hsGMatState.kZNoZRead
if layer_props.skip_depth_write:
state.zFlags |= hsGMatState.kZNoZWrite
# Export the specific texture type # Export the specific texture type
self._tex_exporters[texture.type](bo, layer, slot) self._tex_exporters[texture.type](bo, layer, slot)

21
korman/properties/prop_texture.py

@ -27,11 +27,9 @@ class PlasmaLayer(bpy.types.PropertyGroup):
opacity = FloatProperty(name="Layer Opacity", opacity = FloatProperty(name="Layer Opacity",
description="Opacity of the texture", description="Opacity of the texture",
default=100, default=100.0, min=0.0, max=100.0,
min=0, precision=0, subtype="PERCENTAGE")
max=100, alpha_halo = BoolProperty(name="High Alpha Test",
subtype="PERCENTAGE")
alpha_halo = BoolProperty(name="Fix Alpha Halo",
description="Fixes halos seen around semitransparent objects resulting from sorting errors", description="Fixes halos seen around semitransparent objects resulting from sorting errors",
default=False) default=False)
@ -73,3 +71,16 @@ class PlasmaLayer(bpy.types.PropertyGroup):
description="", description="",
min=0, max=100, default=0, min=0, max=100, default=0,
options=set(), subtype="PERCENTAGE") options=set(), subtype="PERCENTAGE")
z_bias = BoolProperty(name="Z Bias",
description="Request Z bias offset to defeat Z-fighting",
default=False,
options=set())
skip_depth_test = BoolProperty(name="Skip Depth Test",
description="Causes this layer to be rendered, even if behind others",
default=False,
options=set())
skip_depth_write = BoolProperty(name="Skip Depth Write",
description="Don't save the depth information, allowing rendering of layers behind this one",
default=False,
options=set())

36
korman/ui/ui_texture.py

@ -66,21 +66,6 @@ class PlasmaLayerPanel(TextureButtonsPanel, bpy.types.Panel):
layer_props = texture.plasma_layer layer_props = texture.plasma_layer
layout = self.layout layout = self.layout
col = layout.column()
col.active = texture.use_mipmap
col.prop(layer_props, "is_detail_map", text="Use Detail Blending")
split = layout.split()
col = split.column(align=True)
col.active = texture.use_mipmap and layer_props.is_detail_map
col.prop(layer_props, "detail_fade_start")
col.prop(layer_props, "detail_fade_stop")
col = split.column(align=True)
col.active = texture.use_mipmap and layer_props.is_detail_map
col.prop(layer_props, "detail_opacity_start")
col.prop(layer_props, "detail_opacity_stop")
layout.separator()
split = layout.split() split = layout.split()
col = split.column() col = split.column()
col.label("Animation:") col.label("Animation:")
@ -89,10 +74,29 @@ class PlasmaLayerPanel(TextureButtonsPanel, bpy.types.Panel):
col.prop(layer_props, "anim_loop") col.prop(layer_props, "anim_loop")
col = split.column() col = split.column()
col.label("General:") col.label("Miscellaneous:")
col.active = not slot.use_stencil col.active = not slot.use_stencil
col.prop(layer_props, "opacity", text="Opacity") col.prop(layer_props, "opacity", text="Opacity")
layout.separator()
split = layout.split()
col = split.column()
col.active = texture.use_mipmap
col.prop(layer_props, "is_detail_map", text="Detail Blending")
col = col.column(align=True)
col.active = texture.use_mipmap and layer_props.is_detail_map
col.prop(layer_props, "detail_fade_start")
col.prop(layer_props, "detail_fade_stop")
col.separator()
col.prop(layer_props, "detail_opacity_start")
col.prop(layer_props, "detail_opacity_stop")
col = split.column()
col.label("Z Depth:")
col.prop(layer_props, "alpha_halo") col.prop(layer_props, "alpha_halo")
col.prop(layer_props, "skip_depth_write")
col.prop(layer_props, "skip_depth_test")
col.prop(layer_props, "z_bias")
def _has_animation_data(self, context): def _has_animation_data(self, context):
tex = getattr(context, "texture", None) tex = getattr(context, "texture", None)

Loading…
Cancel
Save