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.cpp82
1 files changed, 50 insertions, 32 deletions
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index 97fbb8c601..51c8f4ab79 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,42 @@ 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;
+
+ codec = LLImageBase::getCodecFromExtension(exten);
+ if (codec != IMG_CODEC_INVALID)
+ {
+ asset_type = LLAssetType::AT_TEXTURE;
+ succ = true;
+ }
+ else if (exten == "wav")
+ {
+ asset_type = LLAssetType::AT_SOUND;
+ succ = true;
+ }
+ else if (exten == "anim")
+ {
+ asset_type = LLAssetType::AT_ANIMATION;
+ succ = true;
+ }
+ else if (!bulk_upload && (exten == "bvh"))
+ {
+ asset_type = LLAssetType::AT_ANIMATION;
+ succ = true;
+ }
+
+ return succ;
+}
+
//=========================================================================
LLNewFileResourceUploadInfo::LLNewFileResourceUploadInfo(
std::string fileName,
@@ -360,9 +379,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 +400,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 +418,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 +449,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)
{
@@ -740,7 +758,7 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
return;
}
- S32 uploadPrice = result["upload_price"].asInteger();//uploadInfo->getEconomyUploadCost();
+ S32 uploadPrice = result["upload_price"].asInteger();
if (uploadPrice > 0)
{