WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   darn taint (https://www.wowinterface.com/forums/showthread.php?t=30238)

Grimsin 01-24-10 07:39 PM

darn taint
 
what should i do about this?

1x <event>ADDON_ACTION_BLOCKED:AddOn '!GrimUI' tried to call the protected function 'PartyMemberFrame1:Hide()'.
<in C code>: in function `Hide'
Interface\FrameXML\PartyMemberFrame.lua:111: in function `PartyMemberFrame_UpdateMember':
Interface\FrameXML\PartyMemberFrame.lua:317: in function `PartyMemberFrame_OnEvent':
<string>:"*:OnEvent":1: in function `OnEvent'
Interface\FrameXML\UnitFrame.lua:417: in function <Interface\FrameXML\UnitFrame.lua:415>:

wurmfood 01-24-10 08:21 PM

You're trying to hide stuff during combat, which you can't do.

Grimsin 01-24-10 08:37 PM

yes you can.

Im just not sure how.

I think i may have fixed that problem by disabling the onevent and setscript for the partyframes. Problem though is how to hide my own partyframes when changing to a raid and in combat....

somehow you can show/hide secure frames in combat does anyone know? i know this much... i think it has to do with doing a setattribute but im not sure how to do a setattribute with my own function in it... wowwikki gets hard to follow on this area...

acapela 01-24-10 10:06 PM

dunno if this is what will work for you, but...

something that worked for me in Aloft was to UIObject:SetAlpha() to zero (0).

a bit tricky with nameplates, as this leaves the frame assembly "invisible" but still sensitive to the mouse, which can generically affect clicking on the WorldFrame, but Frame:EnableMouse() is also protected in combat (which resulted in disabled nameplate frame assemblies being recycled in combat, and then coming back into range assigned to a different unit but with the mouse still disabled; this might be less a problem with something static like a unit frame).

edit: depending on the nature of the object being hidden, it is my perception that Region:Hide() can indeed be "protected" in combat. this is true of the root frame in a nameplate assembly, for instance.

Grimsin 01-24-10 10:15 PM

it is protected in deed. If i understand things right you can use SetAttribute with a secure template of somekind to hide show frames in combat.

--- edit ---

heh just ran into a related issue. hiding the party frames is not only protected i used register unit watch to show/hide them in the first place how the heck do i hide those now? lol. need to hide them when joining a raid....

Xrystal 01-24-10 10:20 PM

Wouldn't it be easier ( assuming it's possible ) to have the attributes mark the frame as "player", "party1", "raid1" as required depending on the situation. That way you won't need to hide the frame at all.

Grimsin 01-24-10 10:37 PM

one would think right but the problem is blizzards api does not automaticlly hide party frames when you change to a raid.....or at lest i dont thnk it does lol.

-- Okay it does but my frames are named different. SO of course it does not hide them on its own. fixed that part except of course it most likly will not do it in combat.


-- another edit --
i either need to make it hold off doing anything that would be secure until combat ends or figure out how to show/hide frames in combat.

Dridzt 01-24-10 11:24 PM

I'm not sure we're talking about the same thing as I only read the current page of comments but,
there _is_ a setting in the default client to hide party interface when joining a raid.

It's under Options(Esc)->Interface->Game tab->UnitFrames->"Hide party interface in Raid".

Dayve 01-24-10 11:38 PM

I managed to accomplish this in my own unit/raid frames by parenting the party frames to one frame and hiding that frame using a SecureHandlerStateTemplate (which also doubles as the main table for the addon).
Creation:
lua Code:
  1. local main = CreateFrame("Frame", "DayveUF_Main", UIParent, "SecureHandlerStateTemplate");
  2. SecureHandler_OnLoad(main);
  3. main.partyMain = CreateFrame("Frame", nil, main);
