Emerald Local Assets

This commit is contained in:
Siana Gearz
2011-03-03 02:01:52 +01:00
parent 5cad5a4cfd
commit 633b6d22f2
13 changed files with 1816 additions and 25 deletions

View File

@@ -72,6 +72,12 @@
#include "lllocalinventory.h"
// </edit>
// tag: vaa emerald local_asset_browser [begin]
#include "floaterlocalassetbrowse.h"
#include "llscrolllistctrl.h"
#include "llfilepicker.h"
#define LOCALLIST_COL_ID 1
// tag: vaa emerald local_asset_browser [end]
static const S32 CLOSE_BTN_WIDTH = 100;
const S32 PIPETTE_BTN_WIDTH = 32;
@@ -168,6 +174,18 @@ public:
static void onSearchEdit(const std::string& search_string, void* user_data );
static void onTextureSelect( const LLTextureEntry& te, void *data );
// tag: vaa emerald local_asset_browser [begin]
// static void onBtnLocal( void* userdata );
// static void onBtnServer( void* userdata );
// static void switchModes( bool localmode, void* userdata );
static void onBtnAdd( void* userdata );
static void onBtnRemove( void* userdata );
static void onBtnBrowser( void* userdata );
static void onLocalScrollCommit ( LLUICtrl* ctrl, void *userdata );
// tag: vaa emerald local_asset_browser [end]
protected:
LLPointer<LLViewerImage> mTexturep;
LLTextureCtrl* mOwner;
@@ -198,6 +216,7 @@ protected:
BOOL mNoCopyTextureSelected;
F32 mContextConeOpacity;
LLSaveFolderState mSavedFolderState;
LLScrollListCtrl* mLocalScrollCtrl; // tag: vaa emerald local_asset_browser
};
LLFloaterTexturePicker::LLFloaterTexturePicker(
@@ -243,6 +262,18 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
childSetAction("Blank", LLFloaterTexturePicker::onBtnWhite,this);
childSetAction("Invisible", LLFloaterTexturePicker::onBtnInvisible,this);
// tag: vaa emerald local_asset_browser [begin]
// childSetAction("Local", LLFloaterTexturePicker::onBtnLocal, this);
// childSetAction("Server", LLFloaterTexturePicker::onBtnServer, this);
childSetAction("Add", LLFloaterTexturePicker::onBtnAdd, this);
childSetAction("Remove", LLFloaterTexturePicker::onBtnRemove, this);
childSetAction("Browser", LLFloaterTexturePicker::onBtnBrowser, this);
mLocalScrollCtrl = getChild<LLScrollListCtrl>("local_name_list");
mLocalScrollCtrl->setCallbackUserData(this);
mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit);
LocalAssetBrowser::UpdateTextureCtrlList( mLocalScrollCtrl );
// tag: vaa emerald local_asset_browser [end]
childSetCommitCallback("show_folders_check", onShowFolders, this);
childSetVisible("show_folders_check", FALSE);
@@ -779,6 +810,70 @@ void LLFloaterTexturePicker::onBtnSelect(void* userdata)
self->close();
}
// tag: vaa emerald local_asset_browser [begin]
// static, switches between showing inventory instance for global bitmaps
// to showing the scroll list for local ones and back.
/*
void LLFloaterTexturePicker::onBtnLocal(void *userdata)
{
switchModes( true, userdata );
}
void LLFloaterTexturePicker::onBtnServer(void *userdata)
{
switchModes( false, userdata );
}
void LLFloaterTexturePicker::switchModes(bool localmode, void *userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
// servermode widgets
self->childSetVisible("Local", !localmode);
self->childSetVisible("Default", !localmode);
self->childSetVisible("None", !localmode);
self->childSetVisible("Blank", !localmode);
self->mSearchEdit->setVisible(!localmode);
self->mInventoryPanel->setVisible(!localmode);
// localmode widgets
self->childSetVisible("Server", localmode);
self->childSetVisible("Add", localmode);
self->childSetVisible("Remove", localmode);
self->childSetVisible("Browser", localmode);
self->mLocalScrollCtrl->setVisible(localmode);
}
*/
void LLFloaterTexturePicker::onBtnAdd(void *userdata)
{
LocalAssetBrowser::AddBitmap();
}
void LLFloaterTexturePicker::onBtnRemove(void *userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
LocalAssetBrowser::DelBitmap( self->mLocalScrollCtrl->getAllSelected(), LOCALLIST_COL_ID );
}
void LLFloaterTexturePicker::onBtnBrowser(void *userdata)
{
FloaterLocalAssetBrowser::show(NULL);
}
// static, reacts to user clicking a valid field in the local scroll list.
void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl *ctrl, void *userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
LLUUID id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel( LOCALLIST_COL_ID );
self->mOwner->setImageAssetID( id );
if ( self->childGetValue("apply_immediate_check").asBoolean() )
{ self->mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CHANGE, id); } // calls an overridden function.
}
// tag: vaa emerald local_asset_browser [end]
// static
void LLFloaterTexturePicker::onBtnPipette( void* userdata )
{
@@ -1322,6 +1417,40 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op)
}
}
// tag: vaa emerald local_asset_browser [begin]
/*
overriding onFloaterCommit to forcefeed it a uuid.
also, i still don't get the difference beween mImageItemID and mImageAssetID,
they seem to affect the same thing? using mImageAssetID.
*/
void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id)
{
LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if( floaterp && getEnabled())
{
mImageItemID = id;
mImageAssetID = id; //floaterp->getAssetID(); // using same as on above func.
// seems to work anyway.
if (op == TEXTURE_SELECT && mOnSelectCallback)
{
mOnSelectCallback(this, mCallbackUserData);
}
else if (op == TEXTURE_CANCEL && mOnCancelCallback)
{
mOnCancelCallback(this, mCallbackUserData);
}
else
{
onCommit();
}
}
}
// tag: vaa emerald local_asset_browser [end]
void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id )
{
if( mImageAssetID != asset_id )