You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Tilemap Editor: Use ItemList::set_item_icon_region in tile palette
This commit is contained in:
@@ -231,16 +231,10 @@ void TileMapEditor::_update_palette() {
|
|||||||
if (tex.is_valid()) {
|
if (tex.is_valid()) {
|
||||||
Rect2 region = tileset->tile_get_region(E->get());
|
Rect2 region = tileset->tile_get_region(E->get());
|
||||||
|
|
||||||
if (!region.has_no_area()) {
|
if (!region.has_no_area())
|
||||||
Image data = VS::get_singleton()->texture_get_data(tex->get_rid());
|
palette->set_item_icon_region(palette->get_item_count()-1, region);
|
||||||
|
|
||||||
Ref<ImageTexture> img = memnew( ImageTexture );
|
palette->set_item_icon(palette->get_item_count()-1, tex);
|
||||||
img->create_from_image(data.get_rect(region));
|
|
||||||
|
|
||||||
palette->set_item_icon(palette->get_item_count()-1, img);
|
|
||||||
} else {
|
|
||||||
palette->set_item_icon(palette->get_item_count()-1, tex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
palette->set_item_metadata(palette->get_item_count()-1, E->get());
|
palette->set_item_metadata(palette->get_item_count()-1, E->get());
|
||||||
|
|||||||
Reference in New Issue
Block a user