Lance Corrimal's temporary texture uploads patch. From his LGPLd Dolphin Viewer.
parent
233667b987
commit
412ae70116
|
|
@ -49,4 +49,5 @@ QuickAdditionalInv LGPL
|
|||
UpdatedLibCURL Curl (MIT/X11)
|
||||
UpdatedWebKit LGPL
|
||||
Progress_screens LGPL
|
||||
Prim_align_tool third party viewers (imprudence, Kirsten’s, etc, etc, etc) please feel free to include this code into yours.
|
||||
Prim_align_tool third party viewers (imprudence, Kirsten's, etc, etc, etc) please feel free to include this code into yours.
|
||||
Temp_Uploads LGPL (from Dolphin Viewer 2.4)
|
||||
|
|
@ -10313,6 +10313,17 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>TemporaryUpload</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Temporary texture upload flag (volatile)</string>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>TerrainColorHeightRange</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@
|
|||
#include "pipeline.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llviewertexturelist.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "lleconomy.h"
|
||||
#include "llstring.h"
|
||||
|
||||
#include "llendianswizzle.h"
|
||||
|
|
@ -115,6 +117,12 @@ BOOL LLFloaterImagePreview::postBuild()
|
|||
|
||||
if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF)
|
||||
getChildView("lossless_check")->setEnabled(TRUE);
|
||||
|
||||
gSavedSettings.setBOOL("TemporaryUpload", FALSE);
|
||||
if (LLGlobalEconomy::Singleton::getInstance()->getPriceUpload() == 0)
|
||||
{
|
||||
childHide("temp_check");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@
|
|||
///----------------------------------------------------------------------------
|
||||
/// Local function declarations, constants, enums, and typedefs
|
||||
///----------------------------------------------------------------------------
|
||||
S32 LLFloaterSnapshot::sUIWinHeightLong = 530 ;
|
||||
S32 LLFloaterSnapshot::sUIWinHeightShort = LLFloaterSnapshot::sUIWinHeightLong - 240 ;
|
||||
S32 LLFloaterSnapshot::sUIWinHeightLong = 550 ;
|
||||
S32 LLFloaterSnapshot::sUIWinHeightShort = LLFloaterSnapshot::sUIWinHeightLong - 260 ;
|
||||
S32 LLFloaterSnapshot::sUIWinWidth = 215 ;
|
||||
|
||||
LLSnapshotFloaterView* gSnapshotFloaterView = NULL;
|
||||
|
|
@ -1335,6 +1335,12 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
|
|||
floater->getChildView("keep_aspect_check")->setEnabled(shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff);
|
||||
floater->getChildView("layer_types")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL);
|
||||
|
||||
if (shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
|
||||
{
|
||||
floater->childSetValue("temp_check", false);
|
||||
}
|
||||
floater->childSetEnabled("temp_check", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE);
|
||||
|
||||
BOOL is_advance = gSavedSettings.getBOOL("AdvanceSnapshot");
|
||||
BOOL is_local = shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL;
|
||||
BOOL show_slider = (shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD ||
|
||||
|
|
@ -1376,6 +1382,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
|
|||
LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 );
|
||||
}
|
||||
S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
floater->childSetVisible("temp_check", is_advance && upload_cost > 0);
|
||||
floater->getChild<LLUICtrl>("texture")->setLabelArg("[AMOUNT]", llformat("%d",upload_cost));
|
||||
floater->getChild<LLUICtrl>("upload_btn")->setLabelArg("[AMOUNT]", llformat("%d",upload_cost));
|
||||
floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));
|
||||
|
|
@ -2151,6 +2158,8 @@ BOOL LLFloaterSnapshot::postBuild()
|
|||
parent_view->addChild(previewp);
|
||||
parent_view->addChild(gSnapshotFloaterView);
|
||||
|
||||
gSavedSettings.setBOOL("TemporaryUpload", FALSE);
|
||||
|
||||
//move snapshot floater to special purpose snapshotfloaterview
|
||||
gFloaterView->removeChild(this);
|
||||
gSnapshotFloaterView->addChild(this);
|
||||
|
|
|
|||
|
|
@ -896,6 +896,44 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt
|
|||
}
|
||||
}
|
||||
|
||||
void temp_upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status)
|
||||
{
|
||||
LLResourceData* data = (LLResourceData*)user_data;
|
||||
if (result >= 0)
|
||||
{
|
||||
LLFolderType::EType dest_loc = (data->mPreferredLocation == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(data->mAssetInfo.mType) : data->mPreferredLocation;
|
||||
LLUUID folder_id(gInventory.findCategoryUUIDForType(dest_loc));
|
||||
LLUUID item_id;
|
||||
item_id.generate();
|
||||
LLPermissions perm;
|
||||
perm.init(gAgentID, gAgentID, gAgentID, gAgentID);
|
||||
perm.setMaskBase(PERM_ALL);
|
||||
perm.setMaskOwner(PERM_ALL);
|
||||
perm.setMaskEveryone(PERM_ALL);
|
||||
perm.setMaskGroup(PERM_ALL);
|
||||
LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem(item_id, folder_id, perm,
|
||||
data->mAssetInfo.mTransactionID.makeAssetID(gAgent.getSecureSessionID()),
|
||||
data->mAssetInfo.mType, data->mInventoryType, data->mAssetInfo.getName(),
|
||||
"Temporary asset", LLSaleInfo::DEFAULT, LLInventoryItemFlags::II_FLAGS_NONE,
|
||||
time_corrected());
|
||||
item->updateServer(TRUE);
|
||||
gInventory.updateItem(item);
|
||||
gInventory.notifyObservers();
|
||||
LLFloaterReg::showInstance("preview_texture", LLSD(item_id), TRUE);
|
||||
// open_texture(item_id, std::string("Texture: ") + item->getName(), TRUE, LLUUID::null, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSD args;
|
||||
args["FILE"] = LLInventoryType::lookupHumanReadable(data->mInventoryType);
|
||||
args["REASON"] = std::string(LLAssetStorage::getErrorString(result));
|
||||
LLNotificationsUtil::add("CannotUploadReason", args);
|
||||
}
|
||||
|
||||
LLUploadDialog::modalUploadFinished();
|
||||
delete data;
|
||||
}
|
||||
|
||||
void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type,
|
||||
std::string name,
|
||||
std::string desc, S32 compression_info,
|
||||
|
|
@ -915,6 +953,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
|
|||
}
|
||||
|
||||
LLAssetID uuid = tid.makeAssetID(gAgent.getSecureSessionID());
|
||||
BOOL temp_upload = FALSE;
|
||||
|
||||
if( LLAssetType::AT_SOUND == asset_type )
|
||||
{
|
||||
|
|
@ -924,6 +963,12 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
|
|||
if( LLAssetType::AT_TEXTURE == asset_type )
|
||||
{
|
||||
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_UPLOAD_TEXTURE_COUNT );
|
||||
temp_upload = gSavedSettings.getBOOL("TemporaryUpload");
|
||||
if (temp_upload)
|
||||
{
|
||||
name = "[temp] " + name;
|
||||
}
|
||||
gSavedSettings.setBOOL("TemporaryUpload", FALSE);
|
||||
}
|
||||
else
|
||||
if( LLAssetType::AT_ANIMATION == asset_type)
|
||||
|
|
@ -960,7 +1005,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
|
|||
lldebugs << "Folder: " << gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type) << llendl;
|
||||
lldebugs << "Asset Type: " << LLAssetType::lookup(asset_type) << llendl;
|
||||
std::string url = gAgent.getRegion()->getCapability("NewFileAgentInventory");
|
||||
if (!url.empty())
|
||||
if (!url.empty() && !temp_upload)
|
||||
{
|
||||
llinfos << "New Agent Inventory via capability" << llendl;
|
||||
LLSD body;
|
||||
|
|
@ -982,6 +1027,8 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!temp_upload)
|
||||
{
|
||||
llinfos << "NewAgentInventory capability not found, new agent inventory via asset system." << llendl;
|
||||
// check for adequate funds
|
||||
// TODO: do this check on the sim
|
||||
|
|
@ -1000,6 +1047,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLResourceData* data = new LLResourceData;
|
||||
data->mAssetInfo.mTransactionID = tid;
|
||||
|
|
@ -1014,7 +1062,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
|
|||
data->mAssetInfo.setDescription(desc);
|
||||
data->mPreferredLocation = destination_folder_type;
|
||||
|
||||
LLAssetStorage::LLStoreAssetCallback asset_callback = &upload_done_callback;
|
||||
LLAssetStorage::LLStoreAssetCallback asset_callback = temp_upload ? &temp_upload_done_callback : &upload_done_callback;
|
||||
if (callback)
|
||||
{
|
||||
asset_callback = callback;
|
||||
|
|
@ -1022,7 +1070,9 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
|
|||
gAssetStorage->storeAssetData(data->mAssetInfo.mTransactionID, data->mAssetInfo.mType,
|
||||
asset_callback,
|
||||
(void*)data,
|
||||
FALSE);
|
||||
temp_upload,
|
||||
TRUE,
|
||||
temp_upload);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "llfoldertype.h"
|
||||
#include "llassetstorage.h"
|
||||
#include "llinventorytype.h"
|
||||
#include "llinventorydefines.h"
|
||||
|
||||
class LLTransactionID;
|
||||
|
||||
|
|
|
|||
|
|
@ -130,6 +130,11 @@ Try saving image as 24 bit Targa (.tga).
|
|||
name="lossless_check"
|
||||
top_pad="162"
|
||||
width="280" />
|
||||
<check_box
|
||||
control_name="TemporaryUpload" enabled="true"
|
||||
follows="bottom|left" height="16" initial_value="false"
|
||||
left_delta="155" name="temp_check" width="280" label="Temporary (Free)"
|
||||
tooltip="Sets the asset to be temporary, meaning its free, but in return, only good for a short time before it ceases to exist." />
|
||||
<button
|
||||
follows="bottom|right"
|
||||
height="20"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
can_minimize="false"
|
||||
can_close="true"
|
||||
follows="left|top"
|
||||
height="520"
|
||||
height="540"
|
||||
layout="topleft"
|
||||
name="Snapshot"
|
||||
help_topic="snapshot"
|
||||
|
|
@ -400,4 +400,7 @@
|
|||
top_pad="8"
|
||||
width="180"
|
||||
name="auto_snapshot_check" />
|
||||
<check_box top_pad="8" follows="left|top" control_name="TemporaryUpload" enabled="true"
|
||||
initial_value="false" label="Temporary Image (Free)" left="10"
|
||||
name="temp_check" tooltip="Sets the asset to be temporary, meaning its free, but in return, only good for a short time before it ceases to exist." />
|
||||
</floater>
|
||||
|
|
|
|||
Loading…
Reference in New Issue