Godot: Texture Rect size doesn't go below image size

Created on 22 Nov 2017  路  3Comments  路  Source: godotengine/godot

Godot version
Godot 3 alpha 2

Issue description:
TextureRect doesn't scale below image size in scale stretch mode. The only way to scale it is to directly use the scale property and edit the values.

Proposal
Let the texture frame go below the image size and have different handles for margin change and scale change.

archived core rendering

Most helpful comment

This is not a bug, it's working as intended. If you want to make it shrink less than it's size then toggle the "expand" property. Otherwise, this would be unusable in containers.

All 3 comments

This is not a bug, it's working as intended. If you want to make it shrink less than it's size then toggle the "expand" property. Otherwise, this would be unusable in containers.

cvool

Here is some code to resize an image texture up/down in size:
func get_resized_texture(t: Texture, width: int = 0, height: int = 0):
var image = t.get_data()
if width > 0 && height > 0:
image.resize(width, height)
var itex = ImageTexture.new()
itex.create_from_image(image)
return itex

Was this page helpful?
0 / 5 - 0 ratings