View Single Post
08-20-21, 08:08 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,324
The best way I can find currently is use GetRaceAtlas() that is provided for the character creation screen. The atlas name generated can be applied using texture:SetAtlas().

Here's an example:
Lua Code:
  1. hooksecurefunc("UnitFramePortrait_Update",function(self)
  2.     if self.portrait then
  3.         if UnitIsPlayer(self.unit) then
  4.             self.portrait:SetAtlas(GetRaceAtlas(
  5.                 select(2,UnitRace(self.unit)):lower()
  6.                 ,UnitSex(self.unit)==Enum.Unitsex.Male and "male" or "female"
  7.                 ,true
  8.             ));
  9.         else
  10.             self.portrait:SetTexCoord(0,1,0,1);
  11.         end
  12.     end
  13. end);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote