Skin the Apply and Cancel buttons on the wardrobe model

Both only exist while a transmog change is pending, which is why every
earlier pass over the frame missed them -- it was always skinned in its idle
state -- so they still wore their native green and red pills against an
otherwise flat window.

They are the same widget as the specialization menu's Activate button: no
Normal/Pushed texture for HandleButton to clear, the pill drawn across plain
regions from an atlas. Two files, not one -- Apply takes the green variant of
128GoldRedButton, Cancel is drawn from 128RedButton, HIGHLIGHT region and all,
which is what left a red glow under the cursor once only the gold file was
being cleared. The shared "RedButton" suffix matches both. Their labels take
ElvUI's yellow rather than carrying the atlas's green/red split over: the two
sit side by side and read apart by their text.

The buttons exist from the start rather than being created on the first
pending change, so the normal skin pass reaches them, but the art is only
there to be cleared once a change is pending -- and nothing fires the frame's
OnShow at that point, since the window is already open. The buttons' own
OnShow catches it instead.

The clear-by-file loop the Activate button and the dropdown pills had a copy
of each now lives in Skinning.lua as Skin:StripArtByFile, with the atlas name
alongside it.
This commit is contained in:
2026-08-18 16:29:12 +02:00
parent 58fae4418a
commit cddfc7e7af
3 changed files with 83 additions and 35 deletions
+29 -16
View File
@@ -138,31 +138,44 @@ function Skin:HideArt(frame)
frame:Hide()
end
-- The dropdown pills on the vanity and wardrobe frames are the same widget:
-- nine anonymous "Silver-Button" slices rather than the named Left/Middle/Right
-- fields or the Normal/Pushed/Disabled set S:HandleButton knows how to clear,
-- so its own clearing can't reach them -- and a blind StripTextures would take
-- the caret and the label with them.
-- Several of these controls draw their art as anonymous regions of one atlas
-- file rather than through the named Left/Middle/Right fields or the Normal/
-- Pushed/Disabled set S:HandleButton knows how to clear, so its own clearing
-- can't reach them -- and a blind StripTextures would take the caret or the
-- label with it. Those are cleared by file instead.
--
-- The native mouse-down handler re-arts one of these regions with a pressed
-- variant of the same file on every click, which is why the pill came back
-- skinless while held. SetTexture is noop'd per region after clearing.
local DROPDOWN_ART = "Silver%-Button"
local CARET_ART = "ChatFrameExpandArrow"
local CARET_SIZE = 14
-- SetTexture is noop'd per region rather than just cleared: whatever re-arts
-- the control on a state change (a mouse-down swapping in the pressed variant,
-- a tex coord swap between two variants of the same file) is free to re-set the
-- file as well, and a cleared texture would come straight back.
function Skin:StripArtByFile(frame, pattern)
if not frame then return end
local function StripDropdownArt(dropdown)
for i = 1, dropdown:GetNumRegions() do
local region = select(i, dropdown:GetRegions())
for i = 1, frame:GetNumRegions() do
local region = select(i, frame:GetRegions())
local texture = region.GetTexture and region:GetTexture()
if texture and tostring(texture):find(DROPDOWN_ART) then
if texture and tostring(texture):find(pattern) then
region:SetTexture(nil)
region.SetTexture = E.noop
end
end
end
-- The pill behind the talent frame's Activate button and the wardrobe's Apply
-- and Cancel buttons. Two files rather than one: "128GoldRedButton" carries the
-- green and grey variants as tex coords, and Cancel alone is drawn from
-- "128RedButton" (probed) -- including its HIGHLIGHT region, which is what left
-- a red glow under the cursor while only the gold file was being cleared. The
-- shared suffix matches both, and nothing else on these frames uses either.
Skin.RedButtonArt = "RedButton"
-- The dropdown pills on the vanity and wardrobe frames are the same widget:
-- nine anonymous "Silver-Button" slices.
local DROPDOWN_ART = "Silver%-Button"
local CARET_ART = "ChatFrameExpandArrow"
local CARET_SIZE = 14
-- The caret is retextured after HandleButton, not before: HandleButton strips
-- the pill, and a caret replaced ahead of that gets cleared straight back off.
local function SkinDropdownCaret(dropdown)
@@ -191,7 +204,7 @@ function Skin:Dropdown(dropdown, menu)
if not dropdown or dropdown.CoASkinned then return end
dropdown.CoASkinned = true
StripDropdownArt(dropdown)
self:StripArtByFile(dropdown, DROPDOWN_ART)
S:HandleButton(dropdown)
SkinDropdownCaret(dropdown)