Thread Tools Display Modes
10-06-13, 08:57 PM   #1
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
More oUF troubles!

I've been working on my raid frame layout recently, and I got it working fine until I wanted to make it do different things depending on size. Some quick google-fu led me to this thread, which while outdated still seemed fairly informative and solid.

So I tried to look at oUF_Diablo's current code, and the same method is still used. I tried to copy it over almost completely, with slight changes to values etc so it'd fit my layout. This is probably where it broke.

While I don't fully understand everything that goes on in zork's code, I do think I managed to port it over fairly well, but somewhere along the way it must've took a dark turn because they now spawn twice! I have two raidframes spawning, in both places I'd like, only they spawn no matter what. They spawn under my player frame even if I do 25man, and they spawn in the top left corner even if I'm in a 10man group. Nothing seems to change this.

This is the code I've shamelessly stolen and butchered.
lua Code:
  1. oUF:RegisterStyle('opRaidDPS', Shared)
  2. oUF:SetActiveStyle('opRaidDPS')
  3.  
  4. local playerClass = select(3, UnitClass('player'))
  5. local raid, group, i, j
  6. -- Single Frames   
  7.  
  8. local attr = {
  9.     visibility1 = "custom [@raid11,exists] hide;[group:raid] show; hide",       --use "party,raid" to show this in party aswell
  10.     visibility2 = "custom [@raid26,exists] hide; [@raid11,exists] show; hide"--special display for raid > 20 players (lower scale)
  11.     visibility3 = "custom [@raid26,exists] show; hide",                         --special display for raid > 30 players (lower scale)
  12. }
  13.  
  14. local function getRaidVisibility(id)
  15.     if id == 1 then
  16.         return attr.visibility1
  17.     elseif id == 2 then
  18.         return attr.visibility2
  19.     else
  20.         return attr.visibility3
  21.     end
  22. end  
  23.  
  24. for i=1, 3 do
  25.     raid = {}
  26.     for j=1, NUM_RAID_GROUPS do
  27.         local name = "oUF_OpieRaid"..i.."Group"..j
  28.         group = oUF:SpawnHeader(
  29.             name,
  30.             nil,
  31.             getRaidVisibility(i),
  32.             'showPlayer', true,
  33.             'showSolo', true,
  34.             'showParty', false,
  35.             'showRaid', true,
  36.             'yOffset', -4,
  37.             'maxColumns', 8,
  38.             'unitsPerColumn', 5,
  39.             "groupFilter", tostring(j),
  40.             'groupBy', 'GROUP',
  41.             'groupingOrder', "1,2,3,4,5,6,7,8",
  42.             'columnSpacing', 3,
  43.             'columnAnchorPoint', 'LEFT',
  44.                 'oUF-initialConfigFunction', ([[
  45.                         self:SetHeight(24)
  46.                         self:SetWidth(78)
  47.                 ]])
  48.         )          
  49.         if j == 1 then
  50.             group:SetPoint('TOP', oUF_opUnitFramesPlayer, 'BOTTOM', 0, -10)
  51.         else
  52.             if playerClass == 9 or playerClass == 3 or playerClass == 6 then
  53.                 group:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -28)
  54.             else
  55.                 group:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -5)
  56.             end
  57.         end
  58.         raid[j] = group
  59.     end
  60. end

Here's my full layout: http://pastebin.com/NHTi6ePR
Here's Zork's layout: https://code.google.com/p/rothui/sou...s/raid.lua#365

Thanks in advance!

EDIT: I'd like to also point out that I tried to use this page for documentation on the header API, but I can't find any good documentation on the visibility stuff. If anyone's got a better page for it, I'd welcome it with open arms.
__________________
All I see is strobe lights blinding me in my hindsight.

Last edited by Wimpface : 10-06-13 at 09:03 PM.
  Reply With Quote
10-07-13, 01:17 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Why do you need 3 visibility handlers if you do not change the scale or size of each raidgroup per visibility handler? That's what I do and what I need 3 raid group spawns for.

You can have differnt type of raid frames spawning if the conditions match.

A) group:raid
B) raid11 noexists
C) raid26 exists
This will spawn raidframe 1 and 3.

