Quantcast
Trying to skin Blizzard default buff/debuff frames - WoWInterface
Thread Tools Display Modes
03-30-17, 09:32 PM   #1
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Trying to skin Blizzard default buff/debuff frames

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

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".
Attached Files
File Type: zip LayAura.zip (30.6 KB, 38 views)
  Reply With Quote
03-31-17, 05:03 AM   #2
kurapica.igas
A Flamescale Wyrmkin
Join Date: Aug 2011
Posts: 141
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)
  Reply With Quote
03-31-17, 02:08 PM   #3
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
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?
  Reply With Quote
03-31-17, 03:32 PM   #4
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Layback_ View Post
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
  Reply With Quote
03-31-17, 07:10 PM   #5
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Originally Posted by Game92 View Post
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
  Reply With Quote
03-31-17, 09:47 PM   #6
kurapica.igas
A Flamescale Wyrmkin
Join Date: Aug 2011
Posts: 141
Originally Posted by Layback_ View Post
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.

Last edited by kurapica.igas : 03-31-17 at 10:32 PM.
  Reply With Quote
04-01-17, 12:15 AM   #7
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Originally Posted by kurapica.igas View Post
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
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Trying to skin Blizzard default buff/debuff frames

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off