From eefb40a30a47eeadd9d2b41265f70edeff47c5a6 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 20 Jul 2016 18:46:51 -0400 Subject: [PATCH] Allow Z-flag toggling Also, rearrange the layer panel to make a bit moar sense --- korman/exporter/material.py | 6 ++++++ korman/properties/prop_texture.py | 21 +++++++++++++----- korman/ui/ui_texture.py | 36 +++++++++++++++++-------------- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/korman/exporter/material.py b/korman/exporter/material.py index 8eac18d..29d4247 100644 --- a/korman/exporter/material.py +++ b/korman/exporter/material.py @@ -246,6 +246,12 @@ class MaterialConverter: state.blendFlags |= hsGMatState.kBlendAlpha if layer_props.alpha_halo: 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 self._tex_exporters[texture.type](bo, layer, slot) diff --git a/korman/properties/prop_texture.py b/korman/properties/prop_texture.py index 6f24778..6757ac5 100644 --- a/korman/properties/prop_texture.py +++ b/korman/properties/prop_texture.py @@ -27,11 +27,9 @@ class PlasmaLayer(bpy.types.PropertyGroup): opacity = FloatProperty(name="Layer Opacity", description="Opacity of the texture", - default=100, - min=0, - max=100, - subtype="PERCENTAGE") - alpha_halo = BoolProperty(name="Fix Alpha Halo", + default=100.0, min=0.0, max=100.0, + precision=0, subtype="PERCENTAGE") + alpha_halo = BoolProperty(name="High Alpha Test", description="Fixes halos seen around semitransparent objects resulting from sorting errors", default=False) @@ -73,3 +71,16 @@ class PlasmaLayer(bpy.types.PropertyGroup): description="", min=0, max=100, default=0, 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()) diff --git a/korman/ui/ui_texture.py b/korman/ui/ui_texture.py index b14424c..435e8f8 100644 --- a/korman/ui/ui_texture.py +++ b/korman/ui/ui_texture.py @@ -66,21 +66,6 @@ class PlasmaLayerPanel(TextureButtonsPanel, bpy.types.Panel): layer_props = texture.plasma_layer 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() col = split.column() col.label("Animation:") @@ -89,10 +74,29 @@ class PlasmaLayerPanel(TextureButtonsPanel, bpy.types.Panel): col.prop(layer_props, "anim_loop") col = split.column() - col.label("General:") + col.label("Miscellaneous:") col.active = not slot.use_stencil 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, "skip_depth_write") + col.prop(layer_props, "skip_depth_test") + col.prop(layer_props, "z_bias") def _has_animation_data(self, context): tex = getattr(context, "texture", None)