WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF tutorial layout for oUF 1.4 (https://www.wowinterface.com/forums/showthread.php?t=33566)

zork 06-28-10 11:24 AM

oUF tutorial layout for oUF 1.5
 
oUF_Simple, a oUF 1.5 tutorial layout.

HOW TO USE
In this tutorial I'm showing you step by step how I wrote the following layout. You can follow the steps by checking each Googlecode link under each step. You can even highlight the differences from each step to another by clicking on DIFF at the Googlecode pages. Try to analyse what I'm doing. Copy the code and try to edit it. Reload your UI and see what happens. This way you will gain knowledge on how to write your own oUF layout.

FINAL CODE
http://code.google.com/p/rothui/sour...unk/oUF_Simple for oUF 1.4.x
http://code.google.com/p/rothui/sour...nk/oUF_Simple2 for oUF 1.5.x

DOWNLOAD
http://www.wowinterface.com/download...oUFSimple.html

MAJOR FILES
- config
- lib (functions)
- core (layout)
- tags

The TOC-file calls the 3 LUA-files in the following order: config, library and core.
The config is the first file to be called. It can contains all your config variables. All the config variables will be saved in the namespace object (ns).
Next file is the library. It contains all the function that will be used by your layout files. Currently there is only one layout file (core.lua) but you could have more of them like party.lua, raid.lua and so on.
The last file is the core.lua which registers the styles and activates different styles for each unit.

FEATURES
- how to do outer glow with using SetBackDrop
- frames are moveable with SHIFT+ALT+DRAG
- spawns player/target and shows how you can copy the style function for any other unit you want to spawn
- how to add strings to frames
- how to apply color to self.Health and self.Power
- how to work with the namespace object (ns)

DEVELOPMENT STEPS
If you want to follow the development steps check out the links and click on DIFF!

1) Initial release with some basic files
http://code.google.com/p/rothui/source/detail?r=503




2) Some error fixes
http://code.google.com/p/rothui/source/detail?r=504
http://code.google.com/p/rothui/source/detail?r=505


3) Added focus and pet frame
http://code.google.com/p/rothui/source/detail?r=506




4) Added targettarget frame
http://code.google.com/p/rothui/source/detail?r=507




5) Added portraits and castbar and new statusbar texture (bling bling!)
http://code.google.com/p/rothui/source/detail?r=508
http://code.google.com/p/rothui/source/detail?r=509



6) Added aura icons, party and right-click menu
http://code.google.com/p/rothui/source/detail?r=510



7) Added a raid layout

http://code.google.com/p/rothui/source/detail?r=512

-------------------------------------------------

New version: oUF_Simple2 !!!

-------------------------------------------------

8) Update for oUF 1.5.x
Initial release with the files of the 1.4.x layout. What changed is the init function. It is not allowed to use init-width, height and scale anymore.
http://code.google.com/p/rothui/source/detail?r=718

9) Raid, oUF_MovableFrames and more
- now supports oUF_MovableFrames
- added raid frames
- 3 different raidframes are spawned depending on raid size to show how to do it and to have the opportunity to scale each raid individually with oUF_MovableFrames
- moved the init function to the core and splitted it into initHeader and init. (Unit spawned under header must be handled specially)
- removed the default movabilty, only castbars for player and target have the move function now (to make them dragable)
- new menu function (updated for cataclysm and removed focus selection from menu)
- added 3 attributes to the self object: hidename, hptag and nametag. Once those are given the text strings will be handled different. (Thus you can use specific tags just for one style or hide the name in anothers etc.)

http://code.google.com/p/rothui/source/detail?r=719

10) how to add personal tags
http://code.google.com/p/rothui/source/detail?r=720



11) How to add a module (oUF_DebuffHighlight in this case)
http://code.google.com/p/rothui/source/detail?r=721



12) How to add threat coloring



http://code.google.com/p/rothui/source/detail?r=723

13) Enhanced config

Adding more values to the config and using them in the spawn and style functions.

http://code.google.com/p/rothui/source/detail?r=724

.
.

Dawn 06-28-10 01:49 PM

Nice work. :)

I wouldn't use another file for libs, though. But that's just me. :cool:

zork 06-28-10 02:38 PM

Makes sense when you are going to have different lua files for raid and party and all the other units.

Politig 06-28-10 02:46 PM

Quote:

Originally Posted by zork (Post 194931)
Makes sense when you are going to have different lua files for raid and party and all the other units.

So let me get this straight: This is a beginner's tool for create oUF frames with oUF 1.4?

...Sweet :D

Dawn 06-28-10 04:07 PM

Quote:

Originally Posted by zork (Post 194931)
Makes sense when you are going to have different lua files for raid and party and all the other units.

Yeah, that's right. I didn't think of that. :o

xandora 06-28-10 05:30 PM

Can you edit oUF layouts while WoW is open and then reloadui to see instant changes?

p3lim 06-28-10 05:54 PM

Quote:

Originally Posted by xandora (Post 194956)
Can you edit oUF layouts while WoW is open and then reloadui to see instant changes?

As long its not file remove/rename/add and toc changes, then yes.

zork 06-29-10 12:06 AM

You can even edit textures in your GFX program while being in the game, assuming that a texture of the same name already existed at the start of WoW.

/reload is probably my most used slash command ever.

*UPDATE*
Edited the first post.

p3lim 06-29-10 08:13 AM

Quote:

Originally Posted by zork (Post 194996)
/reload is probably my most used slash command ever.

If you use it alot you should bind it to a distant key. I have mine on F12

Monolit 06-29-10 06:18 PM

Great layout zork, thanks for your work!
I found it very smart the way you organize and build frames (i.e. separate style function for every frame type). This (and also upgrading to oUF1.4) actually inspired me to rebuild my own oUF layout using your code structure as base.

And so far so good, I managed to get like 70% of the features I had in my old layout to the new one.

Though I encountered a little problem:
I can't figure out how to properly implement PostUpdateHealth -like functions.
Basically I need this for stuff like gradient colored health bars, that need to be updated after creation. It'd be great if you could give me some advice concerning this issue.

Werr 06-29-10 08:07 PM

how does this addon show you HOW to do things? when i load this addon along with ouf 1.4, i get a tidy little layout. am i supposed to look at the previous versions and compare to see what changed? id love to learn ouf coding but im wondering how this teaches it.

Ferous 06-29-10 10:27 PM

Quote:

Originally Posted by Werr (Post 195095)
how does this addon show you HOW to do things? when i load this addon along with ouf 1.4, i get a tidy little layout. am i supposed to look at the previous versions and compare to see what changed? id love to learn ouf coding but im wondering how this teaches it.

The Lua is probably very well commented. Other than that, it ain't a "For Dummies" thing :)

Werr 06-29-10 11:19 PM

Quote:

Originally Posted by Ferous (Post 195101)
The Lua is probably very well commented. Other than that, it ain't a "For Dummies" thing :)

its commented by section. i would like to know what things do (the functions and such) and how they work. its like wanting a fishing pole rather than a fish. ouf is a highly customizable framework, and other than playing with values, i cant make much of this (not that it isnt great, it helps a lot).

Ferous 06-29-10 11:19 PM

For some reason.... the buffs for oUF aren't being skinned by the code.. for some weird reason. Idk why, maybe an AddOn is conflicting... I'll have to dig deeper.

edit - does it have something to do with the new oUF release?

I posted this in the comments as well to oUF_Simple.

Ferous 06-29-10 11:20 PM

Quote:

Originally Posted by Werr (Post 195107)
its commented by section. i would like to know what things do (the functions and such) and how they work. its like wanting a fishing pole rather than a fish. ouf is a highly customizable framework, and other than playing with values, i cant make much of this (not that it isnt great, it helps a lot).

You know, I got the World of Warcraft Programming guide, it helps a great deal and I got it from amazon Used for only 60 cents! And its brand new! I love it! That book, will help you indeed a great deal and explain everything in detail and what it does, etc.

Werr 06-29-10 11:27 PM

Quote:

Originally Posted by Ferous (Post 195109)
You know, I got the World of Warcraft Programming guide, it helps a great deal and I got it from amazon Used for only 60 cents! And its brand new! I love it! That book, will help you indeed a great deal and explain everything in detail and what it does, etc.

ouf included? i really have no idea what im doing here. currently, it shows curhp/perhp. i copied and pasted the code directly, changing hpval to ppval, f.Health to f.Power, etc. and nothing changed in game :( all i can do is move text, increase scale, and statusbar texture. im a sad panda

Ferous 06-29-10 11:30 PM

Quote:

Originally Posted by Werr (Post 195110)
ouf included? i really have no idea what im doing here. currently, it shows curhp/perhp. i copied and pasted the code directly, changing hpval to ppval, f.Health to f.Power, etc. and nothing changed in game :( all i can do is move text, increase scale, and statusbar texture. im a sad panda

oUF is Lua, and the book covers on learning Lua, so once you get Lua, you'll get oUF. oUF will become clear if you learned a bit of Lua :)

Werr 06-29-10 11:36 PM

Quote:

Originally Posted by Ferous (Post 195112)
oUF is Lua, and the book covers on learning Lua, so once you get Lua, you'll get oUF. oUF will become clear if you learned a bit of Lua :)

i looked over some lua briefly over on http://lua-users.org/wiki/LuaDirectory but some of these ouf bits are way over my head. like in ouf lily everything doesnt look like anything but a jumbled mess. ouf simple and ouf alza are just to name a few that seem more organized. ouf lily still works though. i saw a ui post a while ago by Politig on the "post your ui" thread and i liked his frames so im trying to make ouf frames like that. ouf alza and ouf simple already start out kind of similar, im just trying to add the tiny little bits to make it how i want.

zork 06-30-10 01:32 AM

@Werr
Your first intention was correct. Follow the development steps in the tutorial step by step and look at what changed at every step. Thus you get an overview what part does what.

You can always download each version from googlecode. And see how every step behaves.

If you just download the last version its just a big mess of code. Start at step one and try to understand what I'm doing. Change stuff and hit "/reload" ingame. See what it does and try/error it out.

@Ferous
I answered in the addon comments. Just add some button.overlay code to the "ib.PostCreateIcon" function in lib.lua. You can even do "button.overlay.Hide = function() end" to make the overlay stay forever and not only appear for specific debuffs. You can apply SetTexture(), SetVertexColor() and so on. Whatever you like.

Minerv 06-30-10 08:49 AM

Any link to some API stuff about health/name/power text :)?

I wanna do something like this |[deficitmp] *playerframe* [curhp]|

|[name(on the border)]
|[curhp] *targetframe* [curmp]| and on ToT |[name]|

But as it is now i can only change on 2 things that changes all of the units tags together? :p

line 125-126 in lib.lua

f:Tag(name, "[name]")
f:Tag(hpval, "[curhp]")

Also i have like a big black border below my UF's atm, dunno what it is/how i got it there O.o.

http://img534.imageshack.us/img534/8509/trolololl.png dont mind the timer thar :o

Btw thx for this guide, i love oUF but im a lua noob so i cant do that much alone, great way to start for me.

Any help would be great! (and sry for any bad english)

(Have moved the powerbar to the top now also, and removed the portrait's/buffs/debuffs on everything else than Target/Party.) Just hope that it works now D:


All times are GMT -6. The time now is 05:02 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI