diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-03-09 21:56:14 +0200 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-03-09 21:56:14 +0200 |
commit | bb17e4b78e37daec481dede64ee7fdaf5a05b205 (patch) | |
tree | e7fe1c4e05b5a782012eacdb437042c02876b68f /indra/newview/llpreviewscript.cpp | |
parent | 54c2608d45e5b0368a07e383046a465375ccb03f (diff) | |
parent | 88d837c16e768c5262073a7df965066d4bd8842c (diff) |
Merge branch 'master' into DRTVWR-515-maint
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rw-r--r-- | indra/newview/llpreviewscript.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 1a579556ad..4c539ded38 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -51,7 +51,7 @@ #include "llsdserialize.h" #include "llslider.h" #include "lltooldraganddrop.h" -#include "llfilesystem.h" +#include "llvfile.h" #include "llagent.h" #include "llmenugl.h" @@ -1688,11 +1688,8 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) { std::string buffer(mScriptEd->mEditor->getText()); - LLUUID old_asset_id = inv_item->getAssetUUID().isNull() ? mScriptEd->getAssetID() : inv_item->getAssetUUID(); - LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLScriptAssetUpload>(mItemUUID, buffer, - [old_asset_id](LLUUID itemId, LLUUID, LLUUID, LLSD response) { - LLFileSystem::removeFile(old_asset_id, LLAssetType::AT_LSL_TEXT); + [](LLUUID itemId, LLUUID, LLUUID, LLSD response) { LLPreviewLSL::finishedLSLUpload(itemId, response); })); @@ -1702,8 +1699,8 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) } // static -void LLPreviewLSL::onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType type, - void* user_data, S32 status, LLExtStat ext_status) +void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAssetType::EType type, + void* user_data, S32 status, LLExtStat ext_status) { LL_DEBUGS() << "LLPreviewLSL::onLoadComplete: got uuid " << asset_uuid << LL_ENDL; @@ -1713,7 +1710,7 @@ void LLPreviewLSL::onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType t { if(0 == status) { - LLFileSystem file(asset_uuid, type); + LLVFile file(vfs, asset_uuid, type); S32 file_length = file.getSize(); std::vector<char> buffer(file_length+1); @@ -1740,7 +1737,6 @@ void LLPreviewLSL::onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType t } preview->mScriptEd->setScriptName(script_name); preview->mScriptEd->setEnableEditing(is_modifiable); - preview->mScriptEd->setAssetID(asset_uuid); preview->mAssetStatus = PREVIEW_ASSET_LOADED; } else @@ -1977,7 +1973,7 @@ void LLLiveLSLEditor::loadAsset() } // static -void LLLiveLSLEditor::onLoadComplete(const LLUUID& asset_id, +void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) { @@ -1991,10 +1987,9 @@ void LLLiveLSLEditor::onLoadComplete(const LLUUID& asset_id, { if( LL_ERR_NOERR == status ) { - instance->loadScriptText(asset_id, type); + instance->loadScriptText(vfs, asset_id, type); instance->mScriptEd->setEnableEditing(TRUE); instance->mAssetStatus = PREVIEW_ASSET_LOADED; - instance->mScriptEd->setAssetID(asset_id); } else { @@ -2018,9 +2013,9 @@ void LLLiveLSLEditor::onLoadComplete(const LLUUID& asset_id, delete floater_key; } -void LLLiveLSLEditor::loadScriptText(const LLUUID &uuid, LLAssetType::EType type) +void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type) { - LLFileSystem file(uuid, type); + LLVFile file(vfs, uuid, type); S32 file_length = file.getSize(); std::vector<char> buffer(file_length + 1); file.read((U8*)&buffer[0], file_length); @@ -2174,7 +2169,6 @@ void LLLiveLSLEditor::finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAs if (preview) { preview->mItem->setAssetUUID(newAssetId); - preview->mScriptEd->setAssetID(newAssetId); // Bytecode save completed if (response["compiled"]) @@ -2245,14 +2239,12 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) if (!url.empty()) { std::string buffer(mScriptEd->mEditor->getText()); - LLUUID old_asset_id = mScriptEd->getAssetID(); LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLScriptAssetUpload>(mObjectUUID, mItemUUID, monoChecked() ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2, isRunning, mScriptEd->getAssociatedExperience(), buffer, - [isRunning, old_asset_id](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) { - LLFileSystem::removeFile(old_asset_id, LLAssetType::AT_LSL_TEXT); - LLLiveLSLEditor::finishLSLUpload(itemId, taskId, newAssetId, response, isRunning); + [isRunning](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) { + LLLiveLSLEditor::finishLSLUpload(itemId, taskId, newAssetId, response, isRunning); })); LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); |