WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   target/focus portrait flash/fade (https://www.wowinterface.com/forums/showthread.php?t=58657)

rulezyx 03-30-21 08:13 AM

target/focus portrait flash/fade
 
Hello,

with the default UI a player target- and focus-portrait will start to flash/fade when at lower health.

I guess it will start flashing under 15% hp and the fade starts under 30%.

Is it possible to disable this function somehow?

I couldnt find any CVar related to this.

Example (Portrait):
https://imgur.com/a/1FSuQqI

SDPhantom 04-01-21 02:30 AM

Looks like it's handled by TargetFrame_HealthUpdate(). It looks like it's safe to redirect to a dummy function. Other than that, there's no setting to configure it.

rulezyx 04-01-21 07:56 AM

Thank you :)

I was looking up the same part of the code yesterday but I didnt thought it is related to that function/even copied it.:rolleyes:

So theres no way to stop this from happening?

I was hoping/searching for a code/script but couldn't find anything related.:confused:

Since I am not good with lua (only ripping/editing codes) I am not sure if theres anything I can do about that.

The main reason for me is that it is not necessary, annoying and it can cause issues with other addons.

For example with BigDebuffs which shows icon/timers in portraits and the fade-function is messing with the alpha of the icons.

The Focus-Frame Portrait stays tainted even back at full health until manually refreshing and other things like that.

It would be great to just disable it somehow. If theres something to brute force this I would appreciate it.

SDPhantom 04-01-21 11:53 PM

Here's an example 0f what I was talking about; redirecting the function to a dummy function.
I added a couple other functions to redirect and a 4th to hook and reset the color.
Lua Code:
  1. --  Define a dummy function that literally does nothing
  2. local function DoNothing() end
  3.  
  4. --  Disable fade pulsing at <20% health
  5. TargetFrame_HealthUpdate=DoNothing;
  6.  
  7. --  Disable health-based portrait tinting
  8. TargetHealthCheck=DoNothing;
  9. TargetofTargetHealthCheck=DoNothing;
  10.  
  11. --  This one's trickier since we want faction textures to work
  12. --  Disable mob tap portrait fade
  13. hooksecurefunc("TargetFrame_CheckFaction",function(self)--  Secure-hook this function to run our own code after
  14. --  Note: This function runs from a template and portraits are optional
  15.     if self.portrait then self.portrait:SetVertexColor(1,1,1); end--    If portrait exists, set RGB filter to 100% on all channels
  16. end);

rulezyx 04-02-21 05:31 AM

Ty so much:)

I didnt even know that DoNothing exists.:rolleyes:

That really makes disabling for not important functions much easier.

What I dont understand is the correlation between the TargetFrame and the FocusFrame related to these functions.

Why is the FocusFrame affected by the function and those changes when its not called at all?

It would make sense for me when I have to target something in order to get it on Focus but it is possible to do that with mouseover/scripts/macros and keybinds (arenas/bg) without targeting anything.

Maybe it is a stupid question but it would help me to understand the process.

SDPhantom 04-02-21 03:43 PM

Quote:

Originally Posted by rulezyx (Post 338766)
I didnt even know that DoNothing exists.:rolleyes:

It doesn't exist, the first thing the code does is create the function on line 2.
Blizzard has a similar function called nop(). You could use that instead if you prefer.


Quote:

Originally Posted by rulezyx (Post 338766)
What I dont understand is the correlation between the TargetFrame and the FocusFrame related to these functions.

Why is the FocusFrame affected by the function and those changes when its not called at all?

They both "inherit" their properties from the same template. The only difference is when they're created, they're given different units to watch. Everything else is fundamentally the same. The first 3 functions are called from the template's event handler and the last one is called from its OnUpdate handler.



Quote:

Originally Posted by rulezyx (Post 338766)
It would make sense for me when I have to target something in order to get it on Focus but it is possible to do that with mouseover/scripts/macros and keybinds (arenas/bg) without targeting anything.

Mainly macros, though mouseover is a type of macro and keybinds can be set to run macros. The only "no" in the list is scripts because of the limitations of calling these functions directly from Lua code.

Behind these are the /target and /focus commands. Both commands work the exact same way on their respective units and are very powerful when combined with macro conditionals.

rulezyx 04-02-21 06:10 PM

Ok got it :)

Thank you for your help and the exact explanation.

Btw. I love your addons/work.


All times are GMT -6. The time now is 04:23 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI