Thread Tools Display Modes
02-20-11, 07:51 PM   #1
villiv
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 14
Any performance wise differences between Header and Single spawning for a group?

Just wandering, Bliz's "CompactUnitFrame" is a single secure-unit-button and they build party/raid frames with it.
And we can build party/raid frame with a header spawning or some single spawnings but which is the better way?

(Sorry for my bad English. Please let me know if my question is not clear one)
  Reply With Quote
02-21-11, 05:44 AM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
You don't really need to wonder about this. Spawning party/raid frames through headers is the most valid solution for us. Consider the following:

- Using headers: We create one header which then creates up to N unit buttons depending on our header settings and number of existing units.
- Using single spawn: We create N unit buttons depending on our setup, regardless of unit existence.

Generally both oUF and CompactFrames have the same solution, but we're required to go through the secure API provided to actually create frames while in combat.

(sent from my phone)
__________________
「貴方は1人じゃないよ」
  Reply With Quote
02-21-11, 08:16 PM   #3
villiv
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 14
Thanks for your reply, haste. I'll try to spawn them as a header with no worry. =)

Btw, I was going to spawn them as singles because I was failed to spawn party-target header.

Code:
oUF:Factory(function (self)
	self:SetActiveStyle('MyPartyTargetStyle')

	local partytarget = self:SpawnHeader(
		nil, nil, nil,
		'showParty', true, 'showPlayer', true,
		'point', 'TOP', 'yOffset', -36,
		'oUF-initialConfigFunction', [[
			self:SetAttribute('unitsuffix', 'target')
			self:SetWidth(84)
			self:SetHeight(24)
		]]
	)

	partytarget:SetPoint('LEFT', 30, 0)
	partytarget:Show()
end)
I think it was because of my fault but:
- These party-targets have not 'partytarget' as 'oUF-guessUnit' attribute.
- It seems 'enableTargetUpdate' function not works correctly. Though 'OnShow' update works.
(I mean when I have no target and then target someone, it's updated correctly. But when I chenge the target to the another one, it's not updated correctly)

Anyway, I'm sure I need farther testing. I'll post again when I find something useful to share.
  Reply With Quote
02-21-11, 09:38 PM   #4
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
You have to do this with xml. This is what I use for partypets and partytargets:
xml Code:
  1. <Ui xmlns="http://www.blizzard.com/wow/ui/">
  2.     <Button name="oUF_Party" inherits="SecureUnitButtonTemplate" hidden="true" virtual="true">
  3.         <Frames>
  4.             <Button name="$parentPet" inherits="SecureUnitButtonTemplate">
  5.                 <Anchors>
  6.                     <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent">
  7.                         <Offset>
  8.                             <AbsDimension x="0" y="-7.5"/>
  9.                         </Offset>
  10.                     </Anchor>
  11.                 </Anchors>
  12.                 <Attributes>
  13.                     <Attribute name="unitsuffix" type="string" value="pet"/>
  14.                     <Attribute name="useparent-unit" type="boolean" value="true"/>
  15.                     <Attribute name="type1" type="string" value="target"/>
  16.                     <Attribute name="initial-unitWatch" type="boolean" value="true"/>
  17.                 </Attributes>
  18.             </Button>
  19.             <Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
  20.                 <Anchors>
  21.                     <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent">
  22.                         <Offset>
  23.                             <AbsDimension x="0" y="-27.5"/>
  24.                         </Offset>
  25.                     </Anchor>
  26.                 </Anchors>
  27.                 <Attributes>
  28.                     <Attribute name="unitsuffix" type="string" value="target"/>
  29.                     <Attribute name="useparent-unit" type="boolean" value="true"/>
  30.                     <Attribute name="type1" type="string" value="target"/>
  31.                     <Attribute name="initial-unitWatch" type="boolean" value="true"/>
  32.                 </Attributes>
  33.             </Button>
  34.         </Frames>
  35.     </Button>
  36. </Ui>

then just declare "template", "oUF_Party" within SpawnHeader for your party frames
  Reply With Quote
02-22-11, 02:54 AM   #5
villiv
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 14
Thanks for your help, Rainrider. =)

I know, many layout uses xml and works fine.
But for me, spawning by lua is easier way to control these frames after spawning.

When I looked a thread, I thought it can be done by lua only ... but maybe I'm wrong.
  Reply With Quote
02-23-11, 08:51 AM   #6
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
It doesn't really matter how you spawn them in terms of adressing them. You don't have to spawn them via xml - self:SetAttribute('unitsuffix', 'target')
- is another way, indeed.

