ItemLists does not support negative indexing.

This commit is contained in:
Relintai 2024-03-08 07:01:04 +01:00
parent a94f302003
commit 9116814193
4 changed files with 5 additions and 5 deletions

View File

@ -309,7 +309,7 @@ void AtlasMergingDialog::update_tile_set(Ref<LayeredTileSet> p_tile_set) {
if (texture.is_valid()) {
String item_text = vformat(TTR("%s (ID: %d)"), texture->get_path().get_file(), source_id);
atlas_merging_atlases_list->add_item(item_text, texture);
atlas_merging_atlases_list->set_item_metadata(-1, source_id);
atlas_merging_atlases_list->set_item_metadata(atlas_merging_atlases_list->get_item_count() - 1, source_id);
}
}
}

View File

@ -246,7 +246,7 @@ void LayeredTileMapLayerEditorTilesPlugin::_update_tile_set_sources_list() {
}
sources_list->add_item(item_text, texture);
sources_list->set_item_metadata(-1, source_id);
sources_list->set_item_metadata(sources_list->get_item_count() - 1, source_id);
}
if (sources_list->get_item_count() > 0) {
@ -466,7 +466,7 @@ void LayeredTileMapLayerEditorTilesPlugin::_update_scenes_collection_view() {
}
if (scene_tiles_list->get_item_count() == 0) {
scene_tiles_list->add_item(TTR("The selected scene collection source has no scenes. Add scenes in the LayeredTileSet bottom tab."));
scene_tiles_list->set_item_disabled(-1, true);
scene_tiles_list->set_item_disabled(scene_tiles_list->get_item_count() - 1, true);
}
// Icon size update.

View File

@ -220,7 +220,7 @@ void LayeredTileSetEditor::_update_sources_list(int force_selected_id) {
}
sources_list->add_item(item_text, texture);
sources_list->set_item_metadata(-1, source_id);
sources_list->set_item_metadata(sources_list->get_item_count() - 1, source_id);
}
// Set again the current selected item if needed.

View File

@ -351,7 +351,7 @@ void LayeredTileSetScenesCollectionSourceEditor::_update_scenes_list() {
}
if (scene_tiles_list->get_item_count() == 0) {
scene_tiles_list->add_item(TTR("Drag and drop scenes here or use the Add button."));
scene_tiles_list->set_item_disabled(-1, true);
scene_tiles_list->set_item_disabled(scene_tiles_list->get_item_count() - 1, true);
}
// Reselect if needed.