WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   taint from moving unit frames (https://www.wowinterface.com/forums/showthread.php?t=49528)

Drool 07-24-14 11:40 AM

taint from moving unit frames
 
hey mates,

im using a simple script to move the default unit frames
Lua Code:
  1. PlayerFrame:ClearAllPoints()
  2. PlayerFrame:SetPoint("CENTER", UIParent, -294, -150)
  3.     PlayerFrame.SetPoint = function()
  4. end
  5.  
  6. TargetFrame:ClearAllPoints()
  7. TargetFrame:SetPoint("CENTER", UIParent, 294, -150)
  8.     TargetFrame.SetPoint = function()
  9. end
  10.  
  11. FocusFrame:ClearAllPoints()
  12. FocusFrame:SetPoint("CENTER", UIParent, 294, 400)
  13.     FocusFrame.SetPoint = function()
  14. end

however i always get the message: interface-action failed because of an addon
and because of said error my target of target frames is hiding
taint.log:

Code:

7/24 19:15:04.630  An action was blocked in combat because of taint from mUI - TargetFrameToT:Show()
7/24 19:15:04.630      Interface\FrameXML\TargetFrame.lua:924 TargetofTarget_Update()
7/24 19:15:04.630      Interface\FrameXML\TargetFrame.lua:415 TargetFrame_OnUpdate()
7/24 19:15:04.630      TargetFrame:OnUpdate()

how do i fix this? is there a better way to move the unitframes in a fixed position than moving it by hand on every character? :/

regards,
Drool

zork 07-24-14 11:57 AM

Those frames are secure. You are changing the SetPoint function on a secureframe. That function gets called infight and you catch a taint.

First question. Why don't you rightclick your unit frame and just unlock it. Move it to whereever you like it to be. That way the position handling will be set to userplaced and save its position to the layout-local.txt.

Drool 07-24-14 12:02 PM

Quote:

Originally Posted by zork (Post 294305)
Those frames are secure. You are changing the SetPoint function on a secureframe. That function gets called infight and you catch a taint.

First question. Why don't you rightclick your unit frame and just unlock it. Move it to whereever you like it to be. That way the position handling will be set to userplaced and save its position to the layout-local.txt.

because i have to do it on every character, that beeing said, its not a problem! but im kind of a perfectionist and want it pixel-exactly on all my characters, (if possible) :)

Fizzlemizz 07-24-14 12:37 PM

Do it once, copy/paste layout-local.txt

Edit: Exit the game before copy/paste.

zork 07-24-14 02:57 PM

This. And if you like pixel perfect so much. Just edit the values inside the layout-local.txt. Problem solved.

ObbleYeah 07-24-14 03:12 PM

Can i hijack this thread to ask if it's possible to move the boss unit frames without causing taint - since they don't have the right-click + move option?

Lua Code:
  1. local a = {Boss1TargetFrame:GetPoint()}
  2.     Boss1TargetFrame:ClearAllPoints()
  3.     Boss1TargetFrame:SetPoint(a[1],a[2],a[3],a[4]-22, a[5]-70)
  4.     Boss1TargetFrame.SetPoint = function() end

Lua Code:
  1. hooksecurefunc("TargetFrame_OnEvent", function(self, event)
  2.         if (event=="INSTANCE_ENCOUNTER_ENGAGE_UNIT") then
  3.             for i = 1, MAX_BOSS_FRAMES do
  4.                 if ( _G["Boss"..i.."TargetFrame"]:IsShown()) then
  5.                     numBossFrames = i;
  6.                 end
  7.             end
  8.             if (numBossFrames > 0) then
  9.                 local frame = CreateFrame("Frame")
  10.                 frame:SetPoint("TOP", MinimapCluster, "BOTTOM", 0, -40)
  11.                 Boss1TargetFrame:SetParent(frame)
  12.                 Boss1TargetFrame:ClearAllPoints()
  13.                 Boss1TargetFrame:SetPoint("TOP", frame, "TOP", 0, 0)
  14.             end
  15.         end
  16.     end)

Lua Code:
  1. local bossParent = CreateFrame("Frame")
  2.     bossParent:SetPoint("TOP", MinimapCluster, "BOTTOM", 10, -80)
  3.  
  4.     local HandleFrame = function(baseName)
  5.         local frame
  6.         if(type(baseName) == 'string') then
  7.             frame = _G[baseName]
  8.         else
  9.             frame = baseName
  10.         end
  11.  
  12.         if (frame) then
  13.             -- move frame without causing taint (?)
  14.             frame:ClearAllPoints()
  15.             frame:SetParent(bossParent)
  16.             frame:SetPoint("TOP", bossParent, "TOP", 0, 0)
  17.         end
  18.     end
  19.    
  20.     function MoveTheFuckinBoss(unit)
  21.         if(not unit) then return end
  22.  
  23.         if(unit:match'(boss)%d?$' == 'boss') then
  24.             local id = unit:match'boss(%d)'
  25.             if(id) then
  26.                 HandleFrame('Boss'..id..'TargetFrame')
  27.             else
  28.                 for i=1, 4 do
  29.                     HandleFrame(('Boss%dTargetFrame'):format(i))
  30.                 end
  31.             end
  32.         end
  33.     end
  34.    
  35.     hooksecurefunc("UIParent_ManageFramePositions", MoveTheFuckinBoss)

