WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   "Unhiding" RuneFrame (https://www.wowinterface.com/forums/showthread.php?t=54088)

Ereki 08-01-16 09:51 AM

"Unhiding" RuneFrame
 
Hi
In my addon RuneHUD I've used a simple fix to stop addons which hides the player unitframe to stop hiding the RuneFrame by simply changing it's parent to a new frame. If I do this after 7.0 I get error messages since Blizzard changed the RuneFrame.lua in FrameXML to suport 7 runes. The change they made is the following:
Code:

function RuneFrame_UpdateNumberOfShownRunes()
        CURRENT_MAX_RUNES = UnitPowerMax(RuneFrame:GetParent().unit, SPELL_POWER_RUNES);
        for i=1, MAX_RUNE_CAPACITY do
                local runeButton = _G["RuneButtonIndividual"..i];
                if(i <= CURRENT_MAX_RUNES) then
                        runeButton:Show();
                else
                        runeButton:Hide();
                end
                -- Shrink the runes sizes if you have all 7
                if (CURRENT_MAX_RUNES == MAX_RUNE_CAPACITY) then
                        runeButton.Border:SetSize(21, 21);
                        runeButton.rune:SetSize(21, 21);
                        runeButton.Textures.Shine:SetSize(52, 31);
                        runeButton.energize.RingScale:SetFromScale(0.6, 0.7);
                        runeButton.energize.RingScale:SetToScale(0.7, 0.7);
                        runeButton:SetSize(15, 15);
                else
                        runeButton.Border:SetSize(24, 24);
                        runeButton.rune:SetSize(24, 24);
                        runeButton.Textures.Shine:SetSize(60, 35);
                        runeButton.energize.RingScale:SetFromScale(0.7, 0.8);
                        runeButton.energize.RingScale:SetToScale(0.8, 0.8);
                        runeButton:SetSize(18, 18);
                end
        end
end

Is there any way to work around this (I can't come up with anything) or is there another good solution to "unhide" the runeframe when the player unitframe is hidden by another addon?

sticklord 08-01-16 01:15 PM

Have you tried to give the .unit key the value "player" on the frame you're parenting the runeframe to?

Ereki 08-02-16 01:54 AM

Quote:

Originally Posted by sticklord (Post 317292)
Have you tried to give the .unit key the value "player" on the frame you're parenting the runeframe to?

No I haven't, didn't even know it was possible. How do you set the value? Tried searching a bit (at work so can't spend too much time with it) without finding how to do it.

sticklord 08-02-16 02:17 AM

Quote:

Originally Posted by Ereki (Post 317306)
No I haven't, didn't even know it was possible. How do you set the value? Tried searching a bit (at work so can't spend too much time with it) without finding how to do it.

Sorry, tried to explain in proper terms and all but ended up overcomplicating it:p What I mean is this, where the frame is the one you're parenting the runeframe to:

Lua Code:
  1. your_frame.unit = "player"

Ereki 08-02-16 08:30 AM

Now I feel kinda stupid for not trying that... So bascially framename.unit is just a global variable? And yes that do work, thanks a lot for the help! :)

Phanx 08-02-16 10:51 AM

No, "framename" is a global variable, pointing to the object by that name, which (in the case of a frame) a table, which has a "unit" key. You can access it and set its keys/values just like any other table.

/dump PlayerFrame:GetObjectType() ==> "table"
/dump PlayerFrame.unit:GetObjectType() ==> "string"
/dump PlayerFrame.unit ==> "player"

sticklord 08-03-16 07:08 AM

What she said:P

Phanx 08-03-16 09:24 AM

Also, rather than setting generic keys like "unit" on arbitrary frames that don't belong to you (like the UIParent) it's probably better to create an intermediate frame, and parent the RuneFrame to that. Then you don't have to worry about overriding, or being overridden by, other addons or default UI code.

lua Code:
  1. local f = CreateFrame("Frame", "RuneFrameContainer", UIParent)
  2. f:SetSize(130, 18) -- default size of RuneFrame, but doesn't actually matter
  3. f:SetPoint("TOP", UIParent, "CENTER") -- use this to set your desired position
  4.  
  5. f.unit = "player"
  6. -- set any other things the RuneFrame needs here
  7.  
  8. RuneFrame:SetParent(f)
  9. RuneFrame:ClearAllPoints()
  10. RuneFrame:SetPoint("TOP", f) -- position the container, not this

sticklord 08-03-16 11:13 AM

I'm pretty sure that is what Ereki did, to stop the Runeframe being hidden by addons that hide the Playerframe. That's why the unit was missing,.

Phanx 08-03-16 04:20 PM

I assumed it was just being reparented to the UIParent, like it was in previous versions of the game, but I could be wrong.

sticklord 08-04-16 11:23 AM

Ah I understand, didn't think of that possibility:)

delabarra 09-07-16 09:12 AM

Try this.

Lua Code:
  1. if class == "DEATHKNIGHT" then
  2.     RuneFrame:Show()
  3. end

Phanx 09-07-16 06:50 PM

That won't help. The frame has been reparented, and the issue is that it depends on properties on its parent frame; the solution is to set those properties on the new parent. You may want to consider reading the thread before posting next time.


All times are GMT -6. The time now is 11:24 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI