<SOLVED> Using SetTexture to replace ActionBar texture?

A lot of the information I’m able to find is outdated to some degree due to changes of the API, so I just can’t figure out the needed lua code.

I recolored the MainMenuBar and while I can get it to work by dumping it in the Interface folder, I still need an addon so I can only make it work for just one character.

I’d hoped something along these lines would work, based on what I’ve seen, but I seem to be missing pieces.
MainMenuBar:SetTexture("Interface\\...\\MainMenuBar.blp");
I’ve tried so many variations of it.

Any help would be greatly appreciated, as between today and yesterday, I’ve spent quite a few hours attempting to figure this out.

Edit: Kept going at it for a while longer and MainMenuBarArtFrameBackground.BackgroundLarge seems to be the key, BUT the whole .blp is in it so yeah, need to narrow it down.

You seem to be asking about two different things and I’m not sure which one is the problem.

Do you want the code you have to be run only for a specific character?

Do you want something to happen with MainMenuBarArtFrameBackground.BackgroundLarge. If so, more of a description of what you want to happen/see would help.

Maybe it’s a bit of both?

I’m also not sure what you’re trying to do, but see these for getting only part of a texture

  • https://wow.gamepedia.com/AtlasID
  • https://wow.tools/files/#search=MainMenuBar.blp
  • https://www.townlong-yak.com/framexml/8.2.5/Helix/AtlasInfo.lua#4079
1 Like

In a way, I was asking for both. Wanting the code to only be ran by a specific character is why I need an addon for it, otherwise I wouldn’t have a problem.

I just wanted to use a different texture there, which I did figure out the night before last, but the problem it was using the whole file, so eventually I figured out how to use SetTexCoords to restrict then it. Getting the exact numbers took a bit.

Just hadn’t had time to say that it all worked out by then.

–For anyone who finds this later when trying to do the same thing, here’s what I figured out:

MainMenuBarArtFrameBackground.BackgroundLarge:SetTexCoord(0.1113, 0.8965, 0.4531, 0.6445);

So the first number is the x axis on the left of the action bar texture, the second is for the right x axis. The third is for the y axis on the top side of it, and the fourth is for the y axis on the bottom.

To get those final numbers, you need to get the pixel coordinates of where those are, and then find out what percentage they are of the corresponding total pixel width or height.

For me for the action bar, Left is 114, Right is 918, Top is 116, Bottom is 164.

Left and Right go with 1024, the width of it, and Top and Bottom go with the height, 256.

So divide the pixel distance to the coordinate you want to crop at by the total pixel distance.

Example, 114 divided by 1024.

This is a terrible explanation but I wanted to put it here just in case it could help someone some day.

You do know https://wow.gamepedia.com/API_Texture_SetAtlas exists?

Hmmm it does look like it could be the same thing but more efficiently, so I suppose I should learn how to use it. I’d figured out SetTexture before you originally mentioned it so I hadn’t bothered looking at it prior. (Sometimes being pushed to having to ask for help is the final kick in the pants I need to make something work. Or it’s just similar level of desperation)

Edit: I am… not seeing how to get it to use custom textures.