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

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