WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Trying to skin Blizzard default buff/debuff frames (https://www.wowinterface.com/forums/showthread.php?t=55280)

Layback_ 03-30-17 09:32 PM

Trying to skin Blizzard default buff/debuff frames
 
1 Attachment(s)
Hi all,

I am currently trying to re-skin Blizzard default buff/debuff frames, but it shows kind of weird result.

Sometimes the newly created (template) frame covers the buff/debuff icons while sometimes it doesn't.

I'm guessing that it's happening because of my :SetTemplate function, but ain't sure where the actual problems are occurring since it happens so randomly :confused:

Here I have attached .zip file, so you can have a look.

Thank you!

EDIT: temporarily fixed it by setting icon's draw layer to "OVERLAY".

kurapica.igas 03-31-17 05:03 AM

It's better to use hooksecurefunc, there are two parts :

Hook the BuffButton_OnLoad, so you'll apply your skin to every aura button, you also need to hook each button's SetTexture method, so when blz set texture to those buttons, you can do the cut job :

Code:

hooksecurefunc("BuffButton_OnLoad", function(self)
    -- the self is aura button
    hooksecurefunc(self, "SetTexture", function(self, path)
        if path then
                -- Cut the icon
                self:SetTexCoord(0.06, 0.94, 0.06, 0.94)
        end
    end)

    -- do other skin job
end)


Layback_ 03-31-17 02:08 PM

Hi kurapica.iga,

Thank you for your advice :)

What about the borders for debuffs?

As you know some debuffs have a different border colors based on their types (like red or blue).

Would this be considered on BuffButton_OnLoad or SetTexture functions?

Aftermathhqt 03-31-17 03:32 PM

Quote:

Originally Posted by Layback_ (Post 322744)
Hi kurapica.iga,

Thank you for your advice :)

What about the borders for debuffs?

As you know some debuffs have a different border colors based on their types (like red or blue).

Would this be considered on BuffButton_OnLoad or SetTexture functions?


I would do this :)

Lua Code:
  1. function SkinDebuff()
  2.     local button, icon;
  3.     for i = LayAura.debuffs + 1, DEBUFF_ACTUAL_DISPLAY do
  4.         button = _G["DebuffButton" .. i];
  5.         icon = _G["DebuffButton" .. i .. "Icon"];
  6.        
  7.         local Border = _G[button .. "Border"]
  8.         if (Border) then
  9.             Border:SetTexture(nil)
  10.             Border:Hide()
  11.        
  12.             local R, G, B = Border:GetVertexColor()
  13.             button:SetColorHere
  14.         end
  15.  
  16.         CutOffEdges(icon);
  17.         SetTemplate(button);
  18.     end
  19.  
  20.     LayAura.debuffs = DEBUFF_ACTUAL_DISPLAY;
  21. end

Layback_ 03-31-17 07:10 PM

Quote:

Originally Posted by Game92 (Post 322747)
I would do this :)

Lua Code:
  1. function SkinDebuff()
  2.     local button, icon;
  3.     for i = LayAura.debuffs + 1, DEBUFF_ACTUAL_DISPLAY do
  4.         button = _G["DebuffButton" .. i];
  5.         icon = _G["DebuffButton" .. i .. "Icon"];
  6.        
  7.         local Border = _G[button .. "Border"]
  8.         if (Border) then
  9.             Border:SetTexture(nil)
  10.             Border:Hide()
  11.        
  12.             local R, G, B = Border:GetVertexColor()
  13.             button:SetColorHere
  14.         end
  15.  
  16.         CutOffEdges(icon);
  17.         SetTemplate(button);
  18.     end
  19.  
  20.     LayAura.debuffs = DEBUFF_ACTUAL_DISPLAY;
  21. end

Yeap, that's how I've done it at the moment, but was not added into attachment :)

kurapica.igas 03-31-17 09:47 PM

Quote:

Originally Posted by Layback_ (Post 322744)
Hi kurapica.iga,

Thank you for your advice :)

What about the borders for debuffs?

As you know some debuffs have a different border colors based on their types (like red or blue).

Would this be considered on BuffButton_OnLoad or SetTexture functions?

Well, I make some problem, write it again :
Lua Code:
  1. local original_SetVertexColor   -- Keep a copy so it won't trigger the hook again
  2.  
  3. hooksecurefunc("BuffButton_OnLoad", function(self)
  4.     -- the self is aura button
  5.  
  6.     -- For cut icon
  7.     local icon = _G[self:GetName() .. "Icon"]  -- miss this
  8.     hooksecurefunc(icon, "SetTexture", function(self, path)
  9.         if path then
  10.             -- Cut the icon
  11.             self:SetTexCoord(0.06, 0.94, 0.06, 0.94)
  12.         end
  13.     end)
  14.  
  15.     -- For the debuff border color
  16.     local debuffSlot = _G[self:GetName().."Border"]
  17.     if not original_SetVertexColor then original_SetVertexColor = debuffSlot.SetVertexColor end
  18.  
  19.     hooksecurefunc(debuffSlot, "SetVertexColor", function(self, r, g, b)
  20.         -- You can only use original_SetVertexColor  to change border color
  21.         -- debuffSlot:SetVertexColor(1, 0, 0)  wrong, it'll cause Infinite loop
  22.         original_SetVertexColor(debuffSlot, 1, 0, 0)   -- that's okay
  23.     end)
  24.  
  25.     -- do other skin job
  26. end)

Don't try to replace the methods directly, it'll cause taint error.

Layback_ 04-01-17 12:15 AM

Quote:

Originally Posted by kurapica.igas (Post 322754)
Well, I make some problem, write it again :

...

Don't try to replace the methods directly, it'll cause taint error.

Sweet!

Thanks for the workaround :)


All times are GMT -6. The time now is 08:53 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI