From 05a4485082b07208a3b5b8d5c2070243cb237e42 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 29 Mar 2023 19:43:19 +0300 Subject: SL-19504 Allow using inventory items as thumbnails from clipboard --- indra/newview/llfloaterchangeitemthumbnail.cpp | 39 ++++++++++++++++++---- .../newview/skins/default/xui/en/notifications.xml | 2 +- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/indra/newview/llfloaterchangeitemthumbnail.cpp b/indra/newview/llfloaterchangeitemthumbnail.cpp index 722adcc254..a10de8ba23 100644 --- a/indra/newview/llfloaterchangeitemthumbnail.cpp +++ b/indra/newview/llfloaterchangeitemthumbnail.cpp @@ -429,15 +429,42 @@ void LLFloaterChangeItemThumbnail::onPasteFromClipboard(void *userdata) LLClipboard::instance().pasteFromClipboard(objects); if (objects.size() > 0) { - LLUUID asset_id = objects[0]; - if (validateAsset(asset_id)) + LLUUID potential_uuid = objects[0]; + LLUUID asset_id; + + if (potential_uuid.notNull()) { - self->setThumbnailId(asset_id); + LLViewerInventoryItem* item = gInventory.getItem(potential_uuid); + if (item) + { + // no point checking snapshot? + if (item->getType() == LLAssetType::AT_TEXTURE) + { + asset_id = item->getAssetUUID(); + } + } + else + { + LLPointer texturep = LLViewerTextureManager::getFetchedTexture(potential_uuid); + if (texturep) + { + asset_id = potential_uuid; + } + } } - else + if (asset_id.notNull()) { - LLNotificationsUtil::add("ThumbnailDimantionsLimit"); + // todo: if texture isn't loaded subscribe, or preload it in some way. + if (validateAsset(asset_id)) + { + self->setThumbnailId(asset_id); + } + else + { + LLNotificationsUtil::add("ThumbnailDimentionsLimit"); + } } + // else show 'buffer has no texture' warning? } } @@ -559,7 +586,7 @@ void LLFloaterChangeItemThumbnail::onTexturePickerCommit(LLUUID id) } else { - LLNotificationsUtil::add("ThumbnailDimantionsLimit"); + LLNotificationsUtil::add("ThumbnailDimentionsLimit"); } } } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 70edd567a1..0ea13e7d63 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6134,7 +6134,7 @@ Are you sure you want to delete them? Only square images from 64 to 256 pixels per side are allowed. -- cgit v1.2.3