Thread Tools Display Modes
12-03-12, 07:48 PM   #1
Elen'
A Murloc Raider
 
Elen''s Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 8
ClassIcon SetVertexColor issue

Hi,
I'm trying to update my layout to 1.6 and I encounter an issue from the ClassIcon element.

Here's my code:
--: CLASSICON :--
if cClassIcn == true then
self.ClassIcons = CreateFrame("Frame", nil, self)
self.ClassIcons:SetPoint("BOTTOMRIGHT", self.Health, "BOTTOMRIGHT", -3, 3)
self.ClassIcons:SetHeight(10)
self.ClassIcons:SetWidth(150)
for i = 1, 5 do
self.ClassIcons[i] = CreateFrame("StatusBar", nil, self)
self.ClassIcons[i]:SetStatusBarTexture(statusbar)
self.ClassIcons[i]:SetHeight(10)
self.ClassIcons[i]:SetWidth((150-4)/5)
self.ClassIcons[i]:SetBackdrop(backdrop)
self.ClassIcons[i]:SetBackdropColor(0, 0, 0)
if i == 1 then
self.ClassIcons[i]:SetPoint("BOTTOMRIGHT", self.Health, "TOPRIGHT", 0, 5)
else
self.ClassIcons[i]:SetPoint("RIGHT", self.ClassIcons[i-1], "LEFT", -1, 0)
end
end
end
And here's the lua error log i get:
6x oUF-1.6.1\elements\classicons.lua:63: attempt to call method "SetVertexColor" (a nil value)
oUF-1.6.1\elements\classicons.lua:63: in function <oUF\elements\classicons.lua:43>
oUF-1.6.1\elements\classicons.lua:250: in function "enable"
oUF-1.6.1\ouf-1.6.1.lua:99: in function "EnableElement"
oUF-1.6.1\ouf-1.6.1.lua:269: in function <oUF\ouf.lua:192>
(tail call): ?
oUF-1.6.1\ouf-1.6.1.lua:552: in function "Spawn"
oUF_Elen-2.0\elen.lua:1274: in function <oUF_Elen\elen.lua:1271>
oUF_Elen-2.0\elen.lua:1286: in function "func"
oUF-1.6.1\factory.lua:20: in function <oUF\factory.lua:16>
(tail call): ?

Locals:
self = oUF_ElenPlayer {
0 = <userdata>
MasterLooter = <unnamed> {}
__tags = <table> {}
PLAYER_ENTERING_WORLD = <func> @oUF\ouf.lua:149
Leader = <unnamed> {}
UNIT_SPELLCAST_CHANNEL_START = <func> @oUF\elements\castbar.lua:256
UNIT_SPELLCAST_INTERRUPTIBLE = <func> @oUF\elements\castbar.lua:190
UNIT_HEALTH_FREQUENT = <func> @oUF\elements\health.lua:145
UNIT_MAXHEALTH = <func> @oUF\elements\health.lua:145
__elements = <table> {}
UNIT_POWER_FREQUENT = <func> @oUF\elements\power.lua:189
Power = <unnamed> {}
HolyPower = <table> {}
Blank = <unnamed> {}
UNIT_THREAT_SITUATION_UPDATE = <table> {}
style = "Elen - Player"
UNIT_EXITED_VEHICLE = <func> @oUF\ouf.lua:38
UNIT_DISPLAYPOWER = <table> {}
UNIT_CONNECTION = <table> {}
PARTY_LOOT_METHOD_CHANGED = <func> @oUF\elements\masterlooter.lua:73
UNIT_MAXPOWER = <func> @oUF\elements\power.lua:189
UNIT_POWER = <func> @oUF\elements\classicons.lua:82
Castbar = <unnamed> {}
PLAYER_ROLES_ASSIGNED = <func> @oUF\elements\lfdrole.lua:57
UNIT_SPELLCAST_START = <func> @oUF\elements\castbar.lua:104
unit = "player"
GROUP_ROSTER_UPDATE = <table> {}
UNIT_POWER_BAR_SHOW = <func> @oUF\elements\power.lua:189
UNIT_SPELLCAST_CHANNEL_STOP = <func> @oUF\elements\castbar.lua:332
PARTY_LEADER_CHANGED = <func> @oUF\elements\leader.lua:53
UNIT_COMBO_POINTS = <func> @oUF\elements\cpoints.lua:70
RaidIcon = <unnamed> {}
PLAYER_TARGET_CHANGED = <func> @oUF\elements\cpoints.lua:70
UNIT_SPELLCAST_CHANNEL_UPDATE = <func> @oUF\elements\castbar.lua:309
LFDRole = <unnamed> {}
Threat = <unnamed> {}
UNIT_SPELLCAST_DELAYED = <func> @oUF\elements\castbar.lua:218
UNIT_SPELLCAST_NOT_INTERRUPTIBLE = <func> @oUF\elements\castbar.lua:204
UNIT_SPELLCAST_INTERRUPTED = <func> @oUF\elements\castbar.lua:172
UNIT_SPELLCAST_STOP = <func> @oUF\elements\castbar.lua:238
UNIT_FACTION = <table> {}
UNIT_ENTERED_VEHICLE = <func> @oUF\ouf.lua:38
CPoints = <unnamed> {}
Health = <unnamed> {}
Info = <unnamed> {}
PvP = <unnamed> {}
menu = <func> @oUF_Elen\elen.lua:132
UNIT_POWER_BAR_HIDE = <func> @oUF\elements\power.lua:189
ClassIcons = <unnamed> {}
UNIT_SPELLCAST_FAILED = <func> @oUF\elements\castbar.lua:154
}
unit = "player"
element = <unnamed> {
1 = <unnamed> {}
2 = <unnamed> {}
3 = <unnamed> {}
4 = <unnamed> {}
5 = <unnamed> {}
__owner = oUF_ElenPlayer {}
ForceUpdate = <func> @oUF\elements\classicons.lua:147
__max = 0
0 = <userdata>
}
ForceUpdate = <func> @oUF\elements\classicons.lua:147
ClassPowerEnable = <func> @oUF\elements\classicons.lua:176
PlayerClass = "PALADIN"
Visibility = <func> @oUF\elements\classicons.lua:132
UpdateTexture = <func> @oUF\elements\classicons.lua:43
Any idea from where it came from?
  Reply With Quote
12-04-12, 12:02 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
oUF expects each of your class icon objects to be a texture. If you aren't using any statusbar features (eg. displaying a value within a range) you should just make your objects textures instead of statusbars. They will look the same, but (a) not defy oUF's expectations and (b) use less memory.

Code:
--: CLASSICON :--
if cClassIcn == true then
	self.ClassIcons = CreateFrame("Frame", nil, self)
	self.ClassIcons:SetPoint("BOTTOMRIGHT", self.Health, "BOTTOMRIGHT", -3, 3)
	self.ClassIcons:SetHeight(10)
	self.ClassIcons:SetWidth(150)
	for i = 1, 5 do
		self.ClassIcons[i] = self:CreateTexture(nil, "ARTWORK")
		self.ClassIcons[i]:SetTexture(statusbar)
		self.ClassIcons[i]:SetHeight(10)
		self.ClassIcons[i]:SetWidth((150-4)/5)
		if i == 1 then
			self.ClassIcons[i]:SetPoint("BOTTOMRIGHT", self.Health, "TOPRIGHT", 0, 5)
		else
			self.ClassIcons[i]:SetPoint("RIGHT", self.ClassIcons[i-1], "LEFT", -1, 0)
		end
	end
end
If you are using :SetValue or other statusbar features, you can just add a dummy function under the "UpdateTexture" key for each class icon (see line 73 in oUF/elements/classicons.lua):

Code:
local DoNothing = function() return end

--: CLASSICON :--
if cClassIcn == true then
	self.ClassIcons = CreateFrame("Frame", nil, self)
	self.ClassIcons:SetPoint("BOTTOMRIGHT", self.Health, "BOTTOMRIGHT", -3, 3)
	self.ClassIcons:SetHeight(10)
	self.ClassIcons:SetWidth(150)
	for i = 1, 5 do
		self.ClassIcons[i] = CreateFrame("StatusBar", nil, self)
		self.ClassIcons[i].UpdateTexture = DoNothing
		...
(Also, please use CODE tags around your code, not QUOTE tags; the latter discards your indents, making your code really hard to read.)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-04-12, 06:39 AM   #3
Elen'
A Murloc Raider
 
Elen''s Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 8
Thanks alot it works perfectly !


And sorry about the QUOTE tags I'll use the right tags next time.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » ClassIcon SetVertexColor issue

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