Initialisation:
lua Code:
  1. self:SetFrameRef("PartyMain", self.partyMain);
  2. self:Execute([[
  3.     PartyMain = self:GetFrameRef("PartyMain");
  4. ]]);
  5. self:SetAttribute("_onstate-unitexists", [[
  6.     if raidhideparty and newstate then
  7.         PartyMain:Hide()
  8.     else
  9.         PartyMain:Show()
  10.     end
  11. ]]);
  12. self:SetAttribute("unit", "raid1");
  13. RegisterUnitWatch(self, true);
And to turn the behaviour on or off to reflect the user's setting:
lua Code:
  1. self:Execute(self.save.raidhideparty and [[
  2.     raidhideparty = true;
  3. ]] or [[
  4.     raidhideparty = false;
  5. ]]);
  6. self:SetAttribute("state-unitexists", UnitExists("raid1"));

Grimsin 01-25-10 09:09 AM

That is exactly what im talking about :)

so that last part about the settings, that registers it to function based on the users selection in the blizzard options as far as raid party hide? trying right now to work this into my code :)
thanks a lot!

Dayve 01-25-10 09:59 AM

It uses the setting in my mod's saved variables, replace self.save.raidhideparty with whatever variable you want the setting to come from; I think the default UI setting is in HIDE_PARTY_INTERFACE

Grimsin 01-25-10 10:16 AM

so the hide party in raid is an option you have in your addon?

im kinda over whelmed atm, everything got real complicated when it came to party frames since i made it so there was different party layouts to accommodate for various screen sizes. The way i did things the majority of the ui size and scale never changes just two pieces of art those two pieces of art dictate that action button space and... you guessed it the party member and raid member space.

so let me see if i under stand. you hook the partyframes that have the unitwatch party1 so on and soo on to the secure handler for the raid watch part?

Dayve 01-25-10 10:35 AM

Quote:

Originally Posted by Grimsin (Post 176021)
so the hide party in raid is an option you have in your addon?

Yes, the addon in question is a combined unit+raid frames addon (not publicly available btw).

Your understanding is pretty much correct; to put things clearly: the party frames are individually shown/hidden as normal using unitwatch, and their shared parent frame is shown/hidden by the state handler (which can be the parent frame itself, or another frame as in my code) using a secure code snippet that responds to unitwatch state for the raid1 unit.

Grimsin 01-25-10 11:35 AM

no luck yet.... :( i think it has to do with to many frames hooked to each other it does not show hide the right ones or something.... i dont know. the base looks like this

lua Code:
  1. -- party frame 1 unit watch
  2. local GrimMPartyFrame1 = CreateFrame("frame", "GrimMPartyFrame1", GrimPartyMain, "SecureUnitButtonTemplate")
  3. GrimMPartyFrame1:SetAttribute('unit', 'party1')
  4. RegisterUnitWatch(GrimMPartyFrame1)
  5.  
  6. GrimUI.GrimMPartyFrame1 = GrimMPartyFrame1
  7.  
  8. -- party frame 2 unit watch
  9. local GrimMPartyFrame2 = CreateFrame("frame", "GrimMPartyFrame2", GrimPartyMain, "SecureUnitButtonTemplate")
  10. GrimMPartyFrame2:SetAttribute('unit', 'party2')
  11. RegisterUnitWatch(GrimMPartyFrame2)
  12.  
  13. GrimUI.GrimMPartyFrame2 = GrimMPartyFrame2
  14.  
  15. -- party frame 3 unit watch
  16. local GrimMPartyFrame3 = CreateFrame("frame", "GrimMPartyFrame3", GrimPartyMain, "SecureUnitButtonTemplate")
  17. GrimMPartyFrame3:SetAttribute('unit', 'party3')
  18. RegisterUnitWatch(GrimMPartyFrame3)
  19.  
  20. GrimUI.GrimMPartyFrame3 = GrimMPartyFrame3
  21.  
  22. -- party frame 4 unit watch
  23. local GrimMPartyFrame4 = CreateFrame("frame", "GrimMPartyFrame4", GrimPartyMain, "SecureUnitButtonTemplate")
  24. GrimMPartyFrame4:SetAttribute('unit', 'party4')
  25. RegisterUnitWatch(GrimMPartyFrame4)
  26.  
  27. GrimUI.GrimMPartyFrame4 = GrimMPartyFrame4
  28.  
  29. ---- hide party frames in raid ----
  30.  
  31.  
  32.  
  33. local RaidPartyHandler = CreateFrame("Frame", "RaidPartyHandler", UIParent, "SecureHandlerStateTemplate");
  34. SecureHandler_OnLoad(RaidPartyHandler);
  35. RaidPartyHandler.GrimPartyMain = CreateFrame("Frame", nil, RaidPartyHandler);
  36.  
  37.  
  38.  
  39. RaidPartyHandler:SetFrameRef("GrimPartyMain", RaidPartyHandler.GrimPartyMain);
  40. RaidPartyHandler:Execute([[
  41. GrimPartyMain = self:GetFrameRef("GrimPartyMain");
  42. ]]);
  43. RaidPartyHandler:SetAttribute("_onstate-unitexists", [[
  44.     if newstate then
  45.     GrimPartyMain:Hide()
  46.     else
  47.     GrimPartyMain:Show()
  48.     end
  49. ]]);
  50.  
  51. RaidPartyHandler:SetAttribute("unit", "raid1");
  52. RegisterUnitWatch(RaidPartyHandler, true);
  53.  
  54. RaidPartyHandler:SetAttribute("state-unitexists", UnitExists("raid1"));

Grimsin 01-25-10 11:55 AM

FIGURED IT OUT!! thanks a lot ! :)

