Skip to content

Instantly share code, notes, and snippets.

@Meorawr
Last active September 23, 2021 13:37
Show Gist options
  • Save Meorawr/35b2483b3dd3e5e3a4985b7b6d57387c to your computer and use it in GitHub Desktop.
Save Meorawr/35b2483b3dd3e5e3a4985b7b6d57387c to your computer and use it in GitHub Desktop.
MacroFrame Loose Icons Support
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