Thread Tools Display Modes
04-30-18, 09:35 PM   #1
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Would using oUF to just replace a player's nameplate be overkill?

I honestly don't like how the player's default nameplate works and thus decided to replace it.

1. Would it be an overkill to use an oUF just to replace player's nameplate?

2. Afaik, spawning a unitframe with oUF would disable/hide default ones. The question is how could I prevent it from being disabled/hidden since I'm only willing to replace the player's nameplate, not unitframe.
  Reply With Quote
05-01-18, 12:39 AM   #2
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
It will only hide the frames you spawn.
So if you only implement the nameplates it will only skin that.
Don't think it is overkill at all. oUF is quite light to be honest but as with everything depends on what you do with it.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
05-01-18, 07:52 AM   #3
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Originally Posted by neverg View Post
It will only hide the frames you spawn.
So if you only implement the nameplates it will only skin that.
Don't think it is overkill at all. oUF is quite light to be honest but as with everything depends on what you do with it.
The problem is I'm planning to create an unitframe-like one instead of spawning a nameplate

At least it's good to hear that it's not an overkill

Last edited by Eungavi : 05-01-18 at 07:54 AM.
  Reply With Quote
05-01-18, 08:35 AM   #4
runamonk
A Theradrim Guardian
 
runamonk's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 61
Careful..it's addictive. I started out with oUF just to replace my player and target units and ended up implementing all units and then actual nameplates as well lol.
  Reply With Quote
05-01-18, 01:59 PM   #5
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Originally Posted by runamonk View Post
Careful..it's addictive. I started out with oUF just to replace my player and target units and ended up implementing all units and then actual nameplates as well lol.
Too bad...

I'm already addicted to it D:

My core UI has all unitframes implemented by oUF.

This will be a separate addon that can be used standalone just to replace player's default resource bar
  Reply With Quote
05-01-18, 02:22 PM   #6
runamonk
A Theradrim Guardian
 
runamonk's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 61
I did two addons with oUF as well. One for nameplates (and personal bar) and one for all the units.
  Reply With Quote
05-14-18, 04:17 AM   #7
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Okay... so back to the origin!

Would it be possible to create an unitframe without hiding the default ones?

Afaik, :Spawn function would disable blizzard's default unitframe for a selected unit.

Any helps please?!
  Reply With Quote
05-15-18, 01:16 AM   #8
runamonk
A Theradrim Guardian
 
runamonk's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 61
In looking at the spawn function in oUF it does not appear there is a way to override the functionality.


You could modify the spawn function yourself and add an override to it? Maybe this is something they can add to the new version for BfA as well.


Lua Code:
  1. function oUF:Spawn(unit, overrideName)
  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 = CreateFrame('Button', name, oUF_PetBattleFrameHider, 'SecureUnitButtonTemplate')
  9.     Private.UpdateUnits(object, unit)
  10.  
  11.     self:DisableBlizzard(unit)
  12.     walkObject(object, unit)
  13.  
  14.     object:SetAttribute('unit', unit)
  15.     RegisterUnitWatch(object)
  16.  
  17.     return object
  18. end

Last edited by runamonk : 05-15-18 at 01:42 AM.
  Reply With Quote
05-15-18, 08:06 AM   #9
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Yeah, I thought of adding one extra parameter to Spawn function, but I quit doing it as I don't want to modify lua file whenver there's an update :/

Lua Code:
  1. function oUF:Spawn(unit, overrideName, showBlizzard)
  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 = CreateFrame('Button', name, oUF_PetBattleFrameHider, 'SecureUnitButtonTemplate')
  9.     Private.UpdateUnits(object, unit)
  10.  
  11.     -- maybe something like this
  12.     if not showBlizzard then
  13.         self:DisableBlizzard(unit)
  14.     end
  15.    
  16.     walkObject(object, unit)
  17.  
  18.     object:SetAttribute('unit', unit)
  19.     RegisterUnitWatch(object)
  20.  
  21.     return object
  22. end
  Reply With Quote
05-27-18, 09:09 PM   #10
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
May I ask project manager and authors to officially add an extra parameter to Spawn function (as above) so that the developers with oUF could choose to disable Blizzard default unitframe or not?

Last edited by Eungavi : 05-27-18 at 09:18 PM.
  Reply With Quote
05-28-18, 03:29 AM   #11
runamonk
A Theradrim Guardian
 
runamonk's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 61
Enhancement Request added to GitHub oUF repo.
  Reply With Quote
05-28-18, 03:43 AM   #12
Cogwerkz
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2017
Posts: 12
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
  Reply With Quote
05-28-18, 03:47 AM   #13
runamonk
A Theradrim Guardian
 
runamonk's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 61
That's a great idea.
  Reply With Quote
05-28-18, 07:43 AM   #14
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   #15
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   #16
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
05-28-18, 12:29 PM   #17
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Why do you want to leave stock ui frames shown? Does the player frame come into question? If so, do you care about stuff handled by oUF elements like totems, additional power or the stagger bar? If the answer to the last two question is yes, you will have to poke into oUF elements that disable stock ui elements.
  Reply With Quote
05-28-18, 07:22 PM   #18
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Originally Posted by Rainrider View Post
Why do you want to leave stock ui frames shown? Does the player frame come into question? If so, do you care about stuff handled by oUF elements like totems, additional power or the stagger bar? If the answer to the last two question is yes, you will have to poke into oUF elements that disable stock ui elements.
I'm sorry, but what's Stock UI?

The only reason that I'd like to keep the default player frame is because I'm willing to create an extra player frame with oUF in the center of the screen (on top of the default one).

It's like the personal resource display thing that Blizzard added since the Legion. The only difference is this will be an unitframe, not nameplate.

Last edited by Eungavi : 05-28-18 at 07:29 PM.
  Reply With Quote
05-28-18, 09:00 PM   #19
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Originally Posted by Eungavi View Post
I'm sorry, but what's Stock UI?
Another term for default. Stock UI is what you see with no addons installed. It comes from the economic market, specifically car parts, where a stock item is what the manufacturer intended to be installed.

Last edited by Kanegasi : 05-28-18 at 09:02 PM.
  Reply With Quote
05-28-18, 09:48 PM   #20
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Originally Posted by Kanegasi View Post
Another term for default. Stock UI is what you see with no addons installed. It comes from the economic market, specifically car parts, where a stock item is what the manufacturer intended to be installed.
A Ha!

Sorry, I'm still weak at those high level(?) terminologies

Last edited by Eungavi : 05-28-18 at 09:58 PM.
  Reply With Quote

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

Thread Tools
Display Modes

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