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.
This commit is contained in:
mara 2023-05-23 10:43:06 +00:00
parent 9dc286967f
commit 93248684b4
2 changed files with 2 additions and 0 deletions

View File

@ -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));
}

View File

@ -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));
}