WorldMapFrame Tainting (Not Green Maps)
Good evening everyone,
I have been working on a lightweight AddOn to perform some fairly simple modifications to the WorldMapFrame. I am running into issues with the WorldMapFrame tainting when it is opened in combat. I attempted to code my AddOn in such a way that the map won't be touched until combat is dropped, but it is still tainting. Would you guys look over my code and give me some advice? Lua Code:
Also, the Lua Code:
I am generally at a loss of what to do. The map acts so quirky, and I feel like some of the code is pretty hacked up. Any advice would be most appreciated, as usual. Thanks so much! |
Quote:
You should just be able to call the modifyMap function in the main chunk, instead of that whole do-end block at the end of your code (containing the above) since, again, InCombatLockdown() is never true when non-LoD addons are initially read. Also, upvaluing hooksecurefunc is pointless. The purpose of upvaluing global functions is to speed up access time, but the speed-up is so minute that it's only useful for functions that are potentially called hundreds of times per second inside an OnUpdate handler or COMBAT_LOG_EVENT_UNFILTERED event handler. For a function that you call once or twice during the loading process, the upvalue is just a (granted, minute) waste of disk space and memory. As for the taint problem, I don't really know, but my first guess would be related to the dropdown menu stuff, since the dropdown menu system is basically a house of cards in a dark basement. Try using a secure post-hook instead: Code:
local function dropdownScaleFix(self) Code:
WorldMapContinentDropDownButton:HookScript("OnClick", dropdownScaleFix) |
Thanks a lot for the insight Phanx. I implemented your changes, but I am still getting "Interface action failed because of an AddOn" message when I open the map while in combat.
Here is a link to the TaintLog produced: http://pastebin.com/ExwfJD1g I see the the DropDownMenu is being tainted, but there are also other aspects of the map that are being tainted. As for the DropDownMenu, I am grabbing that directly from Mapster(Thanks Nev <.<), and I don't ever recall Mapster producing any issues -- and further more, how will I make any changes to the map if it just breaks in combat? |
I have seen taint errors from Mapster when opening the map in combat, though it's pretty rare.
Do you get the same errors when your world map addon is the only addon enabled? Other than that, try just doing SetScale and SetAttribute once when you load, instead of every time the map is shown. I'm not sure why you'd need to repeat them. SetAttribute in particular is likely to have issues in combat. |
When I was reading about InCombatLockdown(), it specified that setting frame attributes, and moving frames without a hardware event were protected, so I KNOW that is causing tainting issues.
Setting the WorldMapFrame scale doesn't work on load, it seems to only work on the map's Show method. m_Map, Mapster, and tekMapEnhancer all have the SetScale for the WorldMapFrame OnShow. I think I am going to start fresh, after ~12 hours of looking and staring at it, and constant modifications, I am sure my code is less than optimal. |
Sorry for the double post!
So I have done some work on my map mod, and I've got it producing no taint at all. The only issue I am running into is that to set the scale for the WorldMapFrame, it has to be done OnShow, and to avoid taint, I have to use a combat lockdown function to handle scaling the map OnShow, so if the map is opened in combat, it doesn't taint, but the scale is wrong. Is there any way to set the scale of the map permanently? Even doing: Lua Code:
Code for refrence: Lua Code:
|
Yay three posts in a row =/.
I was able to achieve the desired goal...in a bit of a round-about fashion. I did some investigating as to what would cause the WorldMapFrame's scale to reset to 1 every time it is shown, and I noticed that it doesn't have a parent frame, which I thought was interesting. I tried parenting it to UIParent as a test, and voila, it inherited UIParent's scale. I was able to manage the scale of the frame, without having to hook the OnShow function, by creating my own frame, setting that frame's scale, and parenting the WorldMapFrame to it. I'd like to not have to create my own frame just to handle the scaling, so if anyone has any insight, I'd greatly appreciate it. Thanks so much for the time, help, and effort. |
All times are GMT -6. The time now is 01:15 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI