#can i "built" an itemlist icon from a few of atlastextures?
11 messages · Page 1 of 1 (latest)
icon like for the editor or for a button or something?
Itemlist node allows give icons to items, so like buttons, it canvas node
you can just pass a now atlas texture with the texture and region set when making the new item' icon
I need to make a texture from several atlastextures
I want to "dress" an icon depending on some values
oh. you're layering textures on top of each other?
you could use Image and build a new texture based off the atlases. you'd have to loop through all the pixels of the image and blend then together, then make an image texture form that to use
What will the code look like using the example of mixing two atlas regions?
something like this, though it will probably have some bug you need to fix:
var lower : Image = texture1.get_image()
var upper : Image = texture2.get_image()
lower.covert(Format.FORMAT_RGBA8)
upper.covert(Format.FORMAT_RGBA8)
if lower.get_height() != upper.get_height() || lower.get_width() != upper.get_width():
return
var result := Image.create_from_data(lower.get_width(), lower.get_height(), false, Format.FORMAT_RGBA8, [])
for i in lower.get_width() * lower.get_height():
var l_color := Color()
l_color.r8 = lower.data.data[i]
l_color.g8 = lower.data.data[i+1]
l_color.b8 = lower.data.data[i+2]
l_color.a8 = lower.data.data[i+3]
var u_color := Color()
u_color.r8 = upper.data.data[i]
u_color.g8 = upper.data.data[i+1]
u_color.b8 = upper.data.data[i+2]
u_color.a8 = upper.data.data[i+3]
var blend : float = u_color.a8 / 255.0
var r_color := Color()
r_color.r8 = lerp(l_color.r8, u_color.r8, blend)
r_color.g8 = lerp(l_color.g8, u_color.g8, blend)
r_color.b8 = lerp(l_color.b8, u_color.b8, blend)
r_color.a8 = lerp(l_color.a8, u_color.a8, blend)
result.data.data[i] = r_color.r8
result.data.data[i+1] = r_color.g8
result.data.data[i+2] = r_color.b8
result.data.data[i+3] = r_color.a8
var texture = ImageTexture.create_from_image(result)
What i ahould write instead Format?