View Single Post
02-26-19, 03:52 AM   #1
Naga'an
A Defias Bandit
Join Date: Feb 2019
Posts: 2
Flipping a default frame

How do I flip the WarlockPowerFrame? Specifically the Demonology power frame. I’ve tried /run WarlockPowerFrame:SetRotation() and /run WarlockPowerFrame:SetTexCoords() with appropriate values but neither work; I always get an error stating SetRotation() or SetTexCoords() are nil values.

I’m trying to flip the power frame upside-down.

With some free time I managed to flip it, but the shards remained unflipped.

https://i.imgur.com/8BhMXTE.jpg

This is what I used:

Code:
local Addon = CreateFrame("Frame")
    Addon:SetScript("OnEvent", function(self, event, ...) return self[event](self, ...) end)
    Addon:RegisterEvent("PLAYER_ENTERING_WORLD")

local function yOffset(Frame, Offset)
    local P = { Frame:GetPoint() }
    Frame:SetPoint(P[1], P[2], P[3], P[4], Offset)
end

-- Inverts texture vertically.
local function yInvertTexture(Texture)
    local Left, Top, _, Bottom, Right = Texture:GetTexCoord()
    Texture:SetTexCoord(Left, Right, Bottom, Top)
end

-- Inverts all child textures of a frame.
local function yInvertAllTextures(Frame)
    for _, Region in pairs({ Frame:GetRegions() }) do
        if Region:IsObjectType("Texture") then yInvertTexture(Region) end
    end
end

function Addon:PLAYER_ENTERING_WORLD()
    yOffset(WarlockPowerFrame, 180)
    yInvertAllTextures(WarlockPowerFrame)
end
Any help would be greatly appreciated.
  Reply With Quote