Thread Tools Display Modes
11-03-10, 03:28 PM   #1
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
totem bar question

I've been trying today to implement oUF_TotemBar into oUF_Drk today.

Code:
-- Shaman Totem Bar
lib.genTotemBar = function(self)
	if IsAddOnLoaded("oUF_TotemBar") and class == "SHAMAN" then
		
		local TotemBar = CreateFrame('Frame', nil, self)
		TotemBar:SetPoint('BOTTOMLET', self.Portrait, 'TOPLEFT', 0, 2)
		TotemBar:SetHeight(4)
		TotemBar:SetWidth(self.Portrait:GetWidth())
		local h = CreateFrame("Frame", nil, TotemBar)
		h:SetFrameLevel(3)
		h:SetPoint("TOPLEFT",-5,5)
		h:SetPoint("BOTTOMRIGHT",5,-5)
		lib.gen_backdrop(h)
		TotemBar = {}
		TotemBar.Destroy = true
		
		for i = 1, 4 do
			local totem = CreateFrame("StatusBar", nil, self)
			totem:SetSize((self.Portrait:GetWidth() / 4) - 0.85, 4)
			totem:SetStatusBarTexture(cfg.statusbar_texture)
			totem:SetFrameLevel(4)
			
			if (i == 1) then
				totem:SetPoint('LEFT', TotemBar, 'LEFT', 1, 0)
			else
				totem:SetPoint('TOPLEFT', TotemBar[i-1], 'TOPRIGHT', 2, 0)
			end
			TotemBar:SetStatusBarTexture(statusbar)
			TotemBar:SetBackdrop(statusbackback)
			totem:SetBackdropColor(0, 0, 0)
			TotemBar:SetMinMaxValues(0, 1)
		
			local totemBG = totem:CreateTexture(nil, 'BACKGROUND')
			totemBG:SetAllPoints(totem)
			totemBG:SetTexture(cfg.statusbar_texture)
			totem.bg = totemBG
			totem.bg.multiplier = 0.3
			TotemBar[i] = totem
		end
		self.TotemBar = TotemBar
	end	
end
The code I posted doesn't present any errors on load or when dropping totems, but fails to produce a totem bar. Any ideas?
  Reply With Quote
11-03-10, 03:34 PM   #2
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Why are you creating TotemBar as a frame?

local TotemBar = CreateFrame('Frame', nil, self)

I don't see the point in that. Remove that and try again. Dunno if it's that but on my layout I just created a table, nothing more. Everything else seems fine to me.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
11-03-10, 04:21 PM   #3
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Just a thought, but have you actually created your portrait before trying to create your totembar?
If not, then your width will always be set to 0.
  Reply With Quote
11-04-10, 06:06 AM   #4
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
So as a test I copied all of your code and modified the obvious stuff that needed to change from oUF_Lumen, Still no totem bar. The code I was orginally using was placed after the DK rune code which works, so its not an issue with creating it before the portrait. Obviously if I'm using working code from another layout and modifying all the vars to constants, then its something I'm doing wrong.

Thanks for the help so far guys.

Last edited by maltese : 11-04-10 at 06:40 AM.
  Reply With Quote
11-04-10, 06:44 AM   #5
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Err, did you had oUF_TotemBar dependency in the TOC file?

Like this: ## OptionalDeps: oUF_TotemBar

Or in the big picture:

Code:
## Interface: 40000
## Author: greven
## Title: oUF_|cFF0d87d5l|r|cFF3f6abdu|r|cFF85419cm|r|cFFc81a7de|r|cFFf20269n|r
## Notes: oUF layout of greven
## X-Category: UnitFrame
## Version: 1.7
## Dependencies: oUF
## OptionalDeps: oUF_MovableFrames, oUF_Smooth, oUF_Swing, oUF_SpellRange, oUF_CombatFeedback, oUF_BarFader, oUF_Experience, oUF_TotemBar

cfg.lua
oUF_lumen.lua
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
11-04-10, 06:59 AM   #6
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
Thats actually one of the first things I did, still no luck.
I've gone through and copied over several different layouts totem code into the one I'm using, redownloaded oUF_TotemBar, and disabled my layout and turned on others. I all cases no errors are produced and every other layout shows a totembar but no errors with mine. I know this is going to be something simple when I finally figure it out (like it usually is heh).

Last edited by maltese : 11-04-10 at 07:05 AM.
  Reply With Quote
11-04-10, 07:33 AM   #7
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
I don't know if this will help you, but here's my implementation. Admittedly the borders aren't just right, but it is a fully working one.

Code:
 -- Totembar
