From d2900429e81175a9f48240b180f1d8e3ab52865c Mon Sep 17 00:00:00 2001 From: kobewi Date: Wed, 4 May 2022 01:49:20 +0200 Subject: Add static methods for creating Image and ImageTexture --- scene/resources/tile_set.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'scene/resources/tile_set.cpp') diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 1e961e870c..05483db1e4 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -1809,11 +1809,8 @@ Vector>> TileSet::generate_terrains_icons(Size2i p_size) { image->create(1, 1, false, Image::FORMAT_RGBA8); image->set_pixel(0, 0, get_terrain_color(terrain_set, terrain)); } - Ref icon; - icon.instantiate(); - icon->create_from_image(image); + Ref icon = ImageTexture::create_from_image(image); icon->set_size_override(p_size); - output.write[terrain_set].write[terrain] = icon; } } @@ -4594,7 +4591,7 @@ void TileSetAtlasSource::_update_padded_texture() { if (!padded_texture.is_valid()) { padded_texture.instantiate(); } - padded_texture->create_from_image(image); + padded_texture->set_image(image); emit_changed(); } -- cgit v1.2.3