Adjusting uploadinfo object for expansion.
Commit is prelim to allow merge from selfless.meow-7.2.2
parent
1b80e02b0b
commit
f8a7eda55b
|
|
@ -993,29 +993,15 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata)
|
|||
std::string name = floaterp->getChild<LLUICtrl>("name_form")->getValue().asString();
|
||||
std::string desc = floaterp->getChild<LLUICtrl>("description_form")->getValue().asString();
|
||||
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
#if 1
|
||||
NewResourceUploadInfo::ptr_t assetUpdloadInfo(new NewResourceUploadInfo(name, desc, 0,
|
||||
|
||||
NewResourceUploadInfo::ptr_t assetUpdloadInfo(new NewResourceUploadInfo(
|
||||
floaterp->mTransactionID, LLAssetType::AT_ANIMATION,
|
||||
name, desc, 0,
|
||||
LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION,
|
||||
LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"),
|
||||
name, expected_upload_cost));
|
||||
expected_upload_cost));
|
||||
|
||||
upload_new_resource(floaterp->mTransactionID, LLAssetType::AT_ANIMATION,
|
||||
assetUpdloadInfo);
|
||||
#else
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
void *userdata = NULL;
|
||||
|
||||
upload_new_resource(floaterp->mTransactionID, // tid
|
||||
LLAssetType::AT_ANIMATION,
|
||||
name,
|
||||
desc,
|
||||
0,
|
||||
LLFolderType::FT_NONE,
|
||||
LLInventoryType::IT_ANIMATION,
|
||||
LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"),
|
||||
name,
|
||||
callback, expected_upload_cost, userdata);
|
||||
#endif
|
||||
upload_new_resource(assetUpdloadInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1009,12 +1009,13 @@ void LLSnapshotLivePreview::saveTexture()
|
|||
std::string name = "Snapshot: " + pos_string;
|
||||
std::string desc = "Taken by " + who_took_it + " at " + pos_string;
|
||||
|
||||
NewResourceUploadInfo::ptr_t assetUploadInfo(new NewResourceUploadInfo(name, desc, 0,
|
||||
NewResourceUploadInfo::ptr_t assetUploadInfo(new NewResourceUploadInfo(
|
||||
tid, LLAssetType::AT_TEXTURE, name, desc, 0,
|
||||
LLFolderType::FT_SNAPSHOT_CATEGORY, LLInventoryType::IT_SNAPSHOT,
|
||||
PERM_ALL, LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"),
|
||||
name, expected_upload_cost));
|
||||
expected_upload_cost));
|
||||
|
||||
upload_new_resource(tid, LLAssetType::AT_TEXTURE, assetUploadInfo);
|
||||
upload_new_resource(assetUploadInfo);
|
||||
|
||||
#else
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,14 @@
|
|||
#include "lluuid.h"
|
||||
#include "llvorbisencode.h"
|
||||
#include "lluploaddialog.h"
|
||||
#include "llpreviewscript.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "lleconomy.h"
|
||||
#include "llagent.h"
|
||||
#include "llfloaterreg.h"
|
||||
#include "llstatusbar.h"
|
||||
#include "llinventorypanel.h"
|
||||
#include "llsdutil.h"
|
||||
|
||||
//=========================================================================
|
||||
/*static*/
|
||||
|
|
@ -44,35 +51,49 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoros::self &self, LLCore
|
|||
{
|
||||
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
|
||||
|
||||
uploadInfo->prepareUpload();
|
||||
LLSD result = uploadInfo->prepareUpload();
|
||||
uploadInfo->logPreparedUpload();
|
||||
|
||||
if (result.has("error"))
|
||||
{
|
||||
HandleUploadError(LLCore::HttpStatus(499), result, uploadInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
//self.yield();
|
||||
|
||||
std::string uploadMessage = "Uploading...\n\n";
|
||||
uploadMessage.append(uploadInfo->getDisplayName());
|
||||
LLUploadDialog::modalUploadDialog(uploadMessage);
|
||||
|
||||
LLSD body = uploadInfo->generatePostBody();
|
||||
|
||||
LLSD result = httpAdapter->postAndYield(self, httpRequest, url, body);
|
||||
result = httpAdapter->postAndYield(self, httpRequest, url, body);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
if ((!status) || (result.has("error")))
|
||||
{
|
||||
|
||||
HandleUploadError(status, result, uploadInfo);
|
||||
LLUploadDialog::modalUploadFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
std::string uploader = result["uploader"].asString();
|
||||
|
||||
result = httpAdapter->postFileAndYield(self, httpRequest, uploader, uploadInfo->getAssetId(), uploadInfo->getAssetType());
|
||||
httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
|
||||
HandleUploadError(status, result, uploadInfo);
|
||||
LLUploadDialog::modalUploadFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
S32 expected_upload_cost = 0;
|
||||
S32 uploadPrice = 0;
|
||||
|
||||
// Update L$ and ownership credit information
|
||||
// since it probably changed on the server
|
||||
|
|
@ -81,58 +102,104 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoros::self &self, LLCore
|
|||
uploadInfo->getAssetType() == LLAssetType::AT_ANIMATION ||
|
||||
uploadInfo->getAssetType() == LLAssetType::AT_MESH)
|
||||
{
|
||||
expected_upload_cost =
|
||||
LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
uploadPrice = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
}
|
||||
|
||||
on_new_single_inventory_upload_complete(
|
||||
uploadInfo->getAssetType(),
|
||||
uploadInfo->getInventoryType(),
|
||||
uploadInfo->getAssetTypeString(), // note the paramert calls for inv_type string...
|
||||
uploadInfo->getFolderId(),
|
||||
uploadInfo->getName(),
|
||||
uploadInfo->getDescription(),
|
||||
result,
|
||||
expected_upload_cost);
|
||||
bool success = false;
|
||||
|
||||
#if 0
|
||||
|
||||
LLSD initalBody = generate_new_resource_upload_capability_body();
|
||||
|
||||
|
||||
|
||||
LLSD result = httpAdapter->postAndYield(self, httpRequest, url, initalBody);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
if (uploadPrice > 0)
|
||||
{
|
||||
// this upload costed us L$, update our balance
|
||||
// and display something saying that it cost L$
|
||||
LLStatusBar::sendMoneyBalanceRequest();
|
||||
|
||||
LLSD args;
|
||||
args["AMOUNT"] = llformat("%d", uploadPrice);
|
||||
LLNotificationsUtil::add("UploadPayment", args);
|
||||
}
|
||||
|
||||
std::string state = result["state"].asString();
|
||||
LLUUID serverInventoryItem = uploadInfo->finishUpload(result);
|
||||
|
||||
if (state == "upload")
|
||||
if (serverInventoryItem.notNull())
|
||||
{
|
||||
// Upload the file...
|
||||
result = httpAdapter->postFileAndYield(self, httpRequest, url, initalBody);
|
||||
success = true;
|
||||
|
||||
httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
// Show the preview panel for textures and sounds to let
|
||||
// user know that the image (or snapshot) arrived intact.
|
||||
LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel();
|
||||
if (panel)
|
||||
{
|
||||
LLFocusableElement* focus = gFocusMgr.getKeyboardFocus();
|
||||
panel->setSelection(serverInventoryItem, TAKE_FOCUS_NO);
|
||||
|
||||
state = result["state"].asString();
|
||||
}
|
||||
|
||||
if (state == "complete")
|
||||
{
|
||||
// done with the upload.
|
||||
// restore keyboard focus
|
||||
gFocusMgr.setKeyboardFocus(focus);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// an error occurred
|
||||
LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL;
|
||||
}
|
||||
|
||||
// remove the "Uploading..." message
|
||||
LLUploadDialog::modalUploadFinished();
|
||||
|
||||
// Let the Snapshot floater know we have finished uploading a snapshot to inventory.
|
||||
LLFloater* floater_snapshot = LLFloaterReg::findInstance("snapshot");
|
||||
if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE && floater_snapshot)
|
||||
{
|
||||
floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", success).with("msg", "inventory")));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
/*static*/
|
||||
void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &result, NewResourceUploadInfo::ptr_t &uploadInfo)
|
||||
{
|
||||
std::string reason;
|
||||
std::string label("CannotUploadReason");
|
||||
|
||||
LL_WARNS() << ll_pretty_print_sd(result) << LL_ENDL;
|
||||
|
||||
if (result.has("label"))
|
||||
{
|
||||
label = result["label"];
|
||||
}
|
||||
|
||||
if (result.has("message"))
|
||||
{
|
||||
reason = result["message"];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (status.getType() == 499)
|
||||
{
|
||||
reason = "The server is experiencing unexpected difficulties.";
|
||||
}
|
||||
else
|
||||
{
|
||||
reason = "Error in upload request. Please visit "
|
||||
"http://secondlife.com/support for help fixing this problem.";
|
||||
}
|
||||
}
|
||||
|
||||
LLSD args;
|
||||
args["FILE"] = uploadInfo->getDisplayName();
|
||||
args["REASON"] = reason;
|
||||
|
||||
LLNotificationsUtil::add(label, args);
|
||||
|
||||
// unfreeze script preview
|
||||
if (uploadInfo->getAssetType() == LLAssetType::AT_LSL_TEXT)
|
||||
{
|
||||
LLPreviewLSL* preview = LLFloaterReg::findTypedInstance<LLPreviewLSL>("preview_script",
|
||||
uploadInfo->getItemId());
|
||||
if (preview)
|
||||
{
|
||||
LLSD errors;
|
||||
errors.append(LLTrans::getString("UploadFailed") + reason);
|
||||
preview->callbackLSLCompileFailed(errors);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ public:
|
|||
static void AssetInventoryUploadCoproc(LLCoros::self &self, LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, const LLUUID &id,
|
||||
std::string url, NewResourceUploadInfo::ptr_t uploadInfo);
|
||||
|
||||
|
||||
private:
|
||||
static void HandleUploadError(LLCore::HttpStatus status, LLSD &result, NewResourceUploadInfo::ptr_t &uploadInfo);
|
||||
};
|
||||
|
||||
#endif // !VIEWER_ASSET_UPLOAD_H
|
||||
|
|
|
|||
|
|
@ -85,8 +85,9 @@ class LLFileEnableUpload : public view_listener_t
|
|||
{
|
||||
bool handleEvent(const LLSD& userdata)
|
||||
{
|
||||
bool new_value = gStatusBar && LLGlobalEconomy::Singleton::getInstance() && (gStatusBar->getBalance() >= LLGlobalEconomy::Singleton::getInstance()->getPriceUpload());
|
||||
return new_value;
|
||||
return true;
|
||||
// bool new_value = gStatusBar && LLGlobalEconomy::Singleton::getInstance() && (gStatusBar->getBalance() >= LLGlobalEconomy::Singleton::getInstance()->getPriceUpload());
|
||||
// return new_value;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -757,38 +758,15 @@ LLUUID upload_new_resource(
|
|||
|
||||
if (!error)
|
||||
{
|
||||
std::string t_disp_name = display_name;
|
||||
if (t_disp_name.empty())
|
||||
{
|
||||
t_disp_name = src_filename;
|
||||
}
|
||||
|
||||
#if 1
|
||||
NewResourceUploadInfo::ptr_t uploadInfo(new NewResourceUploadInfo(
|
||||
tid, asset_type,
|
||||
name, desc, compression_info,
|
||||
destination_folder_type, inv_type,
|
||||
next_owner_perms, group_perms, everyone_perms,
|
||||
display_name, expected_upload_cost));
|
||||
expected_upload_cost));
|
||||
|
||||
upload_new_resource(tid, asset_type, uploadInfo,
|
||||
upload_new_resource(uploadInfo,
|
||||
callback, userdata);
|
||||
#else
|
||||
upload_new_resource(
|
||||
tid,
|
||||
asset_type,
|
||||
name,
|
||||
desc,
|
||||
compression_info, // tid
|
||||
destination_folder_type,
|
||||
inv_type,
|
||||
next_owner_perms,
|
||||
group_perms,
|
||||
everyone_perms,
|
||||
display_name,
|
||||
callback,
|
||||
expected_upload_cost,
|
||||
userdata);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -933,63 +911,7 @@ void upload_done_callback(
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static LLAssetID upload_new_resource_prep(
|
||||
const LLTransactionID& tid,
|
||||
LLAssetType::EType asset_type,
|
||||
LLInventoryType::EType& inventory_type,
|
||||
std::string& name,
|
||||
const std::string& display_name,
|
||||
std::string& description)
|
||||
{
|
||||
LLAssetID uuid = generate_asset_id_for_new_upload(tid);
|
||||
|
||||
increase_new_upload_stats(asset_type);
|
||||
|
||||
assign_defaults_and_show_upload_message(
|
||||
asset_type,
|
||||
inventory_type,
|
||||
name,
|
||||
display_name,
|
||||
description);
|
||||
|
||||
return uuid;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
LLSD generate_new_resource_upload_capability_body(
|
||||
LLAssetType::EType asset_type,
|
||||
const std::string& name,
|
||||
const std::string& desc,
|
||||
LLFolderType::EType destination_folder_type,
|
||||
LLInventoryType::EType inv_type,
|
||||
U32 next_owner_perms,
|
||||
U32 group_perms,
|
||||
U32 everyone_perms)
|
||||
{
|
||||
LLSD body;
|
||||
|
||||
body["folder_id"] = gInventory.findCategoryUUIDForType(
|
||||
(destination_folder_type == LLFolderType::FT_NONE) ?
|
||||
(LLFolderType::EType) asset_type :
|
||||
destination_folder_type);
|
||||
|
||||
body["asset_type"] = LLAssetType::lookup(asset_type);
|
||||
body["inventory_type"] = LLInventoryType::lookup(inv_type);
|
||||
body["name"] = name;
|
||||
body["description"] = desc;
|
||||
body["next_owner_mask"] = LLSD::Integer(next_owner_perms);
|
||||
body["group_mask"] = LLSD::Integer(group_perms);
|
||||
body["everyone_mask"] = LLSD::Integer(everyone_perms);
|
||||
|
||||
return body;
|
||||
}
|
||||
#endif
|
||||
|
||||
void upload_new_resource(
|
||||
const LLTransactionID &tid,
|
||||
LLAssetType::EType assetType,
|
||||
NewResourceUploadInfo::ptr_t &uploadInfo,
|
||||
LLAssetStorage::LLStoreAssetCallback callback,
|
||||
void *userdata)
|
||||
|
|
@ -999,8 +921,8 @@ void upload_new_resource(
|
|||
return ;
|
||||
}
|
||||
|
||||
uploadInfo->setAssetType(assetType);
|
||||
uploadInfo->setTransactionId(tid);
|
||||
// uploadInfo->setAssetType(assetType);
|
||||
// uploadInfo->setTransactionId(tid);
|
||||
|
||||
|
||||
std::string url = gAgent.getRegion()->getCapability("NewFileAgentInventory");
|
||||
|
|
@ -1010,19 +932,6 @@ void upload_new_resource(
|
|||
LLCoprocedureManager::CoProcedure_t proc = boost::bind(&LLViewerAssetUpload::AssetInventoryUploadCoproc, _1, _2, _3, url, uploadInfo);
|
||||
|
||||
LLCoprocedureManager::getInstance()->enqueueCoprocedure("LLViewerAssetUpload::AssetInventoryUploadCoproc", proc);
|
||||
// LL_INFOS() << "New Agent Inventory via capability" << LL_ENDL;
|
||||
// uploadInfo->prepareUpload();
|
||||
// uploadInfo->logPreparedUpload();
|
||||
//
|
||||
// LLSD body = uploadInfo->generatePostBody();
|
||||
//
|
||||
// LLHTTPClient::post(
|
||||
// url,
|
||||
// body,
|
||||
// new LLNewAgentInventoryResponder(
|
||||
// body,
|
||||
// uploadInfo->getAssetId(),
|
||||
// assetType));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1032,9 +941,9 @@ void upload_new_resource(
|
|||
LL_INFOS() << "NewAgentInventory capability not found, new agent inventory via asset system." << LL_ENDL;
|
||||
// check for adequate funds
|
||||
// TODO: do this check on the sim
|
||||
if (LLAssetType::AT_SOUND == assetType ||
|
||||
LLAssetType::AT_TEXTURE == assetType ||
|
||||
LLAssetType::AT_ANIMATION == assetType)
|
||||
if (LLAssetType::AT_SOUND == uploadInfo->getAssetType() ||
|
||||
LLAssetType::AT_TEXTURE == uploadInfo->getAssetType() ||
|
||||
LLAssetType::AT_ANIMATION == uploadInfo->getAssetType())
|
||||
{
|
||||
S32 balance = gStatusBar->getBalance();
|
||||
if (balance < uploadInfo->getExpectedUploadCost())
|
||||
|
|
@ -1049,9 +958,9 @@ void upload_new_resource(
|
|||
}
|
||||
|
||||
LLResourceData* data = new LLResourceData;
|
||||
data->mAssetInfo.mTransactionID = tid;
|
||||
data->mAssetInfo.mTransactionID = uploadInfo->getTransactionId();
|
||||
data->mAssetInfo.mUuid = uploadInfo->getAssetId();
|
||||
data->mAssetInfo.mType = assetType;
|
||||
data->mAssetInfo.mType = uploadInfo->getAssetType();
|
||||
data->mAssetInfo.mCreatorID = gAgentID;
|
||||
data->mInventoryType = uploadInfo->getInventoryType();
|
||||
data->mNextOwnerPerm = uploadInfo->getNextOwnerPerms();
|
||||
|
|
@ -1075,68 +984,6 @@ void upload_new_resource(
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid)
|
||||
{
|
||||
if ( gDisconnected )
|
||||
{
|
||||
LLAssetID rv;
|
||||
|
||||
rv.setNull();
|
||||
return rv;
|
||||
}
|
||||
|
||||
LLAssetID uuid = tid.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
return uuid;
|
||||
}
|
||||
|
||||
void increase_new_upload_stats(LLAssetType::EType asset_type)
|
||||
{
|
||||
if ( LLAssetType::AT_SOUND == asset_type )
|
||||
{
|
||||
add(LLStatViewer::UPLOAD_SOUND, 1);
|
||||
}
|
||||
else if ( LLAssetType::AT_TEXTURE == asset_type )
|
||||
{
|
||||
add(LLStatViewer::UPLOAD_TEXTURE, 1);
|
||||
}
|
||||
else if ( LLAssetType::AT_ANIMATION == asset_type )
|
||||
{
|
||||
add(LLStatViewer::ANIMATION_UPLOADS, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void assign_defaults_and_show_upload_message(
|
||||
LLAssetType::EType asset_type,
|
||||
LLInventoryType::EType& inventory_type,
|
||||
std::string& name,
|
||||
const std::string& display_name,
|
||||
std::string& description)
|
||||
{
|
||||
if ( LLInventoryType::IT_NONE == inventory_type )
|
||||
{
|
||||
inventory_type = LLInventoryType::defaultForAssetType(asset_type);
|
||||
}
|
||||
LLStringUtil::stripNonprintable(name);
|
||||
LLStringUtil::stripNonprintable(description);
|
||||
|
||||
if ( name.empty() )
|
||||
{
|
||||
name = "(No Name)";
|
||||
}
|
||||
if ( description.empty() )
|
||||
{
|
||||
description = "(No Description)";
|
||||
}
|
||||
|
||||
// At this point, we're ready for the upload.
|
||||
std::string upload_message = "Uploading...\n\n";
|
||||
upload_message.append(display_name);
|
||||
LLUploadDialog::modalUploadDialog(upload_message);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void init_menu_file()
|
||||
{
|
||||
|
|
@ -1160,14 +1007,14 @@ void init_menu_file()
|
|||
// "File.SaveTexture" moved to llpanelmaininventory so that it can be properly handled.
|
||||
}
|
||||
|
||||
LLAssetID NewResourceUploadInfo::prepareUpload()
|
||||
LLSD NewResourceUploadInfo::prepareUpload()
|
||||
{
|
||||
LLAssetID uuid = generateNewAssetId();
|
||||
generateNewAssetId();
|
||||
|
||||
incrementUploadStats();
|
||||
assignDefaults();
|
||||
|
||||
return uuid;
|
||||
return LLSD().with("success", LLSD::Boolean(true));
|
||||
}
|
||||
|
||||
std::string NewResourceUploadInfo::getAssetTypeString() const
|
||||
|
|
@ -1209,6 +1056,84 @@ void NewResourceUploadInfo::logPreparedUpload()
|
|||
"Asset Type: " << LLAssetType::lookup(mAssetType) << LL_ENDL;
|
||||
}
|
||||
|
||||
LLUUID NewResourceUploadInfo::finishUpload(LLSD &result)
|
||||
{
|
||||
if (getFolderId().isNull())
|
||||
{
|
||||
return LLUUID::null;
|
||||
}
|
||||
|
||||
U32 permsEveryone = PERM_NONE;
|
||||
U32 permsGroup = PERM_NONE;
|
||||
U32 permsNextOwner = PERM_ALL;
|
||||
|
||||
if (result.has("new_next_owner_mask"))
|
||||
{
|
||||
// The server provided creation perms so use them.
|
||||
// Do not assume we got the perms we asked for in
|
||||
// since the server may not have granted them all.
|
||||
permsEveryone = result["new_everyone_mask"].asInteger();
|
||||
permsGroup = result["new_group_mask"].asInteger();
|
||||
permsNextOwner = result["new_next_owner_mask"].asInteger();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The server doesn't provide creation perms
|
||||
// so use old assumption-based perms.
|
||||
if (getAssetTypeString() != "snapshot")
|
||||
{
|
||||
permsNextOwner = PERM_MOVE | PERM_TRANSFER;
|
||||
}
|
||||
}
|
||||
|
||||
LLPermissions new_perms;
|
||||
new_perms.init(
|
||||
gAgent.getID(),
|
||||
gAgent.getID(),
|
||||
LLUUID::null,
|
||||
LLUUID::null);
|
||||
|
||||
new_perms.initMasks(
|
||||
PERM_ALL,
|
||||
PERM_ALL,
|
||||
permsEveryone,
|
||||
permsGroup,
|
||||
permsNextOwner);
|
||||
|
||||
U32 flagsInventoryItem = 0;
|
||||
if (result.has("inventory_flags"))
|
||||
{
|
||||
flagsInventoryItem = static_cast<U32>(result["inventory_flags"].asInteger());
|
||||
if (flagsInventoryItem != 0)
|
||||
{
|
||||
LL_INFOS() << "inventory_item_flags " << flagsInventoryItem << LL_ENDL;
|
||||
}
|
||||
}
|
||||
S32 creationDate = time_corrected();
|
||||
|
||||
LLUUID serverInventoryItem = result["new_inventory_item"].asUUID();
|
||||
LLUUID serverAssetId = result["new_asset"].asUUID();
|
||||
|
||||
LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem(
|
||||
serverInventoryItem,
|
||||
getFolderId(),
|
||||
new_perms,
|
||||
serverAssetId,
|
||||
getAssetType(),
|
||||
getInventoryType(),
|
||||
getName(),
|
||||
getDescription(),
|
||||
LLSaleInfo::DEFAULT,
|
||||
flagsInventoryItem,
|
||||
creationDate);
|
||||
|
||||
gInventory.updateItem(item);
|
||||
gInventory.notifyObservers();
|
||||
|
||||
return serverInventoryItem;
|
||||
}
|
||||
|
||||
|
||||
LLAssetID NewResourceUploadInfo::generateNewAssetId()
|
||||
{
|
||||
if (gDisconnected)
|
||||
|
|
@ -1263,3 +1188,7 @@ void NewResourceUploadInfo::assignDefaults()
|
|||
|
||||
}
|
||||
|
||||
std::string NewResourceUploadInfo::getDisplayName() const
|
||||
{
|
||||
return (mName.empty()) ? mAssetId.asString() : mName;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,13 +39,15 @@ class LLTransactionID;
|
|||
|
||||
void init_menu_file();
|
||||
|
||||
#if 1
|
||||
class NewResourceUploadInfo
|
||||
{
|
||||
public:
|
||||
typedef boost::shared_ptr<NewResourceUploadInfo> ptr_t;
|
||||
|
||||
NewResourceUploadInfo(std::string name,
|
||||
NewResourceUploadInfo(
|
||||
LLTransactionID transactId,
|
||||
LLAssetType::EType assetType,
|
||||
std::string name,
|
||||
std::string description,
|
||||
S32 compressionInfo,
|
||||
LLFolderType::EType destinationType,
|
||||
|
|
@ -53,48 +55,53 @@ public:
|
|||
U32 nextOWnerPerms,
|
||||
U32 groupPerms,
|
||||
U32 everyonePerms,
|
||||
std::string displayName,
|
||||
S32 expectedCost) :
|
||||
mTransactionId(transactId),
|
||||
mAssetType(assetType),
|
||||
mName(name),
|
||||
mDescription(description),
|
||||
mDisplayName(displayName),
|
||||
mCompressionInfo(compressionInfo),
|
||||
mDestinationFolderType(destinationType),
|
||||
mInventoryType(inventoryType),
|
||||
mNextOwnerPerms(nextOWnerPerms),
|
||||
mGroupPerms(groupPerms),
|
||||
mEveryonePerms(everyonePerms),
|
||||
mExpectedUploadCost(expectedCost),
|
||||
mInventoryType(inventoryType),
|
||||
mDestinationFolderType(destinationType)
|
||||
mFolderId(LLUUID::null),
|
||||
mItemId(LLUUID::null),
|
||||
mAssetId(LLAssetID::null)
|
||||
{ }
|
||||
|
||||
virtual ~NewResourceUploadInfo()
|
||||
{ }
|
||||
|
||||
virtual LLAssetID prepareUpload();
|
||||
virtual LLSD prepareUpload();
|
||||
virtual LLSD generatePostBody();
|
||||
virtual void logPreparedUpload();
|
||||
virtual LLUUID finishUpload(LLSD &result);
|
||||
|
||||
void setAssetType(LLAssetType::EType assetType) { mAssetType = assetType; }
|
||||
//void setAssetType(LLAssetType::EType assetType) { mAssetType = assetType; }
|
||||
//void setTransactionId(LLTransactionID transactionId) { mTransactionId = transactionId; }
|
||||
|
||||
LLTransactionID getTransactionId() const { return mTransactionId; }
|
||||
LLAssetType::EType getAssetType() const { return mAssetType; }
|
||||
std::string getAssetTypeString() const;
|
||||
void setTransactionId(LLTransactionID transactionId) { mTransactionId = transactionId; }
|
||||
LLTransactionID getTransactionId() const { return mTransactionId; }
|
||||
LLUUID getFolderId() const { return mFolderId; }
|
||||
|
||||
LLAssetID getAssetId() const { return mAssetId; }
|
||||
|
||||
std::string getName() const { return mName; };
|
||||
std::string getDescription() const { return mDescription; };
|
||||
std::string getDisplayName() const { return mDisplayName; };
|
||||
S32 getCompressionInfo() const { return mCompressionInfo; };
|
||||
LLFolderType::EType getDestinationFolderType() const { return mDestinationFolderType; };
|
||||
LLInventoryType::EType getInventoryType() const { return mInventoryType; };
|
||||
std::string getInventoryTypeString() const;
|
||||
U32 getNextOwnerPerms() const { return mNextOwnerPerms; };
|
||||
U32 getGroupPerms() const { return mGroupPerms; };
|
||||
U32 getEveryonePerms() const { return mEveryonePerms; };
|
||||
S32 getExpectedUploadCost() const { return mExpectedUploadCost; };
|
||||
LLInventoryType::EType getInventoryType() const { return mInventoryType; };
|
||||
std::string getInventoryTypeString() const;
|
||||
|
||||
LLFolderType::EType getDestinationFolderType() const { return mDestinationFolderType; };
|
||||
|
||||
std::string getDisplayName() const;
|
||||
|
||||
LLUUID getFolderId() const { return mFolderId; }
|
||||
LLUUID getItemId() const { return mItemId; }
|
||||
LLAssetID getAssetId() const { return mAssetId; }
|
||||
|
||||
protected:
|
||||
LLAssetID generateNewAssetId();
|
||||
|
|
@ -102,22 +109,21 @@ protected:
|
|||
virtual void assignDefaults();
|
||||
|
||||
private:
|
||||
LLTransactionID mTransactionId;
|
||||
LLAssetType::EType mAssetType;
|
||||
std::string mName;
|
||||
std::string mDescription;
|
||||
std::string mDisplayName;
|
||||
S32 mCompressionInfo;
|
||||
LLFolderType::EType mDestinationFolderType;
|
||||
LLInventoryType::EType mInventoryType;
|
||||
U32 mNextOwnerPerms;
|
||||
U32 mGroupPerms;
|
||||
U32 mEveryonePerms;
|
||||
S32 mExpectedUploadCost;
|
||||
|
||||
LLUUID mFolderId;
|
||||
|
||||
LLInventoryType::EType mInventoryType;
|
||||
LLFolderType::EType mDestinationFolderType;
|
||||
|
||||
LLUUID mItemId;
|
||||
LLAssetID mAssetId;
|
||||
LLTransactionID mTransactionId;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -137,48 +143,11 @@ LLUUID upload_new_resource(
|
|||
void *userdata);
|
||||
|
||||
void upload_new_resource(
|
||||
const LLTransactionID &tid,
|
||||
LLAssetType::EType type,
|
||||
NewResourceUploadInfo::ptr_t &uploadInfo,
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL,
|
||||
void *userdata = NULL);
|
||||
|
||||
|
||||
#else
|
||||
LLUUID upload_new_resource(
|
||||
const std::string& src_filename,
|
||||
std::string name,
|
||||
std::string desc,
|
||||
S32 compression_info,
|
||||
LLFolderType::EType destination_folder_type,
|
||||
LLInventoryType::EType inv_type,
|
||||
U32 next_owner_perms,
|
||||
U32 group_perms,
|
||||
U32 everyone_perms,
|
||||
const std::string& display_name,
|
||||
LLAssetStorage::LLStoreAssetCallback callback,
|
||||
S32 expected_upload_cost,
|
||||
void *userdata);
|
||||
|
||||
void upload_new_resource(
|
||||
const LLTransactionID &tid,
|
||||
LLAssetType::EType type,
|
||||
std::string name,
|
||||
std::string desc,
|
||||
S32 compression_info,
|
||||
LLFolderType::EType destination_folder_type,
|
||||
LLInventoryType::EType inv_type,
|
||||
U32 next_owner_perms,
|
||||
U32 group_perms,
|
||||
U32 everyone_perms,
|
||||
const std::string& display_name,
|
||||
LLAssetStorage::LLStoreAssetCallback callback,
|
||||
S32 expected_upload_cost,
|
||||
void *userdata);
|
||||
|
||||
LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid);
|
||||
void increase_new_upload_stats(LLAssetType::EType asset_type);
|
||||
#endif
|
||||
void assign_defaults_and_show_upload_message(
|
||||
LLAssetType::EType asset_type,
|
||||
LLInventoryType::EType& inventory_type,
|
||||
|
|
@ -186,18 +155,6 @@ void assign_defaults_and_show_upload_message(
|
|||
const std::string& display_name,
|
||||
std::string& description);
|
||||
|
||||
#if 0
|
||||
LLSD generate_new_resource_upload_capability_body(
|
||||
LLAssetType::EType asset_type,
|
||||
const std::string& name,
|
||||
const std::string& desc,
|
||||
LLFolderType::EType destination_folder_type,
|
||||
LLInventoryType::EType inv_type,
|
||||
U32 next_owner_perms,
|
||||
U32 group_perms,
|
||||
U32 everyone_perms);
|
||||
#endif
|
||||
|
||||
void on_new_single_inventory_upload_complete(
|
||||
LLAssetType::EType asset_type,
|
||||
LLInventoryType::EType inventory_type,
|
||||
|
|
|
|||
Loading…
Reference in New Issue