Thread Tools Display Modes
03-28-10, 10:12 AM   #1
chumii
A Fallenroot Satyr
 
chumii's Avatar
AddOn Compiler - Click to view compilations
Join Date: Jun 2009
Posts: 23
best documented layout?

Hey there,

i rly love using oUF and i think its time to try to make an own layout.

since im not that good at lua, i have to use tutorials and such, so i wondered if there is a layout with good documentation in the .lua file which i can use as orientation. (maybe one where the author describes sth like "now player frame" "now de/buffs" "now grp" and so on..)

//edit: or is there sth like a oUF layout tutorial out there? that would be the easiest way
  Reply With Quote
03-28-10, 10:21 AM   #2
Orane
A Murloc Raider
 
Orane's Avatar
Join Date: Mar 2010
Posts: 5
Originally Posted by chumii View Post
Hey there,

i rly love using oUF and i think its time to try to make an own layout.

since im not that good at lua, i have to use tutorials and such, so i wondered if there is a layout with good documentation in the .lua file which i can use as orientation. (maybe one where the author describes sth like "now player frame" "now de/buffs" "now grp" and so on..)

//edit: or is there sth like a oUF layout tutorial out there? that would be the easiest way
I would like this as well. I have been spending time making textures and artwork and now I can't use them haha
__________________
www.myspace.com/blockheadpunk
  Reply With Quote
03-28-10, 10:25 AM   #3
chumii
A Fallenroot Satyr
 
chumii's Avatar
AddOn Compiler - Click to view compilations
Join Date: Jun 2009
Posts: 23
edit: nothin =)

Last edited by chumii : 03-28-10 at 10:30 AM. Reason: i wrote crap
  Reply With Quote
03-28-10, 01:17 PM   #4
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Just download some and look at the code?!
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
03-28-10, 01:23 PM   #5
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
If we really need to tell what this code is: self.Health = CreateFrame('Statusbar', nil, self) then you are better of using pitbull or shadowed unit frames

Just do what Dawn says. If you don't understand a method, like texture:SetTexCoords, look it up on wowwiki. That's how I learned
  Reply With Quote
03-28-10, 01:38 PM   #6
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
oUF_Lily is the layout made by Haste as a simple reference design. Try starting with that and ask questions about any parts you do not understand.
  Reply With Quote
03-28-10, 02:00 PM   #7
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
The problem is: Lily is not how layouts should be actually made of. haste implemented a style system and does not show to use it. Its one of the best things of oUF imo.

I try to comment most of my layouts and I wrote a oUF template file some time ago.

http://code.google.com/p/rothui/sour...F_Template.lua

Other than that. What Dawn wrote is correct. Take a layout you like. Look at the code and try to understand what it does. Try/error it out by editing code.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 03-28-10 at 02:02 PM.
  Reply With Quote
03-28-10, 06:43 PM   #8
Unkn
Premium Member
 
Unkn's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 258
Most of the layouts are really well commented because people that are using oUF are doing so because they like the customization and generally are capable of going and tweaking their favs.

Like posters have said above me. Once you look at a layout you like and look at the code its very very simple. My suggestion is start with one that just lua no xml unless you are comfortable with that.

Most of it is very easy to understand

Example :
Code:
  	-- Healthbar
   local hp = CreateFrame("StatusBar", nil, self)
   hp:SetStatusBarTexture("Interface\\AddOns\\oUF_Text\\StatusBar\\Empty")
   hp:SetHeight(hp_height)
   hp:SetWidth(width-border_size)
   hp:SetPoint("TOPLEFT", self, "TOPLEFT", 2*border_size, -2*border_size)
   hp:SetPoint("TOPRIGHT", self, "TOPRIGHT", -2*border_size, -2*border_size)
   hp:SetPoint("BOTTOM", self, "CENTER", -2*border_size, 2*border_size)
   hp:SetStatusBarColor(0.45, 0.45, 0.45)
   hp:SetBackdrop(backdrop)
   hp:SetBackdropColor(1,0,0, .55)
   hp.colorDisconnected = true
   hp.colorClass = false
   hp.colorClassPet = false
   hp.frequentUpdates = true
   self.Health = hp
The result of above code + rest of layout...


A bit more complicated one

Code:
 -- Healthbar
   local hp = CreateFrame("StatusBar", nil, self)
   hp:SetStatusBarTexture(statusbartexture)
   hp:SetHeight(hp_height)
   if unit == "player" then
        hp:SetOrientation("VERTICAL")
        hp:SetWidth(((width)/3)-(2*border_size))
        hp:SetPoint("TOPLEFT", oUF.units.player, "TOPLEFT", 2*border_size, -2*border_size)
        hp:SetPoint("BOTTOMLEFT", oUF.units.player, "BOTTOMLEFT", 2*border_size, 2*border_size)
        hp:SetPoint("RIGHT", oUF.units.player, "RIGHT", -7*width/9, 0)
        hp:SetPoint("LEFT", self, "LEFT", 2*border_size, 0)
        hp:SetStatusBarColor(0.45, 0.45, 0.45)
        hp:SetBackdrop({bgFile="Interface\\AddOns\\oUF_Geared\\StatusBar\\DarkBottom"})
        hp:SetBackdropColor(1,0,0, .6)
    elseif unit == "target" then
        hp:SetOrientation("VERTICAL")
        hp:SetWidth(((width)/3)-(2*border_size))
        hp:SetPoint("TOPRIGHT", oUF.units.target, "TOPRIGHT", -2*border_size, -2*border_size)
        hp:SetPoint("BOTTOMRIGHT", oUF.units.target, "BOTTOMRIGHT", -2*border_size, 2*border_size)
        hp:SetPoint("LEFT", oUF.units.target, "LEFT", 7*width/9, 0)
        hp:SetPoint("RIGHT", self, "RIGHT", -2*border_size, 0)
        hp:SetStatusBarColor(0.45, 0.45, 0.45)
        hp:SetBackdrop({bgFile="Interface\\AddOns\\oUF_Geared\\StatusBar\\DarkBottom", edgeFile = "", edgeSize = 4, insets = {left = 3, right = 3, top = o, bottom = 0},})
        hp:SetBackdropColor(1,0,0, .6)
    else
        hp:SetWidth(width-border_size)
        hp:SetPoint("TOPLEFT", self, "TOPLEFT", border_size, -border_size)
        hp:SetPoint("TOPRIGHT", self, "TOPRIGHT", -border_size, 0)
        hp:SetStatusBarColor(0.45, 0.45, 0.45)
    end
   hp.colorDisconnected = true
   hp.colorClass = false
   hp.colorClassPet = false
   hp.frequentUpdates = true
   self.Health = hp



Try messing around with it. You'll find once you start its fun and a great learning tool.



BTW don't use my code as an example... its sloppy as all get out and I don't care
__________________
"I'm very feminine. And I'll beat the crap out of ANYONE who disagrees!"
  Reply With Quote
03-28-10, 11:54 PM   #9
chumii
A Fallenroot Satyr
 
chumii's Avatar
AddOn Compiler - Click to view compilations
Join Date: Jun 2009
Posts: 23
Originally Posted by zork View Post

I try to comment most of my layouts and I wrote a oUF template file some time ago.

http://code.google.com/p/rothui/sour...F_Template.lua

Other than that. What Dawn wrote is correct. Take a layout you like. Look at the code and try to understand what it does. Try/error it out by editing code.
That is what i needed, thx very much.

i know that reading more and more code is the best way to learn, but i needed a good point to start at.
  Reply With Quote
03-29-10, 08:51 AM   #10
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Originally Posted by zork View Post
The problem is: Lily is not how layouts should be actually made of. haste implemented a style system and does not show to use it. Its one of the best things of oUF imo.
Could you point out the major advantages and disadvantages between the way you do it (several small functions for everything) compared to the "one large style function" thing, please?

I just want to understand what's the difference, after all. Just curious.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
03-29-10, 10:37 AM   #11
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
- You can call any of the small functions with different variables set inside the small style function for each unit.
- You can access units (even special units) on the style activate per spawn. Thus you know exactly what unit you have in your style function because its the specific style function for that unit (no match needed etc.)
- If you want to edit the healthbar you go to the healthbar function and change your stuff, you don't have to read through one giant piece of code.
- Each style function can call specific functions depending on style. No conditions needed. If the function call is there it gets called otherwise not.
- Its much more readable/editable.

But thats my way of programming. There are many trees in a forrest, not just one.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 03-29-10 at 10:41 AM.
  Reply With Quote
03-29-10, 02:03 PM   #12
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Thank's, I'll try that. Maybe it works for me, too.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
03-30-10, 01:19 PM   #13
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
I've been working on creating a new layout for my rogue and have adopted a mixed style (only one style is called, but the individual elements are put together by their own function) and it is definitely making it easier for me to read and update. It's very clear where one block starts and another ends.

I'll get to the full modularized approach at some point as I work on it.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » best documented layout?


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