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() frame:Hide()
end end
-- The dropdown pills on the vanity and wardrobe frames are the same widget: -- Several of these controls draw their art as anonymous regions of one atlas
-- nine anonymous "Silver-Button" slices rather than the named Left/Middle/Right -- file rather than through the named Left/Middle/Right fields or the Normal/
-- fields or the Normal/Pushed/Disabled set S:HandleButton knows how to clear, -- Pushed/Disabled set S:HandleButton knows how to clear, so its own clearing
-- so its own clearing can't reach them -- and a blind StripTextures would take -- can't reach them -- and a blind StripTextures would take the caret or the
-- the caret and the label with them. -- label with it. Those are cleared by file instead.
-- --
-- The native mouse-down handler re-arts one of these regions with a pressed -- SetTexture is noop'd per region rather than just cleared: whatever re-arts
-- variant of the same file on every click, which is why the pill came back -- the control on a state change (a mouse-down swapping in the pressed variant,
-- skinless while held. SetTexture is noop'd per region after clearing. -- a tex coord swap between two variants of the same file) is free to re-set the
local DROPDOWN_ART = "Silver%-Button" -- file as well, and a cleared texture would come straight back.
local CARET_ART = "ChatFrameExpandArrow" function Skin:StripArtByFile(frame, pattern)
local CARET_SIZE = 14 if not frame then return end
local function StripDropdownArt(dropdown) for i = 1, frame:GetNumRegions() do
for i = 1, dropdown:GetNumRegions() do local region = select(i, frame:GetRegions())
local region = select(i, dropdown:GetRegions())
local texture = region.GetTexture and region:GetTexture() 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(nil)
region.SetTexture = E.noop region.SetTexture = E.noop
end end
end 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 caret is retextured after HandleButton, not before: HandleButton strips
-- the pill, and a caret replaced ahead of that gets cleared straight back off. -- the pill, and a caret replaced ahead of that gets cleared straight back off.
local function SkinDropdownCaret(dropdown) local function SkinDropdownCaret(dropdown)
@@ -191,7 +204,7 @@ function Skin:Dropdown(dropdown, menu)
if not dropdown or dropdown.CoASkinned then return end if not dropdown or dropdown.CoASkinned then return end
dropdown.CoASkinned = true dropdown.CoASkinned = true
StripDropdownArt(dropdown) self:StripArtByFile(dropdown, DROPDOWN_ART)
S:HandleButton(dropdown) S:HandleButton(dropdown)
SkinDropdownCaret(dropdown) SkinDropdownCaret(dropdown)
+5 -19
View File
@@ -316,24 +316,10 @@ end
-- switches between the green and the grey variant by tex coord. There are no -- 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 -- 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 -- 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/ -- art is cleared by file the way the dropdown pills are (Skin:StripArtByFile,
-- disabled distinction the atlas was carrying has to be re-created on the label. -- which noops SetTexture per region as well -- whatever swaps the tex coord on
local ACTIVATE_ART = "128GoldRedButton" -- 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.
-- 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
-- GetFontString covers the templated case; the scan is for a label that was -- 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. -- 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 if not button.CoASkinned then
button.CoASkinned = true button.CoASkinned = true
StripActivateArt(button) Skin:StripArtByFile(button, Skin.RedButtonArt)
S:HandleButton(button) S:HandleButton(button)
button:HookScript("OnUpdate", UpdateActivateState) button:HookScript("OnUpdate", UpdateActivateState)
+49
View File
@@ -13,6 +13,54 @@ local function SkinActionButtons()
S:HandleButton(_G[FRAME_NAME.."DisableSpellVisualsButton"]) S:HandleButton(_G[FRAME_NAME.."DisableSpellVisualsButton"])
end end
-- Apply and Cancel only exist while a transmog change is pending, which is why
-- they were missed for so long -- but they exist from the start rather than
-- being created on the first change (probed: both are Buttons, hidden, with
-- nothing pending), so the normal skin pass reaches them.
--
-- Same widget as the talent frame's Activate button: the pill is drawn across
-- plain regions, with no Normal/Pushed texture for HandleButton to clear
-- (probed: both come back nil). Apply takes the green variant of the gold
-- atlas, Cancel is drawn from the red file instead -- Skin.RedButtonArt matches
-- both, and Cancel's HIGHLIGHT region goes with the rest of its art.
--
-- The labels don't carry the atlas's green/red split over: the two buttons sit
-- side by side and read apart by their text, and they take the same yellow
-- every other templated button on these frames uses -- the talent frame's live
-- Activate label included -- so a pending change doesn't get its own colour
-- scheme.
local LABEL_COLOR = {1, 0.82, 0}
-- The strip runs on every pass rather than once behind the skinned guard: the
-- art is only there to be cleared once a change is pending, and nothing fires
-- the frame's OnShow at that point -- the window is already open. The buttons'
-- own OnShow is what catches it, since that is exactly when they appear.
local function SkinPendingButton(name)
local button = _G[name]
if not button then return end
Skin:StripArtByFile(button, Skin.RedButtonArt)
if button.CoASkinned then return end
button.CoASkinned = true
-- Stripped before templating: HandleButton adds its backdrop as regions of
-- this same button, so a strip afterwards takes the backdrop with the pill.
S:HandleButton(button)
local text = button.GetFontString and button:GetFontString()
if text then text:SetTextColor(unpack(LABEL_COLOR)) end
button:HookScript("OnShow", function(self)
Skin:StripArtByFile(self, Skin.RedButtonArt)
end)
end
local function SkinPendingButtons()
SkinPendingButton(FRAME_NAME.."PlayerModelApplyButton")
SkinPendingButton(FRAME_NAME.."PlayerModelCancelButton")
end
local function SkinSearchBox() local function SkinSearchBox()
S:HandleEditBox(_G[FRAME_NAME.."CollectionSearchBox"]) S:HandleEditBox(_G[FRAME_NAME.."CollectionSearchBox"])
end end
@@ -59,6 +107,7 @@ local function SkinContents()
Skin:Title(_G[FRAME_NAME.."TitleText"]) Skin:Title(_G[FRAME_NAME.."TitleText"])
Skin:CloseButton(_G[FRAME_NAME.."CloseButton"]) Skin:CloseButton(_G[FRAME_NAME.."CloseButton"])
SkinActionButtons() SkinActionButtons()
SkinPendingButtons()
SkinSearchBox() SkinSearchBox()
SkinCollectionDropdown("Filter") SkinCollectionDropdown("Filter")
SkinCollectionDropdown("Sorting") SkinCollectionDropdown("Sorting")