WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   3D portrait background color not refreshing (https://www.wowinterface.com/forums/showthread.php?t=56171)

GreyFox777 04-21-18 04:23 PM

3D portrait background color not refreshing
 
Have little trouble with 3D portrait for my party frames. Not all party units get the background colored after i joined a group, i think there is need for some delay before it fires...

The code itself working great. If i /reload all background are colored. Can you correct it please?

Quote:

-- 3D Portrait with classification/reaction backdrop color

local portrait = CreateFrame("PlayerModel", nil, self)
portrait:SetScript("OnShow", function(self) self:SetCamera(0) end)
portrait:SetSize(66, 66)

table.insert(self.__elements, function(self, _, unit)
if (unit == 'party1') or (unit == 'party2') or (unit == 'party3') or (unit == 'party4') then
portrait:SetPoint("CENTER", self, "CENTER", -44, 2)
end
end)

portrait:SetFrameStrata("BACKGROUND")
portrait:SetFrameLevel(14)
portrait.type = "3D"

local bg = portrait:CreateTexture(nil, 'BACKGROUND')
bg:SetTexture(m.textures.portrait_backdrop)
table.insert(self.__elements, function(self, _, unit)
local color
if UnitIsPlayer(unit) then
local _, class = UnitClass(unit)

if ( class and RAID_CLASS_COLORS[class] ) then
color = RAID_CLASS_COLORS[class];
end
else
local reaction = UnitReaction(unit, "player");
if ( reaction ) then
color = FACTION_BAR_COLORS[reaction]
end
end

if not color then
color = { r=1, g=1, b=1, a=1 }
end

bg:SetVertexColor(color.r, color.g, color.b)
end)
bg:SetAllPoints()
local overlay = CreateFrame('Frame', nil, portrait)
overlay:SetPoint('TOPLEFT', -1, 1)
overlay:SetPoint('BOTTOMRIGHT', 1, -1)
overlay:SetBackdrop(m.temp.temp2)
overlay:SetBackdropColor(0, 0, 0, 0)
overlay:SetBackdropBorderColor(0, 0, 0, 0)
self.Overlay = overlay

local shader = overlay:CreateTexture(nil, 'BACKGROUND')
shader:SetTexture(m.textures.temp3)
shader:SetVertexColor(0, 0, 0, 0.75)




self.Portrait = portrait

GreyFox777 04-21-18 10:39 PM

Need to be UNIT_NAME_UPDATE event added, but got always errors...

Any help would be appericated

runamonk 04-22-18 01:50 AM

Quote:

Originally Posted by GreyFox777 (Post 327649)
Need to be UNIT_NAME_UPDATE event added, but got always errors...

Any help would be appericated

look at the core\tags.lua file.

There is a tag for name, there is table called events. You need to add the additional events you need there. However I am seeing that UNIT_NAME_UPDATE is already there.

Lua Code:
  1. -- Name
  2. tags['lumen:name'] = function(unit, rolf)
  3.   return UnitName(rolf or unit)
  4. end
  5. events['lumen:name'] = 'UNIT_NAME_UPDATE UNIT_CONNECTION UNIT_ENTERING_VEHICLE UNIT_EXITING_VEHICLE'

GreyFox777 04-22-18 04:21 AM

Quote:

Originally Posted by runamonk (Post 327651)
look at the core\tags.lua file.

There is a tag for name, there is table called events. You need to add the additional events you need there. However I am seeing that UNIT_NAME_UPDATE is already there.

Lua Code:
  1. -- Name
  2. tags['lumen:name'] = function(unit, rolf)
  3.   return UnitName(rolf or unit)
  4. end
  5. events['lumen:name'] = 'UNIT_NAME_UPDATE UNIT_CONNECTION UNIT_ENTERING_VEHICLE UNIT_EXITING_VEHICLE'

Tags is only for text... but i have added this event to ouf itself, now working fine.


All times are GMT -6. The time now is 05:17 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI