#Crop texture

78 messages Β· Page 1 of 1 (latest)

nova scroll
#

Hello,

I'm trying to create a custom UI based on some existing textures.
The textures I have contain multiple things in the same blp file. Is there a way to crop, from the texture, the part that I need in a WA?

Thanks

nova scroll
#

There is no way to do this directly in wa?

loud minnow
#

That's a atlas and if you wait for the next release it has atlas support

torn jasper
#

Texture WA already support using atlases. The only thing that's coming (if I understand correctly) is the ability to select atlases from a picker.

#

The trouble here may be that the regions of the image may not actually be existing atlases. Certainly back in Wrath Blizz used to just use TexCoords more often. I'm not sure when atlases were introduced.

loud minnow
#

AHH wotlk

torn jasper
#

If @nova scroll has atlas names then they should use them directly instead of a path/fileID for the whole image

nova scroll
#

I'm not sure I'm familiar with the atlas πŸ˜„ is this something new?

torn jasper
#

A "texture atlas" is a term for what you're describing. A region within a larger image.
In the game's API this is also a system where texture regions are predefined with names that can be used in texture:SetAtlas(atlasName).
Unfortunately users can't add atlases so this can only be done for stuff that Blizz set up.

#

For anything of your own, or without a Blizz atlas, you'll need TexCoord

nova scroll
#

oh ok, but that should actually be fine in my case. Cause what I'm trying to do is build a custom UI but heavily inspired from the default one, just customised in different places

#

thanks a lot πŸ™‚

#

I'm going to try to see if the textures I need were exposed as atlases in wotlk

torn jasper
#

If TextureAtlasViewer (addon) works on Classic then that'll be a help.

nova scroll
#

it does πŸ™‚

#

just installed it and I'm playing around with textures now

loud minnow
#

Someone mentioned in another channel that apperantly the legion and earlier files and atlases being there, can you check that?

nova scroll
#

but I think you were right, the atlases in there were "bigger" images, e.g. I created a texture WA using the following Atlas:

#

and on the right you can see how it shows

#

there are quite a few atlases, Legion as well

#

ok, but I'm not sure I know now how I could crop a part of such an atlas (if that's possible). E.g. from the first picture, how could I crop to eventually end up just with the gryphon?

#

I understand I have to use some Lua, not sure on where to put it (custom init event maybe?)

loud minnow
#

It shows Zou a name, just using that name in a texture aura with maybe some checkbox, not sure right now, should give you that image.
But asakawa knows more there

torn jasper
#

AFAIK everywhere in WA that takes a path or fileID will accept an atlas name

weak umbra
#

if you use alpha version of weakauras you can just do this

loud minnow
#

Looks squished.

torn jasper
#

Nah, the interface is stretching it to square

nova scroll
#

Well, I can adjust it, beeing a bit squish is not a problem

weak umbra
#

preview is but region adapt size automatically

nova scroll
#

Ok, I'll install the alpha then 😁

#

I can get it from GH right?

weak umbra
loud minnow
#

Just now you can also just use the name the add-on shows you

#

The alpha adds basically what the add-on does

weak umbra
#

try type hud-MainMenuBar-gryphon

nova scroll
#

That's what I used

#

Let me login again and double check

weak umbra
#

but if i remember there are dirty offsets, which is fixed in alpha

torn jasper
#

Or, not switching off Full Rotation

weak umbra
#

nah a little zoom was applied idk why

#

removed that

torn jasper
#

I'm talking about the screenshot they posted above

nova scroll
#

ok, I've exported the one I created so it may be easier to understand what I did

torn jasper
#

Sadly the clamp settings can't help with an atlas like this so you simply can't use full rotation

nova scroll
#
!WA:2!Dj1pVnnqu8u1HImsiAekirxqmWwk0k1o36uhcOK2OZUf2c357z7tC(oZ7oN2WyhqmNpczMP8jaXgBwrSYcIpb9taNDkDGB5EV397D)(9(Zg9BN3M3M)LNUWQJNcOrOv3B63UXcxzlr4TiTyKMdKEdpE0ysSwQX3SP7uSnxyIrWctqTLADPTbE1zjjgWo4iB1FA5oROL2mnEwr9ZgpwUarnMHZ(hUzhC(rTATXsQk2HBSwOSSEbNgfqwWbd1PaQfYMZKGI3id)HbNEYcesDFy0ScaVvNlfQenM3OdpwJIG3J04gIpKySu065lucRhlXDzY8U2II0uxf)GNJ3A(zhRSYKKMFEqWWX9pFOV15qOoLS)1McqkFn349BtjdMckBOdT4QLt6DCy0KWOJjr(Losyfs6maVd2yeCWiHJdgoK0eHnaOsBgrrZbJ38s1TsWRy7AvpfIw7xx1FTv1dlECwjV7iQqncuL(uSBkoRitRUX1ZaurLxSE4Dj5sb3M9R5uLyD)4WQh1VAhFLwbFhOgi0IGk1MT1kED)1HysDnIgiwR4MRRXu3bQ66N74ZLBv3QD3Q6fvVSApNzN)pYZe8vHI8cj8Q1AAUbKjntZQ7VmbDLOJtQLU5nRh09RdvtblShji40RVBfA)sbFz0hViwB9hCI8ccvwKr3CHRrsAg6MN0PANvoxgn(dPOUuXzzGinZ(Jf1YxSEvZxQP8((gXNGoK8sPv457MEXDQ89iXsQXuBXSu3MLTX0LCIi1RTHCWU7T7ETN(Z393
torn jasper
#

As I said, simply untick Full Rotation.

#

There's no need to use Alpha WA

nova scroll
#

oh right right

torn jasper
#

You already have the atlas you want and can browse for more with TAV

nova scroll
#

thanks, it works with that πŸ˜„

weak umbra
#

if you need size without distortion

torn jasper
#

Aha, I was just typing up something regarding that

#

If you're putting in a browser then the atlas dimensions really do matter

nova scroll
#

yep, I noticed the width and height is in TAV, I'm going to rely on that πŸ™‚

torn jasper
#

@weak umbra Personally I'd want to see the images in the browser as the true atlas size, or at least the correct atlas dimensions, scaled up to fit. But also once selected the user needs to know the dimensions really.

weak umbra
#

it edit size of aura when you select (then you do whatever you want)

torn jasper
#

Oh it does? That's great

weak umbra
#

but yah for preview ..

#

yup that where those 128/76 come from

#

just clicked it

torn jasper
#

That's nice. Like WA can't easily compete with TAV's visual way of browsing for items but things like that definitely offer a reason to use it.

weak umbra
#

i love playing with this πŸ˜„

torn jasper
#

I did a quick thing in rehack for atlas scaling up, without warping. Just a proof of concept so can probably be cleaned up a bit

if not f then
   f = CreateFrame("FRAME")
   f.t = f:CreateTexture()
end
f:SetAllPoints("UIParent")
f:Show()
f.t:SetPoint("CENTER")
f.t:SetAtlas("_128-GoldRedButton-Center", true)
local w,h = f.t:GetSize()
if w > h then
   local prop = 100/w
   f.t:SetWidth(100)
   f.t:SetHeight(h*prop)
elseif h > w then
   local prop = 100/h
   f.t:SetWidth(w*prop)
   f.t:SetHeight(100)
else
   f.t:SetSize(100, 100)
end
f.t:Show()
#

I take it Ace fights you on this stuff though?

weak umbra
#

im looking into it

weak umbra
#

100/w should be h/w

#

and 100/h should be w/h

torn jasper
#

I was scaling to 100x100 specifically

#

But yeah, I guess just finding the proportion of the 2 is simpler πŸ˜„

weak umbra
#

got it working with this

      local atlasInfo = GetAtlasInfo(texturePath)
      self.texture:SetAtlas(texturePath, false);
      self.texture.IsAtlas = true
      if atlasInfo.width > atlasInfo.height then
        self.texture:SetSize(120, 120 * (atlasInfo.height / atlasInfo.width))
      elseif atlasInfo.height > atlasInfo.width then
        self.texture:SetSize(120 * (atlasInfo.width / atlasInfo.height), 120)
      else
        self.texture:SetSize(120, 120)
      end
torn jasper
#

Very neat πŸ‘

weak umbra
torn jasper
#

Yeah, right now, I'd use WA over TAV probably. Even for other projects.

nova scroll
#

where could I download the latest alpha version of WA? πŸ™‚

torn jasper
#

If you use Curse (or similar) then you can probably set your preferred version to Alpha. Just remember to set it back again later if you don't want to actually be alpha testing potentially broken stuff