WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Action Bar Textures (https://www.wowinterface.com/forums/showthread.php?t=45566)

laukond 01-04-13 09:59 AM

Action Bar Textures
 
http://i.imgur.com/ue8Pi.jpg

Is there a way a way to remove the textures seen on MultiBarBottomLeft, MultiBarBottomRight, and MultiBarRight?
Always Show ActionBars is unticked. I know /reload hides them, but is there not a script that removes them so I do not have to /reload all the time :-D

Thanks!


CONCLUSION
This fixes the problem:

Lua Code:
  1. local oSetAttribute = getmetatable(ActionButton1).__index.SetAttribute
  2. hooksecurefunc(getmetatable(ActionButton1).__index, 'SetAttribute', function(self, attribute)
  3.     if attribute ~= 'showgrid' or GetCVar('alwaysShowActionBars') ~= '0' or not self.action then return end
  4.     oSetAttribute(self, 'showgrid', GetCursorInfo() and 1 or 0)
  5.     if not HasAction(self.action) then self:Hide() end
  6. end)

Seerah 01-04-13 12:56 PM

Well, what actionbar addon are you using?

laukond 01-04-13 03:57 PM

Quote:

Originally Posted by Seerah (Post 271338)
Well, what actionbar addon are you using?

Just simple :SetPoint of the default.
But this problem I have had even before I used AddOns where it would bug like that.
Is there a way to hide the texture?

Edit: Here is the entire AddOn I use, incase you want to look at it: http://pastebin.com/5RQj4ccv

jeffy162 01-04-13 06:54 PM

Well, this is probably just going to show off my incredible amount of ignorance, but, if you open Blizzards options to the "ActionBars" page is the "Always Show ActionBars" option checked?

Had this problem in the MoP beta with Bartender (because Dominos hadn't been updated yet) and just thought this might be a similar problem.

laukond 01-04-13 06:55 PM

Quote:

Originally Posted by laukond (Post 271331)
Always Show ActionBars is unticked.

:-)
/10chars

laukond 01-04-13 07:04 PM

Can there be done something like:

Code:

MultiBarBottomLeftButton1EmptyTexture:SetAlpha(0)
Of course it is not called 'EmptyTexture' but I have not been able to locate its name with /fstack true (if it exists).

semlar 01-04-13 07:33 PM

Is this an occasional bug or is it always like this? You said it fixes itself after a reload.

You could try calling MultiActionBar_HideAllGrids() or, if that doesn't do it, loop through every action button and do something like..
Lua Code:
  1. local function ActuallyHideGrid(barName)
  2.     for i=1, NUM_MULTIBAR_BUTTONS do
  3.         local button = _G[barName.."Button"..i]
  4.         button:SetAttribute("showgrid",0)
  5.         if not HasAction(button.action) then
  6.             button:Hide()
  7.         end
  8.     end
  9. end
  10. ActuallyHideGrid("MultiBarBottomLeft")
  11. ActuallyHideGrid("MultiBarBottomRight")
  12. ActuallyHideGrid("MultiBarRight")
  13. ActuallyHideGrid("MultiBarLeft")

laukond 01-04-13 07:36 PM

Quote:

Originally Posted by semlar (Post 271355)
Is this an occasional bug or is it always like this? You said it fixes itself after a reload.

You could try calling MultiActionBar_HideAllGrids() or, if that doesn't do it, loop through every action button and do something like "if not HasAction(button.action) then button:SetAttribute("showgrid",0) button:Hide() end".

It is an occasional bug that occurs on random stuff like accepting/completing a quest.
And ehh.. :confused: I'm not really that sharp at writing code, could you write the above more in-depth?

semlar 01-04-13 07:43 PM

You might even try something like this to switch it back if it modifies the value..
Lua Code:
  1. hooksecurefunc(getmetatable(ActionButton1).__index, 'SetAttribute', function(self, attribute)
  2.     if attribute ~= 'showgrid' then return end
  3.     self:SetAttribute('showgrid',0)
  4.     if not HasAction(self.action) then
  5.         self:Hide()
  6.     end
  7. end)
So if SetAttribute gets called on the action button it just resets it back to 0.

laukond 01-04-13 08:02 PM

Quote:

Originally Posted by semlar (Post 271358)
You might even try something like this to switch it back if it modifies the value..
Lua Code:
  1. hooksecurefunc(ActionButton1, 'SetAttribute', function(self, attribute)
  2.     if attribute ~= 'showgrid' then return end
  3.     self:SetAttribute('showgrid',0)
  4.     if not HasAction(self.action) then
  5.         self:Hide()
  6.     end
  7. end)
So if SetAttribute gets called on the action button it just resets it back to 0.

Does above code work for MultiBarBottomLeft, Right, etc.?

semlar 01-04-13 08:09 PM

Sorry, I meant to hook the metatable, let me edit that. It should work for every action button, however it won't do anything until their SetAttribute method is called, so they need to be hidden initially and then this is just to fix it if it changes later.

Alternatively you could try just outright setting the alpha of every texture to 0.. the textures don't appear to be named so you have to loop over button:GetRegions().

You're going to have to fine-tune this to only hide what you want hidden but something like this and then maybe check if the texture path contains UI-QuickSlot..
Lua Code:
  1. local function ActuallyHideGrid(barName)
  2.     for i=1, NUM_MULTIBAR_BUTTONS do
  3.         local button = _G[barName.."Button"..i]
  4.         button:SetAttribute("showgrid",0)
  5.         for i,region in pairs({button:GetRegions()}) do
  6.             if region.GetTexture and region:GetTexture() then
  7.                 region:SetAlpha(0)
  8.             end
  9.         end
  10.     end
  11. end
  12. ActuallyHideGrid("MultiBarBottomLeft")
  13. ActuallyHideGrid("MultiBarBottomRight")
  14. ActuallyHideGrid("MultiBarRight")
  15. ActuallyHideGrid("MultiBarLeft")

laukond 01-04-13 08:12 PM

Quote:

Originally Posted by semlar (Post 271360)
Sorry, I meant to hook the metatable, let me edit that. It should work for every action button, however it won't do anything until their SetAttribute method is called, so they need to be hidden initially and then this is just to fix it if it changes later.

Great! They are hidden initially so I bet it will work.
I will test it tomorrow it is getting late here :-)
Thank you so far! :banana:

laukond 01-05-13 10:37 AM

Lua Code:
  1. local function ActuallyHideGrid(barName)
  2.     for i=1, NUM_MULTIBAR_BUTTONS do
  3.         local button = _G[barName.."Button"..i]
  4.         button:SetAttribute("showgrid",0)
  5.         for i,region in pairs({button:GetRegions()}) do
  6.             if region.GetTexture and region:GetTexture() then
  7.                 region:SetAlpha(0)
  8.             end
  9.         end
  10.     end
  11. end
  12. ActuallyHideGrid("MultiBarBottomLeft")
  13. ActuallyHideGrid("MultiBarBottomRight")
  14. ActuallyHideGrid("MultiBarRight")
  15. ActuallyHideGrid("MultiBarLeft")

This did not work for me. It would bug out one button every time I tried, and if I tried moving the spell on that button it would show all grids.


Lua Code:
  1. hooksecurefunc(getmetatable(ActionButton1).__index, 'SetAttribute', function(self, attribute)
  2.     if attribute ~= 'showgrid' then return end
  3.     self:SetAttribute('showgrid',0)
  4.     if not HasAction(self.action) then
  5.         self:Hide()
  6.     end
  7. end)

This on the other hand worked very well, BUT the problem is it is impossible to put at spell from the spellbook etc. down to the Action Bar, since the textures never appear.
So if there could be added a condition to only hide when not dragging anything (such as a macro, ability, trinket, etc.) then it would work very well :-)

semlar 01-05-13 07:58 PM

