Thread Tools Display Modes
06-16-14, 12:47 PM   #1
asilva
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2014
Posts: 5
Action bar code help.

Hi, maybe someone can help me, i've been looking for info on this but still having difficulties.

The stock Main action bar background/textures are completely different from the stock bottom left and bottom right action bars as in the main bar has a dark grey background and the other ones only a low alpha grey with a border. Is it possible to make the main action bar look exactly like the other two without using addons like bartender? Is there a minimalist code i can use to accomplish that?

Thanks in advance,

Alex

Last edited by asilva : 06-16-14 at 12:49 PM. Reason: Clarity
  Reply With Quote
06-16-14, 08:34 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
The textures are on the MainMenuBar itself and not the ActionBar. Depending on how much of the MainMenuBar you want to hide, here's a list of functions that'll do the trick.

Lua Code:
  1. MainMenuBarTexture0:Hide(); -- Hides the left side of the main ActionBar
  2. MainMenuBarTexture1:Hide(); -- Hides the right side of the main ActionBar
  3. MainMenuBarTexture2:Hide(); -- Hides the left side of the MicroButtons
  4. MainMenuBarTexture3:Hide(); -- Hides the right side of the MicroButtons and the BagButtons
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
06-16-14, 11:09 PM   #3
asilva
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2014
Posts: 5
Originally Posted by SDPhantom View Post
The textures are on the MainMenuBar itself and not the ActionBar. Depending on how much of the MainMenuBar you want to hide, here's a list of functions that'll do the trick.

Lua Code:
  1. MainMenuBarTexture0:Hide(); -- Hides the left side of the main ActionBar
  2. MainMenuBarTexture1:Hide(); -- Hides the right side of the main ActionBar
  3. MainMenuBarTexture2:Hide(); -- Hides the left side of the MicroButtons
  4. MainMenuBarTexture3:Hide(); -- Hides the right side of the MicroButtons and the BagButtons
Thanks alot for your answer, unfortunately, this will make it so nothing at all appears there, i still want the border just like the other two bars (it is a nice border).

Thanks though,
Alex
  Reply With Quote
06-17-14, 01:29 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
It might help if you took a screenshot and marked it (in GIMP, Photoshop, or even Paint) to show us exactly what you want (eg. remove this thing circled in red, make this blue thing look like that green thing, etc.) so we're not guessing based on a written description.

The extra action bars don't have any border or background textures whatsoever, so based on your description I'd have given you the same answer as SDPhantom (remove all textures from the main menu bar) but since you said that result isn't what you want, it may help to clarify exactly what you do want.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 06-17-14 at 01:33 AM.
  Reply With Quote
06-17-14, 02:56 AM   #5
asilva
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2014
Posts: 5
Originally Posted by Phanx View Post
It might help if you took a screenshot and marked it (in GIMP, Photoshop, or even Paint) to show us exactly what you want (eg. remove this thing circled in red, make this blue thing look like that green thing, etc.) so we're not guessing based on a written description.

The extra action bars don't have any border or background textures whatsoever, so based on your description I'd have given you the same answer as SDPhantom (remove all textures from the main menu bar) but since you said that result isn't what you want, it may help to clarify exactly what you do want.
Sure thing, sorry about the lack of info on my request, i do apreciate you guys trying to help though, here is the screen shot. What i want is the bars on RED to look exactly like the bars on GREEN.

https://www.dropbox.com/s/9dcb7w2a8p...ction_bars.jpg

Thanks again,
Alex

Last edited by asilva : 06-17-14 at 03:02 AM.
  Reply With Quote
06-17-14, 02:39 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
I discovered the MultiActionBar backgrounds are generated using the following XML code.
XML Code:
  1. <CheckButton name="MultiBarButtonTemplate" virtual="true" inherits="ActionBarButtonTemplate">
  2.     <Layers>
  3.         <Layer level="BACKGROUND" textureSubLevel="-1">
  4.             <Texture name="$parentFloatingBG" file="Interface\Buttons\UI-Quickslot" alpha="0.4">
  5.                 <Anchors>
  6.                     <Anchor point="TOPLEFT" x="-15" y="15"/>
  7.                     <Anchor point="BOTTOMRIGHT" x="15" y="-15"/>
  8.                 </Anchors>
  9.             </Texture>
  10.         </Layer>
  11.     </Layers>
  12. </CheckButton>

