Thread Tools Display Modes
05-23-11, 06:55 PM   #1
Lordyfrb
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 71
Lightbulb Customising Stuf

Hi all,
After a long time of using Stuf Unit Frames, there's been alot of questions on how to do some things with it,
and some of the answers, although worked only did so much towards the original question leaving alot of things not working the way some users wanted.

i.e. Square Pixel borders on all elements, the method posted somewhere on this forum only seemed to create these borders on certain bars.

So the following posts are modifications I've made to Stuf to enable you todo stuff with Stuf that was not previously not do-able.

Unfortunately I have only 3 mods available at the moment, but if there are any other improvements you want let me know and I'll see if I can come up with something for you.

The first mod allows the user to attach panels to any of the elements that make up the unit frame.

The second mod allows the user to create pixel perfect borders around any element of the unit frame.

The third mod allows the user to anchor the unit frames from a point to any point on the screen, this one is the most advanced mod I've done.

These modifications require the editing of lua files with a text editor, and thus are really aimed at those who know a little amount of code editing, but should be doable by anyone.
For editing lua files I recommend using Notepad++ but there are plenty out there to chose from.

All the above edits can be done with WoW open as we're not adding any files to the environment. The edits can be instigated by reloading the UI, after each.

So with out further ado lets begin.

Lordyfrb
__________________
  Reply With Quote
05-23-11, 06:57 PM   #2
Lordyfrb
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 71
Exclamation Allowing attachments to any element of the unit frames.

This is a simple 1 line change to Stuf\core.lua that names the individual elements of the unit frame(UF), thus allowing other frames to be attached to these elements.

If you didn't know Stuf doesn't name each of the UFs elements, it lets WoW name these with a generic table.
If you dont understand this start WoW with Stuf enabled, and type into to the chat box:
Code:
/fstack
Now mouse over any UF created by stuf, and look for a pop up. Check Img1.
See all those table references and somewhere in the middle is the reference to the UF.
Thats what I mean about Stuf letting WoW give tables names to the parts that make up the UF, so what you may say, we can just attach our frames to those tables and be done with it,
but heres the catch, WoW creates those names randomly each time and thus they are constantly changing. What we want is in img2. Now see how there's a few changes, we now have names for parts of the UF, so we can now attach frames to these parts.

This is how we go about making this change:

Open up Stuf\core.lua from inside your Interface\AddOns folder in your chosen editor.

And search for the following line:
Code:
local f = CreateFrame(frametype or "Frame", nil, uf)
and replace it with the following:
Code:
local f = CreateFrame(frametype or "Frame", "Stuf."..unit.."."..name, uf)
Now save the file and open WoW, or if you have WoW already opened type
Code:
/reload
You can now type
Code:
/fstack
and the changes should be done.

Thats all for this section.

Lordyfrb
Attached Thumbnails
Click image for larger version

Name:	img1.jpg
Views:	928
Size:	34.1 KB
ID:	6187  Click image for larger version

Name:	img2.jpg
Views:	882
Size:	31.9 KB
ID:	6188  
__________________
  Reply With Quote
05-23-11, 06:59 PM   #3
Lordyfrb
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 71
Creating Pixel Perfect Borders and any Unit Frame Element.

Warning: This modification only works to make pixel perfect borders around Stuf UF elements, if you wish to use any other border then they wont work and I suggest you dont follow this part of the guide.

There has been previous guides/posts on how to do this, but this only works with status bars created with stuf, but doesn't work with things like text boxes and portraits,
this link has this method and is pretty straight forward to do. All it takes is to copy and paste a section of code into Stuf\core.lua.

http://www.wowinterface.com/forums/s...ad.php?t=36715

However my mod makes pixel perfect borders on every element possible.
Check the differences in the attached images, img3 shows the default square border around a portrait, whereas img4 shows my new and improved pixel border.

So lets begin, again open Stuf\core.lua into your editor.

The first change is to add a line, near the top of the file you will see something along the line of:
Code:
-- LibSharedMedia-3.0 register media files
And underneath it a block of text, this block of text is the method used by Stuf to register its artworks including Status Bar Texture, Fonts and Borders.
As its a border we're adding this is where we'll register it for use in Stuf.
So at the bottom of this block of text add the following line.
Code:
smed:Register("border", "Pixel Border", "Interface\\ChatFrame\\ChatFrameBackground")
You could try reloading WoW now and checking to see if it added a new border(after saving the file), but if you use it, you would and up with a fat border around anything you use it on, the next steps will change it to a pixel border.

Now scroll down the file a bit further and you should see the following line(dont scroll to far though as you may miss it)
Code:
-- fast access local variables
and just under that you'll see the following line:
Code:
local backdrop, borderdrop = { }, { edgeSize = 16, }
Now the part we're interested in is { edgeSize = 16, } this sets the size for all borders within Stuf, as you can see its set to a size of 16, just change this to a 1 and now we have pixel perfect borders.
Go ahead and try it. See we have those borders we always wanted, see img5, but wait theres a problem, we now have a gap between the element and the border.

Its ok, I have fix for that.

Now do a search for:
Code:
f.border:SetPoint("TOPLEFT", -4, 4)
This line and the following one, set the location of the border in relation to the elements.

In the first line the border is anchored to the TOPLEFT of the element and is set to be 4 pixels to the left and 4 pixels up, so all we have to do is change the 4's for 1's, but remember to leave the minus signs there.

So now save the file and reload.

In Stuf, just change to border to your elements to 'Pixel Border' and change to color/alpha to black and full opacity, and there we go, pixel perfect borders on any Stuf elements.

Thats all for this section.

Lordyfrb
Attached Images
   
__________________
  Reply With Quote
05-23-11, 07:04 PM   #4
Lordyfrb
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 71
Anchoring Stuf Frames to/from any point on the screen

Warning: This is an advanced modification to Stuf.

Ok, so we all know that Stuf anchors its UFs to the topleft of the UIParent, but if you want to release your UI out into to the wild, anyone who doesn't have the same screen resolution as you will run into the familiar problem of the UFs been in a different place.
So what if we could get Stuf to anchor our UFs to different points on the screen, say we could anchor our frames to the center of the screen and then position them from there, well now it possible with a few modifications.

This guide involves editing 2 files, the first and most advanced edit is in Stuf_options\options.lua

If you open Stuf with in WoW, and select any UF or element, you'll notice that you can only move that element to the right and down, so this is the first fix we need to make.

So in Stuf_options\options.lua search for the following line:
Code:
x.max, y.min = floor(sw / s), -floor(sh / s)
and replace it with
Code:
x.min, x.max = -(floor(sw / s)), (floor(sw / s))
y.min, y.max = -(floor(sh / s)), (floor(sh / s))
This change allows us to move elements either left or right and up or down.

The next modification lets us tell Stuf which points to anchor them to.

Just below the change you made aboce, you see this line:
Code:
local blank = { name=" ", type="header", order=3, }
Below this add these lines:
Code:
anchorto = { name=L["Anchor To"], type="select",  set=set, get=get, order=3.1, 
	values={
		TOPLEFT = L["TOPLEFT"],	TOP = L["TOP"],	TOPRIGHT = L["TOPRIGHT"], LEFT = L["LEFT"],
		CENTER = L["CENTER"], RIGHT = L["RIGHT"], BOTTOMLEFT = L["BOTTOMLEFT"],
		BOTTOM = L["BOTTOM"], BOTTOMRIGHT = L["BOTTOMRIGHT"],
	},
}
anchorfrom = { name=L["Anchor From"], type="select", set=set, get=get, order=3.2, 
	values={
		TOPLEFT = L["TOPLEFT"],	TOP = L["TOP"],	TOPRIGHT = L["TOPRIGHT"], LEFT = L["LEFT"],
		CENTER = L["CENTER"], RIGHT = L["RIGHT"], BOTTOMLEFT = L["BOTTOMLEFT"],
		BOTTOM = L["BOTTOM"], BOTTOMRIGHT = L["BOTTOMRIGHT"],
	},
}
Now we need to get the options into the actual options frame.

If you Scroll down a bit further you will see:
Code:
local frame = {
and just below that you'll find:
Code:
blank=blank,
x=x, y=y, w=w, h=h, scale=scale, blank3=blank3,
bordercolormethod=bordercolormethod, bordercolor=bordercolor,
vertical=vertical, hflip=hflip, vflip=vflip,
After the line that says blank=blank, add this line:
Code:
anchorto=anchorto, anchorfrom=anchorfrom,
Now scroll down a bit further, till you see this:
Code:
hide=hide, copy=copy, blank=blank,
x=x, y=y,
Now add the same as above to after the blank=blank,

Ok so now we have the options added in, if you load WoW and open Stuf's options, in each of the UFs you will now find some anchoring options, but they wont work yet, Stuf doesn't know what to do with these options.

This is the easy part of this mod.
So now we have to edit our second file for this, now open up Stuf\core.lua in your editor, and search for this line:
Code:
uf:SetPoint("TOPLEFT", UIParent, "TOPLEFT", dbuf.x, dbuf.y)
This line tells Stuf where to anchor our UFs to/from, we need to tell it to use our anchors.
So change it to:
Code:
uf:SetPoint(dbuf.anchorto, UIParent, dbuf.anchorfrom, dbuf.x, dbuf.y)
Now stuf knows where to anchor out UFs to and from.

Now when you start WoW, you may get some errors, these come from us not telling Stuf our anchor point, so you'll have to go into Stuf's config and set all the anchor points for each UF.

Thanks

Lordyfrb
__________________
  Reply With Quote
05-28-11, 04:50 PM   #5
Lordyfrb
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 71
Wow 100+ views on this guide but no comments.

Anyone fancy giving feedback, either on the content or the layout of this guide, its my first attempt at writing one so was wondering if there's improvements to be made?

Lordyfrb
__________________
  Reply With Quote
05-28-11, 07:01 PM   #6
feraldrood
A Theradrim Guardian
 
feraldrood's Avatar
Join Date: Dec 2008
Posts: 62
you are MORE THAN awesome.

that is all


edit because I updated stuf and forgot to reapply your modifications. after much hair pulling i found this guide again.

*phew* thank you lordy

Last edited by feraldrood : 11-30-11 at 01:54 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Customising Stuf

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