WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Creating aura errors '/fstack' command (https://www.wowinterface.com/forums/showthread.php?t=54055)

Layback_ 07-28-16 08:25 PM

Creating aura errors '/fstack' command
 
Before I start, if I am violating any rules of this forum, please let me know!
( Why is there no delete button on forum D: )

Anyways...

I was creating a auras frame and just copy-pasted the example code provided inside aura.lua file to see how it looks like.

Lua Code:
  1. A.CreateBuffs = function(f, unit)
  2.     local Buffs = CreateFrame("Frame", "$parentBuffs", f);
  3.     Buffs:SetPoint("RIGHT", f, "LEFT");
  4.     Buffs:SetSize(16 * 2, 16 * 16);
  5.  
  6.     f.Buffs = Buffs;
  7. end

After that, I used '/fstack' command which passed me the following error.

Lua Code:
  1. Message: invalid key to 'next'
  2. Time: 07/28/16 19:29:53
  3. Count: 1
  4. Stack: [C]: in function `SetFrameStack'
  5. ...e\AddOns\Blizzard_DebugTools\Blizzard_DebugTools.lua:715: in function `FrameStackTooltip_Toggle'
  6. Interface\FrameXML\ChatFrame.lua:2293: in function `?'
  7. Interface\FrameXML\ChatFrame.lua:4332: in function `ChatEdit_ParseText'
  8. Interface\FrameXML\ChatFrame.lua:4000: in function `ChatEdit_SendText'
  9. Interface\FrameXML\ChatFrame.lua:2631: in function <Interface\FrameXML\ChatFrame.lua:2624>
  10. [C]: in function `UseAction'
  11. Interface\FrameXML\SecureTemplates.lua:348: in function `handler'
  12. Interface\FrameXML\SecureTemplates.lua:621: in function `SecureActionButton_OnClick'
  13. Interface\FrameXML\MultiActionBars.lua:24: in function `MultiActionButtonUp'
  14. [string "MULTIACTIONBAR3BUTTON5"]:4: in function <[string "MULTIACTIONBAR3BUTTON5"]:1>

I honestly can't even think of what is causing this error :(...

Does anyone know what is going wrong with this?

lightspark 07-28-16 09:24 PM

Ugh, that's an old bug in aura.lua, I forgot about it, cuz I never use default aura button constructor.

Default oUF aura buttons and few other frames have no names assigned, and it causes /fstack errors.

For now just do not use default constructor. You'll have to create your own create button function, you can pretty much copy-paste existing one, and add names to all frames. And then override it this way:

Lua Code:
  1. local function CreateAuraIcon(frame, index)
  2.     -- code here
  3. end
  4.  
  5. f.Buffs.CreateIcon = CreateAuraIcon

Layback_ 07-28-16 11:06 PM

Quote:

Originally Posted by lightspark (Post 317157)
Ugh, that's an old bug in aura.lua, I forgot about it, cuz I never use default aura button constructor.

Default oUF aura buttons and few other frames have no names assigned, and it causes /fstack errors.

For now just do not use default constructor. You'll have to create your own create button function, you can pretty much copy-paste existing one, and add names to all frames. And then override it this way:

Lua Code:
  1. local function CreateAuraIcon(frame, index)
  2.     -- code here
  3. end
  4.  
  5. f.Buffs.CreateIcon = CreateAuraIcon

Hi lightspark,

Creating a custom constructor worked :D!!

EDIT: I just have been editing the constructor and this is how it looks like now.

Lua Code:
  1. A.AuraCreateIcon = function(f, index)
  2.     local button = CreateFrame("Button", f:GetName() .. index, f);
  3.     button:SetSize(buffSize, buffSize);
  4.     button:RegisterForClicks("RightButtonUp");
  5.  
  6.     local cd = CreateFrame("Cooldown", button:GetName() .. "CoolDown", button, "CooldownFrameTemplate");
  7.     cd:SetPoint("CENTER");
  8.     cd:SetSize(button:GetWidth() - 2, button:GetHeight() - 2);
  9.  
  10.     local icon = button:CreateTexture(nil, "BORDER");
  11.     icon:SetTexCoord(.1, .9, .1, .9);
  12.     icon:SetPoint("CENTER");
  13.     icon:SetSize(button:GetWidth() - 2, button:GetHeight() - 2);
  14.  
  15.     E.A.CreateEightBorders(icon, button, "Border", BACKDROP, {1, 0, 0, 1});
  16.  
  17.     local count = button:CreateFontString(nil, "OVERLAY");
  18.     count:SetFontObject(NumberFontNormal);
  19.     count:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 0);
  20.  
  21.     local overlay = button:CreateTexture(nil, "OVERLAY");
  22.     overlay:SetTexture("Interface\\Buttons\\UI-Debuff-Overlays");
  23.     overlay:SetAllPoints(button);
  24.     overlay:SetTexCoord(.296875, .5703125, 0, .515625);
  25.     button.overlay = overlay;
  26.  
  27.     local stealable = button:CreateTexture(nil, "OVERLAY");
  28.     stealable:SetTexture("Interface\TargetingFrame\UI-TargetingFrame-Stealable");
  29.     stealable:SetPoint("TOPLEFT", -3, 3);
  30.     stealable:SetPoint("BOTTOMRIGHT", 3, -3);
  31.     stealable:SetBlendMode("ADD");
  32.     button.stealable = stealable;
  33.  
  34.     button.UpdateTooltip = UpdateTooltip;
  35.     button:SetScript("OnEnter", OnEnter);
  36.     button:SetScript("OnLeave", OnLeave);
  37.  
  38.     button.icon = icon;
  39.     button.count = count;
  40.     button.cd = cd;
  41.  
  42.     --[[ :PostCreateIcon(button)
  43.  
  44.      Callback which is called after a new aura icon button has been created.
  45.  
  46.      Arguments
  47.  
  48.      button - The newly created aura icon button.
  49.      ]]
  50.  
  51.     if (f.PostCreateIcon) then
  52.         f:PostCreateIcon(button);
  53.     end
  54.  
  55.     return button;
  56. end

The icon's width and height had successfully decreased by 2, but cd's size did not decrease which I don't get why...

I've checked aura.lua file and there was no such function modifies cd's size...

Could I get some advice on this as well?

Thank you!

Layback_ 07-31-16 03:29 AM

Would it be possible to set number of buffs per each line?
 
So! After I've done some edit, aura element seems to be working pretty good and I'm really happy with current result :D

Thanks to lightspark!

The one problem that I'm currently having is that the number of buffs actually exceeds the size of buffs frame.

What I mean by is the following:



Each buff size is set to 20x20 with 2 pixels spacing between two buffs while the buffs frame is set to the size of 100x100. So, the fifth buff will exceed by 8 pixels.

Should I set the size of buffs frame by manually to prevent this? Or is there any options to set number of buffs per row?

lightspark 07-31-16 03:54 AM

Quote:

Originally Posted by Layback_ (Post 317237)
Each buff size is set to 20x20 with 2 pixels spacing between two buffs while the buffs frame is set to the size of 100x100. So, the fifth buff will exceed by 8 pixels.

20px * 5 + 2px * 4 = 108px :D

Once again, to understand why you have this issue, please, read oUF code.

That's how number of columns (auras per row) is calculated, it rounds the value, so in your case floor(100 / 22 + 0.5) = 5.

Layback_ 07-31-16 04:16 AM

Quote:

Originally Posted by lightspark (Post 317238)
20px * 5 + 2px * 4 = 108px :D

Once again, to understand why you have this issue, please, read oUF code.

That's how number of columns (auras per row) is calculated, it rounds the value, so in your case floor(100 / 22 + 0.5) = 5.

Damn.... I should definitely go see oculist soon.

How could've I missed that...

Thanks for letting me know :D!!!


All times are GMT -6. The time now is 06:20 AM.

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