Worgen male models showing up weirdly in 3D portraits

90 Dwarf Warrior
10880
Well, bacon's little code snippet works absolutely perfect. Thanks mate!
Reply Quote
85 Worgen Warrior
4240
Well, like I said whatever come's before amateur is what I am, when it come's to working with .lua files, but I try.

I see what you mean, this sure fixe's it for Worgen plates, but If I target anything else then worgen now, its my all the other classes that now have the problem.

When I tried addin Bacon's thingie, It removed my portrait overall. I must have done something wrong.

Can you post the entire .Lua map so i can just copy-paste it all when its correct? Thnx
Edited by Draegloth on 01/01/2012 20:44 GMT
Reply Quote
85 Worgen Warrior
4240
And still, I'd rather have my own unitframes look good, and target wrong, then the other way arround xD
Reply Quote
90 Dwarf Warrior
10880
This is the whole code snippet with fixes and everything. Replace the code in portrait.lua with this. Courtesy of Sacredbacon above, this is just his code put into the whole deal. local Portrait = {}
ShadowUF:RegisterModule(Portrait, "portrait", ShadowUF.L["Portrait"])

-- If the camera isn't reset OnShow, it'll show the entire character instead of just the head, odd I know
local function resetCamera(self)
self:SetCamera(0)
end

local function resetGUID(self)
self.guid = nil
end

function Portrait:OnEnable(frame)
frame:RegisterUnitEvent("UNIT_PORTRAIT_UPDATE", self, "UpdateFunc")
frame:RegisterUnitEvent("UNIT_MODEL_CHANGED", self, "Update")

frame:RegisterUpdateFunc(self, "UpdateFunc")
end

function Portrait:OnDisable(frame)
frame:UnregisterAll(self)
end

function Portrait:OnPreLayoutApply(frame, config)
if( not frame.visibility.portrait ) then return end

if( config.portrait.type == "3D" ) then
if( not frame.portraitModel ) then
frame.portraitModel = CreateFrame("PlayerModel", nil, frame)
frame.portraitModel:SetScript("OnShow", resetCamera)
frame.portraitModel:SetScript("OnHide", resetGUID)
frame.portraitModel.parent = frame
end

frame.portrait = frame.portraitModel
frame.portrait:Show()

ShadowUF.Layout:ToggleVisibility(frame.portraitTexture, false)
else
frame.portraitTexture = frame.portraitTexture or frame:CreateTexture(nil, "ARTWORK")
frame.portrait = frame.portraitTexture
frame.portrait:Show()

ShadowUF.Layout:ToggleVisibility(frame.portraitModel, false)
end
end

function Portrait:UpdateFunc(frame)
-- Portrait models can't be updated unless the GUID changed or else you have the animation jumping around
if( ShadowUF.db.profile.units[frame.unitType].portrait.type == "3D" ) then
local guid = UnitGUID(frame.unitOwner)
if( frame.portrait.guid ~= guid ) then
self:Update(frame)
end

frame.portrait.guid = guid
else
self:Update(frame)
end
end

function Portrait:Update(frame, event)
local type = ShadowUF.db.profile.units[frame.unitType].portrait.type

-- Use class thingy
if( type == "class" ) then
local classToken = select(2, UnitClass(frame.unitOwner))
if( classToken ) then
frame.portrait:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes")
frame.portrait:SetTexCoord(CLASS_ICON_TCOORDS[classToken][1], CLASS_ICON_TCOORDS[classToken][2], CLASS_ICON_TCOORDS[classToken][3], CLASS_ICON_TCOORDS[classToken][4])
else
frame.portrait:SetTexture("")
end
-- Use 2D character image
elseif( type == "2D" ) then
frame.portrait:SetTexCoord(0.10, 0.90, 0.10, 0.90)
SetPortraitTexture(frame.portrait, frame.unitOwner)
-- Using 3D portrait, but the players not in range so swap to question mark
elseif( not UnitIsVisible(frame.unitOwner) or not UnitIsConnected(frame.unitOwner) ) then
frame.portrait:SetModelScale(12)
frame.portrait:SetPosition(-4, -4, -0.4)
frame.portrait:SetModel("Interface\\Buttons\\talktomequestionmark.mdx")
-- Use animated 3D portrait
else
frame.portrait:SetUnit(frame.unitOwner)
local _, race = UnitRace(frame.unitOwner)
frame.portrait:SetCamera(race == 'Worgen' and 1 or 0)
frame.portrait:Show()
end
end
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)
Submit Cancel

Reported!

[Close]