If you can live with a single raid spawn the only visibility handler you need is this:
Lua Code:
  1. --[group:raid] show; hide
  2.  
  3.   local raid = {}
  4.   for j=1, NUM_RAID_GROUPS do
  5.       local name = "oUF_OpieRaidHeader"..j
  6.       group = oUF:SpawnHeader(
  7.           name,
  8.           nil,
  9.           '[group:raid] show; hide',
  10.           'showPlayer', true,
  11.           'showSolo', true,
  12.           'showParty', false,
  13.           'showRaid', true,
  14.           'yOffset', -4,
  15.           'maxColumns', 8,
  16.           'unitsPerColumn', 5,
  17.           "groupFilter", tostring(j),
  18.           'groupBy', 'GROUP',
  19.           'groupingOrder', "1,2,3,4,5,6,7,8",
  20.           'columnSpacing', 3,
  21.           'columnAnchorPoint', 'LEFT',
  22.               'oUF-initialConfigFunction', ([[
  23.                       self:SetHeight(24)
  24.                       self:SetWidth(78)
  25.               ]])
  26.       )          
  27.       if j == 1 then
  28.           group:SetPoint('TOP', oUF_opUnitFramesPlayer, 'BOTTOM', 0, -10)
  29.       else
  30.           if playerClass == 9 or playerClass == 3 or playerClass == 6 then
  31.               group:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -28)
  32.           else
  33.               group:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -5)
  34.           end
  35.       end
  36.       raid[j] = group
  37.   end
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-07-13 at 01:29 AM.
  Reply With Quote
10-07-13, 09:50 AM   #3
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
I was hoping to use different visibility states to change group direction and size of the frames if the raid was bigger than 2 groups. I'd like it to spawn under my player frame with the attributes I have set now, and if there's more than 10 people in the raid I want it to spawn in the top left instead and move downwards, much like oUF_Perfect in terms of looks. I also want to change the height of the frames from 24 to 20.

I tried using an event call with PARTY_MEMBERS_CHANGED, but the raidframes didn't spawn at all then.

Also, I don't think I quite fully understand what this line does in the header attribute table:
lua Code:
  1. "groupFilter", tostring(j),

It was something I threw in there after my frames had already spawned twice, and it seemed to do nothing for me.

I'll try to grab a screenshot later of my problem if you'd like, if it still persists after making the changes you suggested.

Thanks!

EDIT:
You can have differnt type of raid frames spawning if the conditions match.

A) group:raid
B) raid11 noexists
C) raid26 exists
This will spawn raidframe 1 and 3.
If I wish to make changes to size of the frames, will I need to spawn different headers with these visibility conditions or should I go back to using a table like you did? I don't wish to change the scale, but rather the Height and Width independently (make the frames wider, but narrower)

EDIT2: With the changes you suggested, the raid frames don't spawn at all anymore. Odd.
__________________
All I see is strobe lights blinding me in my hindsight.

Last edited by Wimpface : 10-07-13 at 12:10 PM.
  Reply With Quote
10-07-13, 10:21 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Wimpface View Post
I was hoping to use different visibility states to change group direction and size of the frames if the raid was bigger than 2 groups. I'd like it to spawn under my player frame with the attributes I have set now, and if there's more than 10 people in the raid I want it to spawn in the top left instead and move downwards, much like oUF_Perfect in terms of looks. I also want to change the height of the frames from 24 to 20.
You can just use :SetAttribute(attr, val) on your already-existing header and unitframes when the group size changes; there's no need to create duplicate headers and frames. This applies to Zork, too.
__________________
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.
  Reply With Quote
10-08-13, 01:02 AM   #5
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Originally Posted by Phanx View Post
You can just use :SetAttribute(attr, val) on your already-existing header and unitframes when the group size changes; there's no need to create duplicate headers and frames. This applies to Zork, too.
So I could potentially do a check for PARTY_MEMBERS_CHANGED and when that fires, I can check for GetNumGroupMembers() and just SetAttributes then? Can I spawn a header without size settings only to modify them later?

What I mean would be something like this:
lua Code:
  1. for j=1, NUM_RAID_GROUPS do
  2.     raid = {}
  3.     local name = "oUF_OpieRaidGroup"..j
  4.     group = oUF:SpawnHeader(
  5.         name,
  6.         nil,
  7.         '[group:raid] show; hide',
  8.         'showPlayer', true,
  9.         'showSolo', true,
  10.         'showParty', false,
  11.         'showRaid', true,
  12.         'yOffset', -4,
  13.         'maxColumns', 8,
  14.         'unitsPerColumn', 5,
  15.         "groupFilter", tostring(j),
  16.         'groupBy', 'GROUP',
  17.         'groupingOrder', "1,2,3,4,5,6,7,8",
  18.         'columnSpacing', 3,
  19.         'columnAnchorPoint', 'LEFT',
  20.             'oUF-initialConfigFunction', ([[
  21.                     self:SetHeight(24)
  22.                     self:SetWidth(78)
  23.             ]])
  24.     )  
  25.     raid[j] = group
  26. end
  27.  
  28. local raidResize = function(self, event, ...)
  29.     if not event or event ~= 'PARTY_MEMBERS_CHANGED' then return end
  30.    
  31.     local raidSize = GetNumGroupMembers() or 0
  32.    
  33.     if raidSize <= 10 then
  34.         group:SetPoint('TOP', oUF_opUnitFramesPlayer, 'BOTTOM', 0, -10)
  35.         group:SetAttribute('initial-width', 78)
  36.         group:SetAttribute('initial-height', 24)
  37.     elseif raidSize > 10 then
  38.         if playerClass == 9 or playerClass == 3 or playerClass == 6 then
  39.             group:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -28)
  40.         else
  41.             group:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -5)
  42.         end
  43.         group:SetAttribute('initial-width', 100)
  44.         group:SetAttribute('initial-height', 20)
  45.     end
  46. end
  47.  
  48. local raidResizeFrame = CreateFrame('Frame')
  49. raidResizeFrame:RegisterEvent('PARTY_MEMBERS_CHANGED')
  50. raidResizeFrame:SetScript('OnEvent', raidResize)

Please note that I drycoded this (with some stuff from zorks code linked in the first post) and I'm not as talented at this as I should be after knocking my head against a wall for a few years.

EDIT: Tried it out, doesn't spawn frames at all!
__________________
All I see is strobe lights blinding me in my hindsight.

Last edited by Wimpface : 10-08-13 at 01:20 AM. Reason: Fixed the code up a bit
  Reply With Quote
10-08-13, 01:44 AM   #6
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Thanks Phanxs that is actually pretty interesting. Is changing of attributes allowed mid-combat?
Can you provide an example on how do change width of header children (group buttons) and scale of the header itself that works mid-combat?

That would be awesome indeed.

I'm not sure if you are able to just call header:SetAttribute(key,value)

Are you talking about sth like this?
Lua Code:
  1. local stateFrame = CreateFrame("Frame", nil, nil, "SecureHandlerStateTemplate")
  2. RegisterStateDriver(stateFrame , "raidsize", "[@raid26,exists] r26; [@raid11,exists] r11; [group:raid] r1")
  3. stateFrame:SetAttribute("_onstate-raidsize", [[ -- arguments: self, stateid, newstate
  4.     local ref = self:GetFrameRef("raidHeader")
  5.     if newstate == "r26" then
  6.       --raid unit 26 found
  7.       ref:SetScale(0.8)
  8.     elseif newstate == "r11" then
  9.       --raid unit 11 found
  10.       ref:SetScale(0.9)
  11.     elseif newstate == "r1" then
  12.       --other case
  13.       ref:SetScale(1)
  14.     end
  15. ]])
  16. stateFrame:SetFrameRef("raidHeader", myRaidFrameHeader)

Secure handler documentation:
http://www.iriel.org/wow/docs/Secure...ide-4.0-r1.pdf
http://wowprogramming.com/docs/secur...ureStateHeader
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-08-13 at 02:21 AM.
  Reply With Quote
10-08-13, 02:15 AM   #7
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
I checked FreebGrid. He is doing
Lua Code:
  1. local setHeaderScale = function(scale)
  2.     for k, v in pairs(ns._Headers) do
  3.         if v then
  4.             v:SetScale(scale)
  5.         end
  6.     end
  7. end
  8.  
  9. function ns:scaleRaid()
  10.     if not ns.db.scaleYes then
  11.         setHeaderScale(ns.db.scale)
  12.         return
  13.     end
  14.  
  15.     local numRaiders = GetNumGroupMembers()
  16.  
  17.     if numRaiders > 25 then
  18.         setHeaderScale(ns.db.scale40)
  19.     elseif numRaiders > 10 then
  20.         setHeaderScale(ns.db.scale25)
  21.     else
  22.         setHeaderScale(ns.db.scale)
  23.     end
  24. end
  25.  
  26. local updateRaid = CreateFrame"Frame"
  27. updateRaid:RegisterEvent("GROUP_ROSTER_UPDATE")
  28. updateRaid:RegisterEvent("PLAYER_ENTERING_WORLD")
  29. updateRaid:SetScript("OnEvent", function(self)
  30.     if(InCombatLockdown()) then
  31.         self:RegisterEvent('PLAYER_REGEN_ENABLED')
  32.     else
  33.         self:UnregisterEvent('PLAYER_REGEN_ENABLED')
  34.  
  35.         ns:scaleRaid()
  36.     end
  37. end)

So basically waiting for out of combat to change the scale of a raid.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
10-09-13, 04:16 AM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by zork View Post
Is changing of attributes allowed mid-combat?
Can you provide an example on how do change width of header children (group buttons) and scale of the header itself that works mid-combat?
Not sure how much is possible in combat, but how often are you really changing raid types in the middle of an important fight?
__________________
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.
  Reply With Quote
10-09-13, 05:47 AM   #9
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
@Phanx
In battlegrounds this will happen pretty often. This can crush your raidframes. I changed my raid spawn and applied Freeb's solution.

Lua Code:
  1. --updateRaidScale
  2.     local updateRaidScale = CreateFrame("Frame")
  3.     updateRaidScale:RegisterEvent("GROUP_ROSTER_UPDATE")
  4.     updateRaidScale:RegisterEvent("PLAYER_ENTERING_WORLD")
  5.     updateRaidScale:SetScript("OnEvent", function(self)
  6.       if(InCombatLockdown()) then
  7.         self:RegisterEvent("PLAYER_REGEN_ENABLED")
  8.       else
  9.         self:UnregisterEvent("PLAYER_REGEN_ENABLED")
  10.         local num = GetNumGroupMembers()
  11.         local scale = (100-num)/100*cfg.units.raid.scale
  12.         for idx, group in pairs(groups) do
  13.           if group then
  14.             group:SetScale(scale)
  15.           end
  16.         end
  17.       end
  18.     end)

http://code.google.com/p/rothui/sour...s/raid.lua#424
@Wimpface
I spawn 8 group headers for the raid. The important attribute is the groupFilter. It is set to the current index of the loop. Thus groupFilter = 1 will only show units that are actually in group1. Thus my raidframes show the same units in each raid group as the Blizzard raidframes.

If you don't care about the units in each group you can just use a single group header instead of 8. It will contain all your group header units and the attributes define how they are sorted/positioned.

http://wowprogramming.com/docs/secur.../Group_Headers

A simple single group header raid spawn would be this:
Lua Code:
  1. --spawn
  2.  
  3.   local raidGroupHeader = oUF:SpawnHeader(
  4.     "MyFantasticRaidGroupHeaderName", --put your raid group header name here
  5.     nil,
  6.     "custom [group:raid] show; hide",
  7.     "showPlayer",         false, --in a party, show the player unit?
  8.     "showSolo",           false, --show while soloing
  9.     "showParty",          false, --show in party
  10.     "showRaid",           true,  --show in raid
  11.     "point",              "TOP",
  12.     "yOffset",            10,
  13.     "xoffset",            10,
  14.     "unitsPerColumn",     5,
  15.     "columnSpacing",      10,
  16.     "columnAnchorPoint",  "LEFT",
  17.     "oUF-initialConfigFunction", ([[
  18.       self:SetWidth(%d)
  19.       self:SetHeight(%d)
  20.     ]]):format(128, 64)
  21.   )
  22.   raidGroupHeader:SetPoint("TOPLEFT",0,0) --topleft of UIPARENT

If you forget to apply a setpoint your raidframe will be invisible because it does not know where to be painted on the canvas.

You can still sort/group units in your raid by using group header attributes. Experiment with offsets and points.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-09-13 at 06:15 AM.
  Reply With Quote
10-09-13, 02:52 PM   #10
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Ah, thank you. I didn't know I had to SetPoint after I spawned them, because I thought if I did that it wouldn't update on the event call. Turns out it did!

Now the only thing not working is the resize. I'm guessing I'm using SetAttribute in a bad way, because the raid frames don't change size depending on the amount of raid members. They do change position though, so the rest of the code works fine.

This is the code I've got right now:
lua Code:
  1. oUF:RegisterStyle('opRaidDPS', Shared)
  2. oUF:SetActiveStyle('opRaidDPS')
  3.  
  4. local playerClass = select(3, UnitClass('player'))
  5.  
  6. --spawn
  7.  
  8. local raidGroupHeader = oUF:SpawnHeader(
  9.     "oUF_OpieRaidHeader", --put your raid group header name here
  10.     nil,
  11.     "custom [group:raid] show; hide",
  12.     'showPlayer', true,
  13.     'showSolo', true,
  14.     'showParty', false,
  15.     'showRaid', true,
  16.     'yOffset', -4,
  17.     'maxColumns', 8,
  18.     'unitsPerColumn', 5,
  19.     'groupBy', 'GROUP',
  20.     'groupingOrder', "1,2,3,4,5,6,7,8",
  21.     'columnSpacing', 3,
  22.     'columnAnchorPoint', 'LEFT', --]]
  23.         'oUF-initialConfigFunction', ([[
  24.                 self:SetHeight(24)
  25.                 self:SetWidth(78)
  26.         ]])
  27. )          
  28. raidGroupHeader:SetPoint('TOP', oUF_opUnitFramesPlayer, 'BOTTOM', 0, -10) --topleft of UIPARENT
  29.  
  30. local raidResize = function(self, event, ...)  
  31.     local raidSize = GetNumGroupMembers()
  32.    
  33.     if raidSize <= 10 then
  34.         raidGroupHeader:SetPoint('TOP', oUF_opUnitFramesPlayer, 'BOTTOM', 0, -10)
  35.         raidGroupHeader:SetAttribute('initial-width', 78)
  36.         raidGroupHeader:SetAttribute('initial-height', 24)
  37.     elseif raidSize > 10 then
  38.         if playerClass == 9 or playerClass == 3 or playerClass == 6 then
  39.             raidGroupHeader:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -28)
  40.         else
  41.             raidGroupHeader:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -5)
  42.         end
  43.         raidGroupHeader:SetAttribute('initial-width', 100)
  44.         raidGroupHeader:SetAttribute('initial-height', 20)
  45.     end
  46. end
  47.  
  48. local updateRaid = CreateFrame("Frame")
  49. updateRaid:RegisterEvent("GROUP_ROSTER_UPDATE")
  50. updateRaid:RegisterEvent("PLAYER_ENTERING_WORLD")
  51. updateRaid:SetScript("OnEvent", function(self)
  52.     if(InCombatLockdown()) then
  53.         self:RegisterEvent('PLAYER_REGEN_ENABLED')
  54.     else
  55.         self:UnregisterEvent('PLAYER_REGEN_ENABLED')
  56.  
  57.         raidResize()
  58.     end
  59. end)

As you can see, I call SetAttribute twice. Once for width and once for height. Is it possible to do it with just one call? Or is it meant to be two? I'm unsure.

As it stands right now, it doesn't change any attributes apart from position when more members join. It's not a massive deal, as the frames are definitely functional now, but I'd like to see if I could change them around more.

Also, thanks for the explanation of the pairs thing. I suspected it had to do with tables.
EDIT: Asked mods to move the pairs question and explanation into it's own thread.
__________________
All I see is strobe lights blinding me in my hindsight.

Last edited by Wimpface : 10-09-13 at 03:14 PM.
  Reply With Quote
10-09-13, 09:27 PM   #11
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by zork View Post
@Phanx
In battlegrounds this will happen pretty often. This can crush your raidframes.
Good point, though I'd argue that it's still not a significant issue, since each battleground has a fixed raid size... when you join AV apply the 40-player raid attributes, when you join AB apply the 15-player raid attributes, etc.
__________________
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.
  Reply With Quote
10-10-13, 02:00 AM   #12
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Kept experimenting, scrapped the initial-width/height stuff and went with the oUF attribute thing.

lua Code:
  1. local raidResize = function(self, event, ...)  
  2.     local raidSize = GetNumGroupMembers()
  3.    
  4.     if raidSize <= 10 then
  5.         raidGroupHeader:SetPoint('TOP', oUF_opUnitFramesPlayer, 'BOTTOM', 0, -10)
  6.         raidGroupHeader:SetAttribute('oUF-initialConfigFunction', ([[
  7.                 self:SetHeight(24)
  8.                 self:SetWidth(78)
  9.         ]]))
  10.         --raidGroupHeader:SetAttribute('initial-width', 78)
  11.         --raidGroupHeader:SetAttribute('initial-height', 24)
  12.     elseif raidSize > 10 then
  13.         if playerClass == 9 or playerClass == 3 or playerClass == 6 then
  14.             raidGroupHeader:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -28)
  15.         else
  16.             raidGroupHeader:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -5)
  17.         end
  18.         --raidGroupHeader:SetAttribute('initial-width', 100)
  19.         --raidGroupHeader:SetAttribute('initial-height', 20)
  20.         raidGroupHeader:SetAttribute('oUF-initialConfigFunction', ([[
  21.                 self:SetHeight(20)
  22.                 self:SetWidth(100)
  23.         ]]))
  24.     end
  25. end
  26.  
  27. local updateRaid = CreateFrame("Frame")
  28. updateRaid:RegisterEvent("GROUP_ROSTER_UPDATE")
  29. updateRaid:RegisterEvent("PLAYER_ENTERING_WORLD")
  30. updateRaid:SetScript("OnEvent", function(self)
  31.     if(InCombatLockdown()) then
  32.         self:RegisterEvent('PLAYER_REGEN_ENABLED')
  33.     else
  34.         self:UnregisterEvent('PLAYER_REGEN_ENABLED')
  35.  
  36.         raidResize()
  37.     end
  38. end)

Mixed results! One the one hand, it does resize the frames now. On the other hand, it doesn't resize the original 10 frames, but only the frames that spawn after that.

I was thinking of somehow moving the function up in the code too, but I'm not sure how that's possible. I'd like to be able to use this code to change the text positioning and tag I use, but I have no idea how to do that.
Can you do function calls in the Shared function? No, right? I assume nested functions are bad.

Would it perhaps be better to have separate layouts for 10 and 25man for what I want to accomplish?
__________________
All I see is strobe lights blinding me in my hindsight.
  Reply With Quote
10-10-13, 03:26 AM   #13
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
Use two styles and custom visibility.

Lua Code:
  1. local Style1 = function(self)
  2.     --blah blah
  3. end
  4.  
  5. local Style2 = function(self)
  6.     --blah blah
  7. end
  8.  
  9. oUF:RegisterStyle('opRaidDPS1', Style1)
  10. oUF:RegisterStyle('opRaidDPS2', Style2)
  11.  
  12. -- Set Style1
  13. oUF:SetActiveStyle('opRaidDPS1')
  14.  
  15. local raidGroupHeader1 = oUF:SpawnHeader("oUF_OpieRaidHeader1",
  16.     nil,
  17.     "custom [@raid11,exists] hide;[@raid1,exists] show; hide",
  18.  
  19.     --blah blah
  20.  
  21.     'oUF-initialConfigFunction', ([[
  22.         self:SetHeight(24)
  23.         self:SetWidth(78)
  24.     ]])
  25. )
  26.  
  27. -- Switch to Style2
  28. oUF:SetActiveStyle('opRaidDPS2')
  29.  
  30. local raidGroupHeader2 = oUF:SpawnHeader("oUF_OpieRaidHeader2",
  31.     nil,
  32.     "custom [@raid11,exists] show; hide",
  33.  
  34.     --blah blah
  35.  
  36.     'oUF-initialConfigFunction', ([[
  37.         self:SetHeight(20)
  38.         self:SetWidth(100)
  39.     ]])
  40. )
  Reply With Quote
10-10-13, 04:38 AM   #14
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Ah, didn't realize you could have two styles. Welp.

EDIT: This would've actually solved all my troubles much earlier. Silly.
__________________
All I see is strobe lights blinding me in my hindsight.

Last edited by Wimpface : 10-10-13 at 04:43 AM.
  Reply With Quote
10-10-13, 07:01 PM   #15
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
So, I went with the two styles method and it works for 25mans and up, but my 10man no longer spawns.

lua Code:
  1. oUF:RegisterStyle('opRaidDPS10', opRaid10)
  2. oUF:RegisterStyle('opRaidDPS25', opRaid25)
  3.  
  4. --spawn 10man
  5. oUF:SetActiveStyle('opRaidDPS10')
  6.  
  7. local raid10Header = oUF:SpawnHeader(
  8.     "oUF_OpieRaid10Header",
  9.     nil,
  10.     "custom [@raid11,exists] hide;[@raid1,exists] show; hide",
  11.     'showPlayer', true,
  12.     'showSolo', false,
  13.     'showParty', false,
  14.     'showRaid', true,
  15.     'yOffset', -3,
  16.     'maxColumns', 8,
  17.     'unitsPerColumn', 5,
  18.     'groupBy', 'GROUP',
  19.     'groupingOrder', "1,2,3,4,5,6,7,8",
  20.     'columnSpacing', 3,
  21.     'columnAnchorPoint', 'LEFT',
  22.         'oUF-initialConfigFunction', ([[
  23.                 self:SetHeight(24)
  24.                 self:SetWidth(78)
  25.         ]])
  26. )          
  27. raid10Header:SetPoint('TOP', oUF_opUnitFramesPlayer, 'BOTTOM', 0, -10) -- top of header set to bottom of player frame
  28.  
  29. --spawn 25man
  30. oUF:SetActiveStyle('opRaidDPS25')
  31.  
  32. local raid25Header = oUF:SpawnHeader(
  33.     "oUF_OpieRaid25Header",
  34.     nil,
  35.     "custom [@raid11,exists] show; hide",
  36.     'showPlayer', true,
  37.     'showSolo', false,
  38.     'showParty', false,
  39.     'showRaid', true,
  40.     'yOffset', -3,
  41.     'xOffset', 0,
  42.     'point', 'TOP',
  43.     'maxColumns', 8,
  44.     'unitsPerColumn', nil,
  45.     'groupBy', 'GROUP',
  46.     'groupingOrder', "1,2,3,4,5,6,7,8",
  47.     'columnSpacing', 3,
  48.     'columnAnchorPoint', 'TOP',
  49.         'oUF-initialConfigFunction', ([[
  50.                 self:SetHeight(16)
  51.                 self:SetWidth(100)
  52.         ]])
  53. )  
  54. if playerClass == 9 or playerClass == 3 or playerClass == 6 then
  55.     raid25Header:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -28)
  56. else
  57.     raid25Header:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -5)
  58. end

I guessed that this had to do with calling SetActiveStyle twice, so I tried calling it on event instead, but that didn't work either.

lua Code:
  1. local raidResize = function(self, event, ...)  
  2.     local raidSize = GetNumGroupMembers()
  3.    
  4.     if raidSize <= 10 then
  5.         oUF:SetActiveStyle('opRaidDPS10')
  6.     elseif raidSize > 10 then
  7.         oUF:SetActiveStyle('opRaidDPS25')
  8.     end
  9. end
  10.  
  11. local updateRaid = CreateFrame("Frame")
  12. updateRaid:RegisterEvent("GROUP_ROSTER_UPDATE")
  13. updateRaid:RegisterEvent("PLAYER_ENTERING_WORLD")
  14. updateRaid:SetScript("OnEvent", function(self)
  15.     if(InCombatLockdown()) then
  16.         self:RegisterEvent('PLAYER_REGEN_ENABLED')
  17.     else
  18.         self:UnregisterEvent('PLAYER_REGEN_ENABLED')
  19.  
  20.         raidResize()
  21.     end
  22. end)

It might just be something small and stupid, as a lot of my errors are, but I can't spot it if that's the case.

Here's what 25man looks like: http://www.abload.de/img/wowscrnshot_101113_02s3uhr.jpg
Here's what 10man looks like: http://www.abload.de/img/wowscrnshot_101113_028bjce.jpg
Here's what 10man should look like: http://www.abload.de/img/wowscrnshot_100913_22p3j55.jpg

Full code: http://pastebin.com/7XXd2zxd
__________________
All I see is strobe lights blinding me in my hindsight.
  Reply With Quote
10-10-13, 09:11 PM   #16
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
SetActiveStyle does not actually spawn or activate anything. It's just telling oUF which style to use on the next oUF:Spawn call. Try this visibility for 10 man.

Code:
custom [@raid11,exists] hide;[group:raid] show; hide
  Reply With Quote
10-10-13, 09:36 PM   #17
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Didn't work, no error as usual, they just don't spawn. Or show.

EDIT: Figured the issue! It doesn't seem to recognize oUF_opUnitFramesPlayer as a valid frame to anchor to. It spawns if I use UIParent. Reason this is weird to me is because it worked before this last change.

So I guess this issue's resolved. Just wait until another one pops up!
__________________
All I see is strobe lights blinding me in my hindsight.

Last edited by Wimpface : 10-10-13 at 09:39 PM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » More oUF troubles!


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