Thank you for your reply.
Originally Posted by SDPhantom
Appears texture:SetTexCoord() doesn't work on StatusBars as they keep overwriting it on render.
|
I can confirm this (maybe I should have had my simple test bar actually track something when I first tested with it). Even when putting SetTexCoord() inside the same function that updates the status bar value, it barely works (only when the value's stopped changing for a few seconds).
Lua Code:
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function(self, event, ...)
local tex = f:CreateTexture()
tex:SetAtlas("UI-HUD-UnitFrame-Player-PortraitOff-Bar-Health-Status")
tex:SetTexCoord(0.1, 0.9, 0, 1)
ElanthisStatusBar = CreateFrame("StatusBar")
ElanthisStatusBar:SetPoint("CENTER", UIParent, "CENTER", 0, -30)
ElanthisStatusBar:SetSize(126, 12)
ElanthisStatusBar:SetStatusBarTexture(tex)
ElanthisStatusBar:RegisterEvent("UNIT_POWER_FREQUENT")
ElanthisStatusBar:SetScript("OnEvent", function(self, event, ...)
local unitID = ...
if not UnitIsPlayer(unitID) then return end
local maxPower = UnitPowerMax(unitID)
local currentPower = UnitPower(unitID)
self:SetMinMaxValues(0, maxPower)
self:SetValue(currentPower)
-- tex:SetTexCoord(0.1, 0.9, 0, 1)
end)
end)
Originally Posted by SDPhantom
Generally, texture:SetTexCoord() doesn't work on atlas' either, but using C_Texture.GetAtlasInfo() to set by texture file and trimming the supplied texcoord isn't yielding useful results either as it normally would.
|
I tried that earlier (sorry, I should have said so) and yea, it seems to be specific to the SetTexCoord() method as a whole.
Do you by chance know if it's possible to define new atlas members from Blizzards atlas' (so I can crop the bar textures "right at the source")?
Else it is probably easier to make up my own texture file with the desired bar texture.