From e1bbfed16dfdbcf421061de98ee1781df205140e Mon Sep 17 00:00:00 2001 From: Patrick Dulebohn Date: Sat, 26 Jun 2021 16:31:57 -0400 Subject: [PATCH 1/2] Alpha Vertex Color Toggle Adds a per-layer toggle to use the Alpha VCol values and blend the texture --- korman/exporter/material.py | 5 ++++- korman/properties/prop_texture.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/korman/exporter/material.py b/korman/exporter/material.py index a29f9d8..c9b1774 100644 --- a/korman/exporter/material.py +++ b/korman/exporter/material.py @@ -509,7 +509,10 @@ class MaterialConverter: else: layer_props = texture.plasma_layer layer.opacity = layer_props.opacity / 100 - self._handle_layer_opacity(layer, layer_props.opacity) + if layer_props.opacity < 100 and not state.blendFlags & hsGMatState.kBlendMask: + state.blendFlags |= hsGMatState.kBlendAlpha + if layer_props.use_alpha_vcol: + state.blendFlags |= hsGMatState.kBlendAlpha if layer_props.alpha_halo: state.blendFlags |= hsGMatState.kBlendAlphaTestHigh if layer_props.z_bias: diff --git a/korman/properties/prop_texture.py b/korman/properties/prop_texture.py index 78d83ad..297018f 100644 --- a/korman/properties/prop_texture.py +++ b/korman/properties/prop_texture.py @@ -38,6 +38,9 @@ class PlasmaLayer(bpy.types.PropertyGroup): description="Opacity of the texture", default=100.0, min=0.0, max=100.0, precision=0, subtype="PERCENTAGE") + use_alpha_vcol = BoolProperty(name="Use Alpha VCol", + description="Texture uses the Alpha vertex color values", + default=False) alpha_halo = BoolProperty(name="High Alpha Test", description="Fixes halos seen around semitransparent objects resulting from sorting errors", default=False) From 5191e786be0e469d90bc893d500e9664486134bb Mon Sep 17 00:00:00 2001 From: Patrick Dulebohn Date: Mon, 7 Feb 2022 13:49:21 -0500 Subject: [PATCH 2/2] Add Alpha VCol UI function Forgot to add this earlier --- korman/ui/ui_texture.py | 1 + 1 file changed, 1 insertion(+) diff --git a/korman/ui/ui_texture.py b/korman/ui/ui_texture.py index a346d47..c63e05b 100644 --- a/korman/ui/ui_texture.py +++ b/korman/ui/ui_texture.py @@ -82,6 +82,7 @@ class PlasmaLayerPanel(TextureButtonsPanel, bpy.types.Panel): sub = col.column() sub.active = not use_stencil sub.prop(layer_props, "opacity", text="Opacity") + sub.prop(layer_props, "use_alpha_vcol", text="Use Alpha VCol") sub.separator() sub = col.column() sub.active = texture.type == "IMAGE" and texture.image is None