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.


All times are GMT -6. The time now is 09:28 AM.

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