BackdropTemplate issues

A lot of my addons started tossing lua errors this patch and some may not be updated which means I may have to manually update them. One of the major issues seems to be coming from this change:

SharedTooltipTemplate and GameTooltipTemplate no longer inherit BackdropTemplate

For example in Astral keys, the tooltip frame is currently created this way:

local AstralKeyToolTip = CreateFrame( “GameTooltip”, “AstralKeyToolTip”, AAFrame, “GameTooltipTemplate” )

But as the note says that GameTooltipTemplate no longer inherits BackdropTemplate so all the backdrop functions are now failing. Is there an easy way for me to modify this to reintroduce the BackdropTemplate functionality.

Side note, the AAFrame (the parent class) in that call seems to come from out of nowhere. I searched the whole addon directory and that is the only reference I can find. I install addons manually so it can’t be linking outside to another addon unless this is a blizzard supplied parent class?

Try

local AstralKeyToolTip = CreateFrame( “GameTooltip”, “AstralKeyToolTip”, AAFrame, “BackdropTemplate,GameTooltipTemplate” )

It’s likely the AAFrame was made dynamically based on a concatenated name. It seems very weird it’d use it directly like that. It’s certainly not something in the default UI.

Thanks that fixed astral, so I’ll get to work on messing with the other addons that need it.

Yeah it’s weird for sure. I did a full directory search in vscode on the addon, and that is the only location AAFrame shows up. I’m not versed in LUA enough to have any idea where it originates unless like you said the function just creates it if it doesn’t exist.

Maybe search for “$parentFrame”.

If the addon created a frame named “AA” then a child frame named “$parentFrame” it would produce a frame named AAFrame (the $parent is automatically replaced with the parent frame name).

Thanks! I’ll take a look.

Anyone know why this is failing? This is for TipTac.

local tt = CreateFrame("Frame",modName,UIParent,BackdropTemplateMixin and "BackdropTemplate"); -- 9.0.1: Using BackdropTemplate

I looked at Titan’s fix and they seemed to change theirs by what looks like adding an additional special frame just for the backdrop. This is the code around that if it helps:

local tip_name = frame:GetName()
local tip_back_name = tip_name…“Backdrop”
local tip_back_frame = _G[tip_back_name] or CreateFrame(“Frame”, tip_back_name, frame, BackdropTemplateMixin and “BackdropTemplate” or nil)

Or perhaps the “or nil” part? It’s a bit out of my league so sorry I don’t have better.

1 Like

Do you have the actual error and the line mentioned in it?

It’s unlikely that line in itself is causing an error.

The whole BackdropTemplateMixin and "BackdropTemplate" or nil was a way of writing code that was compatible for both classic and retail, when the backdrop rules were inconsistent between them all.

It’s no longer necessary. Anything that should be a backdrop can just simply inherit "BackdropTemplate" as the fourth argument in CreateFrame.

Here, still trying to fix it:

Message: Interface\AddOns\TipTac\ttCore.lua:730: attempt to call method 'SetBackdropColor' (a nil value)
Time: Wed Nov  3 10:57:02 2021
Count: 2
Stack: Interface\AddOns\TipTac\ttCore.lua:730: attempt to call method 'SetBackdropColor' (a nil value)
[string "=[C]"]: in function `SetBackdropColor'
[string "@Interface\AddOns\TipTac\ttCore.lua"]:730: in function <Interface\AddOns\TipTac\ttCore.lua:717>
[string "=[C]"]: ?

Rather than hunting for the where the frame is created it’s probably easier to just change the line (730 in ttCore.lua) from:

self:SetBackdropColor(unpack(cfg.tipColor));

to

if not self.SetBackdrop then
	Mixin(self, BackdropTemplateMixin)
end
self:SetBackdropColor(unpack(cfg.tipColor));

So it looks like this?

> 	-- Tooltips from world objects that change cursor seems to also require this. (Tested in 8.0/BfA)
> 	if (self:IsOwned(UIParent)) and (not self:GetUnit()) then
> 		if not self.SetBackdrop then
> 			Mixin(self, BackdropTemplateMixin)
> 		end
> 		self:SetBackdropColor(unpack(cfg.tipColor));
> 	end

That should work for that bit of code but there may be other frames that need the same treatment elsewhere. It’s not elegant, just a workaround.

The downside of using an addon that is (seemingly) no longer maintained.

Yeah, the code does work, but the functionality for border colors and backdrop colors is basically broken.

It’s weird that I can’t seem to find another similar tooltip mod.

9.1.5 made some toolip changes beyond just the backdrops I think so this type of thing is not unexpected.

I just want a simple mod with 4 features:

Tooltip on mouse cursor, with customizable offset.
Option to remove tooltip border.
Background color based on interaction.
Show on mouse mouseover.

I should probably just try to make one.

Any tooltip addon not yet updated for 9.1.5 is likely going to have Backdrop issues.