Quantcast
WoWInterface - View Single Post - oUF for nameplate creation?
View Single Post
10-02-16, 11:34 AM   #3
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,739
I tried adding the following change as a test to the oUF Spawn function:

Lua Code:
  1. function oUF:Spawn(unit, overrideName, type, nameplate)
  2.   argcheck(unit, 2, 'string')
  3.   if(not style) then return error("Unable to create frame. No styles have been registered.") end
  4.  
  5.   unit = unit:lower()
  6.  
  7.   local name = overrideName or generateName(unit)
  8.   local object
  9.   if type == "nameplate" then
  10.     object = CreateFrame("Button", name, nameplate)
  11.   else
  12.     object = CreateFrame("Button", name, oUF_PetBattleFrameHider, "SecureUnitButtonTemplate")
  13.   end
  14.   Private.UpdateUnits(object, unit)
  15.  
  16.   self:DisableBlizzard(unit)
  17.   walkObject(object, unit)
  18.  
  19.   object:SetAttribute("unit", unit)
  20.   RegisterUnitWatch(object)
  21.  
  22.   return object
  23. end

This gets rid of the in combat error. But sometimes the health will not update properly. I think that is because going from secure to not secure unitframes is not just removing the template and be done?!

Well another issue is that nameplates will pop up during combat. They must be spawnable in combat. Maybe nameplates can be handled like party or raid via secure group header?

The current solution works perfectly. Out of combat.

*edit*

I went back to the adjusted oUF spawn because I think it is the only solution. We need to spawn the nameplates without the secure template. From what I can tell the only thing that is missing atm is that UNIT_HEALTH is not updating the target nameplate properly.

Hmm yeah...when fighting UNIT_HEALTH fires only for target and oUF is not updating the target nameplate correctly.

But I can fix that by doing C_NamePlate.GetNamePlateForUnit("target") and applying the value on postupdate to the corresponding nameplate. Will see how that goes. Imo anything that affects the target unit has to be populated to a corresponding nameplate target unit aswell since it will only fire once.

Urgs...the same is also true party/raid units...hmm that sounds messy. No sure if seperating nameplate from other unit frames in two seperate ouf layouts helps with that.

*edit*

Yes that seems to have fixed all issues. I disabled all unitframes but the nameplate spawn. I only used nameplate unit ids. I spawned them with the adjusted oUF spawn function as a not secure button.

So here is my idea for now.

1.) Adjust the oUF spawn function to allow the creation of non secure nameplate units.
2.) Create a seperate layout for nameplates only that does only spawn nameplate units (never use anything else but nameplate1..n as your unit id)

The tricky part is that I want to access style function from my oUF unit layout. But I probably can circumvent this by making the layout functions globally available.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

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

Last edited by zork : 10-02-16 at 12:35 PM.
  Reply With Quote