WoWInterface - View Single Post - Class icons on nameplates
View Single Post
08-21-18, 11:15 AM   #6
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Originally Posted by Mitur View Post
I only omitted things like table creation (icons table for example), and obvious stuff like event registration etc. Main logic is contained within the code I posted.
You should still post your whole code, rule of thumb. You may know what seems important or not, but to the people reading, we don't know what else is there so there's no way for anyone to know.

Originally Posted by Mitur View Post
Thanks for explaining the Hide() part, I just don't know how to get the reference to the Frame that I created to hide it properly.
And you're right about the efficiency part for sure.
I should somehow check if the nameplate already contains my Frame. If only I knew how to manage the nameplates properly
iconFrame is local to your addIcon function, you'll have a hard time accessing it from anywhere else.

You could declare iconFrame inside nameplateHandler, and pass it as an argument to addIcon and removeIcon. Ideally, you'd probably do this differently as a whole, but see if that works to begin with.

The way nameplates work, there is a finite amount of nameplates, and they are recycled as units appear and disappear. Nameplates aren't unique to the unit.If NamePlate1 gets assigned to a Warrior player character, and that character either dies or moves out of sight, NamePlate1 will get re-assigned to a different unit later on. If you modify that nameplate, the modifications will still be in place when it reappears later with a different unit assigned to it. So that has to be kept in mind.

Also, I could be wrong about the multiple frames per nameplate thing, but from my understanding, iconFrame being local to addIcon function, a new instance of it is created every time the function gets called, and references to it are lost once the function exits. Anyone feel free to let me know if that's wrong
  Reply With Quote