Tooltip hook stopped working in latest patch?
Is anyone aware of any changes in how tooltip hooking works in yesterday's DragonFlight patch (2022-10-04, patch 45969)? One of my addons that adds a few lines to item tooltips has unexpecetdly stopped working (it worked in earlier dragonflight beta patches). Has there been a change? Or alternatively, can anyone show a minimalistic example of addon code that adds a line to an item tooltip?
|
Tooltips have been reworked with C_TooltipInfo but, from what I've read so far, if your tooltip uses "GameTooltipTemplate" instead of "SharedTooltipTemplate" you should be (mostly) OK... for the time being.
The info hasn't been added to WowPedia yet which is understandable being new and all. |
Thanks for the info! I am not creating my own tooltip though, but adding extra lines to the system "GameTooltip" (and a few related ones), using code similar to this to hook in my code:
Lua Code:
What I observe is that my "MyTooltipAddon:ProcessTip" method is no longer being called at all since this patch. The hooking code in the PLAYER_LOGIN event handler is called, and no errors are raised there, but the hooks are just never called, as if HookScript silently no longer does anything anymore. |
I've found OnTooltipSetItem is not being called for GameTooltip as I'd expect. GameTooltip's SetCurrencyToken continues to work as expected. Unfortunately I've not had time to look into this more beyond acknowledging that was a problem. Looks like you use that too.
|
As per Gello's response... 10.0 PTR has OnTooltipSetItem exists but on 10.0 Beta it doesn't in the ItemRef.xml file.
|
Presumably the PTR will get the Beta code at some stage before launch, but as it's new there maybe more things to come to match the differences between the two for at least a period before full deprecation.
|
Yeah, there are definitely things in flux .. Container file also has differences between PTR and Beta. So I have had to withhold any changes there as I can't fully test it yet. The Container changes are kicking up errors with nUI but not pointing to which line in nUI is causing the problem. So could be a regular error rather than an addon error .. or .. similar to the options and editmode changes, they just don't like addons interfering with frames they want to work with :chuckle:
|
Quote:
|
It means there's more to "unpack" from the latest changes and possibly more changes to come... must be getting close to launch ;)
|
Quote:
Edit: Well the update finally kicked in just now. But PTR servers are still down. |
Lua Code:
I'm looking into this, too because of my items addon. I can change the tooltip and add a line. With hooksecure my function is called multiple times a second and the line is added 1-3 times for a tooltip (3 times when I hover over one of the bags in the bagbar, 2 times mostly for items). With HookScript its called only once but the tooltip is changed back after my line shows up for a split second. Not so promising ;) I really hope someone has a good guide how this is meant to work in the future :) |
Docs have been updated.
|
is the pre patch using a old version of wow compared to the beta?
Retail Pre-Patch: 46313 Current Beta: 46259 Seems many of the old Tooltip handlers are still used whereas the new ones suggested for beta dont work So just ended up doing this: Code:
if TooltipDataProcessor then |
Is there still a way to do a pre-hook on what used to be OnTooltipSetItem?
I want to operate on the tooltip of items before any other addons added their lines to it. Before 10.0.2 I executed this code (a few seconds after login, to make sure that all other addons have already registered): Lua Code:
How could the same effect be achieved with the new TooltipDataProcessor? |
Quote:
|
Other addons can also register with that function and there's no guarantee that your code would run first. Nor is there a way to force it without causing taint, which is more of an issue now that the new TooltipDataHandler is capable of handling secure code.
|
That's true. Thanks for pointing it out. :)
In fact, it seems that the registered functions are executed in the order they have been registered. So it is not possible to make sure you are first by waiting with the registration. Lua Code:
Printed result is: Registered first. Registered after 3 seconds. Registered after 5 seconds. |
Quote:
|
I have a similar problem in nUI now that I have reinstated its action bars back to service.
nUI adds Keybinding info to the action button tooltip which of course no longer displays permanently due to the tooltip changes I presume. Now, looking at your findings I tried to do something similar but it has gone belly up. In PLAYER_LOGIN I have the following block of code - amongst other code Lua Code:
It worked fine before Dragonflight but now inside OnEnter it briefly shows but then disappears, and outside OnEnter it shows a ton of lines running down the screen. Instead of the 1-4 I am expecting per button. Anyone have any ideas on how I would get it working like before ? Thanks in advance. edit: I also tried creating my own tooltip as follows: local tooltip = CreateFrame("GameTooltip",nil,button,"GameTooltipTemplate") And using this instead of GameTooltip but no difference. |
The problem with registering with TooltipDataProcessor.AddTooltipPostCall() is it's a global register. This means it'll call the function every time anything wishes to display a spell's tooltip. Not just the individual button you're working with.
For example, someone mouseovers a spell in their spellbook and every instance of that function for every button you've created will run sequentially for that single tooltip. I wouldn't suggest this approach as it would impact performance if everyone would start doing it this way, but here's an attempt to fix your code example. Lua Code:
As noted earlier, TooltipDataProcessor.AddTooltipPostCall() is a global register, so I reduced its handler to a single function. I registered it with the TooltipDataProcessor.AllTypes enum, which is a special flag that tells the processor to call the handler for every tooltip type. The handler is called with the tooltip being processed and its associated raw data table. We can query its owner with :GetOwner() and check if it's one of our buttons. If it is, we can proceed with posting its keybind info. |
All times are GMT -6. The time now is 11:48 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI