Thread Tools Display Modes
07-28-07, 06:15 AM   #1
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
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.
  Reply With Quote
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.
  Reply With Quote
08-19-08, 01:59 PM   #3
Vranx
A Flamescale Wyrmkin
 
Vranx's Avatar
Join Date: May 2008
Posts: 101
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?
  Reply With Quote
08-20-08, 01:32 AM   #4
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
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..."
  Reply With Quote
08-20-08, 07:28 PM   #5
Vranx
A Flamescale Wyrmkin
 
Vranx's Avatar
Join Date: May 2008
Posts: 101
Im either blind (a good possibility) or the only option for class color is the bar.
  Reply With Quote
08-21-08, 01:27 AM   #6
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
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..."
  Reply With Quote
04-23-09, 03:43 PM   #7
Lunarion
A Deviate Faerie Dragon
 
Lunarion's Avatar
AddOn Compiler - Click to view compilations
Join Date: Mar 2008
Posts: 12
I know absolutely nothing about lua code.

That said I did get this to work.

I just don't know what to change about the PerfectRaid:GetColoredName() in order to get the names to show up white.

XD
__________________
  Reply With Quote
04-23-09, 03:49 PM   #8
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
Change

return string.format("%s|cFF%02x%02x%02x%s|r", group, color.r*255, color.g*255, color.b*255, UnitName(unit) or "Unknown")

to

return string.format("%s|cFFFFFF%s|r", group, UnitName(unit) or "Unknown")
__________________
"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..."
  Reply With Quote
05-07-09, 08:50 PM   #9
Vranx
A Flamescale Wyrmkin
 
Vranx's Avatar
Join Date: May 2008
Posts: 101
Originally Posted by Cladhaire View Post
return string.format("%s|cFFFFFF%s|r", group, UnitName(unit) or "Unknown")
I just tried this and it changed the name to white but it has the |cFFFFFF on the frame in front of the name.
  Reply With Quote
05-08-09, 02:25 AM   #10
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
i think it needs another set of FF's

|cFFFFFFFF
__________________
"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..."
  Reply With Quote
05-09-09, 08:14 AM   #11
Vranx
A Flamescale Wyrmkin
 
Vranx's Avatar
Join Date: May 2008
Posts: 101
That fixed it, thanks.
  Reply With Quote
05-16-09, 01:50 PM   #12
Exinferis
A Defias Bandit
Join Date: Jan 2009
Posts: 1
Sorry, I'm kind of new to editing LUA and want to change the names to be over the health bars. What program do you use to edit the lua files? I tried notepad/wordpad but they dont list the lines. I than downloaded WoW UI Designer but the lines dont seem to match up with the directions you provided.

Thanks in advance
  Reply With Quote
05-16-09, 02:51 PM   #13
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
I used to use Scite on windows. The line numbers will not match precisely, they have changed.
__________________
"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..."
  Reply With Quote
12-12-09, 02:49 PM   #14
Jooze
A Wyrmkin Dreamwalker
 
Jooze's Avatar
AddOn Compiler - Click to view compilations
Join Date: Jul 2007
Posts: 52
Just thought I'd share this here, it took ages for me to get this part
I wanted to change the colors of the bars (when it's not class colored), to white, shifting to red when the HP decreases.

I did this by changing the Dongle.Utils.GerSeverity(perc,class) function in
PerfectRaid_Utils.lua (around line 64).

It now looks like this:

Code:
function DongleUtils.GetHPSeverity(perc, class)
	--[[if not class then return DongleUtils.ColorGradient(perc, 1,0,0, 1,1,0, 0,1,0)
	else
		local c = RAID_CLASS_COLORS[class]
		return DongleUtils.ColorGradient(perc, 1,0,0, 1,1,0, c.r,c.g,c.b)
	end
	--]] 
	return DongleUtils.ColorGradient(perc, 1, 1, 1, 1, 1, 1, 1, 1, 1)
end
The color now shifts from white (max hp) over yellow to red
  Reply With Quote
12-12-09, 06:22 PM   #15
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
Great, thanks =)
__________________
"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..."
  Reply With Quote
01-24-10, 09:14 AM   #16
monya
A Kobold Labourer
 
monya's Avatar
Join Date: Dec 2006
Posts: 1
Me and my sexy undead priest love praid for years it seems and the only 2 things i came across, which irritate me:
- slightly more accurate (large) backdrop frame, cause first/last healthbars are not covered fully and beginnning of long names either...
- disabled mouseover or mouseclick activity between healthbars, cause sometimes i get tooltips when i hover between healthbars, if there is some raidmember there ^^. I got all tooltips disabled in combat due to that disadvantage, but even seconds before pull, when im still out of combat it irritates (tooltip i mean). What to say about sudden targeting of random guy...
Thanks in advance for implementing such options/fixes or for the way how to edit code to get it working.

P.S.: Ur addon is best ever! <3
  Reply With Quote
03-11-10, 09:04 AM   #17
Tag of Fire
A Defias Bandit
Join Date: Jun 2009
Posts: 2
Is there a way to prevent player names from being shortened with a triple dot?
I looked into the .lua files but I can't seem to find it...
  Reply With Quote
03-11-10, 09:09 AM   #18
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
Not trivially, no.
__________________
"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..."
  Reply With Quote

WoWInterface » 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