Nono. It's working properly. The picture I posted is what I want to happen, not what's actually happening.
I think I've *almost* figured out the solution. The problem is that right now it's working properly for the power bar, but not for the health bar, even though the code is identical. See here:
The coloring on the power bar "background" bar (bottom, in blue) is applied properly, but the health bar (middle, in purple) background isn't colored. And if I make the 'foreground' bar transparent, I can also see that the power bar 'background' is updating properly, but the health bar 'background' is not:
Here's my bar constructor. I seriously have no idea why the two bars would behave differently - they're constructed identically.
lua Code:
lib.GenerateBar = function(f, n, b, isgroup)
local style
if isgroup then
style = profile.groupframes[n].bars[b]
else
style = profile.unitframes[n].bars[b]
end
local bg = CreateFrame("StatusBar", nil, f)
bg:SetStatusBarTexture(LSM:Fetch("statusbar", style.texture))
bg:SetHeight(f.height * style.heightmult)
bg:SetWidth(f.width * style.widthmult)
bg:SetPoint(style.anchor, f, style.anchor,
f.width * style.xoffsetmult, f.height * style.yoffsetmult)
bg:SetFrameLevel(style.level * 2 + 1)
local s = CreateFrame("StatusBar", nil, f)
s:SetStatusBarTexture(LSM:Fetch("statusbar", style.texture))
s:SetHeight(f.height * style.heightmult)
s:SetWidth(f.width * style.widthmult)
s:SetPoint(style.anchor, f, style.anchor,
f.width * style.xoffsetmult, f.height * style.yoffsetmult)
s:SetFrameLevel(style.level * 2 + 3)
local h = CreateFrame("Frame", nil, s)
h:SetPoint("TOPLEFT", -style.bginset, style.bginset)
h:SetPoint("BOTTOMRIGHT", style.bginset, -style.bginset)
h:SetFrameLevel(style.level * 2)
lib.GenerateBackdrop(h, style)
if (style.reverse and not style.invert) or (style.invert and not style.reverse) then
s:SetReverseFill(true)
bg:SetReverseFill(false)
else
s:SetReverseFill(false)
bg:SetReverseFill(true)
end
if style.vertical then
s:SetOrientation("VERTICAL")
s:SetRotatesTexture(true)
bg:SetOrientation("VERTICAL")
bg:SetRotatesTexture(true)
else
s:SetOrientation("HORIZONTAL")
s:SetRotatesTexture(false)
bg:SetOrientation("HORIZONTAL")
bg:SetRotatesTexture(false)
end
s.bar_bg = bg
s.backdrop = h
local iscustombg = style.bgcolorCustom
local mult = style.barbgmultiplier
if b == 1 then
f.Health = s
if style.invert then
f.Health.PostUpdate = function(self, unit, min, max)
self.bar_bg:SetMinMaxValues(0, max)
self.bar_bg:SetValue(min)
self:SetValue(max - min)
if not iscustombg then
local r, g, b = self:GetStatusBarColor()
self.bar_bg:SetStatusBarColor(r*mult, g*mult, b*mult)
end
end
else
f.Health.PostUpdate = function(self, unit, min, max)
self.bar_bg:SetMinMaxValues(0, max)
self.bar_bg:SetValue(max - min)
if not iscustombg then
local r, g, b = self:GetStatusBarColor()
self.bar_bg:SetStatusBarColor(r*mult, g*mult, b*mult)
end
end
end
elseif b ==2 then
f.Power = s
if style.invert then
f.Power.PostUpdate = function(self, unit, min, max)
self.bar_bg:SetMinMaxValues(0, max)
self.bar_bg:SetValue(min)
self:SetValue(max - min)
if not iscustombg then
local r, g, b = self:GetStatusBarColor()
self.bar_bg:SetStatusBarColor(r*mult, g*mult, b*mult)
end
end
else
f.Power.PostUpdate = function(self, unit, min, max)
self.bar_bg:SetMinMaxValues(0, max)
self.bar_bg:SetValue(max - min)
if not iscustombg then
local r, g, b = self:GetStatusBarColor()
self.bar_bg:SetStatusBarColor(r*mult, g*mult, b*mult)
end
end
end
elseif b == 3 then
f.AltPowerBar = s
if style.invert then
f.AltPowerBar.PostUpdate = function(self, min, cur, max)
self.bar_bg:SetMinMaxValues(0, max)
self.bar_bg:SetValue(cur)
self:SetValue(max - cur)
if not iscustombg then
local r, g, b = self:GetStatusBarColor()
self.bar_bg:SetStatusBarColor(r*mult, g*mult, b*mult)
end
end
else
f.AltPowerBar.PostUpdate = function(self, min, cur, max)
self.bar_bg:SetMinMaxValues(0, max)
self.bar_bg:SetValue(max - cur)
if not iscustombg then
local r, g, b = self:GetStatusBarColor()
self.bar_bg:SetStatusBarColor(r*mult, g*mult, b*mult)
end
end
end
end
end