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
+5 -19
View File
@@ -316,24 +316,10 @@ end
-- switches between the green and the grey variant by tex coord. There are no
-- Normal/Pushed/Disabled textures for HandleButton to clear (probed: both come
-- back nil, and every region's vertex colour is white in either state), so the
-- art is cleared by file the way the dropdown pills are, and the enabled/
-- disabled distinction the atlas was carrying has to be re-created on the label.
local ACTIVATE_ART = "128GoldRedButton"
-- SetTexture is noop'd per region for the same reason as the dropdown pills:
-- whatever swaps the tex coord on a state change is free to re-art the region
-- as well, and a cleared texture would come straight back.
local function StripActivateArt(button)
for i = 1, button:GetNumRegions() do
local region = select(i, button:GetRegions())
local texture = region.GetTexture and region:GetTexture()
if texture and tostring(texture):find(ACTIVATE_ART) then
region:SetTexture(nil)
region.SetTexture = E.noop
end
end
end
-- art is cleared by file the way the dropdown pills are (Skin:StripArtByFile,
-- which noops SetTexture per region as well -- whatever swaps the tex coord on
-- a state change is free to re-art the region), and the enabled/disabled
-- distinction the atlas was carrying has to be re-created on the label.
-- GetFontString covers the templated case; the scan is for a label that was
-- added as a plain region rather than set as the button's own font string.
@@ -393,7 +379,7 @@ local function SkinActivateButton(button)
if not button.CoASkinned then
button.CoASkinned = true
StripActivateArt(button)
Skin:StripArtByFile(button, Skin.RedButtonArt)
S:HandleButton(button)
button:HookScript("OnUpdate", UpdateActivateState)