Thread Tools Display Modes
Prev Previous Post   Next Post Next
09-27-12, 12:06 PM   #1
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
FrameLocks.lua and target taint

So i have a taint issue. After going into a pet battle my target frame becomes tainted and any time i change targets in combat after a petbattle it fires taint errors. The problem is with the new FrameLocks.lua

my code hides and locks out the original bliz targetframe. This new framelocks.lua does this...
Lua Code:
  1. ----------Local helper functions---------------
  2. local function initiateFrame(frame)
  3.     local frameName = frame:GetName();
  4.     if ( not frameName or frameName == "" ) then
  5.         GMError("Frames controlled by FrameLocks must have names.");
  6.     end
  7.  
  8.     if ( BASE_STATES[frameName] ) then
  9.         return;
  10.     end
  11.  
  12.     BASE_STATES[frameName] = frame:IsShown() and "shown" or "hidden";
  13.     assert(frame.originalShow ~= frame.Show); --Make sure we didn't already set up this frame.
  14.     frame.originalShow = frame.Show;
  15.     frame.originalHide = frame.Hide;
  16.     frame.Show = SmartShow;
  17.     frame.Hide = SmartHide;
  18. end
  19.  
  20. local function updateFrameByState(frame)
  21.     initiateFrame(frame);
  22.     local frameName = frame:GetName();
  23.     if ( not frameName or frameName == "" ) then
  24.         GMError("Frames controlled by FrameLocks must have names.");
  25.     end
  26.     for i=1, #FRAMELOCK_STATE_PRIORITIES do
  27.         local lock = FRAMELOCK_STATE_PRIORITIES[i];
  28.         if ( ACTIVE_FRAMELOCKS[lock] ) then
  29.             local desiredState = FRAMELOCK_STATES[lock][frameName];
  30.             if ( desiredState == "hidden" ) then
  31.                 frame:originalHide();
  32.                 return;
  33.             elseif ( desiredState == "shown" ) then
  34.                 frame:originalShow();
  35.                 return;
  36.             end
  37.         end
  38.     end
  39.  
  40.     --If we got to here, no lock is in place, so use the base state.
  41.     if ( BASE_STATES[frameName] == "shown" ) then
  42.         frame:originalShow();
  43.     else
  44.         frame:originalHide();
  45.     end
  46. end

I think the taint is created because my addon cancels the orignal hide and show functions via
Lua Code:
  1. function addon:HideFrame(reference)
  2.     local frame = type(reference) == 'string' and _G[reference] or reference
  3.     if type(frame) ~= 'table' then return end
  4.     frame.Show = DoNothing
  5.     frame:Hide()
  6. end

and this is the actual hiding of it...
Lua Code:
  1. --[[-----------------------------------------------------------------------------
  2. Configure Bliz Target Frame
  3. -------------------------------------------------------------------------------]]
  4. function addon:ConfigureBlizTargetFrame()
  5.     if addon.settings.hideBlizTargetFrame then
  6.         addon:HideFrame('TargetFrame')  -- come back to this and put in unregisters but watch out for buffs :)
  7.     else
  8.         TargetFrame.Show = TargetFrame:Show()
  9.         TargetFrame:RegisterEvent("PLAYER_TARGET_CHANGED")
  10.         TargetFrame:RegisterEvent("UNIT_HEALTH")
  11.         TargetFrame:RegisterEvent("UNIT_LEVEL")
  12.         TargetFrame:RegisterEvent("UNIT_FACTION")
  13.         TargetFrame:RegisterEvent("UNIT_CLASSIFICATION_CHANGED")
  14.         TargetFrame:RegisterEvent("UNIT_AURA")
  15.         TargetFrame:RegisterEvent("PLAYER_FLAGS_CHANGED")
  16.         TargetFrame:RegisterEvent("PLAYER_FOCUS_CHANGED")
  17.         if UnitExists("target") then TargetFrame:Show() end
  18.     end
  19. end
  20.  
  21. addon.RegisterEvent("TargetFrame-Prime", 'PLAYER_LOGIN', function(self, event)
  22.     addon.UnregisterEvent(self, event)
  23.     addon:ConfigureBlizTargetFrame()
  24. end)

Any ideas for turning the framelock.lua off?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 09-27-12 at 12:08 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » FrameLocks.lua and target taint

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off