Trying things like this has either failed to produce results, caused an ADDON_ACTION_BLOCKED error, or both.

Resike 07-24-14 03:29 PM

Quote:

Originally Posted by ObbleYeah (Post 294313)
Can i hijack this thread to ask if it's possible to move the boss unit frames without causing taint - since they don't have the right-click + move option?

Could try this:

Lua Code:
  1. local a = {Boss1TargetFrame:GetPoint()}
  2. Boss1TargetFrame:ClearAllPoints()
  3. Boss1TargetFrame:SetPoint(a[1],a[2],a[3],a[4]-22, a[5]-70)
  4. Boss1TargetFrame:SetMovable(true)
  5. Boss1TargetFrame:SetUserPlaced(true)
  6. Boss1TargetFrame:SetMovable(false)

I think this would work with the TargetFrame or pretty much any protected frames too.

At least i'm using this in:

http://www.wowinterface.com/forums/s...ad.php?t=49385

However i'm not finished with the "in combat" testing yet.

ObbleYeah 07-24-14 03:41 PM

interesting, will report back.

Drool 07-24-14 10:23 PM

Quote:

Originally Posted by Resike (Post 294315)
Could try this:

Lua Code:
  1. local a = {Boss1TargetFrame:GetPoint()}
  2. Boss1TargetFrame:ClearAllPoints()
  3. Boss1TargetFrame:SetPoint(a[1],a[2],a[3],a[4]-22, a[5]-70)
  4. Boss1TargetFrame:SetMovable(true)
  5. Boss1TargetFrame:SetUserPlaced(true)
  6. Boss1TargetFrame:SetMovable(false)

I think this would work with the TargetFrame or pretty much any protected frames too.

At least i'm using this in:

http://www.wowinterface.com/forums/s...ad.php?t=49385

However i'm not finished with the "in combat" testing yet.

this does the job!! thanks !:banana:

it seems like it works already by just adding SetMovable(true), SetUserPlaced(true), SetMovable(false)

like this:

Lua Code:
  1. PlayerFrame:SetMovable(true)
  2. PlayerFrame:ClearAllPoints()
  3. PlayerFrame:SetPoint("CENTER", UIParent, -294, -150)
  4. PlayerFrame:SetUserPlaced(true)
  5. PlayerFrame:SetMovable(false)
  6.  
  7. TargetFrame:SetMovable(true)
  8. TargetFrame:ClearAllPoints()
  9. TargetFrame:SetPoint("CENTER", UIParent, 294, -150)
  10. TargetFrame:SetUserPlaced(true)
  11. TargetFrame:SetMovable(false)
  12.  
  13. FocusFrame:SetMovable(true)
  14. FocusFrame:ClearAllPoints()
  15. FocusFrame:SetPoint("CENTER", UIParent, 294, 400)
  16. FocusFrame:SetUserPlaced(true)
  17. FocusFrame:SetMovable(false)

so it'll work both ways without a taint, thanks mate!!

zork 07-25-14 01:10 AM

Yes that is actually the same as unlocking the frame in game and moving it. Technically you enable movable, enable userplaced and when finished lock it again. :)

ObbleYeah 07-25-14 05:18 AM

Quote:

Originally Posted by Resike (Post 294315)
Could try this:

Lua Code:
  1. local a = {Boss1TargetFrame:GetPoint()}
  2. Boss1TargetFrame:ClearAllPoints()
  3. Boss1TargetFrame:SetPoint(a[1],a[2],a[3],a[4]-22, a[5]-70)
  4. Boss1TargetFrame:SetMovable(true)
  5. Boss1TargetFrame:SetUserPlaced(true)
  6. Boss1TargetFrame:SetMovable(false)

I think this would work with the TargetFrame or pretty much any protected frames too.

At least i'm using this in:

http://www.wowinterface.com/forums/s...ad.php?t=49385

However i'm not finished with the "in combat" testing yet.

This doesn't work - doesn't produce any visible results or errors when I used as is but when I tried it like this:

Lua Code:
  1. hooksecurefunc(Boss1TargetFrame, "SetPoint", function(self, _, parent)
  2.         Boss1TargetFrame:SetMovable(true)
  3.         Boss1TargetFrame:ClearAllPoints()
  4.         Boss1TargetFrame:SetPoint("TOP", Minimap, "BOTTOM", 0, -70)
  5.         Boss1TargetFrame:SetUserPlaced(true)
  6.         Boss1TargetFrame:SetMovable(false)
  7.     end)

I get this:

Code:

\Map.lua:342: Frame Boss1TargetFrame is not movable or resizable
So i assume SetMoveable() is not accessible in this instance.

ObbleYeah 07-25-14 05:23 AM

I'm fairly sure that any successful way to moving it, if possible, is via the UIParent.lua

https://github.com/tekkub/wow-ui-sou...L/UIParent.lua

specifically from line 2310 onwards. But yeah, I dunno how to actually go about it. And it still might be something much simpler.

Resike 07-25-14 06:56 AM

Is there any fast quests or scenarios where i can test this frames?

ObbleYeah 07-25-14 08:07 AM

I've just been nipping in and out of LFR to test, but I just found this with a quick cursory search for anything to do with boss frames:

Quote:

...To test the boss frame, just head into Blackrock Caverns on normal and aggro Rom'ogg (before making a beeline for the entrance).

Resike 07-25-14 08:41 AM

Quote:

Originally Posted by ObbleYeah (Post 294343)
I've just been nipping in and out of LFR to test, but I just found this with a quick cursory search for anything to do with boss frames:

Thats a tought one, seems like we can't move that frame since pretty much everytime it appers you are already in combat. Not sure why they had to protect thoose frames tho.

ObbleYeah 07-25-14 08:43 AM

Yeah - it's annoying. I guess as a last resort I can always just use the DBM hp bars, but I'd prefer not to.

ObbleYeah 07-25-14 08:49 AM

Also, I can't remember if I imagined this - but I think I vaguely remember SexyMap advertising that it could successfully move the frames at one point. Not sure if that's still the case though.

Lombra 07-25-14 03:32 PM

Think you need to/can move the boss frame container, whatever that is, rather than the individual unit frames. I seem to recall that being suggested in some other thread.

Phanx 07-26-14 02:22 AM

There is no "boss frame container".

https://github.com/tekkub/wow-ui-sou...ua#L2310-L2323

Code:

        -- Boss frames - need to move below buffs/debuffs if both right action bars are showing
        local numBossFrames = 0;
        for i = 1, MAX_BOSS_FRAMES do
                if ( _G["Boss"..i.."TargetFrame"]:IsShown() ) then
                        numBossFrames = i;
                end
        end
        if ( numBossFrames > 0 ) then
                if ( rightActionBars > 1 ) then
                        anchorY = min(anchorY, buffsAnchorY);
                end
                Boss1TargetFrame:SetPoint("TOPRIGHT", "MinimapCluster", "BOTTOMRIGHT", -(CONTAINER_OFFSET_X * 1.3) + 60, anchorY * 1.333);        -- by 1.333 because it's 0.75 scale
                anchorY = anchorY - (numBossFrames * (68 + BOSS_FRAME_CASTBAR_HEIGHT) + BOSS_FRAME_CASTBAR_HEIGHT);
        end

That said, as long as you're not trying to move it in combat, I don't see why a simple hook shouldn't work:

Code:

local moving
hooksecurefunc(Boss1TargetFrame, "SetPoint", function(self) -- don't care about args
        if moving or InCombatLockdown() then -- avoid infinite loops and blocked actions
                return print("Boss1TargetFrame:SetPoint", moving and "already moving" or "in combat")
        end
        moving = true
        print("Boss1TargetFrame:SetPoint moving...")

        self:ClearAllPoints()
        self:SetPoint("TOP", Minimap, "BOTTOM", 0, -70)

        print("Boss1TargetFrame:SetPoint done!")
        moving = nil
end)

If you still get the "not movable or resizable" error it would help to specify what exactly is on line 342 in your file...

ObbleYeah 07-26-14 02:34 AM

Quote:

Originally Posted by Phanx (Post 294379)
That said, as long as you're not trying to move it in combat, I don't see why a simple hook shouldn't work:

Code:

local moving
hooksecurefunc(Boss1TargetFrame, "SetPoint", function(self) -- don't care about args
        if moving or InCombatLockdown() then -- avoid infinite loops and blocked actions
                return print("Boss1TargetFrame:SetPoint", moving and "already moving" or "in combat")
        end
        moving = true
        print("Boss1TargetFrame:SetPoint moving...")

        self:SetMovable(true)
        self:ClearAllPoints()
        self:SetPoint("TOP", Minimap, "BOTTOM", 0, -70)
        self:SetUserPlaced(true)
        self:SetMovable(false)

        print("Boss1TargetFrame:SetPoint done!")
        moving = nil
end)

If you still get the "not movable or resizable" error it would help to specify what exactly is on line 342 in your file...

line 342 was self:SetMovable(true). I'll try this - though I've already tried variations on the theme.


All times are GMT -6. The time now is 05:50 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI