Thread Tools Display Modes
08-01-16, 09:51 AM   #1
Ereki
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 25
"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?
 
08-01-16, 01:15 PM   #2
sticklord
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 57
Have you tried to give the .unit key the value "player" on the frame you're parenting the runeframe to?
 
08-02-16, 01:54 AM   #3
Ereki
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 25
Originally Posted by sticklord View Post
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.
 
08-02-16, 02:17 AM   #4
sticklord
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 57
Originally Posted by Ereki View Post
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 What I mean is this, where the frame is the one you're parenting the runeframe to:

Lua Code:
  1. your_frame.unit = "player"
 
08-02-16, 08:30 AM   #5
Ereki
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 25
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!
 
08-02-16, 10:51 AM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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"
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
 
08-03-16, 07:08 AM   #7
sticklord
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 57
What she said:P
 
08-03-16, 09:24 AM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
 
08-03-16, 11:13 AM   #9
sticklord
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 57
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,.
 
08-03-16, 04:20 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I assumed it was just being reparented to the UIParent, like it was in previous versions of the game, but I could be wrong.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
 
08-04-16, 11:23 AM   #11
sticklord
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 57
Ah I understand, didn't think of that possibility
 
09-07-16, 09:12 AM   #12
delabarra
A Murloc Raider
Join Date: Jun 2011
Posts: 6
Try this.

Lua Code:
  1. if class == "DEATHKNIGHT" then
  2.     RuneFrame:Show()
  3. end
 
09-07-16, 06:50 PM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » "Unhiding" RuneFrame

Thread Tools
Display Modes

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