WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   about 'SecureGroupHeaderTemplate' (https://www.wowinterface.com/forums/showthread.php?t=54106)

Layback_ 08-03-16 02:05 AM

about 'SecureGroupHeaderTemplate'
 
Hi all,

I finally started to make party frame with oUF and here's what it looks so far.

Lua Code:
  1. C.Party = oUF:SpawnHeader(
  2.     "testParty",
  3.     nil,
  4.     "custom [group:party,nogroup:raid] show; hide",
  5.     -- attributes
  6.     "initial-width", G["unitframe"]["party"]["width"],
  7.     "initial-height", G["unitframe"]["party"]["height"],
  8.     "oUF-initialConfigFunction", [[
  9.         local header = self:GetParent();
  10.         self:SetWidth(header:GetAttribute("initial-width"));
  11.         self:SetHeight(header:GetAttribute("initial-height"));
  12.     ]],
  13.     "showRaid", false,
  14.     "showParty", true,
  15.     "showSolo", false,
  16.     "showPlayer", true,
  17.     "point", "TOP",
  18.     "xOffset", 0,
  19.     "yOffset", -40
  20. );
  21. C.Party:SetPoint(unpack(G["unitframe"]["party"]["point"]));

The one thing that I am currently unhappy with is that it adds "UnitButton" to each party frame's name.



I thought this was because of "SecureGroupHeaderTemplate", thus I have dug into Blizzard's interface code and found the following lines of code from SecureGroupHeaders.lua

Lua Code:
  1. -- ensure there are enough buttons
  2. local needButtons = max(1, numDisplayed);
  3. if not ( self:GetAttribute("child"..needButtons) ) then
  4.     local buttonTemplate = self:GetAttribute("template");
  5.     local templateType = self:GetAttribute("templateType") or "Button";
  6.     local name = self:GetName();
  7.     for i = 1, needButtons, 1 do
  8.         local childAttr = "child" .. i;
  9.         if not ( self:GetAttribute(childAttr) ) then
  10.             local newButton = CreateFrame(templateType, name and (name.."UnitButton"..i), self, buttonTemplate);
  11.             self[i] = newButton;
  12.             SetupUnitButtonConfiguration(self, newButton);
  13.             setAttributesWithoutResponse(self, childAttr, newButton, "frameref-"..childAttr, GetFrameHandle(newButton));
  14.         end
  15.     end
  16. end

To be honest, I don't think I can create my own custom template with my current skills, but really would like to get rid of that "UnitButton" text from frame's name.

If anyone could suggest a workaround, I would really appreciate it!

Thank you.

Torhal 08-03-16 03:15 AM

Why, though? Are you going to be displaying the frame's name in-game? This is really just an implementation detail that allows you to more easily target those frames using code.

Layback_ 08-03-16 03:32 AM

Quote:

Originally Posted by Torhal (Post 317371)
Why, though? Are you going to be displaying the frame's name in-game? This is really just an implementation detail that allows you to more easily target those frames using code.

Hi Torhal,

Yeah, you are totally right. Changing the name of the frame won't improve any of game performances and I won't be displaying the name in-game like you said.

I honestly dunno how I should explain this, but arrrrrr.... I don't know....
(Could possibly be 'mysophobia' thing...)

If there is no such straightforward solution that is totally fine :D

Thank you for your reply!


All times are GMT -6. The time now is 01:37 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI