View Single Post
12-17-22, 09:05 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
In general, you can't render anything in the 3D game world and in the past, Blizzard has taken steps to block attempts to make UI elements from appearing so.



The way NamePlates are handled is special. They're generated in two parts. First the C code creates an invisible frame in the UI system and does all the 3D translation into the 2D screenspace. This invisible frame is then handed to Lua through the NAMEPLATE_CREATED event. They are often reused as they exit and reenter view and are signaled as such by NAMEPLATE_ADDED and NAMEPLATE_REMOVED.

The DefaultUI listens for these and attaches a dummy CompactUnitFrame to them. These UnitFrames have their click handler disabled and clicks are actually processed by the invisible frame they're attached to.

See AddOns\Blizzard_NamePlates for the DefaultUI side of this.

Note NamePlates are the health bars that pop up when you get close to something if you have them enabled. The name text that's visible when NamePlates aren't there is rendered in the 3D world and can't be interacted with.



PS: Parenting to WorldFrame or the screenspace itself (represented by nil) just makes your frame ignore the UI scale setting, which is applied to UIParent. The base screenspace has a static height of 768 and a variable width depending on aspect ratio.
__________________
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