Reply
Thread Tools Display Modes
Unread 10-06-12, 10:14 AM   #1
neverg
A Cobalt Mageweaver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 241
ClassIcons

I know this question has been raised a lot lately but I've been trying to update my UI to late oUF and WoW API changes and I'm now trying to update to the new ClassIcons function of oUF.

I started with Monk and now Paladin but both are giving me the same problem. The bars get shown at like they were maxed but never disappear from the screen nor they are updated.

I took my previous implementation of HolyPower and just changed the element to ClassIcons and I get the behavior I just described above.

This is my code now for ClassIcons for the Paladin Holy Power:

lua Code:
  1. -- Paladin Holy Power with StatusBar
  2.     local PaladinHolyPower = function(self)
  3.    
  4.         if(cfg.show_PL_HolyPower and PlayerClass == "PALADIN") then
  5.             local HolyPower = CreateFrame("Frame", nil, self)
  6.  
  7.             local max = UnitPowerMax("player", SPELL_POWER_HOLY_POWER)
  8.            
  9.             for i = 1, max do
  10.                 HolyPower[i] = CreateFrame("StatusBar", self:GetName().."_Shards"..i, self)
  11.                 HolyPower[i]:SetHeight(cfg.PL_hp_height)
  12.                 HolyPower[i]:SetWidth(cfg.PL_hp_width)
  13.                
  14.                 HolyPower[i]:SetStatusBarTexture(fill_texture)
  15.                 --local color = self.colors.power["HOLY_POWER"]
  16.                 --HolyPower[i]:SetStatusBarColor(color[1], color[2], color[3])
  17.                 HolyPower[i]:SetStatusBarColor(245/255, 102/255, 165/255)
  18.                 SetBackdrop(HolyPower[i], 2, 2, 2, 2)
  19.                 if (i == 1) then
  20.                     HolyPower[i]:SetPoint('LEFT', self, 'RIGHT', cfg.PL_hp_x or ((cfg.target_frame_x_from_player/2) - (((cfg.PL_hp_width + cfg.PL_hp_spacing) * 1.5) - (cfg.PL_hp_spacing/2))), cfg.PL_hp_y or 0)
  21.                 else
  22.                     HolyPower[i]:SetPoint('TOPLEFT', HolyPower[i-1], "TOPRIGHT", cfg.PL_hp_spacing, 0)
  23.                 end
  24.             end
  25.         end
  26.        
  27.         self.ClassIcons = HolyPower
  28.     end

Dunno what is wrong since the element is not being updated.

__________________
My oUF Layout: oUF Lumen

Last edited by neverg : 10-06-12 at 10:51 AM.
neverg is offline   Reply With Quote
Unread 10-06-12, 10:21 AM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 979
ClassIcons expects textures, not statusbars. You should turn Lua errors on, as it should error due to calling :SetVertexColor().
__________________
「貴方は1人じゃないよ」
haste is offline   Reply With Quote
Unread 10-06-12, 10:38 AM   #3
neverg
A Cobalt Mageweaver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 241
I'm a bit confused. I have Lua errors on and even BugSack and I get no errors whatsoever.

And I didn't quite get what you mean haste, since I'm not calling SetVertexColor anywhere.

EDIT :

Ok it's ClassIcons that call SetVertexColor... thing is It's not giving me any errors so I think somehow it's not linking to the oUF element at all. :/

I even check Phanx code on this topic and it also uses :SetStatusBarTexture for the Icons.

EDIT 2 - I'm using print(self.Castbar) before delivering HolyPower to self.ClassIcons and it's returning a nil.
I'm calling the function on the layout definition inside:

Lua Code:
  1. -- Unit Specific Styles
  2.     local UnitSpecific = {
  3.    
  4.         player = function(self, ...)

Does this means it's not linking ClassIcons correctly?
__________________
My oUF Layout: oUF Lumen

Last edited by neverg : 10-06-12 at 11:21 AM.
neverg is offline   Reply With Quote
Unread 10-06-12, 11:31 AM   #4
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 979
Your HolyPower variable is local to the scope above where you assign ClassIcons. So your code basically reads "self.ClassIcons = nil".

Didn't notice the difference in scoping the first time around.
__________________
「貴方は1人じゃないよ」
haste is offline   Reply With Quote
Unread 10-06-12, 11:34 AM   #5
neverg
A Cobalt Mageweaver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 241
Thanks. I didn't even noticed. I'm getting errors now, that is good I can now work with something.
__________________
My oUF Layout: oUF Lumen
neverg is offline   Reply With Quote
Unread 10-06-12, 11:39 AM   #6
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 979
Switch the statusbars to textures, unless you want to use them for something... statusbary. Alternatively just do HolyPower[i].SetStatusBarColor = SetStatusBarColor. (scumbag bbcodes interfering with code :P)
__________________
「貴方は1人じゃないよ」
haste is offline   Reply With Quote
Unread 10-06-12, 01:19 PM   #7
neverg
A Cobalt Mageweaver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 241
Thanks, it's working great now.
__________________
My oUF Layout: oUF Lumen
neverg is offline   Reply With Quote
Reply

Go BackWoWInterface » Featured Projects » oUF (Otravi Unit Frames) » ClassIcons

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