Kill first-render flicker on Talent/Vanity Blizzard-frame skins
The 0.5s ScheduleRepeatingTimer poll that caught these frames couldn't catch them before their first-ever :Show() this session, since they're created on-demand the instant the player opens them -- native art got one frame of paint before the poll's next tick could skin it. Switched to a generic ADDON_LOADED listener instead: it fires synchronously (before control returns to whatever opens the frame) the moment the owning addon finishes loading, so skinning now lands before the frame is ever shown. Confirmed in-game via an ADDON_LOADED probe on the talent frame's addon before implementing. Also fixes a regression this introduced: TalentFrame's CropBackground was caching the background texture's "original" tex coords on its first-ever call for later crop math. That first call now happens pre-Show, before Blizzard's own code sets the texture's real art-tile region, so it was permanently baking in the XML-template default (full 0..1) as the baseline. Moved the crop to run only from OnShow, where the real coords are already set.
This commit is contained in:
+11
-4
@@ -163,10 +163,17 @@ function CoA:InitializeVanityFrame()
|
||||
if not E.private.skins.blizzard.enable then return end
|
||||
if TryHook() then return end
|
||||
|
||||
self.vanityFrameTimer = self:ScheduleRepeatingTimer(function()
|
||||
-- Frame is created on-demand by its owning addon, the instant the player
|
||||
-- first opens it -- a poll can't catch that before native art gets a
|
||||
-- paint. ADDON_LOADED fires (synchronously, before control returns to
|
||||
-- whatever code calls :Show()) the moment that addon finishes loading, so
|
||||
-- skinning here lands before the first-ever :Show(). Confirmed in-game on
|
||||
-- the talent frame's identical pattern; see TalentFrame.lua.
|
||||
local loader = CreateFrame("Frame")
|
||||
loader:RegisterEvent("ADDON_LOADED")
|
||||
loader:SetScript("OnEvent", function(self)
|
||||
if TryHook() then
|
||||
self:CancelTimer(self.vanityFrameTimer)
|
||||
self.vanityFrameTimer = nil
|
||||
self:UnregisterEvent("ADDON_LOADED")
|
||||
end
|
||||
end, 0.5)
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user