Overlapping NineSlice textures with ButtonFrameTemplate
I am using ButtonFrameTemplate for a frame.
But as my frame has a low height I get overlapping NineSlice textures resulting in the frame shaddows adding up. Lua Code:
As you can see, I already removed NineSlice.LeftEdge and NineSlice.RightEdge but is it possible to crop the NineSlice corner textures somehow? Or is there another solution like using the templates differently? |
I would resize the bottom corners and not hide the edges:
Code:
local myFrame = CreateFrame("Frame", "myFrame", UIparent, "ButtonFrameTemplate") |
Thanks so much (again)! :-)
So it comes down to SetTexCoord() once more. Can I ask a general question regarding this? If I have a texture file e.g. Interface/FrameGeneral/UIFrameMetal: How would I go about to find the correct SetTexCoord() arguments for, say, the texture with the two topright buttom slots? In this particular case I know that there is the Atlas name UI-Frame-Metal-CornerTopRightDouble, which I found out using Texture Atlas Viewer. But for any texture in general, how do you find out your desired SetTexCoord() arguments? Is there a tool for this as well? |
For the most part, find the Blizzard XML file the frame/texture is defined in and check for its TexCoords tag.
Code:
<TexCoords left="0" right="0.675" top="0" bottom="0.675"/> |
Or you would open it in an image editor and count pixels to calculate the coords as they are in percentages of the image's dimensions.
|
Quote:
But when I try to find the textures and coordinates used by ButtonFrameTemplate, I seem to run into a dead end... In BlizzardInterfaceCode\Interface\SharedXML\SharedUIPanelTemplates.xml I find the definition of ButtonFrameTemplate. But when I trace back the inheritances I end up here without any mention of Interface/FrameGeneral/UIFrameMetal or any of its Atlas equivalents: Code:
<Frame name="NineSlicePanelTemplate" mixin="NineSlicePanelMixin" frameLevel="500" setAllPoints="true" virtual="true"> |
For your example you would use:
Code:
myFrame.NineSlice.TopRightCorner:SetTexture("Interface\\FrameGeneral\\UIFrameMetal") Note that I left all arguments in the form pixelPos/dimensionSize to make it easier to understand (I hope). |
Quote:
|
Maybe something like Discord Art (or probably KgPanels) where you can create a texture with the artwork and click some buttons and/or enter coords so you don't have to do continous /reload. Possibly quicker for getting started at least.
|
May I ask a related follow-up question?
I would like to place a button divider texture in my frame: Code:
local myFrame = CreateFrame("Frame", "cosFix_SetFactorFrame", UIparent, "ButtonFrameTemplate") But what I get is: (The -10 offset is there on purpose for testing.) But how can I get on top of the NineSlice border texture?? |
The region method SetDrawLayer is what you want to use.
|
Quote:
Which is the LayeredRegion I should call SetDrawLayer() for? The only texture I could think of was myFrame.NineSlice.TopRightCorner. So I tried Code:
myFrame.NineSlice.TopRightCorner:SetDrawLayer("BORDER") |
Actually, I am getting very indeterministic results...
As I am trying to find the right offset and size it is sometimes drawn on top and sometimes drawn below the NineSlice border... :confused: Code:
myFrame.NineSlice.TopRightCorner:SetDrawLayer("BORDER") |
Quote:
All I could come up with was this work around. Code:
local oldX, oldY = 12, 24 |
Both regions are sharing a layer so you need to make sure the subLevel of your new texture is greater than the other:
Code:
local layer, subLevel = myFrame.NineSlice.TopRightCorner:GetDrawLayer() Code:
myFrame.NineSlice.TopRightCorner:SetDrawLayer("BORDER") |
Ahhhh! Thank you so much!
It turns out the layer of NineSlice.TopRightCorner is "OVERLAY", not "BORDER"!! This is why I never had a chance! :D |
All times are GMT -6. The time now is 01:35 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI