Bug: Lua Error Skinning Base Buttons
kstange opened this issue ยท 16 comments
Game Flavor
Retail
Game Version
10.0.0
Add-On Version
10.0.0
Description
With my addon Masque Blizz Bars, when adding the buttons from the system Action Bars, I get the indicated error. This error goes away if I change the following code:
if SetAllPoints then
Region:SetAllPoints(Anchor or Button)
else
to:
if SetAllPoints then
Region:SetAllPoints(Anchor)
else
I haven't been able to detect any visual differences regardless of this error.
Error Message
Message: Texture:SetAllPoints(): Wrong object type for function
Time: Fri Oct 28 23:21:26 2022
Count: 118
Stack: Texture:SetAllPoints(): Wrong object type for function
[string "=[C]"]: ?
[string "=[C]"]: in function `SetAllPoints'
[string "@Interface/AddOns/Masque/Core/Utility.lua"]:75: in function <Interface/AddOns/Masque/Core/Utility.lua:68>
[string "@Interface/AddOns/Masque/Core/Regions/Texture.lua"]:143: in function <Interface/AddOns/Masque/Core/Regions/Texture.lua:50>
[string "@Interface/AddOns/Masque/Core/Button.lua"]:171: in function <Interface/AddOns/Masque/Core/Button.lua:161>
[string "=[C]"]: in function `UpdateButtonArt'
[string "@Interface/FrameXML/EditModeSystemTemplates.lua"]:664: in function `UpdateButtonArt'
[string "@Interface/FrameXML/EditModeSystemTemplates.lua"]:657: in function `RefreshButtonArt'
[string "@Interface/FrameXML/EditModeSystemTemplates.lua"]:582: in function `UpdateSystem'
[string "@Interface/FrameXML/EditModeManager.lua"]:1021: in function `UpdateSystem'
[string "@Interface/FrameXML/EditModeManager.lua"]:1014: in function `UpdateSystems'
[string "@Interface/FrameXML/EditModeManager.lua"]:888: in function `UpdateLayoutInfo'
[string "@Interface/FrameXML/EditModeManager.lua"]:235: in function <Interface/FrameXML/EditModeManager.lua:232>
Locals:
Steps to Reproduce
No response
Screenshots
No response
Notes
I apologize if trying to skin the Blizzard action bars is something you don't want to support and I'm being a pest! :P
I'm at work so can't really test it, but I'm curious about something. I always had the impression that SetAllPoints
accepted any object as a relative object, including the parent. If that's not the case and passing the parent causes an error, I'll have to adjust my logic for that. Could you try:
if SetAllPoints then
Region:SetAllPoints(Button)
else
and
if SetAllPoints then
Region:SetAllPoints()
else
Actually, this should only occur if the object calling the method or the object being passed as a relative object is invalid. Eg, calling it on or passing a FontObject. Can you test to see the object type of Region
and Button
when the error occurs? It would also help to know which region is being skinned when the error occurs.
@StormFX finally got to dig into this again. From my testing Anchor is (almost) always coming up as nil and Button is not a Frame, so GetObjectType() is not defined. It appears to be a table that looks like this:
Hey, sorry. I'll take a look soon. I haven't gotten to sit down at my PC yet today.
@kstange /poke
Does this mean we will be able to skin the ugly blizzard action bars soon? :O
@GeekAndProud Yes. I already have a working addon, just waiting for Curse to approve it!
Does this mean we will be able to skin the ugly blizzard action bars soon? :O
Looking some more at this, Anchor is sometimes Icon, but it's mostly nil. After this code:
Anchor = (Anchor and Regions) and Regions[Anchor]
If Anchor started as nil, then it remains nil after that. When it's Icon, after this line, Anchor ends up being a table.
Regions (assigned from Button.__Regions) seems to always be a table.
Button is always defined and is always a table.
Further analysis:
In Hook_UpdateButtonArt()
, Button is still a CheckButton. I think what is happening here is SkinTexture()
is getting called with the wrong arguments:
It's called as:
SkinTexture("Pushed", Pushed, Skin.Pushed, Button, Button.__MSQ_PushedColor, GetScale(Button))
However the function defintiion is:
Core.SkinTexture(Layer, Region, Button, Skin, Color, xScale, yScale)
Skin.Pushed and Button should be swapped:
SkinTexture("Pushed", Pushed, Button, Skin.Pushed, Button.__MSQ_PushedColor, GetScale(Button))
After this change, the LUA error is gone.
That makes sense. When testing, I had a similar typo with one of the other functions. I must have spaced off checking UpdateArt
. It'll be fixed in the next build.
@StormFX I noticed in your commit you switched to xScale, yScale parameters instead of getScale(Button) but they are not defined in the scope of the function.
Ah, yep, I see it in commit 92e15c2. Thanks again.