if(IsAddOnLoaded("oUF_TotemBar") and select(2, UnitClass("player")) == "SHAMAN") then
self.TotemBar = {}
for i = 1, 4 do
self.TotemBar[i] = CreateFrame("StatusBar", nil, self)
self.TotemBar[i]:SetHeight(7)
self.TotemBar[i]:SetWidth(plWidth/4 - 0.85)
if (i == 1) then
self.TotemBar[i]:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, -1)
else
self.TotemBar[i]:SetPoint("TOPLEFT", self.TotemBar[i-1], "TOPRIGHT", 1, 0)
end
self.TotemBar[i]:SetStatusBarTexture(texture)
self.TotemBar[i]:SetBackdrop{
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
insets = {left = -2, right = -2, top = -2, bottom = -2},
}
self.TotemBar[i]:SetBackdropColor(0, 0, 0, .3)
self.TotemBar[i]:SetMinMaxValues(0, 1)
self.TotemBar[i].destroy = true

self.TotemBar[i].bg = self.TotemBar[i]:CreateTexture(nil, "BORDER")
self.TotemBar[i].bg:SetAllPoints(self.TotemBar[i])
self.TotemBar[i].bg:SetTexture(texture)
self.TotemBar[i].bg.multiplier = 0.25
end
end
  Reply With Quote
11-04-10, 07:38 AM   #8
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
And here is my implementation...
https://github.com/Evilpaul/oUF_EP/b...UF_EP.lua#L421


It might be worth posting a pastey of your entire layout, there may be something that means you totem code is not actually being run.
  Reply With Quote
11-04-10, 08:05 AM   #9
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
tried some more layouts and found some code that worked for me after changing it some. Not sure why my original didn't work, but hey.. it works now

Code:
-- Shaman Totem Bar
lib.genTotemBar = function(self)
	if IsAddOnLoaded('oUF_TotemBar') and playerClass == 'SHAMAN' then
		local totems = CreateFrame('Frame', nil, self)
		totems:SetPoint('BOTTOMLEFT', self.Portrait, 'TOPLEFT', 0, 2)
		totems:SetHeight(4)
		totems:SetWidth(self.Portrait:GetWidth())
		local h = CreateFrame("Frame", nil, totems)
		h:SetFrameLevel(3)
		h:SetPoint("TOPLEFT",-5,5)
		h:SetPoint("BOTTOMRIGHT",5,-5)
		lib.gen_backdrop(h)
		totems.delay = 0.1
		totems.Destroy = true
		for i = 1, 4 do
			local totem = CreateFrame('StatusBar', nil, totems)
			totem:SetSize((self.Portrait:GetWidth() / 4) - 2, 4)
			totem:SetStatusBarTexture(cfg.statusbar_texture)
			totem:SetFrameLevel(4)
			totem:SetMinMaxValues(0, 1)
			if (i == 1) then
				totem:SetPoint('LEFT', totems, 'LEFT', 1, 1)
			else
				totem:SetPoint('TOPLEFT', totems[i - 1], 'TOPRIGHT', 2, 0)
			end
			local totemBG = totem:CreateTexture(nil, 'BACKGROUND')
			totemBG:SetAllPoints(totem)
			totemBG:SetTexture(cfg.statusbar_texture)
			totem.bg = totemBG
			totem.bg.multiplier = 0.3
			totems[i] = totem
		end
		self.TotemBar = totems
	end
end

the only issue now is the background color as the totems tick down is white, when I want it black. I'm sure I can fiddle around and figure that out, but incase someone sees something obvious, pointing me in the right direction would be helpful.

thanks again

Last edited by maltese : 11-04-10 at 09:07 AM. Reason: Edited for current version of working code. IT WORKS! :D
  Reply With Quote
11-04-10, 08:08 AM   #10
Taroven
A Cyclonian
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 49
Look for SetBackdropColor and change the 1's to 0's. =P
__________________
Former author of EventHorizon Continued and Other Releases.
  Reply With Quote
11-04-10, 08:11 AM   #11
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
Thats what I thought too.. but still white
  Reply With Quote
11-04-10, 08:41 AM   #12
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Originally Posted by maltese View Post
the only issue now is the background color as the totems tick down is white, when I want it black. I'm sure I can fiddle around and figure that out, but incase someone sees something obvious, pointing me in the right direction would be helpful.

thanks again
You are setting the background for each totem indicator to this texture:
Code:
totemBG:SetTexture(cfg.statusbar_texture)
If you are not setting a solid colour as the texture, then you will need to set the vertex colour.
  Reply With Quote
11-04-10, 08:51 AM   #13
maltese
A Wyrmkin Dreamwalker
 
maltese's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 54
aye! just found that right as you posted. I just commented it out and its working properly. thanks I've edited my code above for anyone that is intrested in getting oUF_TotemBars into oUF_Drk.

Only one glaring error left in my layout which seems to be plaguing every oUF layout, right click menu not working properly in a raid.

EDIT: I actually went back and put the bg texture back in and added the multiplier code, working exactly like it should.

Last edited by maltese : 11-04-10 at 09:15 AM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » totem bar question


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