Reply
Thread Tools Display Modes
Unread 01-04-13, 09:59 AM   #1
laukond
A Black Drake
Join Date: Dec 2011
Posts: 81
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)

Last edited by laukond : 01-05-13 at 08:33 PM.
laukond is offline   Reply With Quote
Unread 01-04-13, 12:56 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,683
Well, what actionbar addon are you using?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

Seerah is offline   Reply With Quote
Unread 01-04-13, 03:57 PM   #3
laukond
A Black Drake
Join Date: Dec 2011
Posts: 81
Originally Posted by Seerah View Post
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

Last edited by laukond : 01-04-13 at 04:50 PM.
laukond is offline   Reply With Quote
Unread 01-04-13, 06:54 PM   #4
jeffy162
Premium Member
 
jeffy162's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 1,842
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.
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?

jeffy162 is offline   Reply With Quote
Unread 01-04-13, 06:55 PM   #5
laukond
A Black Drake
Join Date: Dec 2011
Posts: 81
Originally Posted by laukond View Post
Always Show ActionBars is unticked.
:-)
/10chars
laukond is offline   Reply With Quote
Unread 01-04-13, 07:04 PM   #6
laukond
A Black Drake
Join Date: Dec 2011
Posts: 81
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).
laukond is offline   Reply With Quote
Unread 01-04-13, 07:33 PM   #7
semlar
A Molten Giant
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 623
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")

Last edited by semlar : 01-04-13 at 07:39 PM.
semlar is offline   Reply With Quote
Unread 01-04-13, 07:36 PM   #8
laukond
A Black Drake
Join Date: Dec 2011
Posts: 81
Originally Posted by semlar View Post
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.. I'm not really that sharp at writing code, could you write the above more in-depth?
laukond is offline   Reply With Quote
Unread 01-04-13, 07:43 PM   #9
semlar
A Molten Giant
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 623
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.

Last edited by semlar : 01-04-13 at 08:08 PM.
semlar is offline   Reply With Quote
Unread 01-04-13, 08:02 PM   #10
laukond
A Black Drake
Join Date: Dec 2011
Posts: 81
Originally Posted by semlar View Post
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.?
laukond is offline   Reply With Quote
Unread 01-04-13, 08:09 PM   #11
semlar
A Molten Giant
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 623
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")

Last edited by semlar : 01-05-13 at 06:48 AM.
semlar is offline   Reply With Quote
Unread 01-04-13, 08:12 PM   #12
laukond
A Black Drake
Join Date: Dec 2011
Posts: 81
Originally Posted by semlar View Post
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!
laukond is offline   Reply With Quote
Unread 01-05-13, 10:37 AM   #13
laukond
A Black Drake
Join Date: Dec 2011
Posts: 81
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 :-)
laukond is offline   Reply With Quote
Unread 01-05-13, 07:58 PM   #14
semlar
A Molten Giant
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 623
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.
semlar is offline   Reply With Quote
Unread 01-05-13, 08:02 PM   #15
laukond
A Black Drake
Join Date: Dec 2011
Posts: 81
Originally Posted by semlar View Post
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! 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!

Last edited by laukond : 01-05-13 at 08:16 PM.
laukond is offline   Reply With Quote
Unread 01-05-13, 08:17 PM   #16
semlar
A Molten Giant
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 623
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.
semlar is offline   Reply With Quote
Unread 01-05-13, 08:19 PM   #17
laukond
A Black Drake
Join Date: Dec 2011
Posts: 81
Originally Posted by semlar View Post
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!
laukond is offline   Reply With Quote
Unread 01-05-13, 08:27 PM   #18
semlar
A Molten Giant
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 623
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)
semlar is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Lua/XML Help » Action Bar Textures

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