Alright, try this one, it should actually work this time.
Lua Code:
  1. local oSetAttribute = getmetatable(ActionButton1).__index.SetAttribute
  2. hooksecurefunc(getmetatable(ActionButton1).__index, 'SetAttribute', function(self, attribute)
  3.     if attribute ~= 'showgrid' then return end
  4.     oSetAttribute(self, 'showgrid', CursorHasSpell() or 0)
  5.     if not HasAction(self.action) then
  6.         self:Hide()
  7.     end
  8. end)

Plus I'm pretty sure my last example had an infinite loop in it, I'm surprised it worked at all.

laukond 01-05-13 08:02 PM

Quote:

Originally Posted by semlar (Post 271390)
Alright, try this one, it should actually work this time.
Lua Code:
  1. local oSetAttribute = getmetatable(ActionButton1).__index.SetAttribute
  2. hooksecurefunc(getmetatable(ActionButton1).__index, 'SetAttribute', function(self, attribute)
  3.     if attribute ~= 'showgrid' then return end
  4.     oSetAttribute(self, 'showgrid', CursorHasSpell() or 0)
  5.     if not HasAction(self.action) then
  6.         self:Hide()
  7.     end
  8. end)

Plus I'm pretty sure my last example had an infinite loop in it, I'm surprised it worked at all.

EDIT4: I got it working with the stuff I use 99% of the time, but I cannot get it working when moving:
  • Companion
  • EquipmentSet

I tried with CursorHasCompanion / EquipmentSet, but it seems they do not exist.


Is there a way to make it work when anything is being dragged?

Edit: I added CursorHasItem() to it, but how do I make it work with macros?
Edit2: HAHA! :D I just randomly tried CursorHasMacro, and of course it worked!
Edit3: Edited #1 to contain the working code.

You have been a big help really, thank you so much!

semlar 01-05-13 08:17 PM

Okay for real this time, THIS one should work with everything. Probably.
Lua Code:
  1. local oSetAttribute = getmetatable(ActionButton1).__index.SetAttribute
  2. hooksecurefunc(getmetatable(ActionButton1).__index, 'SetAttribute', function(self, attribute)
  3.     if attribute ~= 'showgrid' or GetCVar('alwaysShowActionBars') ~= '0' then return end
  4.     oSetAttribute(self, 'showgrid', GetCursorInfo() and 1 or 0)
  5.     if not HasAction(self.action) then self:Hide() end
  6. end)

I added a check for the cvar too so it should honor the setting.

laukond 01-05-13 08:19 PM

Quote:

Originally Posted by semlar (Post 271392)
Okay for real this time, THIS one should work with everything. Probably.
Lua Code:
  1. local oSetAttribute = getmetatable(ActionButton1).__index.SetAttribute
  2. hooksecurefunc(getmetatable(ActionButton1).__index, 'SetAttribute', function(self, attribute)
  3.     if attribute ~= 'showgrid' or GetCVar('alwaysShowActionBars') ~= '0' then return end
  4.     oSetAttribute(self, 'showgrid', GetCursorInfo() and 1 or 0)
  5.     if not HasAction(self.action) then self:Hide() end
  6. end)

I added a check for the cvar too so it should honor the setting.

Works 100%.
Once again, THANK YOU! :D

semlar 01-05-13 08:27 PM

It might be a good idea to add something like "or not self.action" to the "return end" statement at the top just in case it tries to apply to a button without that attribute for some reason.
Lua Code:
  1. local oSetAttribute = getmetatable(ActionButton1).__index.SetAttribute
  2. hooksecurefunc(getmetatable(ActionButton1).__index, 'SetAttribute', function(self, attribute)
  3.     if attribute ~= 'showgrid' or GetCVar('alwaysShowActionBars') ~= '0' or not self.action then return end
  4.     oSetAttribute(self, 'showgrid', GetCursorInfo() and 1 or 0)
  5.     if not HasAction(self.action) then self:Hide() end
  6. end)


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

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