Thread Tools Display Modes
11-20-11, 10:39 AM   #1
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Changing layout settings without ReloadUI()

I'm currently making an GUI config for my oUF layout and would like to know what is changeable on the go without doing ReloadUI(). I don't need moving and scaling as those are perfectly done with oUF MoveableFrames. What I'm interested in are aura filtering and some basic click-casting. Currently I enable the aura filter based on a config option, so I assume it's then set at frame creation and would need a ReloadUI() to be changed. I didn't want to move this into the filter itself in order to spare a table look-up as UNIT_AURA is being fired quite a lot. Is this the only way and is my assumption right?

I apply my click-casting in :SpawnHeader
lua Code:
  1. "oUF-initialConfigFunction", ([[
  2.     self:SetWidth(110)
  3.     self:SetHeight(11)
  4.     self:SetAttribute("type3", "spell")
  5.     self:SetAttribute("spell3", "%s")
  6. ]]):format(spellName)
and let the player specify spellName in the config. This would require a ReloadUI() too, wouldn't it? Could I avoid it somehow?

Some directions and links to layouts implementing some of these would be very appreciated. Changing frame size would be interesting too.
  Reply With Quote
11-20-11, 12:06 PM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
AuraFiltering and such is done through variables set on the element table on the frame. Just setting those variables and running :ForceUpdate() on the element or :UpdateAllElements() on the frame.

When it comes to your click-casting, oUF-initialConfigFunction is only a attribute on the header. You can change that one whenever you want (as long as you are out of combat). Note that its only ran no frame creation.

For the already created frames, just re-run :SetAttribute('spell3', 'spell') on all your frames after the user has made a change.

Changing frame size is really the same thing, re-run :SetSize() on all your frames and update oUF-initialConfigFunction to contain the correct sizes.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-20-11, 07:06 PM   #3
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Thank you very much for your help, Haste.

How would I go for disabling frames like party, partypets etc.? Just call :Hide() on the corresponding header? If I remember correctly, oUF does not update frames that are not visible, is this right?

What about changing between horizontal and vertical party flow? My code for the later is:

lua Code:
  1. local party
  2. if (cfg.showParty) then
  3.     if (cfg.horizParty) then
  4.         party = self:SpawnHeader(
  5.             "oUF_Rain_Party", nil, "party, raid",
  6.             "showParty", true,
  7.             "showRaid", true,
  8.             "maxColumns", 4,
  9.             "unitsPerColumn", 1,
  10.             "columnAnchorPoint", "LEFT",
  11.             "columnSpacing", 9.5,
  12.             "oUF-initialConfigFunction", ([[
  13.                 self:SetWidth(110)
  14.                 self:SetHeight(22)
  15.                 self:SetAttribute("type3", "spell")
  16.                 self:SetAttribute("spell3", "%s")
  17.             ]]):format(spellName)
  18.         )
  19.         party:SetPoint("LEFT", UIParent, "BOTTOM", -231.25, 130)
  20.     else
  21.         party = self:SpawnHeader(
  22.             "oUF_Rain_Party", nil, "party, raid",
  23.             "showParty", true,
  24.             "showRaid", true,
  25.             "yOffset", -27.5,
  26.             "oUF-initialConfigFunction", ([[
  27.                 self:SetWidth(110)
  28.                 self:SetHeight(22)
  29.                 self:SetAttribute("type3", "spell")
  30.                 self:SetAttribute("spell3", "%s")
  31.             ]]):format(spellName)
  32.         )
  33.         party:SetPoint("TOPLEFT", UIParent, 125, -25)
  34.     end
  35.     party:Show()
  36. end

Also, is there a table or a function in oUF returning all enabled frames? I ask this as I have some elements I'd like the user to be able to change that are enabled on almost every frame (like debuff highlighting) and it would be then tedious to call :ForceUpdate on them through the global frame names and checking whether the element is enabled.

Last edited by Rainrider : 11-20-11 at 07:22 PM.
  Reply With Quote
11-21-11, 01:10 AM   #4
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by Rainrider View Post
How would I go for disabling frames like party, partypets etc.? Just call :Hide() on the corresponding header? If I remember correctly, oUF does not update frames that are not visible, is this right?
It depends. For single frames you can just call frame:Disable(), then later when you want it to work again: frame:Enable().

Headers are slightly worse however:
If the header has a visibility state, then you will have to disable it (yours have): UnregisterAttributeDriver(header, 'state-visibility') -- you probably want to cache the value tho'
After this you can simple call header:Hide().

Originally Posted by Rainrider View Post
What about changing between horizontal and vertical party flow?
Just change the attributes and hide/show the header. Alternatively you can wait for the next header update cycle.

Originally Posted by Rainrider View Post
Also, is there a table or a function in oUF returning all enabled frames? I ask this as I have some elements I'd like the user to be able to change that are enabled on almost every frame (like debuff highlighting) and it would be then tedious to call :ForceUpdate on them through the global frame names and checking whether the element is enabled.
You will have to maintain this list yourself. I currently only maintain a list of created frames and unit -> frame mapping in oUF, and the later is removed in 1.6.x.

Remember that the style function is called as (object, objectUnit, not header), so you can easily maintain a list of single-spawned frames through it.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-21-11, 04:13 PM   #5
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
I checked SecureStateHeaderTemplate code, ouf.lua and read the whole 25th chapter of "World of Warcraft Programming" and wasn't able to find out how to get the currently set value of the "state-visibility" driver. header:GetAttribute("state-visibility") and the like didn't get me something either. In my case it is

Code:
[group:party,nogroup:raid] show;[group:raid] show;hide
but if I later change the third argument to :SpawnHeader, this value will change as well. Would someone give me a hint at this?
  Reply With Quote
11-22-11, 11:00 AM   #6
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
I thought I provided a way to retrieve the value, but it looks like I don't. Guess that one has slipped on my side .
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-22-11, 03:35 PM   #7
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Not a problem, l'll just set an upvalue for the visibily, use the custom rule for it and pass it along through the namespace. I'll post my progress later when I'm home.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Changing layout settings without ReloadUI()


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