Grimsin 01-25-10 04:49 PM

now trying to make the variable it checks come from theblizzard one but... not happening so far.

how would you check the blizz variables in this case? getcvar in the brackets does nothing

Xrystal 01-25-10 06:08 PM

Quote:

Originally Posted by Grimsin (Post 176064)
now trying to make the variable it checks come from theblizzard one but... not happening so far.

how would you check the blizz variables in this case? getcvar in the brackets does nothing

I usually dabble in the options screen that sets the variable and see how they set it, then grab it from that.

eg.
local uiScaling = GetCVar("useUiScale");
local uiScale = tonumber(GetCVar("uiScale"));

I use those in my nUI InfoPanel plugins when I need to ensure scaling values in the options are taken into account. Example : FontSize 10 at scale of 1.0 would be too small at scale or 0.6 so I check the scale and then use a higher fontsize so that it still looks fine.

Grimsin 01-25-10 07:00 PM

yea the problem is i cant put those into secure template functions. or at lest em not sure how i think they need to be woven into the execute but..

Grimsin 01-25-10 07:31 PM

just found out that set focus on the dropdown menu is blocked for my party and player frames :(

Xrystal 01-25-10 07:50 PM

Quote:

Originally Posted by Grimsin (Post 176088)
just found out that set focus on the dropdown menu is blocked for my party and player frames :(

Yep, standard addon functionality I'm afraid.

Dayve 01-25-10 08:05 PM

For the user setting to work the code snippet that runs in response to state change needs to reference the setting in a variable in its restricted environment; in the code I provided it is stored in "raidhideparty". After initialization and whenever the user setting changes it must be propagated into the restricted enviroment using :Execute, which is the purpose of the 3rd code extract in my first post, which effectively sets "ridehideparty" to be equal to the value in the user setting variable. That part could also be written like this for clarity (with the appropriate CVar used):
lua Code:
  1. RaidPartyHandler:Execute("raidhideparty = " .. tostring(GetCVarBool("hidePartyInRaid")));
  2. RaidPartyHandler:SetAttribute("state-unitexists", UnitExists("raid1"));

Grimsin 01-25-10 10:05 PM

Quote:

Originally Posted by Xrystal (Post 176092)
Yep, standard addon functionality I'm afraid.

this was linked to me from the bliz forums, posted same question there.

http://forums.wowace.com/showthread.php?t=16669

i also had another idea.... what if... one were to take over the bliz function for setfocus on the drop down and replace it with lua code that runs the /focus slash cmd, and create your own setfocus frame that opens on unit watch..

if the bliz focus frame works on unitwatch then you dont need to make your own even. assuming the macro will fire from lua while in combat.

that work around that i posted the link to looks dicey to me but then im still a coding noob imo.

AnrDaemon 01-28-10 09:04 AM

I'm using keybind (Alt+F) to set focus.
I saw many discussions about addon being unable to set focus, and to create a macro for "/focus", but I'm failing to see how that would be more useful...

nightcracker 01-28-10 09:08 AM

I have no idea how it works, but it's in my bookmarks:
http://paste.wowace.com/781/

Grimsin 02-26-10 11:30 AM

it is doable a few addons do it. One in particular is Clique. Although it does not appear to use the actual menu function. However this would mean one way or another you can make an addon setfocus its just a mater of how to make that menu feature setfocus. Its really something blizz should be fixing....

nightcracker 02-26-10 11:46 AM

For hiding protected frames:
Code:

local securehandler = CreateFrame("Frame", nil, nil, "SecureHandlerBaseTemplate")
securehandler:WrapScript(Frame, "OnShow", "self:Hide()")

For the focus problem, look at the code of ncHoverFocus.

Grimsin 02-26-10 12:06 PM

did you see the post about the arena frames? how would i work the secure show hide into whats being talked about there? the biggest problems right now are the show hiding of raid and party frames, and the secure show/hide of secure button frames of various sorts, not action bars but like the spellbook frame, those are secure buttons so if you screw around with the size or position or show/hide of that frame it has to be done secure or you get taint when in combat.

Shadowed 02-26-10 12:45 PM

Quote:

Originally Posted by Grimsin (Post 179989)
did you see the post about the arena frames? how would i work the secure show hide into whats being talked about there? the biggest problems right now are the show hiding of raid and party frames, and the secure show/hide of secure button frames of various sorts, not action bars but like the spellbook frame, those are secure buttons so if you screw around with the size or position or show/hide of that frame it has to be done secure or you get taint when in combat.

Can you describe what you are trying to do exactly? Reading through the posts was more confusing than anything.

Quote:

Originally Posted by Grimsin (Post 179980)
it is doable a few addons do it. One in particular is Clique. Although it does not appear to use the actual menu function. However this would mean one way or another you can make an addon setfocus its just a mater of how to make that menu feature setfocus. Its really something blizz should be fixing....

Clique uses the focus attribute which is called by the secure code to set focus. The menu function calls SetFocus which when it gets tainted (and it gets tainted easily) doesn't work. They're two different systems. No UF addon can get around the set focus bug, without reimplementing the entire dropdown system in secure code, and nobody is insane enough to do that.

The pastey nightcracker linked was broken with 3.2 (3.1?), it was technically a loophole that caused it to work in the first place.

Grimsin 02-26-10 01:16 PM

So there is just no fix to the menu setfocus issue?

As for the frame showing and hiding well the problem is my party frames do not always show hide as they should. one of the times its an issue is if you drop raid while in combat. or join raid in combat... or for that mater do anything in combat :) the other thread has the actual code pasted.
http://www.wowinterface.com/forums/s...ad.php?t=30923

Shadowed 02-26-10 03:41 PM

Quote:

Originally Posted by Grimsin (Post 179995)
So there is just no fix to the menu setfocus issue?

As for the frame showing and hiding well the problem is my party frames do not always show hide as they should. one of the times its an issue is if you drop raid while in combat. or join raid in combat... or for that mater do anything in combat :) the other thread has the actual code pasted.
http://www.wowinterface.com/forums/s...ad.php?t=30923

Not sanely, correct. It's something Blizzard has to fix.

See the other topic about the frame issue.


All times are GMT -6. The time now is 12:03 AM.

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