Last active
September 23, 2021 13:37
-
-
Save Meorawr/35b2483b3dd3e5e3a4985b7b6d57387c to your computer and use it in GitHub Desktop.
MacroFrame Loose Icons Support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoadAddOn("Blizzard_MacroUI"); | |
local function OnMacroPopupDialogAccepted() | |
local macroIndex = MacroFrame.selectedMacro; | |
local macroIcon = GetSpellorMacroIconInfo(MacroPopupFrame.selectedIcon); | |
if type(macroIcon) == "string" then | |
macroIcon = GetFileIDFromPath([[Interface\Icons\]] .. macroIcon); | |
end | |
if not macroIndex or not macroIcon then | |
return; | |
end | |
EditMacro(macroIndex, nil, macroIcon, nil); | |
-- Visual fixups for MacroFrame buttons to use the correct icon and not | |
-- appear invisible until the user interacts with it. | |
local macroButtonIndex = MacroFrame.macroBase + macroIndex; | |
local macroButtonName = "MacroButton" .. macroButtonIndex; | |
local macroButtonIcon = _G[macroButtonName .. "Icon"]; | |
macroButtonIcon:SetTexture(macroIcon); | |
MacroFrameSelectedMacroButtonIcon:SetTexture(macroIcon); | |
end | |
hooksecurefunc(MacroPopupFrame.BorderBox, "OnOkay", OnMacroPopupDialogAccepted); | |
hooksecurefunc("MacroPopupOkayButton_OnClick", OnMacroPopupDialogAccepted); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment