Thread Tools Display Modes
06-30-10, 09:16 AM   #21
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
If you changed the height of your powerbar, you need to adjust the height of the helper frame (that does the black background aswell). That is my guess.

If you are a noob start slow (Assuming your screenshot is from an edited oUF_Simple you already changed a lot). Don't do too much changes at a time. Change some stuff then reload you UI and see how it looks. Change some more and so on. Always make save-files from steps inbetween so that you can revert to an already running version.
__________________
| 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 : 06-30-10 at 09:24 AM.
  Reply With Quote
06-30-10, 01:06 PM   #22
zohar101
A Cyclonian
 
zohar101's Avatar
Join Date: Jan 2010
Posts: 43
That's a really nice guide for noobs like me. I do appreciate all the extra editing in the files. And I already nabbed some of those nice textures for my raidframe layout:P Big fan of those.
But the biggest thing was this:
Can you edit oUF layouts while WoW is open and then reloadui to see instant changes?
Originally Posted by p3lim View Post
As long its not file remove/rename/add and toc changes, then yes.
Lol I read that bit and wanted to just go into the corner and cry for all the time wasted not knowing that little bit of info. Sigh...
  Reply With Quote
06-30-10, 03:23 PM   #23
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Holy Crap!!!
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
06-30-10, 06:21 PM   #24
Monolit
A Black Drake
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 81
Originally Posted by Monolit View Post
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.
I still fail to understand what am I doing wrong :/

just as example:
a small function that updates healthbar color:
lua Code:
  1. lib.PostUpdateHealth = function(s, unit, min, max)
  2.   local r, g, b = oUF.ColorGradient(min/max, 1,0,0, .7,.41,.44, .3,.3,.3)
  3.   s:SetStatusBarColor(r, g, b)
  4. end
how do I properly implement it so it fires all the time to keep the color of my health bar updated?
  Reply With Quote
06-30-10, 06:27 PM   #25
vlakarados
An Aku'mai Servant
 
vlakarados's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 36
could I ask you to point me in the right direction of adding raid frames to this layout? simply can't get it, how it should be done..

I've copied
Code:
local Raid = {}
local group = 0
for i = 1, 5 do
  local RaidGroup = oUF:Spawn("header", "oUF_Raid" .. i)
  RaidGroup:SetManyAttributes("groupFilter", tostring(i), "showRaid", true, "yOffset", 3, "point", "BOTTOM", "sortDir", "DESC")
  table.insert(Raid, RaidGroup)
  if i == 1 then
    RaidGroup:SetPoint("TOPLEFT", UIParent, 5, -25) 	
  else
    RaidGroup:SetPoint("TOPLEFT", Raid[i-1], "TOPRIGHT", 3, 0)  
  end    
  group = group + 1
  RaidGroup:Show()
end
and similar from dozens of layouts, but each and every one returns me an error: oUF_Simple\core.lua:164: attempt to index local 'RaidGroup' (a nil value)

please

Last edited by vlakarados : 06-30-10 at 06:52 PM.
  Reply With Quote
07-01-10, 01:23 AM   #26
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
@Monolit
Easy one. Haste renamed some functions. Please read oUF/elements/health.lua
Search for "post" and you will find "PostUpdate(unit, min, max)"

So you can do
Code:
--lib.lua
      lib.PostUpdateHealth = function(s, unit, min, max)
        local r, g, b = oUF.ColorGradient(min/max, 1,0,0, .7,.41,.44, .3,.3,.3)
        s:SetStatusBarColor(r, g, b)
      end
Now you have 2 options. Edit the PostUpdateHealth function only to some units or to all of them.

If it should only be applied to some units then go to core.lua and add this to the style functions of the units you want to adjust.
Code:
--core.lua
self.Health.PostUpdate = lib.PostUpdateHealth
If you want that function in ANY unit you can even change the "lib.gen_hpbar"-function. Find:
Code:
    b:SetAllPoints(s)
    f.Health = s
and change that to
Code:
    b:SetAllPoints(s)
    s.PostUpdate = lib.PostUpdateHealth 
    f.Health = s
"s" is your health statusbar and gets handed over later to the self object which is represented by the variable "f" in the function, so f.Health is the same as self.Health.

~~~~~~~~~~~~

@vlakarados
SetManyAttributes is gone since 1.4
Just look at any lately released oUF 1.4 compatible layouts how they implement raid groups.
There is a new SpawnHeader() afaik.
__________________
| 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 : 07-01-10 at 01:40 AM.
  Reply With Quote
07-01-10, 03:16 AM   #27
vlakarados
An Aku'mai Servant
 
vlakarados's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 36
thanks, errors have gone, but I don't see any frames, here's what I have added
Code:
local function CreateRaidStyle(self)
    --style specific stuff
    self.width = 180
    self.height = 25
    self.scale = 0.8
    self.mystyle = "raid"
    genStyle(self)
    self.Health.frequentUpdates = true
    self.Health.colorDisconnected = true
    self.Health.colorClass = true
    self.Health.colorHealth = true
    self.Health.bg.multiplier = 0.3
    self.Power.colorPower = true
    self.Power.bg.multiplier = 0.3
    lib.gen_castbar(self)
    lib.createDebuffs(self)
end
Code:
  if 1==1 then
		oUF:RegisterStyle("oUF_SimpleRaid", CreateRaidStyle)
		oUF:SetActiveStyle("oUF_SimpleRaid")
		local raid = {}
		for i = 1, NUM_RAID_GROUPS do
			local raidgroup = oUF:SpawnHeader("oUF_Raid"..i, nil, visible,
			"groupFilter", tostring(i), "showRaid", true, "yOffSet", -3
		)
			table.insert(raid, raidgroup)
			if i == 1 then
				raidgroup:SetPoint("TOPLEFT", UIParent, "CENTER", 20, -20)
				print("1 GROUP")
			else
				raidgroup:SetPoint("TOPLEFT", raid[i-1], "TOPRIGHT", 60, 0)
				print("NEXT GROUP")
			end
		end
	end
  Reply With Quote
07-01-10, 04:04 AM   #28
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Caellian is using the oUF:Factory func, the tutorial is not.

Code:
  --the raid style
  local function CreateRaidStyle(self)
    --style specific stuff
    self.width = 150
    self.height = 25
    self.scale = 0.8
    self.mystyle = "raid"
    genStyle(self)
    self.Health.frequentUpdates = true
    self.Health.colorDisconnected = true
    self.Health.colorHappiness = true
    self.Health.colorClass = true
    self.Health.colorReaction = true
    self.Health.colorHealth = true
    self.Health.bg.multiplier = 0.3
    self.Power.colorPower = true
    self.Power.bg.multiplier = 0.3
  end  
  
  
  if cfg.showraid then
    oUF:RegisterStyle("oUF_SimpleRaid", CreateRaidStyle)
    oUF:SetActiveStyle("oUF_SimpleRaid")
    local raid = {}
    for i = 1, NUM_RAID_GROUPS do
      raid[i] = oUF:SpawnHeader("oUF_Raid"..i, nil, "raid",  "groupFilter", i, "showRaid", true, "yOffSet", -50)
      if i == 1 then
        raid[i]:SetPoint("TOPLEFT", 70, -20)
      else
        raid[i]:SetPoint("TOPLEFT", raid[i-1], "TOPRIGHT", 100, 0)
      end
    end
  end
__________________
| 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 : 07-01-10 at 04:45 AM.
  Reply With Quote
07-01-10, 07:57 AM   #29
Monolit
A Black Drake
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 81
Originally Posted by zork View Post
@Monolit
Easy one. Haste renamed some functions. Please read oUF/elements/health.lua
...
Oh god, silly me, I had s.PostUpdateHealth = lib.PostUpdateHealth in gen_hpbar func.
Thank you! Didn't notice this change in that extensive change log oUF1.4 has, once again thanks for pointing out
  Reply With Quote
07-01-10, 02:57 PM   #30
giakaama
A Murloc Raider
Join Date: Nov 2008
Posts: 5
Hi, is there any way to merge the oUF_D3OrbsRaid with this config, so we can have the raid frames too ?!
  Reply With Quote
07-01-10, 03:29 PM   #31
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Added raid layout
http://code.google.com/p/rothui/source/detail?r=512

Info on texture fillings looking distorted
http://www.wowinterface.com/forums/s...d.php?p=182798
http://wow.mmoui.com/forums/showthread.php?t=31967

Example edit in lib.lua:

Before
Code:
s:SetStatusBarTexture(cfg.statusbar_texture)
After
Code:
s:SetStatusBarTexture(cfg.statusbar_texture)
s:GetStatusBarTexture():SetHorizTile(true)
__________________
| 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 : 07-02-10 at 08:03 AM.
  Reply With Quote
07-02-10, 10:45 PM   #32
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
Originally Posted by zork View Post
Added raid layout
http://code.google.com/p/rothui/source/detail?r=512

Info on texture fillings looking distorted
http://www.wowinterface.com/forums/s...d.php?p=182798
http://wow.mmoui.com/forums/showthread.php?t=31967

Example edit in lib.lua:

Before
Code:
s:SetStatusBarTexture(cfg.statusbar_texture)
After
Code:
s:SetStatusBarTexture(cfg.statusbar_texture)
s:GetStatusBarTexture():SetHorizTile(true)
Ah! Thank you zork, I was trying to figure out why the bar was literally growing when I casted :P
  Reply With Quote
07-03-10, 12:35 PM   #33
Monolit
A Black Drake
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 81
Hello again.
Well I've completely rebuilt my frames and everything seems to be working, but there's still one thing that doesn't work and I fail to understand why.

for some reason I'm not able to spawn units with multiple indexes like Boss1,Boss2, ... or Arena1,Arena2,...
I tried 2 different methods of spawning them:
1) via oUF_Factory function http://pastey.net/138256
2) by simply registering and setting style http://pastey.net/138254
Though there should be no difference between them.
None of those worked :/ For example when I entered arena default blizzard arena frames came up without any styling.

I'd greatly appreciate any advice you can give me concerning this issues.

Last edited by Monolit : 07-04-10 at 05:02 AM.
  Reply With Quote
07-15-10, 06:14 AM   #34
Icerat
A Fallenroot Satyr
Join Date: Sep 2006
Posts: 28
Just come accross this and its inspired me to have a go at creating my own layout once i get home (@Work at mo).

That being said im a complete lua nooob lol and was wondering how hard would it be to add dk runes and a lvl on palyer and target frames?

Looking at the oUF lumen code it doesnt look to bad but all his doe is in one file not broke up like this.

I like the modular approach as it will help me understand / break it down in my mind.

Great work

Harpz
  Reply With Quote
07-15-10, 09:03 AM   #35
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
it would be nice if you used the factory as well in your tutorial. It will allow the player to select style on a per unit basis in the future.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
07-16-10, 01:45 AM   #36
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Actually I'm using one style for each spawn. What does "will allow the player to select style on a per unit basis" do differently other than looking differently and being harder to read through?
__________________
| 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 : 07-16-10 at 01:51 AM.
  Reply With Quote
07-16-10, 03:31 AM   #37
Broes
A Deviate Faerie Dragon
Join Date: Jul 2010
Posts: 11
IMO, from a programmers PoV, the factory pattern should not apply here. There just are too many variables, for instance for my own UI:

- player has HP-bar, PP-bar, debuffs
- target has HP-bar, PP-bar, buffs & debuffs custom filtered
- tot has hp-bar, debuffs
- totot has hp-bar
- party members has HP-bar, PP-bar, debuffs, different Layout from player
- raid differs in 10/15/25 man setup
- arena is different yet again

all differ in size, alignments, position etc.

Factory would be nice if all UF-elements would be more or less the same otherwise you still end up with

Code:
Factory()
make_hp_bar()
if player then
  position like so
elseif target then 
  mirror and position like so
elseif .. then
 ...
end

if player and shaman then
  totems
elseif player and dk then
  runes
end

-- etc etc etc
I've gone and made several styles like in the tut:
Code:
local function CreatePlayerStyle(self)
	self.unit = "player"
	func.placeFrame(self)
	func.createStatusBar(self, "Health", true)
	func.createStatusBar(self, "Power", true)
	self.Health.frequentUpdates = true
    self.Health.colorClass = true
    self.Power.colorPower = true
	func.addTag(self, self.Health, "[name]")
	func.addTag(self, self.Health, "[eth:playerhp]")
	func.addTag(self, self.Power, "[eth:smartpp]")
	func.addTag(self, self.Health, "[eth:afk]")
	func.createCastBar(self)
	func.addPortrait(self)
--	func.addCombatText(self, self.Health)
           
           func.checkTotems(self)
           func.checkRunes(self)

--yeye, still streamlining this :P 
	self.Health.PostUpdate = func.addThreatColoring
	self:RegisterEvent("PLAYER_REGEN_DISABLED", func.addInitThreatColoring)
	self:RegisterEvent("PLAYER_REGEN_ENABLED", func.removeThreatColoring)
	func.createDebuffs(self)
end
which build it all with generic functions:
Code:
--[[stripped documentation for size purpose]]--
func.createStatusBar = function(frame, barType, border)
	local statusBar = CreateFrame("StatusBar", nil, frame)
	statusBar:SetStatusBarTexture(media.images.statusbar)
	statusBar:SetHeight(config[frame.unit].bars[barType].size.height)
	statusBar:SetWidth(config[frame.unit].bars[barType].size.width)
	statusBar:SetPoint(config[frame.unit].bars[barType].position.anchor,config[frame.unit].bars[barType].position.xOff,config[frame.unit].bars[barType].position.yOff)
	local bgFrame = statusBar:CreateTexture(nil, "BACKGROUND")
	bgFrame:SetTexture(media.images.statusbar)
	bgFrame:SetAllPoints(statusBar)
	bgFrame:SetAlpha(0.3)
	if border == true then
		local borderFrame = CreateFrame("Frame", nil, statusBar)
		borderFrame:SetBackdrop(colors.backdrop_tab)
		borderFrame:SetBackdropColor(unpack(colors.bgcolor))
		borderFrame:SetBackdropBorderColor(unpack(colors.bgbordercolor))
		borderFrame:SetPoint("TOPLEFT", statusBar, -3, 3)
		borderFrame:SetPoint("BOTTOMRIGHT", statusBar, 2, -2)
	end
	frame[barType] = statusBar
	frame[barType].bg = bgFrame