I think your "nil, nil, nil," is the problem, try "nil, nil, party,".
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
02-23-11, 11:10 AM   #7
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Please let me know if this works for you. I tried to spawn partytargets, partypets and mttargets with lua and they get spawned but are never visible. Doing it with xml templates works just fine.

Btw nice catch Dawn but shouldn't the visibility option be a string (nil, nil, "party" instead of "nil, nil, party")? The first nil is supposed to be the frame name. What is the second for? Type of template to be used?
  Reply With Quote
02-23-11, 11:17 AM   #8
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
I was just looking at it quickly and giving a hint, no "case-sensitiv-copy&paste ready" code.

I personally spawn MT targets without xml, just fine.

Code:
	local MainTankTarget = self:SpawnHeader("oUF_MainTankTarget", nil, 'raid, party', 
		'showRaid', true, 
		"groupFilter", "MAINTANK", 
		'yOffset', -16, 
		'oUF-initialConfigFunction', ([[
			self:SetWidth(%d)
			self:SetHeight(%d)
			self:SetAttribute('unitsuffix', 'target')
		]]):format(140, 18))		
	MainTankTarget:SetPoint("TOPRIGHT", oUF_MainTank, "TOPLEFT", -20, 0)
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
02-23-11, 02:04 PM   #9
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
https://github.com/haste/oUF/issues/74

I probably won't be able to take a proper look until Saturday or Friday.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
02-23-11, 02:05 PM   #10
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Also, health will update as long as you use frequentUpdates in the current version.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
02-23-11, 03:13 PM   #11
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Hm, I managed to spawn MTT and party pets through headers. When I try to spawn party target though, I get this:
1x oUF-1.5.8\ouf.lua:468: CreateFrame(): Couldn't find inherited node "party"
oUF-1.5.8\ouf.lua:468: in function `SpawnHeader'
oUF_Rain-pre alpha\oUF_Rain.lua:264: in function `func'
oUF-1.5.8\factory.lua:17: in function <oUF\factory.lua:13>
(tail call): ?:

Locals:
self = "oUF_Rain_PartyTargets"
overrideName = nil
template = "party,raid"
visibility = "showParty"
isPetHeader = nil
name = "oUF_Rain"
style = "Rain"
error = <function> @ oUF\private.lua:20:
generateName = <function> @ oUF\ouf.lua:345:
select = <function> defined =[C]:-1
styleProxy = <function> @ oUF\ouf.lua:404:
initialConfigFunction = " local header = self:GetParent()
local frames = table.new()
table.insert(frames, self)
self:GetChildList(frames)
for i=1, #frames do
local frame = frames[i]
local unit
-- There's no need to do anything on frames with onlyProcessChildren
if(not frame:GetAttribute'oUF-onlyProcessChildren') then
RegisterUnitWatch(frame)

-- Attempt to guess what the header is set to spawn.
if(header:GetAttribute'showRaid') then
unit = 'raid'
elseif(header:GetAttribute'showParty') then
unit = 'party'
end

local headerType = header:GetAttribute'oUF-headerType'
local suffix = frame:GetAttribute'unitsuffix'
if(unit and suffix) then
if(headerType == 'pet' and suffix == 'target') then
unit = unit .. headerType .. suffix
else
unit = unit .. suffix
end
elseif(unit and headerType == 'pet') then
unit = unit .. headerType
end

frame:SetAttribute('*type1', 'target')
frame:SetAttribute('*type2', 'menu')
getCondition = <function> @ oUF\ouf.lua:329:

---
Here the code I use to spawn the headers:
lua Code:
  1. if (cfg.showParty) then
  2.         local party = self:SpawnHeader("oUF_Rain_Party", nil, "party,raid",
  3.             "showParty", true,
  4.             "showRaid", true,
  5.             "showPlayer", true,
  6.             "showSolo", true,
  7.             "maxColumns", 5,
  8.             "unitsPerColumn", 1,
  9.             "columnAnchorPoint", "LEFT",
  10.             "columnSpacing", 7.5,
  11.             "oUF-initialConfigFunction", [[
  12.                 self:SetWidth(110)
  13.                 self:SetHeight(22)
  14.             ]]
  15.         )
  16.         party:SetPoint("LEFT", UIParent, "CENTER", -231.25, -250)
  17.         party:Show()
  18.     end
  19.  
  20.     if (cfg.showParty and cfg.showPartyTargets) then
  21.         local partyTargets = self.SpawnHeader(
  22.             "oUF_Rain_PartyTargets", nil, "party,raid",
  23.             "showParty", true,
  24.             "showRaid", true,
  25.             "showPlayer", true,
  26.             "showSolo", true,
  27.             "maxColumns", 5,
  28.             "unitsPerColumn", 1,
  29.             "columnAnchorPoint", "LEFT",
  30.             "columnSpacing", 7.5,
  31.             "oUF-initialConfigFunction", [[
  32.                 self:SetWidth(110)
  33.                 self:SetHeight(22)
  34.                 self:SetAttribute("unitsuffix", "target")
  35.             ]]
  36.         )
  37.         partyTargets:SetPoint("TOPLEFT", "oUF_Rain_Party", "BOTTOMLEFT", 0, -27.5)
  38.         partyTarget:Show()
  39.     end
  40.  
  41.     if (cfg.showParty and cfg.showPartyPets) then
  42.         local partyPets = self:SpawnHeader(
  43.             "oUF_Rain_PartyPets", nil, "party,raid",
  44.             "showParty", true,
  45.             "showRaid", true,
  46.             "showPlayer", true,
  47.             "showSolo", true,
  48.             "maxColumns", 5,
  49.             "unitsPerColumn", 1,
  50.             "columnAnchorPoint", "LEFT",
  51.             "columnSpacing", 7.5,
  52.             "oUF-initialConfigFunction", [[
  53.                 self:SetWidth(110)
  54.                 self:SetHeight(11)
  55.                 self:SetAttribute("unitsuffix", "pet")
  56.             ]]
  57.         )
  58.         partyPets:SetPoint("TOPLEFT", "oUF_Rain_Party", "BOTTOMLEFT", 0, -7.5)
  59.         partyPets:Show()
  60.     end
  61.    
  62.     if (cfg.showMT) then
  63.         local mainTanks = self:SpawnHeader(
  64.             "oUF_Rain_MT", nil, "raid",
  65.             "showRaid", true,
  66.             "groupFilter", "MAINTANK",
  67.             "yOffset", -7.5,
  68.             "oUF-initialConfigFunction", [[
  69.                 self:SetWidth(110)
  70.                 self:SetHeight(22)
  71.             ]]
  72.         )
  73.         mainTanks:SetPoint("TOPLEFT", UIParent, "LEFT", 50, -50)
  74.         mainTanks:Show()
  75.     end
  76.    
  77.     if (cfg.showMT and cfg.showMTT) then
  78.         local mainTankTargets = self:SpawnHeader(
  79.             "oUF_Rain_MTT", nil, "raid",
  80.             "showRaid", true,
  81.             "groupFilter", "MAINTANK",
  82.             "yOffset", -7.5,
  83.             "oUF-initialConfigFunction", [[
  84.                 self:SetWidth(110)
  85.                 self:SetHeight(22)
  86.                 self:SetAttribute("unitsuffix", "target")
  87.             ]]
  88.         )
  89.         mainTankTargets:SetPoint("TOPLEFT", "oUF_Rain_MT", "TOPRIGHT", 7.5, 0)
  90.         mainTankTargets:Show()
  91.     end

So it's not me, it's just bugged?
  Reply With Quote
02-23-11, 03:15 PM   #12
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
self.SpawnHeader( is not equal to self:SpawnHeader(
__________________
「貴方は1人じゃないよ」
  Reply With Quote
02-23-11, 07:00 PM   #13
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Ooooh maaaan. I definitely need an optician Everything works now, thank you very much for looking into it
  Reply With Quote
03-13-11, 09:10 AM   #14
villiv
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 14
Thanks haste, with latest git it works.

Now, I'm worry about having the units like 'playerpet' or 'playertarget' though.
  Reply With Quote
03-13-11, 09:51 AM   #15
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Should be solved on git.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
03-13-11, 08:36 PM   #16
villiv
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 14
Sorry about my useless report that was sent while you are still coding.
I'll test it as soon as I can.

Edit: I overlooked the thread about git testing.
Yes, the title of this thread makes no sense anymore.

Last edited by villiv : 03-13-11 at 08:50 PM.
  Reply With Quote
03-14-11, 01:53 AM   #17
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
I pushed the fix due to you reporting it.

It's also better to report errors, even if you are uncertain why they are happening. I'd rather have too many error reports, than too few.
__________________
「貴方は1人じゃないよ」
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Any performance wise differences between Header and Single spawning for a group?

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