Fixed local texture not working. Hacked in exception for textures.

This commit is contained in:
phr0z3nt04st
2010-06-29 00:14:42 -05:00
parent b96e225ef8
commit acab2bd974

View File

@@ -8,6 +8,9 @@
#include "lllocalinventory.h"
#include "llviewerwindow.h"
#include "llassetconverter.h"
#include "llviewerimagelist.h"
#include "llviewerimage.h"
LLFloaterVFS* LLFloaterVFS::sInstance;
std::list<LLFloaterVFS::entry> LLFloaterVFS::mFiles;
LLFloaterVFS::LLFloaterVFS()
@@ -201,6 +204,9 @@ void LLFloaterVFS::removeEntry()
{
if((*iter).mID == mEditID)
{
if((*iter).mType == LLAssetType::AT_TEXTURE)
gImageList.deleteImage(gImageList.hasImage( (*iter).mID ));
else
gVFS->removeFile((*iter).mID, (*iter).mType);
iter = mFiles.erase(iter);
}
@@ -246,6 +252,28 @@ void LLFloaterVFS::onClickAdd(void* user_data)
LLAPRFile fp;
fp.open(temp_filename, LL_APR_RB, LLAPRFile::global, &file_size);
if(fp.getFileHandle())
{
if(asset_type == LLAssetType::AT_TEXTURE)
{
fp.close();
//load the texture using built in functions
LLPointer<LLImageJ2C> image_j2c = new LLImageJ2C;
if( !image_j2c->loadAndValidate( temp_filename ) )
{
llinfos << "Image: " << file_name << " is corrupt." << llendl;
return;
}
LLPointer<LLImageRaw> image_raw = new LLImageRaw;
if( !image_j2c->decode(image_raw,0.0f) )
{
llinfos << "Image: " << file_name << " is corrupt." << llendl;
return;
}
LLPointer<LLViewerImage> imagep = new LLViewerImage(asset_id);
imagep->createGLTexture(0, image_raw, 0, TRUE, LLViewerImageBoostLevel::BOOST_NONE);
gImageList.addImage(imagep);
}
else
{
LLVFile file(gVFS, asset_id, asset_type, LLVFile::WRITE);
file.setMaxSize(file_size);
@@ -255,6 +283,7 @@ void LLFloaterVFS::onClickAdd(void* user_data)
file.write(copy_buf, file_size);
fp.close();
}
}
else
{
if(temp_filename != file_name)