View Single Post
08-21-21, 02:08 PM   #4
Nagí
A Murloc Raider
 
Nagí's Avatar
Join Date: Oct 2020
Posts: 6
Amazing! Thanks a lot to both of you for your time and your consideration. I searched a bit before dare to ask for help and I have already seen SetAtlas() while looking in the folders of the Interface with Notepad++. But I have never thought about using it.

I have tried both scripts. First the one from Ketho's post causes me massive FPS drops. When entering in combat with a training dummy everything is normal. But when in combat with a NPC who is targeting me, my FPS fall and are locked at ~20.

Then the one from SDPhantom's post works great. But after that I add the line with SetMask() from Ketho's code like this:
Lua Code:
  1. hooksecurefunc("UnitFramePortrait_Update",function(self)
  2.     if self.portrait then
  3.         if UnitIsPlayer(self.unit) then
  4.             self.portrait:SetMask("Interface\\CharacterFrame\\TempPortraitAlphaMask");
  5.             self.portrait:SetAtlas(GetRaceAtlas(
  6.                 select(2,UnitRace(self.unit)):lower()
  7.                 ,UnitSex(self.unit)==Enum.Unitsex.Male and "male" or "female"
  8.                 ,true
  9.             ));
  10.         else
  11.             self.portrait:SetTexCoord(0,1,0,1);
  12.         end
  13.     end
  14. end);

...when in combat against NPC same issue with FPS drops.

I thought this was a problem of compatibility with one of my AddOns.
At start I have downloaded AddonUsage to know the source of the issue. (*cough* I will make another post about DSM)
I check with AddOns and without AddOns

So, I presume that the problem is the use of SetMask() or the update during combat itself.

I'm quite curious to know what is the difference between SetMask() and SetPortraitToTexture() here? And if SetPortraitToTexture() would cause the same issue? (I attempted SetPortraitToTexture() but I didn't succeed to make it works, I haven't put the good informations certainly...)

Also I want to flip horizontally the portrait for the unit frame of my target and focus.
I have tried to do by myself, but I'm not too sure where to insert the elements.
I guess that I should use SetTexCoord(1, 0, 0, 1) for flip the icon, and probably assign the specific units with a new local unit =

Last edited by Nagí : 08-21-21 at 07:05 PM. Reason: After usage...
  Reply With Quote