WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   ClassIcons (https://www.wowinterface.com/forums/showthread.php?t=44657)

neverg 10-06-12 10:14 AM

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.


haste 10-06-12 10:21 AM

ClassIcons expects textures, not statusbars. You should turn Lua errors on, as it should error due to calling :SetVertexColor().

neverg 10-06-12 10:38 AM

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?

haste 10-06-12 11:31 AM

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.

neverg 10-06-12 11:34 AM

Thanks. I didn't even noticed. I'm getting errors now, that is good I can now work with something. :)

haste 10-06-12 11:39 AM

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)

neverg 10-06-12 01:19 PM

Thanks, it's working great now. :)


All times are GMT -6. The time now is 02:43 PM.

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