From 93248684b4bfb291722447cf455c79acc83d0d0c Mon Sep 17 00:00:00 2001 From: mara Date: Tue, 23 May 2023 10:43:06 +0000 Subject: [PATCH] Add pattern index tooltip to tilemap and tileset editor Just a little UI convenience feature. Knowing the index (without having to count manually) is convenient when working with tile patterns programmatically, especially when having lots of them. --- editor/plugins/tiles/tile_map_editor.cpp | 1 + editor/plugins/tiles/tile_set_editor.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index 0a8ccdba1a5..c8575395066 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -321,6 +321,7 @@ void TileMapEditorTilesPlugin::_update_patterns_list() { for (int i = 0; i < tile_set->get_patterns_count(); i++) { int id = patterns_item_list->add_item(""); patterns_item_list->set_item_metadata(id, tile_set->get_pattern(i)); + patterns_item_list->set_item_tooltip(id, vformat(TTR("Index: %d"), i)); TilesEditorPlugin::get_singleton()->queue_pattern_preview(tile_set, tile_set->get_pattern(i), callable_mp(this, &TileMapEditorTilesPlugin::_pattern_preview_done)); } diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 358cc479770..52e91ad9136 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -418,6 +418,7 @@ void TileSetEditor::_update_patterns_list() { for (int i = 0; i < tile_set->get_patterns_count(); i++) { int id = patterns_item_list->add_item(""); patterns_item_list->set_item_metadata(id, tile_set->get_pattern(i)); + patterns_item_list->set_item_tooltip(id, vformat(TTR("Index: %d"), i)); TilesEditorPlugin::get_singleton()->queue_pattern_preview(tile_set, tile_set->get_pattern(i), callable_mp(this, &TileSetEditor::_pattern_preview_done)); }