Thread Tools Display Modes
05-28-18, 07:43 AM   #1
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Originally Posted by runamonk View Post
Oh, Thanks mate!

I've recently lost my Github password and am being lazy to find it

Originally Posted by Cogwerkz View Post
As a workaround, you could always prehook oUF.DisableBlizzard, and only call it for the units you wish disabled. Then you don't have to directly change anything in the oUF code. Been doing this in some of mine for a while.

Just add something like the following before your spawn code is run:

Lua Code:
  1. local parent, ns = ...
  2. local oUF = ns.oUF
  3. local disableBlizzard = oUF.DisableBlizzard
  4.  
  5. -- table of units you wish to disable,
  6. -- all others blizzard frames will remain
  7. local framesToDisable = {
  8.    player = true,
  9.    target = true
  10. }
  11.  
  12. function oUF:DisableBlizzard(unit)
  13.    if unit and framesToDisable[unit] then
  14.       return disableBlizzard(self, unit)
  15.    end
  16. end
That's actually a great idea.

The question is...

Let's say you have two addons which embeds their own copy of oUF.

One will replace all the unitframes (A) while the other will just draw an extra player unitframe on the center of the screen (B).

Do you reckon overriding a DisableBlizzard function in B would also affect one in A?

oUF doesn't use a LibStub, so I'm guessing that it won't affect each other tho...
(I can't test it myself atm )
  Reply With Quote
05-28-18, 08:54 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Eungavi View Post
Let's say you have two addons which embeds their own copy of oUF.

One will replace all the unitframes (A) while the other will just draw an extra player unitframe on the center of the screen (B).

Do you reckon overriding a DisableBlizzard function in B would also affect one in A?

oUF doesn't use a LibStub, so I'm guessing that it won't affect each other tho...
(I can't test it myself atm )
Embedded oUF instances are their own addons, with their own space. Overwriting oUF internal functions will only affect each one, not both/all.
The only way it'd affect everything is if multiple layouts use the same unembedded oUF instance (which is why you should never override colors globally).

Another way to get what you want without modifying oUF source:
Lua Code:
  1. -- store and disable the method
  2. local orig = oUF.DisableBlizzard
  3. oUF.DisableBlizzard = nop
  4.  
  5. -- spawn your frames
  6. oUF:Spawn('player')
  7.  
  8. -- re-enable the method
  9. oUF.DisableBlizzard = orig

Last edited by p3lim : 05-28-18 at 08:59 AM.
  Reply With Quote
05-28-18, 09:10 AM   #3
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Originally Posted by p3lim View Post
Embedded oUF instances are their own addons, with their own space. Overwriting oUF internal functions will only affect each one, not both/all.
The only way it'd affect everything is if multiple layouts use the same unembedded oUF instance (which is why you should never override colors globally).
That makes sense

Originally Posted by p3lim View Post
Another way to get what you want without modifying oUF source:
Lua Code:
  1. -- store and disable the method
  2. local orig = oUF.DisableBlizzard
  3. oUF.DisableBlizzard = nop
  4.  
  5. -- spawn your frames
  6. oUF:Spawn('player')
  7.  
  8. -- re-enable the method
  9. oUF.DisableBlizzard = orig
Damn... why did I not come up with this

Thanks for the tip!
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Would using oUF to just replace a player's nameplate be overkill?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off