Race Icon Portrait
1 Attachment(s)
Hi, I'm trying to have these race icons to the portrait of my unit frames (player, target, targettarget, arena1, etc...) in the same spirit as the few addons who allow you to have the class icons to portraits. All these addons use a similar structure like this one:
Lua Code:
I attempted some modifications by my own, of course it resulted nothing... I presume that I should replace "CLASS_ICON_TCOORDS" by "RACE_ICON_TCOORDS", add "UnitSex" and replace "UnitClass" by "UnitRace". Maybe it needs more changes or another structure. Honnestly I don't know, I'm lost with many questions like: UnitGUID wouldn't be better? / What about C_PlayerInfo.GetRace? Etc... I can't even figure if what I ask for is possible or not. My knowledge are very limited in coding, I think I'm able to read and nearly understand line after line but not to write it all by myself without some guidance. Could someone help me with this? |
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:
|
To expand on SDPhantom's post, you can additionally mask the texture
Lua Code:
|
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:
...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 = |
Quote:
Oof, I should have tested that more. I'm not that familiar with textures as you can see This doesn't seem to give a massive FPS drop, but still gives you a 5-10 FPS hit. which is not good Lua Code:
|
Thanks for you reply Ketho.
I have tried what you send and it was almost as you said. (more a hit of 20-25 FPS in my case) Quote:
I found this post when getting some information about SetMask() but unfortunately it didn't worked. I attempted by myself some other stuff like applying mask to each specific frames at specific events Lua Code:
|
1 Attachment(s)
So I keep search and I found something very interesting and it gives me an idea.
It's an AddOn called EnhancedClassIconPortraits, and this is his core: Lua Code:
If I take a similar way as above, I can avoid to call SetMask() and have the same result without performance issue. So I have extracted the textures and applied directly a mask on it. Now I have a folder with 46 icons, here is an example. Maybe the name of the textures in the folder could need to be renamed if I want to call them. That's probably less efficient than SetAtlas(). What do you think about it? Is that possible? |
Hey! I'm updating this post to expose my advancement on the subject.
The previous answers have helped and learned me a lot. So I would therefore like to thank them once again. At first, I obstinately continued in the way that has been suggested. I tried to fix the issue encountered with SetMask() while in combat. But I didn't found anything pertinent in the Blizzard interface. So I decided to try as I thought with a folder containing my textures in order to avoid SetMask(). And I achieved to something working perfectly as expected. It's like this: Lua Code:
|
Glad to see you solved your framerate drop issue
|
All times are GMT -6. The time now is 06:05 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI