A Molten Giant
Join Date: Dec 2009
Posts: 784
|
Heres my functions to remove textures/hide frames.
Lua Code:
A.Func = function() return end
Lua Code:
A.Kill = function(Object) if Object.UnregisterAllEvents then Object:UnregisterAllEvents() end Object.Show = A.Func Object:Hide() end A.StripTexture = function(Object, Kill) for i = 1, Object:GetNumRegions() do local Region = select(i, Object:GetRegions()) if Region:GetObjectType() == "Texture" then if Kill then A.Kill(Region) else Region:SetTexture(nil) end end end end
Heres my skinning API
Lua Code:
local A, C, L = select(2, ...):unpack() local BorderColor = unpack(C.General.BorderColor) A.Mult = 768/string.match(A.Resolution, "%d+x(%d+)")/C.General.UIScale A.Scale = function(ScaleObject) return A.Mult*math.floor(ScaleObject/A.Mult) end A.CreateBorder = function(self, ButtonOverlay, OverlayButtonWidth, OverlayButtonHeight, LeftSize, RightSize, BottomSize, TopSize, SLeftSize, SRightSize, SBottomSize, STopSize) if not self.HasBorder then self.ABorder = CreateFrame("Frame", nil, self) self.ABorder:SetFrameLevel(self:GetFrameLevel() + 5) self.ABorder:SetPoint("TOPLEFT", self, "TOPLEFT", LeftSize or 0, TopSize or 0) self.ABorder:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", RightSize or 0, BottomSize or 0) self.ABorder:SetBackdrop({ edgeFile = "Interface\\Buttons\\WHITE8x8", edgeSize = A.Scale(1.5), }) self.ABorder:SetBackdropBorderColor(BorderColor, BorderColor, BorderColor) self.ABorderShadow = CreateFrame("Frame", nil, self) self.ABorderShadow:SetFrameLevel(self.ABorder:GetFrameLevel() - 1) self.ABorderShadow:SetPoint("TOPLEFT", self, "TOPLEFT", LeftSize or 0, TopSize or 0) self.ABorderShadow:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", RightSize or 0, BottomSize or 0) self.ABorderShadow:SetBackdrop({ edgeFile = "Interface\\Buttons\\WHITE8x8", edgeSize = A.Scale(2), }) self.ABorderShadow:SetBackdropBorderColor(0, 0, 0, 1) self.ABorderShadow2 = CreateFrame("Frame", nil, self) self.ABorderShadow2:SetFrameLevel(self.ABorder:GetFrameLevel() - 1) self.ABorderShadow2:SetPoint("TOPLEFT", self, "TOPLEFT", SLeftSize or -0.8, STopSize or 0.8) self.ABorderShadow2:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", SRightSize or 0.8, SBottomSize or -0.8) self.ABorderShadow2:SetBackdrop({ edgeFile = "Interface\\Buttons\\WHITE8x8", edgeSize = A.Scale(2), }) self.ABorderShadow2:SetBackdropBorderColor(0, 0, 0, 1) if ButtonOverlay then self.AShadowOverlay = self:CreateTexture(nil, "OVERLAY") self.AShadowOverlay:SetPoint("CENTER", self, 0,0) self.AShadowOverlay:SetWidth(OverlayButtonWidth or 33) self.AShadowOverlay:SetHeight(OverlayButtonHeight or 33) self.AShadowOverlay:SetTexture(C.Media.BorderOverlay) self.AShadowOverlay:SetVertexColor(0, 0, 0, 0.80) end self.HasBorder = true end end A.ColorBorder = function(self, R, G, B) self.ABorder:SetBackdropBorderColor(R, G, B) end A.Skin = function(self) self:SetBackdrop({ bgFile = "Interface\\Buttons\\WHITE8x8", insets = {top = 1, left = 1, bottom = 1, right = 1}, }) self:SetBackdropColor(unpack(C.General.BackdropColor)) A.CreateBorder(self) end A.SkinButton = function(self, SmallerButton) self:SetNormalTexture("") self:SetHighlightTexture("") self:SetPushedTexture("") self:SetDisabledTexture("") if self.Left then self.Left:SetAlpha(0) end if self.Middle then self.Middle:SetAlpha(0) end if self.Right then self.Right:SetAlpha(0) end if self.LeftSeparator then self.LeftSeparator:Hide() end if self.RightSeparator then self.RightSeparator:Hide() end if SmallerButton then A.CreateBorder(self, nil, nil, nil, nil, nil, 1, -1, nil, nil, 0.8, -0.8) self:SetBackdrop({ bgFile = C.Media.Texture2, insets = {top = 2, left = 1, bottom = 2, right = 1}, }) else A.CreateBorder(self) self:SetBackdrop({ bgFile = C.Media.Texture2, insets = {top = 1, left = 1, bottom = 1, right = 1}, }) end self:SetBackdropColor(unpack(C.General.PanelColor)) self:HookScript("OnEnter", function() A.ColorBorder(self, A.ClassColor.r, A.ClassColor.g, A.ClassColor.b) end) self:HookScript("OnLeave", function() A.ColorBorder(self, BorderColor, BorderColor, BorderColor) end) end A.CloseButton = function(self, OffsetX, OffsetY, CloseSize) self:SetSize(CloseSize or 18, CloseSize or 18) self:ClearAllPoints() self:SetPoint("TOPRIGHT", OffsetX or 0, OffsetY or 0) self:SetNormalTexture("") self:SetPushedTexture("") self:SetHighlightTexture("") self:SetDisabledTexture("") self:SetBackdrop({ bgFile = "Interface\\Buttons\\WHITE8x8", insets = {top = 1, left = 1, bottom = 1, right = 1}, }) self:SetBackdropColor(unpack(C.General.BackdropColor)) A.CreateBorder(self) local ACloseButtonFont = self:CreateFontString(nil, "OVERLAY") ACloseButtonFont:SetFont(C.Media.Font, 12.5, "THINOUTLINE") ACloseButtonFont:SetShadowOffset(1, -1) ACloseButtonFont:SetShadowColor(0, 0, 0) ACloseButtonFont:SetPoint("CENTER", 1.5, 1) ACloseButtonFont:SetText("x") self:HookScript("OnEnter", function(self) ACloseButtonFont:SetTextColor(1, 0, 0) A.ColorBorder(self, 1, 0, 0) end) self:HookScript("OnLeave", function(self) ACloseButtonFont:SetTextColor(1, 1, 1) A.ColorBorder(self, BorderColor, BorderColor, BorderColor) end) end
And heres where i've skinned a few objects.
Lua Code:
local A, C, L = select(2, ...):unpack() local ASkin = CreateFrame("Frame", nil, UIParent) ASkin:RegisterEvent("ADDON_LOADED") ASkin:SetScript("OnEvent", function(self, event, AddOn) if AddOn == "AftermathhUI" then -- Frames local Frames = { "GameMenuFrame", "StackSplitFrame", "ReadyCheckFrame", } for i = 1, #Frames do local SkinFrames = _G[Frames[i]] if SkinFrames then A.Skin(SkinFrames) end end -- Buttons local Buttons = { "StackSplitOkayButton", "StackSplitCancelButton", "ReadyCheckFrameYesButton", "ReadyCheckFrameNoButton", } for i = 1, #Buttons do local SkinButtons = _G[Buttons[i]] if SkinButtons then A.SkinButton(SkinButtons) end end local SmallButtons = { "GameMenuButtonHelp", "GameMenuButtonWhatsNew", "GameMenuButtonOptions", "GameMenuButtonUIOptions", "GameMenuButtonKeybindings", "GameMenuButtonMacros", "GameMenuButtonAddons", "GameMenuButtonLogout", "GameMenuButtonQuit", "GameMenuButtonContinue", "GameMenuButtonStore", } for i = 1, #SmallButtons do local SkinSmallButtons = _G[SmallButtons[i]] if SkinSmallButtons then A.SkinButton(SkinSmallButtons, true) end end -- Headers local Headers = { "GameMenuFrame" } for i = 1, #Headers do local Title = _G[Headers[i].."Header"] if Title then Title:SetTexture("") Title:ClearAllPoints() if _G["GameMenuFrameHeader"] then Title:SetPoint("TOP", GameMenuFrame, 0, 7) else Title:SetPoint("TOP", Headers[i], 0, 0) end end end -- ReadyCheck ReadyCheckFrame:HookScript("OnShow", function(self) if UnitIsUnit("player", self.initiator) then self:Hide() end end) select(2, ReadyCheckListenerFrame:GetRegions()):Hide() -- Static Popup for i = 1, 4 do local AStaticFrame = _G["StaticPopup"..i] for k = 1, 3 do A.SkinButton(AStaticFrame["button"..k]) end A.Skin(AStaticFrame) end -- StackSplitFrame StackSplitFrame:GetRegions():Hide() -- QueueStatusFrame Tooltip local AQueueStatusFrame = _G["QueueStatusFrame"] A.StripTexture(AQueueStatusFrame) A.Skin(AQueueStatusFrame) -- GarrisonAlertFrame local AGarrisonMissionAlertFrame = _G["GarrisonMissionAlertFrame"] A.StripTexture(AGarrisonMissionAlertFrame) A.Skin(AGarrisonMissionAlertFrame) local AGarrisonShipMissionAlertFrame = _G["GarrisonShipMissionAlertFrame"] A.StripTexture(AGarrisonShipMissionAlertFrame) A.Skin(AGarrisonShipMissionAlertFrame) -- New RecipeAlertFrame hooksecurefunc(NewRecipeLearnedAlertSystem, "setUpFunction", function(frame, ...) frame:GetRegions():Hide() frame.Icon:SetDrawLayer("OVERLAY", 7) --local IconOverlay = CreateFrame("Frame", nil, frame) --IconOverlay:SetAllPoints(frame.Icon) --A.CreateBorder(IconOverlay, nil, nil, nil, 4, -4, 4, -4, 4.8, -4.8, 4.8, -4.8) A.Skin(frame) end) -- BattlePet Tooltip local AFloatingBattlePetTooltip = _G["FloatingBattlePetTooltip"] AFloatingBattlePetTooltip.BorderRight:Hide() AFloatingBattlePetTooltip.BorderLeft:Hide() AFloatingBattlePetTooltip.BorderBottom:Hide() AFloatingBattlePetTooltip.BorderBottomLeft:Hide() AFloatingBattlePetTooltip.BorderBottomRight:Hide() AFloatingBattlePetTooltip.BorderTop:Hide() AFloatingBattlePetTooltip.BorderTopLeft:Hide() AFloatingBattlePetTooltip.BorderTopRight:Hide() AFloatingBattlePetTooltip.Background:Hide() A.Skin(AFloatingBattlePetTooltip) A.CloseButton(AFloatingBattlePetTooltip.CloseButton, -4, -4, 14) end if AddOn == "TinyDPS" then A.CreateBorder(tdpsFrame) end end)
|