vfs explorer can now be used to view cached asset data with the built in hex editor

This commit is contained in:
Hazim Gazov
2010-06-26 17:57:34 +00:00
parent 1145f8aa2e
commit dae72dcee4

View File

@@ -31,6 +31,17 @@ DOFloaterHex::DOFloaterHex(LLUUID item_id, BOOL vfs, LLAssetType::EType asset_ty
: LLFloater()
{
sInstances.push_back(this);
if(vfs)
{
mVFS = true;
mAssetId = item_id;
mAssetType = asset_type;
} else {
mVFS = false;
mAssetId = mItem->getAssetUUID();
mAssetType = mItem->getType();
}
llinfos << "Asset ID: " << item_id.asString() << llendl;
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hex.xml");
}
@@ -49,9 +60,6 @@ void DOFloaterHex::show(LLUUID item_id, BOOL vfs, LLAssetType::EType asset_type)
DOFloaterHex* floaterp = new DOFloaterHex(item_id);
floaterp->setRect(rect);
floaterp->mVFS = false;
floaterp->mAssetId = item->getAssetUUID();
floaterp->mAssetType = item->getType();
floaterp->mItem = item;
gFloaterView->adjustToFitScreen(floaterp, FALSE);
@@ -61,12 +69,10 @@ void DOFloaterHex::show(LLUUID item_id, BOOL vfs, LLAssetType::EType asset_type)
gFloaterView->getNewFloaterPosition(&left, &top);
LLRect rect = gSavedSettings.getRect("FloaterHexRect");
rect.translate(left - rect.mLeft, top - rect.mTop);
DOFloaterHex* floaterp = new DOFloaterHex(item_id);
DOFloaterHex* floaterp = new DOFloaterHex(item_id, true, asset_type);
floaterp->setRect(rect);
floaterp->mVFS = true;
floaterp->mAssetId = item_id;
floaterp->mAssetType = asset_type;
llinfos << "Asset ID: " << item_id.asString() << llendl;
gFloaterView->adjustToFitScreen(floaterp, FALSE);
}
@@ -139,6 +145,7 @@ void DOFloaterHex::imageCallback(BOOL success,
BOOL final,
void* userdata)
{
if(final)
{
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
@@ -179,6 +186,7 @@ void DOFloaterHex::assetCallback(LLVFS *vfs,
LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status)
{
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
DOFloaterHex* floater = (DOFloaterHex*)(data->floater);
if(!floater) return;
@@ -259,6 +267,7 @@ void DOFloaterHex::assetCallback(LLVFS *vfs,
// static
void DOFloaterHex::onClickUpload(void* user_data)
{
DOFloaterHex* floater = (DOFloaterHex*)user_data;
LLInventoryItem* item = floater->mItem;
@@ -453,9 +462,12 @@ void DOFloaterHex::handleSizing()
void DOFloaterHex::readVFile()
{
if(!mVFS) return;
// quick cut paste job
// Todo: this doesn't work for static vfs shit
LLVFile file(gVFS, mAssetId, mAssetType, LLVFile::READ);
if(file.getVFSThread())
{
S32 size = file.getSize();
char* buffer = new char[size];
@@ -476,6 +488,8 @@ void DOFloaterHex::readVFile()
mEditor->setValue(new_data);
mEditor->setVisible(TRUE);
}
childSetText("status_text", std::string("Editing VFile"));
childSetEnabled("upload_btn", false);