View Single Post
Old 12-03-12, 11:02 PM   #2
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,675
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.)
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote