BuffOverlay

BuffOverlay

366k Downloads

Fix for the AshToAsh

kurapica opened this issue ยท 3 comments

commented

Description

Just found your addon, happy to see it provide the support to the AshToAsh, and with a special fix :).

I thought you can simple that by change the AshToAsh setting to

    ["AshToAsh"] = {
        {
            frame = "^AshToAshUnit%d+Unit%d+",
            type = "raid",
            unit = "unit",
        },
        {
            frame = "^AshToAshPet%d+Unit%d+",
            type = "raid",
            unit = "unit",
        },
        {
            frame = "^AshToAshUnitWatch%d+Unit%d+",
            type = "raid",
            unit = "unit",
        },
    },

There are three panel type in ATA, so the unit frame name has three patterns.

Then you don't need to check the AshToAshUnit%dShadowGroupHeaderUnitButton since ATA will create unit frames dynamicly, and check the shadow group header won't be able to catch them all.

Screenshots

No response

commented

The main issue is that BO obtains frames by hooking CreateFrame and matching any found frames to the patterns shown. ATA is using something different for its frame creation IIRC (reusing from a pool? I don't remember exactly). There's actually no active search for frames in BO, so the dynamic nature of ATA not using CreateFrame makes it challenging to find the frame references without searching every time the group changes.

Could you give me a bit more info in how ATA handles its frames? I'd be happy to try and get a more robust fix :)

commented

Interesting, seems the secure hook on CreateFrame can't track the UI generated by Scorpio. I use private environment as modules affect that. So I can only do that with the Scorpio's style system.

You can remove the fix for AshToAsh in addonFrameInfo and cleanFrameCache, just add a fix in AddOnsExist like

local function AddOnsExist()
    local addonsExist = false
    for addon, info in pairs(addonFrameInfo) do
        if IsAddOnLoaded(addon) then
            for _, frameInfo in pairs(info) do
                enabledPatterns[frameInfo.frame] = { unit = frameInfo.unit, type = frameInfo.type }
            end

            if not addonsExist then
                addonsExist = true
            end

            -- Fix for ElvUI Party Pet Frames. They are not in the frame cache due
            -- to the way ElvUI creates them. This is unique to party pets, thankfully.
            if addon == "ElvUI" then
                for i = 1, 5 do
                    framesToFind["ElvUF_PartyGroup1UnitButton" .. i .. "Pet"] = "unit"
                end
            end
        end
    end

    -- Fix for AshToAsh
    if IsAddOnLoaded("AshToAsh") then
        -- Declare an ui style property to receive the unit from the unit frame
        Scorpio.UI.Property {
            name            = "BuffOverlayUnit",
            require         = Scorpio.Secure.UnitFrame,
            nilable         = true,
            set             = function(self, unit)
                print("[Unit]" .. self:GetName() .. " To " .. (unit or "clear"))

                if unit and unit ~= "clear" then
                    BuffOverlay:AddUnitFrame(Scorpio.UI.GetRawUI(self), unit)
                end
            end,
        }

        -- Add the property to the base unit frame class's default skin
        -- So all unit frame generated from Scorpio will use that
        Scorpio.UI.Style.UpdateSkin("Default", {
            [Scorpio.Secure.UnitFrame] = {
                -- Scorpio.Wow.Unit() is an observable data source
                -- provide the unit from the unit frame
                BuffOverlayUnit = Scorpio.Wow.Unit()
            }
        }, true)
    end

    addOnsExist = addonsExist
    BuffOverlay.addons = addonsExist
    return addonsExist
end

I test it, should works now.

commented

Interesting, seems the secure hook on CreateFrame can't track the UI generated by Scorpio. I use private environment as modules affect that. So I can only do that with the Scorpio's style system.

Yeah, this is what I remember seeing when I first tested with ATA. I never did dive in to figure out why though. I'll look over your changes soon when I have some more time, but at a glance it all looks good.