Thread Tools Display Modes
08-05-20, 08:44 PM   #1
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Action Button now a Mixin in 9.0 latest builds

nUI uses HookSecureFunc() to hook into alot of Wows ActionButton code. It appears it is all Mixins in 9.0.

For example:
--function ActionButton_Update(self)
function ActionBarActionButtonMixin:Update()

Would I use the Mixin(addonFrame, BlizzardMixin) function to apply the appropriate Mixin to nUI's frames that replace Blizzards ?
__________________
  Reply With Quote
08-05-20, 08:49 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Presumably it would be "mixed in" when you inherit the ActionButtonTemplate and everything else would remain the same. Much like the Backdrops.

If there is a "ActionBarActionButtonMixin:Update()" function I would check to see if that calls a global function you could hook if you want something universal.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-05-20 at 08:53 PM.
  Reply With Quote
08-06-20, 04:38 AM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Unfortunately the Update function and the others, do most if not all of the functionality they need in there with no external function calls at the end of the function I can hook into instead.

for reference these are the errors I have been getting
Before Changes : Interface\\AddOns\\nUI\\Bars\\nUI_Button.lua:225: hooksecurefunc(): ActionButton_Update is not a function
After Changes : Interface\\AddOns\\nUI\\Bars\\nUI_ButtonBar.lua:697: attempt to call method 'initActionButton' (a nil value)



This might be my lack of lua knowledge but I tried the following. It gets rid of the initial errors but introduced a few more and apparently made no difference. I even tried the suggestion made for another similar scenario here : https://www.wowinterface.com/forums/...ad.php?t=56515 with no joy. The same result when I tried the way that worked elsewhere .. https://www.wowinterface.com/forums/...ad.php?t=56578.

I created a function HookButtonFunctions(button) that is called as soon as nUI starts to create a button for each bar.

And I adjusted all the hooksecurefunc entries from ActionButton_xxxx ones to self.xxxx and also tried self:xxx and wrapped the HookButtonFunctions function above around them all. But neither must work as it makes the initial createBar function now fail as it no longer exists.


So .. if Blizzard has now made each button a mixin so that now you have mixin:Update, mixin:OnUpdate etc funcitons that need to be overridden would I used self.Update or self:Update etc to hook them ?

Here is an example of two of the smaller functions
Lua Code:
  1. function HookButtonFunctions(self)
  2.     --hooksecurefunc( "ActionButton_OnUpdate",
  3.     hooksecurefunc(self:OnUpdate,
  4.         function( self, elapsed )
  5.             if self and nUI_ButtonMap[self] then
  6.                 if nUI_ButtonMap[self].onUpdate( self, elapsed ) then
  7.                     nUI_ButtonMap[self].updateUsable( self );
  8.                 end
  9.             end
  10.         end
  11.     );
  12.  
  13.     --hooksecurefunc( "ActionButton_UpdateUsable",
  14.     hooksecurefunc(self:UpdateUsable,
  15.         function( self )
  16.             if self and nUI_ButtonMap[self] then
  17.                 nUI_ButtonMap[self].updateUsable( self );
  18.             end
  19.         end
  20.     );
  21. end
__________________

Last edited by Xrystal : 08-06-20 at 04:58 AM.
  Reply With Quote
08-06-20, 05:37 AM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
What did seem to work after a few restarts ..

Lua Code:
  1. function nUI_HookButtonFunctions(button)
  2.  
  3. hooksecurefunc(button,"Update",
  4.    ....
  5. end
  6.  
  7. hooksecurefunc(button,"OnUpdate",
  8.    ....
  9. end
  10.  
  11. hooksecurefunc(button,"UpdateHotkeys",
  12.    ....
  13. end
  14.  
  15. hooksecurefunc(button,"UpdateUsable",
  16.    ....
  17. end
  18.  
  19. end
  20.  
  21. function nUI:initActionButton(button)
  22.     nUI_HookButtonFunctions(button)
  23.     ... rest of code
  24. end
__________________
  Reply With Quote

WoWInterface » PTR » PTR API and Graphics Changes » Action Button now a Mixin in 9.0 latest builds

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