Bartender4

Bartender4

70M Downloads

[10.x] Spell Flyouts are broken in pre-patch

ashemedai opened this issue ยท 11 comments

commented

With no addons enabled, I can click on the Rogue's Poisons button on the action bar without problem and get a vertical expansion of the poisons available to my character.

Enable only the Bartender4 addon, click button and get this Lua Error:

Message: Interface/FrameXML/SpellFlyout.lua:240: attempt to call method 'GetSpellFlyoutDirection' (a nil value)
Time: Wed Oct 26 13:31:59 2022
Count: 1
Stack: Interface/FrameXML/SpellFlyout.lua:240: attempt to call method 'GetSpellFlyoutDirection' (a nil value)
[string "=[C]"]: ?
[string "=[C]"]: ?
[string "@Interface/FrameXML/SecureHandlers.lua"]:40: in function <Interface/FrameXML/SecureHandlers.lua:39>
[string "@Interface/FrameXML/SecureHandlers.lua"]:268: in function <Interface/FrameXML/SecureHandlers.lua:263>
[string "=[C]"]: ?
[string "@Interface/FrameXML/SecureHandlers.lua"]:296: in function <Interface/FrameXML/SecureHandlers.lua:279>
[string "=(tail call)"]: ?

Locals: <none>

If I open the spellbook and click the same button, it works as it should.

commented

Alright, figured it would be on Blizzard's side due to the trace, but the fact it only happened with BT4 enabled made me doubt.
Do you want to keep this open to track it (and avoid others spamming the same error?) or close it?

commented

Blizzard broke flyout buttons for addons. Unfortunately there is nothing to do until they fix it.

commented

Will leave it open to direct other people here.

commented

Perhaps my way of thinking wouldnt work or isnt possible but logically at least it would seem to work around this particular issue in the short term and provide a basis for the same for anything else that may happen in the future. That being said, wouldn't it be better to change the behavior of the addon so that instead of automatically overriding the default functionality as soon the addon is loaded the user has to select which components to enable (or can choose which to disable) as well as which to display or hid in the config option for each component. For example action bar 1, instead of the singular enable check box that changes if it is displayed. the enable would control if addon or default bar is enabled and then a new hide box that determines if the bar is displayed or hidden.

commented

Hello, by changing the name of the function in the ActionBar.lua file at line 343:
GetFlyoutDirection -> GetSpellFlyoutDirection.
It displays the Flyouts but if I click on a spell, I get a popup that says Bartender4 has been blocked from an action only available to the Blizzard UI

I'm still researching a bit but it's been so long since I've done any programming that i'm struggling.

commented

Be assured that if there was a simple solution, it would already have been done. Its not possible to use this right now, other then fully re-creating the functionality, which would be an immense effort for something Blizzard could fix within minutes.

If there is no indication of this getting fixed by the time DF actually launches, I might actually work on a replacement function, but alas the prepatch is a time where we all have to prioritize and adapt to Blizzard issues.

commented

Since this issue came up I started using OPie for any flyout abilities and it's now one of my favorite addons.

commented

If you have it, you can compare the 9.2.7 patch version of Blizzard's Interface/FrameXML/SpellFlyout.lua to the 10.0.0 version and relatively quicky locate the major changes that impact the way this is handled. To be more specific 30 lines of code were added.

Here an example that looks directly at the code behind one of the relevant errors.
Message: Interface/FrameXML/SpellFlyout.lua:240: attempt to call method 'GetSpellFlyoutDirection' (a nil value)

This block of code was added at line 238.

	-- If you're on an action bar then base your direction on the action bar's orientation and position
	if (isActionBar) then
		direction = actionBar:GetSpellFlyoutDirection();
	end
The other changes I saw for SpellFlyout.lua are below but I suppose I could have missed one of two and/or had a copy paste error. And of course, I am by no stretch of the imagination a coder. But I do appreciate those of you that are.

Line 4
Previous

	local SPELLFLYOUT_FINAL_SPACING = 4;

Current

	local SPELLFLYOUT_FINAL_SPACING = 9;

Line 51
Previous

	if (not self:GetParent().isActionBar or LOCK_ACTIONBAR ~= "1" or IsModifiedClick("PICKUPACTION")) then

Current

	if (not self:GetParent().isActionBar or not Settings.GetValue("lockActionBars") or IsModifiedClick("PICKUPACTION")) then

