Skip to content

Commit cbca262

Browse files
committed
Apply rebased PR #60 (AD tint OOR fade) and add state.healthbar* tracking
PR #60 conflicted with PR #62 on the replace-mode hbTex:SetVertexColor block; applied only the non-duplicate parts manually. The state.healthbarMode/R/G/B/Blend writes also fix a latent bug in already-merged PR #62 where adHealthBarMode was read but never written, making the live tint/replace switch gate always fail.
1 parent 57084d2 commit cbca262

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

AuraDesigner/Indicators.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,9 +1033,17 @@ function Indicators:ApplyHealthBar(frame, config, auraData)
10331033

10341034
local r, g, b = color[1] or color.r or 1, color[2] or color.g or 1, color[3] or color.b or 1
10351035
local mode = string.lower(config.mode or "replace")
1036-
-- Both modes use the overlay — replace forces full opacity, tint uses blend slider
1036+
-- Replace: full opacity overlay; Tint: blend slider controls mix strength
10371037
local blend = (mode == "replace") and 1 or (config.blend or 0.5)
10381038

1039+
-- Store on state so UpdateAuraDesignerAppearance / UpdateHealthBarAppearance
1040+
-- can access these for OOR handling and the replace/tint mode gate.
1041+
state.healthbarMode = mode
1042+
state.healthbarR = r
1043+
state.healthbarG = g
1044+
state.healthbarB = b
1045+
state.healthbarBlend = blend
1046+
10391047
local overlay = GetOrCreateTintOverlay(frame)
10401048
if overlay then
10411049
-- Re-sync texture in case the health bar's texture changed since the overlay

Features/ElementAppearance.lua

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,27 @@ function DF:UpdateAuraDesignerAppearance(frame)
10931093
end
10941094
end
10951095
end
1096+
-- Tint overlay (health bar "show when missing" indicator)
1097+
-- Control opacity via SetStatusBarColor rather than SetAlpha.
1098+
-- SetAlpha compounds with the blend baked into SetStatusBarColor:
1099+
-- blend × oorAlpha = e.g. 0.5 × 0.2 = 0.1 (nearly invisible OOR).
1100+
-- Setting SetStatusBarColor directly gives the exact target opacity.
1101+
local tintOverlay = frame.dfAD and frame.dfAD.tintOverlay
1102+
if tintOverlay and tintOverlay:IsShown() then
1103+
local adState = frame.dfAD
1104+
local r, g, b = adState.healthbarR or 1, adState.healthbarG or 1, adState.healthbarB or 1
1105+
local blend = adState.healthbarBlend or 0.5
1106+
1107+
if issecretvalue and issecretvalue(inRange) then
1108+
-- Secret boolean fallback — can't branch; leave at configured blend.
1109+
tintOverlay:SetStatusBarColor(r, g, b, blend)
1110+
elseif inRange then
1111+
tintOverlay:SetStatusBarColor(r, g, b, blend)
1112+
else
1113+
tintOverlay:SetStatusBarColor(r, g, b, oorAlpha)
1114+
end
1115+
tintOverlay:SetAlpha(1.0)
1116+
end
10961117
else
10971118
-- Frame-level mode: restore each indicator's base alpha
10981119
if frame.dfAD_icons then
@@ -1110,6 +1131,17 @@ function DF:UpdateAuraDesignerAppearance(frame)
11101131
if bar then bar:SetAlpha(bar.dfBaseAlpha or 1.0) end
11111132
end
11121133
end
1134+
-- Tint overlay (health bar "show when missing" indicator)
1135+
-- Frame-level mode: the frame cascade handles OOR alpha. Restore the overlay's
1136+
-- own alpha and SetStatusBarColor to their configured values.
1137+
local tintOverlay = frame.dfAD and frame.dfAD.tintOverlay
1138+
if tintOverlay and tintOverlay:IsShown() then
1139+
local adState = frame.dfAD
1140+
local r, g, b = adState.healthbarR or 1, adState.healthbarG or 1, adState.healthbarB or 1
1141+
local blend = adState.healthbarBlend or 0.5
1142+
tintOverlay:SetStatusBarColor(r, g, b, blend)
1143+
tintOverlay:SetAlpha(1.0)
1144+
end
11131145
end
11141146
end
11151147

0 commit comments

Comments
 (0)