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

Xrystal 08-05-20 08:44 PM

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 ?

Fizzlemizz 08-05-20 08:49 PM

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.

Xrystal 08-06-20 04:38 AM

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 : with no joy. The same result when I tried the way that worked elsewhere ..

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.     );
  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

Xrystal 08-06-20 05:37 AM

What did seem to work after a few restarts ..

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

All times are GMT -6. The time now is 09:43 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI