WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Action bar code help. (https://www.wowinterface.com/forums/showthread.php?t=49397)

asilva 06-16-14 12:47 PM

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

SDPhantom 06-16-14 08:34 PM

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

asilva 06-16-14 11:09 PM

Quote:

Originally Posted by SDPhantom (Post 293413)
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

Phanx 06-17-14 01:29 AM

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.

asilva 06-17-14 02:56 AM

Quote:

Originally Posted by Phanx (Post 293416)
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

SDPhantom 06-17-14 02:39 PM

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.

asilva 06-18-14 12:23 AM

Thank you very much, i'll see what i can do with it.

Again, thanks,

Alex

Quote:

Originally Posted by SDPhantom (Post 293420)
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.


asilva 06-18-14 02:26 AM

Thanks for all the help, it works perfectly :)


All times are GMT -6. The time now is 04:11 PM.

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