Thread Tools Display Modes
07-25-15, 11:30 AM   #1
Jasmer
A Flamescale Wyrmkin
 
Jasmer's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 122
TargetFrameToT taint?

Hey guys, I'm having a hard time moving my TargetFrameToT. I'm trying to "detach" it from my target frame, basically, and have it display above and to the right so it doesn't overlap my action bars. I really just want to keep it parented to the target frame if I can and just move it a little. Here's a copy of my taint log.

http://pastebin.com/gyQV87xU

I'm really new to this lua stuff (even started reading WoW Programming 2nd Edition) but is this because the ToT frame isn't technically movable? Using SetMovable and SetUserPlaced didn't change anything. This is what I'm using to move the ToT frame.

Lua Code:
  1. TargetFrameToT:ClearAllPoints()
  2. TargetFrameToT:SetPoint("CENTER",TargetFrame,"CENTER", 60,100)
  3. TargetFrameToT.SetPoint = function() end

It's the same way I moved my other UFs but haven't had any errors from them. Pet frame works fine, I've successfully "detached" it from my player frame the same way I'm trying with the ToT frame. I think the fix for this is a little over my head yet, I could really use some help tracking this down
  Reply With Quote
07-25-15, 11:52 AM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
This line is your problem that causes taint:
Lua Code:
  1. TargetFrameToT.SetPoint = function() end

Instead, you need to hook it securely:
Lua Code:
  1. local newSetPoint = TargetFrameToT.SetPoint
  2. hooksecurefunc(TargetFrameToT, "SetPoint", function()
  3.           newSetPoint(TargetFrameToT, "CENTER",TargetFrame,"CENTER", 60,100)
  4.      end)

That way, every time the game tries to move the ToT frame, your function will fire immediately after and move it right back. (Note: you may wish to add in a check so that it doesn't try to move it while in combat)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
07-25-15, 11:56 AM   #3
Jasmer
A Flamescale Wyrmkin
 
Jasmer's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 122
Originally Posted by Seerah View Post
This line is your problem that causes taint:
Lua Code:
  1. TargetFrameToT.SetPoint = function() end

Instead, you need to hook it securely:
Lua Code:
  1. local newSetPoint = TargetFrameToT.SetPoint
  2. hooksecurefunc(TargetFrameToT, "SetPoint", function()
  3.           newSetPoint(TargetFrameToT, "CENTER",TargetFrame,"CENTER", 60,100)
  4.      end)

That way, every time the game tries to move the ToT frame, your function will fire immediately after and move it right back. (Note: you may wish to add in a check so that it doesn't try to move it while in combat)
Thanks, Seerah, I'll try it out. I'd read the function() end was a problem, but then got confused because I'd also read elsewhere to add it to player and target frames to keep them from resetting. They don't cause any taint problems and they've stopped resetting. Is it because they're actually unlockable, then? Also, the pet frame also has the same function() end and no taint problems as far as I can tell. Kind of confused about this.

As for the combat check, I'll see if I can figure it out. Does that mean it'll reset when I'm in combat, or will it stay where I place it?
  Reply With Quote
07-25-15, 12:01 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
I don't know, I don't use the default frames and haven't messed with them beyond using the default UI's method of moving the player and target frames around on PTRs.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
07-25-15, 02:30 PM   #5
Jasmer
A Flamescale Wyrmkin
 
Jasmer's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 122
I fixed it! Turns out TargetFrameToT wasn't the source of the taint once I removed
Lua Code:
  1. TargetFrameToT.SetPoint = function() end

However, I kept getting taint issues pointing to that frame. I removed similar lines from all my other frames and used SetMovable and SetUserPlaced. Everything seems to work, with one catch. My pet frame resets to default position unless I add

Lua Code:
  1. PetFrame.SetPoint = function() end

No taint log so far, ToT frame stays where I placed it in combat, so far so good. Does anyone know a better way to keep my pet frame stationary? I tried SetMovable and SetUserPlaced, they didn't work, PetFrame kept resetting. It's working fine with SetPoint = function() end, so far at least, but if this is something that causes taint I'd like a better way to lock my pet frame in place.
  Reply With Quote
07-25-15, 07:22 PM   #6
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Jasmer View Post
I fixed it! Turns out TargetFrameToT wasn't the source of the taint once I removed
Lua Code:
  1. TargetFrameToT.SetPoint = function() end

However, I kept getting taint issues pointing to that frame. I removed similar lines from all my other frames and used SetMovable and SetUserPlaced. Everything seems to work, with one catch. My pet frame resets to default position unless I add

Lua Code:
  1. PetFrame.SetPoint = function() end

No taint log so far, ToT frame stays where I placed it in combat, so far so good. Does anyone know a better way to keep my pet frame stationary? I tried SetMovable and SetUserPlaced, they didn't work, PetFrame kept resetting. It's working fine with SetPoint = function() end, so far at least, but if this is something that causes taint I'd like a better way to lock my pet frame in place.
Hook it, as Seerah mentioned:

Lua Code:
  1. local moving
  2. hooksecurefunc(PetFrame, "SetPoint", function(self)
  3.     if moving then
  4.         return
  5.     end
  6.     moving = true
  7.     self:SetMovable(true)
  8.     self:SetUserPlaced(true)
  9.     self:ClearAllPoints()
  10.     self:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
  11.     self:SetMovable(false)
  12.     moving = nil
  13. end)
  14. PetFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)

The big advantage of the SetUserPlaced call if the frame is supported, then you can clear/move protected frames even in combat.

There is also a similar hack with secure frames, where you can resize them in combat while StartSizing is active.

Last edited by Resike : 07-25-15 at 07:26 PM.
  Reply With Quote
07-25-15, 04:12 PM   #7
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by Jasmer View Post
Is it because they're actually unlockable, then? Also, the pet frame also has the same function() end and no taint problems as far as I can tell.
When you overwrite a variable or function (like you did) and then blizzard's code runs your function it taints the entire execution path after that point, which means if they have a function that calls TargetFrameToT:SetPoint() after you replaced it then everything in the blizzard function after that point can't do anything that's restricted or protected (like show or hide a unit frame).
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » TargetFrameToT taint?


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