ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Question About RegisterForUpdate (https://www.esoui.com/forums/showthread.php?t=603)

Kith 04/05/14 06:18 PM

Question About RegisterForUpdate
 
I'm working on a mod to 'enhance' the stock UI rather than replace it for things like attribute bars and one of the options I want to offer is to set a minimum-fade (alpha) level for the bars out of combat. Now i'm aware of this function:

EVENT_MANAGER:UnregisterForUpdate("ZO_PlayerAttributeMagickaFadeUpdate")

That will stop the bars fading entirely, but then requires that I need to hook a couple of events to manually change alpha levels as I go, and also the method used by 'improvedattributebars' that runs an OnUpdate handler to constantly force the alpha back up to the desired level.

Is there anyway to find out how the FadeUpdate function is working and modify it to set a minimum alpha level, as in, does anybody have a full access to the current UI and would be willing to nudge over a snippet so I could mess with such? I'd like to maintain the current fading in/out that the UI has just without it fading entirely and I don't really want to use OnUpdate for this.

Seerah 04/05/14 08:17 PM

It looks like this feature is already in this addon: http://www.esoui.com/downloads/info7...ibuteBars.html

/edit: you can see how they managed to do it

Kith 04/05/14 10:54 PM

Quote:

Originally Posted by Seerah (Post 2872)
It looks like this feature is already in this addon: http://www.esoui.com/downloads/info7...ibuteBars.html

/edit: you can see how they managed to do it

Aye, thats the mod I saw using the OnUpdate method to prevent the fade out. Its why I was wondering if there was a way to possibly do so without using such. Its not a huge amount of work in an OnUpdate handler for it, but I still try to avoid the handler when I possibly can (though my current concept is using that method until I can find another one).

Garkin 04/10/14 10:38 AM

Quote:

Originally Posted by Kith (Post 2865)
I'm working on a mod to 'enhance' the stock UI rather than replace it for things like attribute bars and one of the options I want to offer is to set a minimum-fade (alpha) level for the bars out of combat. Now i'm aware of this function:

EVENT_MANAGER:UnregisterForUpdate("ZO_PlayerAttributeMagickaFadeUpdate")

That will stop the bars fading entirely, but then requires that I need to hook a couple of events to manually change alpha levels as I go, and also the method used by 'improvedattributebars' that runs an OnUpdate handler to constantly force the alpha back up to the desired level.

Is there anyway to find out how the FadeUpdate function is working and modify it to set a minimum alpha level, as in, does anybody have a full access to the current UI and would be willing to nudge over a snippet so I could mess with such? I'd like to maintain the current fading in/out that the UI has just without it fading entirely and I don't really want to use OnUpdate for this.

As far as I know, fading is done using animations, so you will need to try to do something with:
ZO_PlayerAttributeMagickaBar.timeline

Pawkette's "LibAnimation-1.0" could help.

Kith 04/10/14 08:19 PM

Finally figured this one out, and it was simple enough i'm annoyed at myself for not looking before. Each of the attributes does use animations to fade as Garkin said, so I looked into the metadata in ZGoo, found the timeline and was as simple as setting the alpha for the animations.
Lua Code:
  1. ZO_PlayerAttributeHealth.playerAttributeBarObject.timeline:GetAnimation():SetStartAlpha(minAlpha)
StartAlpha for the player attributes is its 'resting' state, so this is the minimum it'll fade to, EndAlpha is its active state (ie, during combat). Have been testing this in my mod while I finish polishing it up and its working fine so far, and got rid of wibbly feeling about having to use OnUpdate to force alpha.


All times are GMT -6. The time now is 08:58 AM.

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