Quantcast 3D portrait background color not refreshing - WoWInterface
Thread Tools Display Modes
04-21-18, 04:23 PM   #1
GreyFox777
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 54
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?

-- 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
  Reply With Quote
04-21-18, 10:39 PM   #2
GreyFox777
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 54
Need to be UNIT_NAME_UPDATE event added, but got always errors...

Any help would be appericated
  Reply With Quote
04-22-18, 01:50 AM   #3
runamonk
A Wyrmkin Dreamwalker
 
runamonk's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 54
Originally Posted by GreyFox777 View Post
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'
  Reply With Quote
04-22-18, 04:21 AM   #4
GreyFox777
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 54
Originally Posted by runamonk View Post
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.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » 3D portrait background color not refreshing

Thread Tools
Display Modes

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