Reply
 
Thread Tools Display Modes
Unread 07-28-07, 06:15 AM   #1
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
WoWInterface Super Mod
Featured
Join Date: Jul 2005
Posts: 1,933
HOWTO: Change PerfectRaid's Visual Layout

Since I've gotten this question a bunch of times, but have not had the opportunity to get everything I'd like done with PerfectRaid, I wanted to post a quick tutorial on how the visual style of PerfectRaid is coded, and give you all an idea of how you can alter it to customize the visual style.

The layout is all done in module functions called UpdateButtonLayout, with the initial layout being done in PerfectRaid.lua. This function is called with the unit frame, which contains a number of member frames:

* button - the unit frame
* button.leftbox - A bounding box on the left-hand side of the frame. This is by default 70 pixels wide
* button.rightbox - A bounding box on the right-hand side of the frame. This is by default 70 pixels wide
* button.healthbar - The health bar, anchored in between the two bounding boxes.. so this will be the frame size - 140.
* button.manabar - The mana bar, anchored to the bottom of the health bar
* button.status - The "DEAD, GHOST and HPMISSING" text.. this is always anchored to the right of the health bar.
* button.name - The unit's name. This is anchored to one of the bounding boxes, depending on the "ALIGN RIGHT" option.
* button.aura - Defined in PerfectRaid_Buffs.lua, this is the "buffs" text that appears by default next to the right-hand side of the health bar.

That's all the stuff in PerfectRaid.lua, everythign else is provided by a module. Here's how you would change some common things:

How do I make the overall frame larger
This unfortunately is done by the secure templates, and needs to be changed outside the LayoutButton function. On PerfectRaid.lua:625 and PerfectRaid.lua:626 you will see lines:

Code:
button:SetAttribute("initial-width", 225)
button:SetAttribute("initial-height", 14)
These two attributes dictate how large the frame is width and height-wise. To make it larger, you simply change these numbers.

How do I put the name inside the health bar?
This one is pretty easy, actually but will take some tweaking to get it to look just right. First off, remember that the frame looks like this by default:

[leftbox][healthbar][rightbox]

and in default mode, the rightbox contains the buff text, and the leftbox contains the name. What you can do to experiment is, change the leftbox to 1 pixel width, and then anchor the name. Do this:

PerfectRaid.lua:697 - Change to button.leftbox:SetPoint("BOTTOMRIGHT", button, "BOTTOMLEFT", 1, 0)

PerfectRaid.lua:729/730 - Change these two lines to:
Code:
button.name:SetPoint("LEFT", button.healthbar, "LEFT", 0, 0)
button.name:SetPoint("RIGHT", button.healthbar, "RIGHT", 0, 0)
This should make the left bound box smaller, and anchor the name to the left hand side of the healthbar. If the name is too long, it will run into the status text, but you could fix this with anchoring.

How do I alter the code to allow dragging the frame off-screen
In PerfectRaid.lua, lines 340 and 670, the ClampedToScreen setting is set on both the button, and the header (if you don't understand these, it doesn't matter all that much). Simply comment those lines out by adding a -- at the start of them, and you should be able to drag PerfectRaid without having it dock to the screen. I will likely add an option for this relatively soon, when I have a spare moment.

Buff text
The buff text is layed out in PerfectRaid_Buffs.lua (in the Buffs:UpdateButtonLayout() function). In addition to handling the buff text, this also handles the setting and resetting of the highlight backdrops. This is done here, since those highlights are triggered from this module (also note, there is no PerfectRaid_Highlight.lua file, that options pane is defined in this file.

That's really it. What I could do, is provide a separate file that can be used to code layouts in Lua by providing a new master UpdateButtonLayout() function. This way, people could share their customizations on the PerfectRaid visual style. Would that be interesting to anyone?
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."

Last edited by Cladhaire : 07-28-07 at 06:21 AM.
Cladhaire is offline   Reply With Quote
Unread 08-19-07, 05:13 AM   #2
Twonky
A Kobold Labourer
Join Date: Jul 2007
Posts: 1
Originally Posted by Cladhaire
How do I put the name inside the health bar?
This one is pretty easy, actually but will take some tweaking to get it to look just right. First off, remember that the frame looks like this by default:

[leftbox][healthbar][rightbox]

and in default mode, the rightbox contains the buff text, and the leftbox contains the name. What you can do to experiment is, change the leftbox to 1 pixel width, and then anchor the name. Do this:

PerfectRaid.lua:697 - Change to button.leftbox:SetPoint("BOTTOMRIGHT", button, "BOTTOMLEFT", 1, 0)
It should be line 696.

Originally Posted by Cladhaire
PerfectRaid.lua:729/730 - Change these two lines to:
Code:
button.name:SetPoint("LEFT", button.healthbar, "LEFT", 0, 0)
button.name:SetPoint("RIGHT", button.healthbar, "RIGHT", 0, 0)
This should make the left bound box smaller, and anchor the name to the left hand side of the healthbar. If the name is too long, it will run into the status text, but you could fix this with anchoring.
You also have to change the next line (731) to
Code:
button.name:SetJustifyH("LEFT")
otherwise the names will be anchored right.

With this change Manabar is on top of the name, so the bigger the manabar the less you see of the name. Is there a possibilty to change this behaviour?

Last edited by Twonky : 08-19-07 at 08:03 AM.
Twonky is offline   Reply With Quote
Unread 08-19-08, 01:59 PM   #3
Vranx
A Black Drake
 
Vranx's Avatar
Join Date: May 2008
Posts: 82
Using the latest version of PRaid I have managed to get the name over the bar with the following changes:
Code:
Line 557
from - 	button:SetAttribute("initial-width", 225)
to - 	button:SetAttribute("initial-width", 170)

Line 632
from - button.leftbox:SetPoint("BOTTOMRIGHT", button, "BOTTOMLEFT", 70, 0)
to -   button.leftbox:SetPoint("BOTTOMRIGHT", button, "BOTTOMLEFT", 1, 0)

Lines 665-667
from - 
button.name:SetPoint("RIGHT", button.leftbox, "RIGHT", -2, 0)
button.name:SetPoint("LEFT", button.leftbox, "LEFT", 0, 0)
button.name:SetJustifyH("RIGHT")
to - 
button.name:SetPoint("LEFT", button.healthbar, "LEFT", 2, 1)
button.name:SetPoint("RIGHT", button.healthbar, "RIGHT", 0, 0)
button.name:SetJustifyH("LEFT")
Now I have class colored names over a class colored bar. How can I change the name color to white?
Vranx is offline   Reply With Quote
Unread 08-20-08, 01:32 AM   #4
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
WoWInterface Super Mod
Featured
Join Date: Jul 2005
Posts: 1,933
Isn't there an option for that? Disable the checkbox that colors names by class.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."
Cladhaire is offline   Reply With Quote
Unread 08-20-08, 07:28 PM   #5
Vranx
A Black Drake
 
Vranx's Avatar
Join Date: May 2008
Posts: 82
Im either blind (a good possibility) or the only option for class color is the bar.
Vranx is offline   Reply With Quote
Unread 08-21-08, 01:27 AM   #6
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
WoWInterface Super Mod
Featured
Join Date: Jul 2005
Posts: 1,933
You are probably correct. There's a function called PerfectRaid:GetColoredName(). Simply change that to have it return a white name instead of the class colored name.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."
Cladhaire is offline   Reply With Quote
Reply

Go BackWoWInterface » Featured Projects » Cladhaire's Mods » HOWTO: Change PerfectRaid's Visual Layout

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