View Single Post
10-02-16, 08:28 AM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
oUF for nameplate creation?

I posted a barebone nameplate setup here:
http://www.wowinterface.com/forums/s...4&postcount=62

Most important are the following three.

- nameplate_create when we spawn the frame using a certain style.
- unit_added when we show the frame and set the unit of the frame.
- unit_removed when we hide the frame and remove the unit.

Is this possible with the default oUF core?

I need to be able to pass the nameplate base as an anchor frame into the Spawn function.

*edit*

Wooow. It actually works!



Fixed scaling:


magic bean:

Lua Code:
  1. function W:NAME_PLATE_UNIT_ADDED(unit)
  2.   local nameplate = C_NamePlate.GetNamePlateForUnit(unit)
  3.  
  4.   if not nameplate.unitFrame then
  5.     local unitFrame = oUF:Spawn(unit, A..nameplate:GetName())
  6.     unitFrame:SetParent(nameplate)
  7.     unitFrame:ClearAllPoints()
  8.     unitFrame:SetPoint("CENTER")
  9.     nameplate.unitFrame = unitFrame
  10.     --mix-in ubm table data
  11.     Mixin(unitFrame, UFM)
  12.   end
  13.  
  14.   nameplate.unitFrame:UnitAdded(nameplate,unit)
  15. end

Not perfect yet though. But it shows that it should be possible.

Currently I seem to struggle with the unit update. Nameplates shuffle units quite often and I need a way to tell oUF about the unit change.

Hasn't oUF a function to trigger a full update? Sth like UpdateAllElements.

If you want to test it here is the code I'm using atm:

https://github.com/zorker/rothui/blo...imple/core.lua

Units do not update properly and clicking on a unit does not activate the correct unit.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-02-16 at 10:44 AM.
  Reply With Quote