I used this to generate the following Lua code.
Lua Code:
  1. --  Hide the MainMenuBar textures
  2. MainMenuBarTexture0:Hide();
  3. MainMenuBarTexture1:Hide();
  4.  
  5. --  Generate the backgrounds as needed
  6. for i=1,NUM_ACTIONBAR_BUTTONS do
  7.     local bg=_G["ActionButton"..i]:CreateTexture("$parentFloatingBG","BACKGROUND");
  8.     bg:SetDrawLayer("BACKGROUND",-1);-- For some strange reason, we can't set sublevel in button:CreateTexture()
  9.     bg:SetPoint("TOPLEFT",-15,15);
  10.     bg:SetPoint("BOTTOMRIGHT",15,-15);
  11.     bg:SetTexture("Interface\\Buttons\\UI-Quickslot");
  12.     bg:SetAlpha(0.4);
  13. end
  14.  
  15. --  Helper function to show/hide the main ActionBar
  16. local function UpdateButtons(show)
  17. --  Can't show/hide buttons while in combat from insecure code, so don't try to
  18.     if InCombatLockdown() then return; end
  19.  
  20.     for i=1,NUM_ACTIONBAR_BUTTONS do
  21. --      We need to set the attribute ourselves since the show/hide grid functions won't do it from insecure code
  22.         local btn=_G["ActionButton"..i];
  23.         btn:SetAttribute("showgrid",math.max(btn:GetAttribute("showgrid")+(show and 1 or -1),0));
  24.         _G[show and "ActionButton_ShowGrid" or "ActionButton_HideGrid"](btn);
  25.     end
  26. end
  27.  
  28. --  Hooks to our helper function
  29. hooksecurefunc("MultiActionBar_ShowAllGrids",function() UpdateButtons(true); end);
  30. hooksecurefunc("MultiActionBar_HideAllGrids",function() UpdateButtons(false); end);

I had some trouble with getting the ActionButtons to behave like the MultiActionBars. This is mostly because the Blizzard functions needed don't like to be called from insecure code.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 06-17-14 at 02:51 PM.
  Reply With Quote
06-18-14, 12:23 AM   #7
asilva
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2014
Posts: 5
Thank you very much, i'll see what i can do with it.

Again, thanks,

Alex

Originally Posted by SDPhantom View Post
I discovered the MultiActionBar backgrounds are generated using the following XML code.
XML Code:
  1. <CheckButton name="MultiBarButtonTemplate" virtual="true" inherits="ActionBarButtonTemplate">
  2.     <Layers>
  3.         <Layer level="BACKGROUND" textureSubLevel="-1">
  4.             <Texture name="$parentFloatingBG" file="Interface\Buttons\UI-Quickslot" alpha="0.4">
  5.                 <Anchors>
  6.                     <Anchor point="TOPLEFT" x="-15" y="15"/>
  7.                     <Anchor point="BOTTOMRIGHT" x="15" y="-15"/>
  8.                 </Anchors>
  9.             </Texture>
  10.         </Layer>
  11.     </Layers>
  12. </CheckButton>

I used this to generate the following Lua code.
Lua Code:
  1. --  Hide the MainMenuBar textures
  2. MainMenuBarTexture0:Hide();
  3. MainMenuBarTexture1:Hide();
  4.  
  5. --  Generate the backgrounds as needed
  6. for i=1,NUM_ACTIONBAR_BUTTONS do
  7.     local bg=_G["ActionButton"..i]:CreateTexture("$parentFloatingBG","BACKGROUND");
  8.     bg:SetDrawLayer("BACKGROUND",-1);-- For some strange reason, we can't set sublevel in button:CreateTexture()
  9.     bg:SetPoint("TOPLEFT",-15,15);
  10.     bg:SetPoint("BOTTOMRIGHT",15,-15);
  11.     bg:SetTexture("Interface\\Buttons\\UI-Quickslot");
  12.     bg:SetAlpha(0.4);
  13. end
  14.  
  15. --  Helper function to show/hide the main ActionBar
  16. local function UpdateButtons(show)
  17. --  Can't show/hide buttons while in combat from insecure code, so don't try to
  18.     if InCombatLockdown() then return; end
  19.  
  20.     for i=1,NUM_ACTIONBAR_BUTTONS do
  21. --      We need to set the attribute ourselves since the show/hide grid functions won't do it from insecure code
  22.         local btn=_G["ActionButton"..i];
  23.         btn:SetAttribute("showgrid",math.max(btn:GetAttribute("showgrid")+(show and 1 or -1),0));
  24.         _G[show and "ActionButton_ShowGrid" or "ActionButton_HideGrid"](btn);
  25.     end
  26. end
  27.  
  28. --  Hooks to our helper function
  29. hooksecurefunc("MultiActionBar_ShowAllGrids",function() UpdateButtons(true); end);
  30. hooksecurefunc("MultiActionBar_HideAllGrids",function() UpdateButtons(false); end);

I had some trouble with getting the ActionButtons to behave like the MultiActionBars. This is mostly because the Blizzard functions needed don't like to be called from insecure code.
  Reply With Quote
06-18-14, 02:26 AM   #8
asilva
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2014
Posts: 5
Thanks for all the help, it works perfectly
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Action bar code help.


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