diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-02-17 01:28:42 +0200 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-02-20 19:05:54 +0200 |
commit | a657b9b52d2818e2ba5b36ab3c58d0025dcb08e3 (patch) | |
tree | 96dd8453de69cc995b9318bb3eaca7ab172ea5c3 /indra/newview/llfloatersimplesnapshot.cpp | |
parent | 8be121e7cd88e692dad26510426defc5fc1df358 (diff) |
jira-archive-internal#71115 Add Images to Objects in Bulk
SL-20725
Diffstat (limited to 'indra/newview/llfloatersimplesnapshot.cpp')
-rw-r--r-- | indra/newview/llfloatersimplesnapshot.cpp | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/indra/newview/llfloatersimplesnapshot.cpp b/indra/newview/llfloatersimplesnapshot.cpp index 58604c5628..63802de6b3 100644 --- a/indra/newview/llfloatersimplesnapshot.cpp +++ b/indra/newview/llfloatersimplesnapshot.cpp @@ -50,7 +50,7 @@ const S32 LLFloaterSimpleSnapshot::THUMBNAIL_SNAPSHOT_DIM_MIN = 64; static const std::string THUMBNAIL_UPLOAD_CAP = "InventoryThumbnailUpload"; -void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, LLSD first_data) +void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, LLSD first_data, LLFloaterSimpleSnapshot::completion_t callback) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -129,6 +129,11 @@ void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, L { LL_WARNS("Thumbnail") << "Failed to upload image " << result << LL_ENDL; } + + if (callback) + { + callback(LLUUID()); + } return; } @@ -153,6 +158,11 @@ void post_thumbnail_image_coro(std::string cap_url, std::string path_to_image, L // Are we supposed to get BulkUpdateInventory? gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id); } + + if (callback) + { + callback(result["new_asset"].asUUID()); + } } ///---------------------------------------------------------------------------- @@ -364,7 +374,7 @@ void LLFloaterSimpleSnapshot::onSend() std::string temp_file = gDirUtilp->getTempFilename(); if (previewp->createUploadFile(temp_file, THUMBNAIL_SNAPSHOT_DIM_MAX, THUMBNAIL_SNAPSHOT_DIM_MIN)) { - uploadImageUploadFile(temp_file, mInventoryId, mTaskId); + uploadImageUploadFile(temp_file, mInventoryId, mTaskId, mUploadCompletionCallback); closeFloater(); } else @@ -372,6 +382,10 @@ void LLFloaterSimpleSnapshot::onSend() LLSD notif_args; notif_args["REASON"] = LLImage::getLastError().c_str(); LLNotificationsUtil::add("CannotUploadTexture", notif_args); + if (mUploadCompletionCallback) + { + mUploadCompletionCallback(LLUUID::null); + } } } @@ -381,7 +395,10 @@ void LLFloaterSimpleSnapshot::postSave() } // static -void LLFloaterSimpleSnapshot::uploadThumbnail(const std::string &file_path, const LLUUID &inventory_id, const LLUUID &task_id) +void LLFloaterSimpleSnapshot::uploadThumbnail(const std::string &file_path, + const LLUUID &inventory_id, + const LLUUID &task_id, + completion_t callback) { // generate a temp texture file for coroutine std::string temp_file = gDirUtilp->getTempFilename(); @@ -394,11 +411,14 @@ void LLFloaterSimpleSnapshot::uploadThumbnail(const std::string &file_path, cons LL_WARNS("Thumbnail") << "Failed to upload thumbnail for " << inventory_id << " " << task_id << ", reason: " << notif_args["REASON"].asString() << LL_ENDL; return; } - uploadImageUploadFile(temp_file, inventory_id, task_id); + uploadImageUploadFile(temp_file, inventory_id, task_id, callback); } // static -void LLFloaterSimpleSnapshot::uploadThumbnail(LLPointer<LLImageRaw> raw_image, const LLUUID& inventory_id, const LLUUID& task_id) +void LLFloaterSimpleSnapshot::uploadThumbnail(LLPointer<LLImageRaw> raw_image, + const LLUUID& inventory_id, + const LLUUID& task_id, + completion_t callback) { std::string temp_file = gDirUtilp->getTempFilename(); if (!LLViewerTextureList::createUploadFile(raw_image, temp_file, THUMBNAIL_SNAPSHOT_DIM_MAX, THUMBNAIL_SNAPSHOT_DIM_MIN)) @@ -409,11 +429,14 @@ void LLFloaterSimpleSnapshot::uploadThumbnail(LLPointer<LLImageRaw> raw_image, c LL_WARNS("Thumbnail") << "Failed to upload thumbnail for " << inventory_id << " " << task_id << ", reason: " << notif_args["REASON"].asString() << LL_ENDL; return; } - uploadImageUploadFile(temp_file, inventory_id, task_id); + uploadImageUploadFile(temp_file, inventory_id, task_id, callback); } // static -void LLFloaterSimpleSnapshot::uploadImageUploadFile(const std::string &temp_file, const LLUUID &inventory_id, const LLUUID &task_id) +void LLFloaterSimpleSnapshot::uploadImageUploadFile(const std::string &temp_file, + const LLUUID &inventory_id, + const LLUUID &task_id, + completion_t callback) { LLSD data; @@ -442,7 +465,7 @@ void LLFloaterSimpleSnapshot::uploadImageUploadFile(const std::string &temp_file } LLCoros::instance().launch("postAgentUserImageCoro", - boost::bind(post_thumbnail_image_coro, cap_url, temp_file, data)); + boost::bind(post_thumbnail_image_coro, cap_url, temp_file, data, callback)); } void LLFloaterSimpleSnapshot::update() |