View Single Post
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