line 149 added

	self.SetBorderSize = SpellFlyout_SetBorderSize;

Line 327 changed to 333 and 334
Previous

	self.BgEnd:ClearAllPoints();

Current Lines 333 & 334

	self.Background.End:ClearAllPoints();
	self.Background.Start:ClearAllPoints();

Lines 329 - 336 changed to 336 - 346
Previous

		self:SetPoint("BOTTOM", parent, "TOP", 0, 0);
		self.BgEnd:SetPoint("TOP");
		SetClampedTextureRotation(self.BgEnd, 0);
		self.HorizBg:Hide();
		self.VertBg:Show();
		self.VertBg:ClearAllPoints();
		self.VertBg:SetPoint("TOP", self.BgEnd, "BOTTOM");
		self.VertBg:SetPoint("BOTTOM", 0, distance);

Current

		self:SetPoint("BOTTOM", parent, "TOP");
		self.Background.End:SetPoint("TOP", 0, SPELLFLYOUT_INITIAL_SPACING);
		SetClampedTextureRotation(self.Background.End, 0);
		SetClampedTextureRotation(self.Background.VerticalMiddle, 0);
		self.Background.Start:SetPoint("TOP", self.Background.VerticalMiddle, "BOTTOM");
		SetClampedTextureRotation(self.Background.Start, 0);
		self.Background.HorizontalMiddle:Hide();
		self.Background.VerticalMiddle:Show();
		self.Background.VerticalMiddle:ClearAllPoints();
		self.Background.VerticalMiddle:SetPoint("TOP", self.Background.End, "BOTTOM");
		self.Background.VerticalMiddle:SetPoint("BOTTOM", 0, distance);

Lines 338 - 345 changed to 348 - 358
Previous

		self:SetPoint("TOP", parent, "BOTTOM", 0, 0);
		self.BgEnd:SetPoint("BOTTOM");
		SetClampedTextureRotation(self.BgEnd, 180);
		self.HorizBg:Hide();
		self.VertBg:Show();
		self.VertBg:ClearAllPoints();
		self.VertBg:SetPoint("BOTTOM", self.BgEnd, "TOP");
		self.VertBg:SetPoint("TOP", 0, -distance);

Current

		self:SetPoint("TOP", parent, "BOTTOM");
		self.Background.End:SetPoint("BOTTOM", 0, -SPELLFLYOUT_INITIAL_SPACING);
		SetClampedTextureRotation(self.Background.End, 180);
		SetClampedTextureRotation(self.Background.VerticalMiddle, 180);
		self.Background.Start:SetPoint("BOTTOM", self.Background.VerticalMiddle, "TOP");
		SetClampedTextureRotation(self.Background.Start, 180);
		self.Background.HorizontalMiddle:Hide();
		self.Background.VerticalMiddle:Show();
		self.Background.VerticalMiddle:ClearAllPoints();
		self.Background.VerticalMiddle:SetPoint("BOTTOM", self.Background.End, "TOP");
		self.Background.VerticalMiddle:SetPoint("TOP", 0, -distance);

Lines 347 - 354 changed to 360 - 370
Previous

		self:SetPoint("RIGHT", parent, "LEFT", 0, 0);
		self.BgEnd:SetPoint("LEFT");
		SetClampedTextureRotation(self.BgEnd, 270);
		self.VertBg:Hide();
		self.HorizBg:Show();
		self.HorizBg:ClearAllPoints();
		self.HorizBg:SetPoint("LEFT", self.BgEnd, "RIGHT");
		self.HorizBg:SetPoint("RIGHT", -distance, 0);

Current

		self:SetPoint("RIGHT", parent, "LEFT");
		self.Background.End:SetPoint("LEFT", -SPELLFLYOUT_INITIAL_SPACING, 0);
		SetClampedTextureRotation(self.Background.End, 270);
		SetClampedTextureRotation(self.Background.HorizontalMiddle, 180);
		self.Background.Start:SetPoint("LEFT", self.Background.HorizontalMiddle, "RIGHT");
		SetClampedTextureRotation(self.Background.Start, 270);
		self.Background.VerticalMiddle:Hide();
		self.Background.HorizontalMiddle:Show();
		self.Background.HorizontalMiddle:ClearAllPoints();
		self.Background.HorizontalMiddle:SetPoint("LEFT", self.Background.End, "RIGHT");
		self.Background.HorizontalMiddle:SetPoint("RIGHT", -distance, 0);

Lines 356 - 363 changed to 372 - 382
Previous

		self:SetPoint("LEFT", parent, "RIGHT", 0, 0);
		self.BgEnd:SetPoint("RIGHT");
		SetClampedTextureRotation(self.BgEnd, 90);
		self.VertBg:Hide();
		self.HorizBg:Show();
		self.HorizBg:ClearAllPoints();
		self.HorizBg:SetPoint("RIGHT", self.BgEnd, "LEFT");
		self.HorizBg:SetPoint("LEFT", distance, 0);

Current

		self:SetPoint("LEFT", parent, "RIGHT");
		self.Background.End:SetPoint("RIGHT", SPELLFLYOUT_INITIAL_SPACING, 0);
		SetClampedTextureRotation(self.Background.End, 90);
		SetClampedTextureRotation(self.Background.HorizontalMiddle, 0);
		self.Background.Start:SetPoint("RIGHT", self.Background.HorizontalMiddle, "LEFT");
		SetClampedTextureRotation(self.Background.Start, 90);
		self.Background.VerticalMiddle:Hide();
		self.Background.HorizontalMiddle:Show();
		self.Background.HorizontalMiddle:ClearAllPoints();
		self.Background.HorizontalMiddle:SetPoint("RIGHT", self.Background.End, "LEFT");
		self.Background.HorizontalMiddle:SetPoint("LEFT", distance, 0);

Lines 366 - 372 Replaced with 385 - 387
Previous

	if (direction == "UP" or direction == "DOWN") then
		self:SetWidth(prevButton:GetWidth());
		self:SetHeight((prevButton:GetHeight()+SPELLFLYOUT_DEFAULT_SPACING) * numButtons - SPELLFLYOUT_DEFAULT_SPACING + SPELLFLYOUT_INITIAL_SPACING + SPELLFLYOUT_FINAL_SPACING);
	else
		self:SetHeight(prevButton:GetHeight());
		self:SetWidth((prevButton:GetWidth()+SPELLFLYOUT_DEFAULT_SPACING) * numButtons - SPELLFLYOUT_DEFAULT_SPACING + SPELLFLYOUT_INITIAL_SPACING + SPELLFLYOUT_FINAL_SPACING);
	end

Current

	self:Layout();

	self.direction = direction;

Added 394

	self:SetBorderSize(47);

Lines 396 changed to 411
Previous

		ActionButton_UpdateFlyout(self:GetParent());

Current

		self:GetParent():UpdateFlyout();

Lines 421 - 423 Replaced with 436 - 453
Previous

	self.HorizBg:SetVertexColor(r, g, b);
	self.VertBg:SetVertexColor(r, g, b);
	self.BgEnd:SetVertexColor(r, g, b);

Current

	self.Background.Start:SetVertexColor(r, g, b);
	self.Background.HorizontalMiddle:SetVertexColor(r, g, b);
	self.Background.VerticalMiddle:SetVertexColor(r, g, b);
	self.Background.End:SetVertexColor(r, g, b);
end

function SpellFlyout_SetBorderSize(self, size)
	if (not self.direction or self.direction == "UP" or self.direction == "DOWN") then
		self.Background.Start:SetWidth(size);
		self.Background.HorizontalMiddle:SetWidth(size);
		self.Background.VerticalMiddle:SetWidth(size);
		self.Background.End:SetWidth(size);
	else
		self.Background.Start:SetHeight(size);
		self.Background.HorizontalMiddle:SetHeight(size);
		self.Background.VerticalMiddle:SetHeight(size);
		self.Background.End:SetHeight(size);
	end
commented

Quick and very dirty fix.

Bar.lua line 9.
Change:

local Bar = CreateFrame("Frame")

To:

local Bar = CreateFrame("Frame", nil, nil, ActionBarMixin and "ActionBarTemplate")

Immediately throws

FrameXML/ActionBar.lua:127: attempt to perform arithmetic on field 'numRows' (a nil value)
FrameXML/ActionBar.lua:12: 'for' limit must be a number

But otherwise seems to work.

commented

Even with that fix and displayed errors, the flyout only goes to the left. Better than nothing but annoying, when it goes over other buttons and is hard to see. Hopefully Bliz fixes it and doesn't ignore it. It has been quite a while in the beta that this bug exists and still no sign of acknowledgement of it.

commented

This should now be fixed by having an entirely custom flyout independent of the Blizzard function.