Thread Tools Display Modes
03-03-10, 08:37 PM   #1
Aerials
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 92
Portrait change?

Hi, is the following a bug or intentional?

when i change targets and the new target has the same name as the old one, the portrait does not update. (not all npc's with the same name have the same portrait)

basically, the easiest way to get it working is in the element change:
Code:
local Update = function(self, event, unit)
	if(not UnitIsUnit(self.unit, unit)) then return end
	if(self.PreUpdatePortrait) then self:PreUpdatePortrait(event, unit) end

	local portrait = self.Portrait
	if(portrait:IsObjectType'Model') then
		local name = UnitName(unit)
		if(not UnitExists(unit) or not UnitIsConnected(unit) or not UnitIsVisible(unit)) then
			portrait:SetModelScale(4.25)
			portrait:SetPosition(0, 0, -1.5)
			portrait:SetModel"Interface\\Buttons\\talktomequestionmark.mdx"
		elseif(portrait.name ~= name or event == 'UNIT_MODEL_CHANGED') then
			local alpha = portrait:GetAlpha()
			portrait:SetUnit(unit)
			portrait:SetCamera(0)
			portrait:SetAlpha(alpha)

			portrait.name = name
		else
			portrait:SetCamera(0)
		end
	else
		SetPortraitTexture(portrait, unit)
	end

	if(self.PostUpdatePortrait) then
		return self:PostUpdatePortrait(event, unit)
	end
end
to:
Code:
local Update = function(self, event, unit)
	if(not UnitIsUnit(self.unit, unit)) then return end
	if(self.PreUpdatePortrait) then self:PreUpdatePortrait(event, unit) end

	local portrait = self.Portrait
	if(portrait:IsObjectType'Model') then
		local name = UnitName(unit)
		if(not UnitExists(unit) or not UnitIsConnected(unit) or not UnitIsVisible(unit)) then
			portrait:SetModelScale(4.25)
			portrait:SetPosition(0, 0, -1.5)
			portrait:SetModel"Interface\\Buttons\\talktomequestionmark.mdx"
		else
			local alpha = portrait:GetAlpha()
			portrait:SetUnit(unit)
			portrait:SetCamera(0)
			portrait:SetAlpha(alpha)
		end
	else
		SetPortraitTexture(portrait, unit)
	end

	if(self.PostUpdatePortrait) then
		return self:PostUpdatePortrait(event, unit)
	end
end
but i don't like the change to be in ouf so i've handled it in the layout.

Last edited by Aerials : 03-03-10 at 09:13 PM.
  Reply With Quote
03-04-10, 12:35 AM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
I'll push out a fix on git later today.
__________________
「貴方は1人じゃないよ」
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Portrait change?


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