end

--[[stripped documentation for size purpose]]--
func.addTag = function(frame, parent, tag, font, size, outline, shadow)
	local fString = parent:CreateFontString(nil, "OVERLAY")
	fString:SetFont(font or config[frame.unit].texts[tag].font or media.font.normal, 
					size or config[frame.unit].texts[tag].size or media.font.size, 
					outline or config[frame.unit].texts[tag].outline or nil)
	if shadow or config[frame.unit].texts[tag].shadow then
		if shadow then
			fString:SetShadowColor(unpack(shadow))
		else
			fString:SetShadowColor(unpack(config[frame.unit].texts[tag].shadow))
		end
		if config[frame.unit].texts[tag].shadowoff then
			fString:SetShadowOffset(unpack(config[frame.unit].texts[tag].shadowoff))
		end
	end
	fString:SetPoint(config[frame.unit].texts[tag].anchor, parent, config[frame.unit].texts[tag].xOff, config[frame.unit].texts[tag].yOff)
	fString:SetJustifyH(config[frame.unit].texts[tag].justH)
	frame:Tag(fString, tag)
end
which as you can see get it's data from a config (which I wont list here as we all know what an array with data looks like).

This makes code highly re-usable, and easily configurable.
Also, adding/disabling/removing or altering a style is much easier then when you have to go through your whole factory editing/altering for the new/old/whatnot unit.

Best of all: I can easily alter my UF's without touching any code. All I have to do is just change my config.

files:
tags.lua
config.lua
func.lua
styles.lua
manage.lua

---

I'm not saying that the factory pattern is terribad and should not be used, I'm saying that when I want to make my own code reusable and easy, where quick changes are easily made, I would never use it. Since that's what every programmer should strive for (DRY, SRP) I'd discourage the use of the facory here to be honest.

Unfortunately I won't be around here again till tomorrow afternoon somewhere, but I'd be very interested in other people's PoV regarding this.

/salute

P.S.: yes, I know I'm relatively new to oUF compared to others around here, but I do have a solid programmers background
Oh yeah, and the above is still a WIP, so don't shoot the sometimes unlogical or unsimplified code
  Reply With Quote
07-16-10, 06:19 PM   #38
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Using the factory allows you to block the layouts default :Spawn and handle style selection on a per unit basis yourself. It's really only there to allow the user to choose.

How it makes your code much harder to read I don't know, as it's only a function call wrapped around your old spawn code.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
07-18-10, 09:14 AM   #39
Icerat
A Fallenroot Satyr
Join Date: Sep 2006
Posts: 28
Learning a little more now, getting my head around it slowly, i have the following which displays the name at a set distance from the left of the frame,

For player and target its 28 from left as so that I can get player / target lvl (80+ for example) in before the name with out any over lap.

For Pet and focus and tot I don't display the lvl on them frames so it 0 from left.

Code:
 --gen name string func
  	lib.gen_namestring = function(f)
	--name text string
		local name = lib.gen_fontstring(f.Health, cfg.font, 9, "THINOUTLINE")
			if f.mystyle == "player" then
				name:SetPoint("LEFT", f.Health, "LEFT",28, 10)
				elseif f.mystyle == "target" then
				name:SetPoint("LEFT", f.Health, "LEFT",28, 10)
				name:SetWidth(100)
				else
				name:SetPoint("LEFT", f.Health, "LEFT", 0, 10)
			end
		f:Tag(name, "[name]")
	end
The problem I had was that if the target has a long name it would over lap the [curhp]/[maxhp] I have on the same line top right.

I thought that if I used name:SetWidth(100) it would cause the name to be cut off but instead it moves my / target name over to the right and if the target has a long name it stacks/word wraps it so you have the first part of name on top and the rest directly underneath it.

I apologize in advance if the code is terrible I'm only just learning.

Mike
  Reply With Quote
07-18-10, 12:58 PM   #40
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Try to set name:SetHeight(set it to yourfontsize). This should prevent the name from switching to a second line, in theory. However, the best solution would be to abbreviate names.
__________________
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

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF tutorial layout for oUF 1.4


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