summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerassetupload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerassetupload.cpp')
-rw-r--r--indra/newview/llviewerassetupload.cpp93
1 files changed, 58 insertions, 35 deletions
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index 97fbb8c601..bc07821ccd 100644
--- a/indra/newview/llviewerassetupload.cpp
+++ b/indra/newview/llviewerassetupload.cpp
@@ -36,7 +36,6 @@
#include "lluploaddialog.h"
#include "llpreviewscript.h"
#include "llnotificationsutil.h"
-#include "lleconomy.h"
#include "llagent.h"
#include "llfloaterreg.h"
#include "llfloatersnapshot.h"
@@ -171,22 +170,6 @@ void LLResourceUploadInfo::logPreparedUpload()
"Asset Type: " << LLAssetType::lookup(mAssetType) << LL_ENDL;
}
-S32 LLResourceUploadInfo::getEconomyUploadCost()
-{
- // Update L$ and ownership credit information
- // since it probably changed on the server
- if (getAssetType() == LLAssetType::AT_TEXTURE ||
- getAssetType() == LLAssetType::AT_SOUND ||
- getAssetType() == LLAssetType::AT_ANIMATION ||
- getAssetType() == LLAssetType::AT_MESH)
- {
- return LLGlobalEconomy::instance().getPriceUpload();
- }
-
- return 0;
-}
-
-
LLUUID LLResourceUploadInfo::finishUpload(LLSD &result)
{
if (getFolderId().isNull())
@@ -323,6 +306,43 @@ std::string LLResourceUploadInfo::getDisplayName() const
return (mName.empty()) ? mAssetId.asString() : mName;
};
+bool LLResourceUploadInfo::findAssetTypeOfExtension(const std::string& exten, LLAssetType::EType& asset_type)
+{
+ U32 codec;
+ return findAssetTypeAndCodecOfExtension(exten, asset_type, codec, false);
+}
+
+// static
+bool LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(const std::string& exten, LLAssetType::EType& asset_type, U32& codec, bool bulk_upload)
+{
+ bool succ = false;
+ std::string exten_lc(exten);
+ LLStringUtil::toLower(exten_lc);
+ codec = LLImageBase::getCodecFromExtension(exten_lc);
+ if (codec != IMG_CODEC_INVALID)
+ {
+ asset_type = LLAssetType::AT_TEXTURE;
+ succ = true;
+ }
+ else if (exten_lc == "wav")
+ {
+ asset_type = LLAssetType::AT_SOUND;
+ succ = true;
+ }
+ else if (exten_lc == "anim")
+ {
+ asset_type = LLAssetType::AT_ANIMATION;
+ succ = true;
+ }
+ else if (!bulk_upload && (exten_lc == "bvh"))
+ {
+ asset_type = LLAssetType::AT_ANIMATION;
+ succ = true;
+ }
+
+ return succ;
+}
+
//=========================================================================
LLNewFileResourceUploadInfo::LLNewFileResourceUploadInfo(
std::string fileName,
@@ -360,9 +380,11 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
std::string filename = gDirUtilp->getTempFilename();
std::string exten = gDirUtilp->getExtension(getFileName());
- U32 codec = LLImageBase::getCodecFromExtension(exten);
LLAssetType::EType assetType = LLAssetType::AT_NONE;
+ U32 codec = IMG_CODEC_INVALID;
+ bool found_type = findAssetTypeAndCodecOfExtension(exten, assetType, codec);
+
std::string errorMessage;
std::string errorLabel;
@@ -379,10 +401,16 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
errorLabel = "NoFileExtension";
error = true;
}
- else if (codec != IMG_CODEC_INVALID)
+ else if (!found_type)
+ {
+ // Unknown extension
+ errorMessage = llformat(LLTrans::getString("UnknownFileExtension").c_str(), exten.c_str());
+ errorLabel = "ErrorMessage";
+ error = TRUE;;
+ }
+ else if (assetType == LLAssetType::AT_TEXTURE)
{
// It's an image file, the upload procedure is the same for all
- assetType = LLAssetType::AT_TEXTURE;
if (!LLViewerTextureList::createUploadFile(getFileName(), filename, codec))
{
errorMessage = llformat("Problem with file %s:\n\n%s\n",
@@ -391,9 +419,8 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
error = true;
}
}
- else if (exten == "wav")
+ else if (assetType == LLAssetType::AT_SOUND)
{
- assetType = LLAssetType::AT_SOUND; // tag it as audio
S32 encodeResult = 0;
LL_INFOS() << "Attempting to encode wav as an ogg file" << LL_ENDL;
@@ -423,18 +450,10 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
errorLabel = "DoNotSupportBulkAnimationUpload";
error = true;
}
- else if (exten == "anim")
+ else if (assetType == LLAssetType::AT_ANIMATION)
{
- assetType = LLAssetType::AT_ANIMATION;
filename = getFileName();
}
- else
- {
- // Unknown extension
- errorMessage = llformat(LLTrans::getString("UnknownFileExtension").c_str(), exten.c_str());
- errorLabel = "ErrorMessage";
- error = TRUE;;
- }
if (error)
{
@@ -487,7 +506,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType:
mTaskId(LLUUID::null),
mContents(buffer),
mInvnFinishFn(finish),
- mTaskFinishFn(NULL),
+ mTaskFinishFn(nullptr),
mStoredToVFS(false)
{
setItemId(itemId);
@@ -501,7 +520,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLPointer<LL
mTaskId(LLUUID::null),
mContents(),
mInvnFinishFn(finish),
- mTaskFinishFn(NULL),
+ mTaskFinishFn(nullptr),
mStoredToVFS(false)
{
setItemId(itemId);
@@ -534,7 +553,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemI
mTaskUpload(true),
mTaskId(taskId),
mContents(buffer),
- mInvnFinishFn(NULL),
+ mInvnFinishFn(nullptr),
mTaskFinishFn(finish),
mStoredToVFS(false)
{
@@ -739,8 +758,12 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
LLUploadDialog::modalUploadFinished();
return;
}
+ if (!result.has("success"))
+ {
+ result["success"] = LLSD::Boolean((ulstate == "complete") && status);
+ }
- S32 uploadPrice = result["upload_price"].asInteger();//uploadInfo->getEconomyUploadCost();
+ S32 uploadPrice = result["upload_price"].asInteger();
if (uploadPrice > 0)
{