Thread Tools Display Modes
11-19-10, 11:43 PM   #1
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Party Pets Spawning

Me again with more tasty questions!

Ok, I spawn party pets not using a .xml template but by using the SecureGroupPetHeaderTemplate in the SpawnHeader option provided by oUF. All works fine, or did till...

I started sorting my Party Elements by Class. What happens now it's the Pet's are not parented to the owners but they simply are spawning where the header anchor is anchored to.

So... Code.

Party:

lua Code:
  1. -- Party Frames
  2.         if cfg.show_PartyFrame and not cfg.party_inRaid_instead then
  3.             self:SetActiveStyle('lumen - Party')
  4.             local party = oUF:SpawnHeader('oUF_Party', nil, "custom  [group:party,nogroup:raid][@raid6,noexists,group:raid] show;hide",
  5.             --local party = oUF:SpawnHeader('oUF_Party', nil, "party",
  6.             --local party = oUF:SpawnHeader('oUF_Party', nil, "solo", "showSolo", true,  -- debug
  7.             "showParty", cfg.show_PartyFrame,
  8.             "showPlayer", cfg.show_Player_inParty,
  9.             "xoffset", 7,
  10.             "columnSpacing", 7,
  11.             "groupBy", "CLASS",
  12.             "groupingOrder", "WARRIOR,DRUID,PALADIN,DEATHKNIGHT,SHAMAN,PRIEST,MAGE,WARLOCK,ROGUE,HUNTER", -- Trying to put classes that can tank first
  13.             "point", "LEFT",
  14.             "columnAnchorPoint", "TOP",
  15.             "oUF-initialConfigFunction", ([[
  16.             self:SetWidth(%d)
  17.             self:SetHeight(%d)
  18.             self:SetScale(%d)
  19.             ]]):format(cfg.party_width, cfg.party_height, cfg.scale))
  20.             party:SetPoint("CENTER", cfg.party_pos_x, cfg.party_pos_y)
  21.         end


Pets:

lua Code:
  1. if cfg.show_PartyPetsFrame and cfg.show_PartyFrame and not cfg.party_inRaid_instead then
  2.             self:SetActiveStyle('lumen - Partypet')
  3.             local pets = oUF:SpawnHeader('oUF_PartyPets', 'SecureGroupPetHeaderTemplate', "custom  [group:party,nogroup:raid][@raid6,noexists,group:raid] show;hide",
  4.             --local pets = oUF:SpawnHeader('oUF_PartyPets', 'SecureGroupPetHeaderTemplate', "solo", "showSolo", true,  -- debug
  5.             "showParty", cfg.show_PartyFrame,
  6.             "showPlayer", cfg.show_Player_inParty,
  7.             "xoffset", 7,
  8.             "columnSpacing", 7,
  9.             "point", "LEFT",
  10.             "columnAnchorPoint", "TOP",
  11.             "oUF-initialConfigFunction", ([[
  12.             self:SetWidth(%d)
  13.             self:SetHeight(%d)
  14.             self:SetScale(%d)
  15.             ]]):format(cfg.party_pets_width, cfg.party_pets_height, cfg.scale))
  16.             pets:SetPoint("TOPLEFT", "oUF_Party", "BOTTOMLEFT", 0, -6)
  17.         end


Anyone with a smart solution for this? Sorting the pets by class won't work for obvious reasons.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
11-20-10, 06:50 AM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
The solution is to use a XML template to spawn the partypet frames with the party frames. You can do this either through the old way of having the pet as a child of the party frame, or the new way of separate frames for them both. Take a look at oUF.xml for examples of both solutions.

You can also spawn them manually without using the pet header, and anchor them yourself.

You might also want to know that the party pet header currently is bugged, and will in many cases give you units that are named partypetpetN instead of partypetN. Making it pretty useless as that unitid will never exist.

The solution to this is to set the attribute 'useOwnerUnit' to true and set 'unitsuffix' to 'pet' on the frames spawned (through oUF-initialConfigurationFunction).
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-20-10, 07:14 AM   #3
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Got it. Will try one of those then. Thanks.

You know, I don't have anything against .xml templates, although I prefer coding over layouts, the only problem I have with it is that if I want to turn off the display of pets for example, errors will spawn I suppose?
__________________
My oUF Layout: oUF Lumen

Last edited by neverg : 11-20-10 at 07:41 AM.
  Reply With Quote
11-20-10, 08:48 AM   #4
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by neverg View Post
Got it. Will try one of those then. :) Thanks.

You know, I don't have anything against .xml templates, although I prefer coding over layouts, the only problem I have with it is that if I want to turn off the display of pets for example, errors will spawn I suppose?
You can:
a) Toggle the use of the template (init only).
b) Call UnregisterUnitWatch(frame) and frame:Hide() in oUF-initialConfigFunction (init only).
c) Call :Disable() on the pet frames out of combat.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-20-10, 01:12 PM   #5
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Thanks again haste. I'm going to try those tomorrow when I'm at home.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Party Pets Spawning


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