Dragged over lltexlayer, lldriverparam, lllocaltextureobject, llwearabledata

This commit is contained in:
Shyotl
2013-01-04 20:50:35 -06:00
parent 5ada2d4b6f
commit 9596514c79
57 changed files with 3350 additions and 2819 deletions

View File

@@ -42,20 +42,23 @@ struct LLWearableArrivedData
{
LLWearableArrivedData(LLAssetType::EType asset_type,
const std::string& wearable_name,
void(*asset_arrived_callback)(LLWearable*, void* userdata),
LLAvatarAppearance* avatarp,
void(*asset_arrived_callback)(LLViewerWearable*, void* userdata),
void* userdata) :
mAssetType( asset_type ),
mCallback( asset_arrived_callback ),
mUserdata( userdata ),
mName( wearable_name ),
mRetries(0)
mRetries(0),
mAvatarp(avatarp)
{}
LLAssetType::EType mAssetType;
void (*mCallback)(LLWearable*, void* userdata);
void (*mCallback)(LLViewerWearable*, void* userdata);
void* mUserdata;
std::string mName;
S32 mRetries;
LLAvatarAppearance *mAvatarp;
};
////////////////////////////////////////////////////////////////////////////
@@ -72,10 +75,10 @@ void LLWearableList::cleanup()
mList.clear();
}
void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata)
void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAvatarAppearance* avatarp, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata)
{
llassert( (asset_type == LLAssetType::AT_CLOTHING) || (asset_type == LLAssetType::AT_BODYPART) );
LLWearable* instance = get_if_there(mList, assetID, (LLWearable*)NULL );
LLViewerWearable* instance = get_if_there(mList, assetID, (LLViewerWearable*)NULL );
if( instance )
{
asset_arrived_callback( instance, userdata );
@@ -85,7 +88,7 @@ void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& weara
gAssetStorage->getAssetData(assetID,
asset_type,
LLWearableList::processGetAssetReply,
(void*)new LLWearableArrivedData( asset_type, wearable_name, asset_arrived_callback, userdata ),
(void*)new LLWearableArrivedData( asset_type, wearable_name, avatarp, asset_arrived_callback, userdata ),
TRUE);
}
}
@@ -95,12 +98,17 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID
{
BOOL isNewWearable = FALSE;
LLWearableArrivedData* data = (LLWearableArrivedData*) userdata;
LLWearable* wearable = NULL; // NULL indicates failure
LLViewerWearable* wearable = NULL; // NULL indicates failure
LLAvatarAppearance *avatarp = data->mAvatarp;
if( !filename )
{
LL_WARNS("Wearable") << "Bad Wearable Asset: missing file." << LL_ENDL;
}
else if(!avatarp)
{
LL_WARNS("Wearable") << "Bad asset request: missing avatar pointer." << LL_ENDL;
}
else if (status >= 0)
{
// read the file
@@ -111,7 +119,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID
}
else
{
wearable = new LLWearable(uuid);
wearable = new LLViewerWearable(uuid);
bool res = wearable->importFile( fp );
if (!res)
{
@@ -203,11 +211,11 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID
}
LLWearable* LLWearableList::createCopy(const LLWearable* old_wearable, const std::string& new_name)
LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearable, const std::string& new_name)
{
lldebugs << "LLWearableList::createCopy()" << llendl;
LLWearable *wearable = generateNewWearable();
LLViewerWearable *wearable = generateNewWearable();
wearable->copyDataFrom(old_wearable);
LLPermissions perm(old_wearable->getPermissions());
@@ -222,11 +230,11 @@ LLWearable* LLWearableList::createCopy(const LLWearable* old_wearable, const std
return wearable;
}
LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type )
LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type, LLAvatarAppearance *avatarp )
{
lldebugs << "LLWearableList::createNewWearable()" << llendl;
LLWearable *wearable = generateNewWearable();
LLViewerWearable *wearable = generateNewWearable();
wearable->setType( type );
std::string name = LLTrans::getString( LLWearableType::getTypeDefaultNewName(wearable->getType()) );
@@ -251,13 +259,13 @@ LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type )
return wearable;
}
LLWearable *LLWearableList::generateNewWearable()
LLViewerWearable *LLWearableList::generateNewWearable()
{
LLTransactionID tid;
tid.generate();
LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
LLWearable* wearable = new LLWearable(tid);
LLViewerWearable* wearable = new LLViewerWearable(tid);
mList[new_asset_id] = wearable;
return wearable;
}