SH-3455 WIP - removed llagentwearablesfetch files, among other changes

master
Brad Payne (Vir Linden) 2013-09-26 17:27:01 -04:00
parent 39900843c9
commit 2248cbf2b8
5 changed files with 5 additions and 465 deletions

View File

@ -110,7 +110,6 @@ set(viewer_SOURCE_FILES
llagentpilot.cpp
llagentui.cpp
llagentwearables.cpp
llagentwearablesfetch.cpp
llanimstatelabels.cpp
llappcorehttp.cpp
llappearancemgr.cpp
@ -695,7 +694,6 @@ set(viewer_HEADER_FILES
llagentpilot.h
llagentui.h
llagentwearables.h
llagentwearablesfetch.h
llanimstatelabels.h
llappcorehttp.h
llappearance.h

View File

@ -30,7 +30,6 @@
#include "llaccordionctrltab.h"
#include "llagent.h"
#include "llagentcamera.h"
#include "llagentwearablesfetch.h"
#include "llappearancemgr.h"
#include "llcallbacklist.h"
#include "llfloatersidepanelcontainer.h"
@ -207,13 +206,6 @@ LLAgentWearables::AddWearableToAgentInventoryCallback::AddWearableToAgentInvento
void LLAgentWearables::AddWearableToAgentInventoryCallback::fire(const LLUUID& inv_item)
{
if (mTodo & CALL_CREATESTANDARDDONE)
{
// SUNSHINE CLEANUP
llassert(false); // does not appear to ever be used.
llinfos << "callback fired, inv_item " << inv_item.asString() << llendl;
}
if (inv_item.isNull())
return;
@ -227,13 +219,6 @@ void LLAgentWearables::AddWearableToAgentInventoryCallback::fire(const LLUUID& i
/*
* Do this for every one in the loop
*/
if (mTodo & CALL_CREATESTANDARDDONE)
{
// SUNSHINE CLEANUP
llassert(false); // does not appear to ever be used.
//LLAppearanceMgr::instance().addCOFItemLink(inv_item);
//gAgentWearables.createStandardWearablesDone(mType, mIndex);
}
if (mTodo & CALL_MAKENEWOUTFITDONE)
{
gAgentWearables.makeNewOutfitDone(mType, mIndex);
@ -288,84 +273,6 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy
gInventory.notifyObservers();
}
// SUNSHINE CLEANUP dead?
void LLAgentWearables::sendAgentWearablesUpdate()
{
return; // try as NO_OP // SUNSHINE CLEANUP
#if 0
// First make sure that we have inventory items for each wearable
for (S32 type=0; type < LLWearableType::WT_COUNT; ++type)
{
for (U32 index=0; index < getWearableCount((LLWearableType::EType)type); ++index)
{
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type,index);
if (wearable)
{
if (wearable->getItemID().isNull())
{
LLPointer<LLInventoryCallback> cb =
new AddWearableToAgentInventoryCallback(
LLPointer<LLRefCount>(NULL),
(LLWearableType::EType)type,
index,
wearable,
AddWearableToAgentInventoryCallback::CALL_NONE);
addWearableToAgentInventory(cb, wearable);
}
else
{
gInventory.addChangedMask(LLInventoryObserver::LABEL,
wearable->getItemID());
}
}
}
}
// Then make sure the inventory is in sync with the avatar.
gInventory.notifyObservers();
// Send the AgentIsNowWearing
gMessageSystem->newMessageFast(_PREHASH_AgentIsNowWearing);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
lldebugs << "sendAgentWearablesUpdate()" << llendl;
// MULTI-WEARABLE: DEPRECATED: HACK: index to 0- server database tables don't support concept of multiwearables.
for (S32 type=0; type < LLWearableType::WT_COUNT; ++type)
{
gMessageSystem->nextBlockFast(_PREHASH_WearableData);
U8 type_u8 = (U8)type;
gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8);
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type, 0);
if (wearable)
{
//llinfos << "Sending wearable " << wearable->getName() << llendl;
LLUUID item_id = wearable->getItemID();
const LLViewerInventoryItem *item = gInventory.getItem(item_id);
if (item && item->getIsLinkType())
{
// Get the itemID that this item points to. i.e. make sure
// we are storing baseitems, not their links, in the database.
item_id = item->getLinkedUUID();
}
gMessageSystem->addUUIDFast(_PREHASH_ItemID, item_id);
}
else
{
//llinfos << "Not wearing wearable type " << LLWearableType::getTypeName((LLWearableType::EType)i) << llendl;
gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID::null);
}
lldebugs << " " << LLWearableType::getTypeLabel((LLWearableType::EType)type) << ": " << (wearable ? wearable->getAssetID() : LLUUID::null) << llendl;
}
gAgent.sendReliableMessage();
#endif
}
void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index,
const std::string new_name)
{
@ -514,8 +421,6 @@ void LLAgentWearables::saveAllWearables()
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
saveWearable((LLWearableType::EType)i, j);
}
// SUNSHINE CLEANUP - check ok
//sendAgentWearablesUpdate();
}
// Called when the user changes the name of a wearable inventory item that is currently being worn.
@ -544,8 +449,6 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
old_wearable->setName(old_name);
setWearable((LLWearableType::EType)i,j,new_wearable);
// SUNSHINE CLEANUP - verify ok
//sendAgentWearablesUpdate();
break;
}
}
@ -666,15 +569,6 @@ LLViewerWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_i
return NULL;
}
void LLAgentWearables::sendAgentWearablesRequest()
{
gMessageSystem->newMessageFast(_PREHASH_AgentWearablesRequest);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gAgent.sendReliableMessage();
}
LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/)
{
return dynamic_cast<LLViewerWearable*> (getWearable(type, index));
@ -775,18 +669,8 @@ void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type,
void LLAgentWearables::recoverMissingWearableDone()
{
// Have all the wearables that the avatar was wearing at log-in arrived or been fabricated?
updateWearablesLoaded();
if (areWearablesLoaded())
{
// Make sure that the server's idea of the avatar's wearables actually match the wearables.
//gAgent.sendAgentSetAppearance();
}
else
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, LLUUID::null);
gInventory.notifyObservers();
}
gInventory.addChangedMask(LLInventoryObserver::LABEL, LLUUID::null);
gInventory.notifyObservers();
}
void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index)
@ -923,17 +807,6 @@ void LLAgentWearables::createStandardWearables()
}
}
// SUNSHINE CLEANUP apparently unused.
#if 0
void LLAgentWearables::createStandardWearablesDone(S32 type, U32 index)
{
llinfos << "type " << type << " index " << index << llendl;
if (!isAgentAvatarValid()) return;
gAgentAvatarp->updateVisualParams();
}
#endif
void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
{
LLUUID first_item_id = getWearableItemID((LLWearableType::EType)type, index);
@ -1066,9 +939,6 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo
}
}
// Update the server
// SUNSHINE CLEANUP
// updateServer();
gInventory.notifyObservers();
}
@ -1200,10 +1070,10 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
// Start rendering & update the server
mWearablesLoaded = TRUE;
checkWearablesLoaded();
// SUNSHINE CLEANUP - these checks for done never worked. Should they be modified?
//checkWearablesLoaded();
notifyLoadingFinished();
// SUNSHINE CLEANUP
//updateServer();
gAgentAvatarp->dumpAvatarTEs("setWearableOutfit");
@ -1324,12 +1194,6 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara
llinfos << "Replaced current element 0 for type " << type
<< " size is now " << getWearableCount(type) << llendl;
}
//llinfos << "LLVOAvatar::setWearableItem()" << llendl;
//new_wearable->writeToAvatar(TRUE);
// SUNSHINE CLEANUP
//updateServer();
}
// User has picked "remove from avatar" from a menu.
@ -1500,18 +1364,6 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra
}
}
// SUNSHINE CLEANUP - itemUpdatePendingCount() was always 0, so this should be removed as useless.
void LLAgentWearables::checkWearablesLoaded() const
{
#ifdef SHOW_ASSERT
U32 item_pend_count = 0; //itemUpdatePendingCount();
if (mWearablesLoaded)
{
llassert(item_pend_count==0);
}
#endif
}
// Returns false if the given wearable is already topmost/bottommost
// (depending on closer_to_body parameter).
bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body) const
@ -1531,17 +1383,6 @@ BOOL LLAgentWearables::areWearablesLoaded() const
return mWearablesLoaded;
}
// MULTI-WEARABLE: DEPRECATED: item pending count relies on old messages that don't support multi-wearables. do not trust to be accurate
// SUNSHINE CLEANUP - itemUpdatePendingCount was always 0 due to longstanding bug, might as well remove (or fix) this.
void LLAgentWearables::updateWearablesLoaded()
{
mWearablesLoaded = true; //(itemUpdatePendingCount()==0);
if (mWearablesLoaded)
{
notifyLoadingFinished();
}
}
bool LLAgentWearables::canWearableBeRemoved(const LLViewerWearable* wearable) const
{
if (!wearable) return false;
@ -1684,14 +1525,6 @@ void LLAgentWearables::editWearableIfRequested(const LLUUID& item_id)
}
}
// SUNSHINE CLEANUP - both of these funcs seem to be dead code, so this one should go too.
#if 0
void LLAgentWearables::updateServer()
{
sendAgentWearablesUpdate();
}
#endif
boost::signals2::connection LLAgentWearables::addLoadingStartedCallback(loading_started_callback_t cb)
{
return mLoadingStartedSignal.connect(cb);

View File

@ -42,7 +42,6 @@
class LLInventoryItem;
class LLVOAvatarSelf;
class LLViewerWearable;
class LLInitialWearablesFetch;
class LLViewerObject;
class LLAgentWearables : public LLInitClass<LLAgentWearables>, public LLWearableData
@ -51,7 +50,6 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>, public LLWearable
// Constructors / destructors / Initializers
//--------------------------------------------------------------------
public:
friend class LLInitialWearablesFetch;
LLAgentWearables();
virtual ~LLAgentWearables();
@ -149,18 +147,6 @@ private:
void removeWearableFinal(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
protected:
static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response);
//--------------------------------------------------------------------
// Server Communication
//--------------------------------------------------------------------
protected:
// SUNSHINE CLEANUP dead
void sendAgentWearablesUpdate();
// SUNSHINE CLEANUP remove?
void sendAgentWearablesRequest();
// SUNSHINE CLEANUP dead?
//void updateServer();
static void onInitialWearableAssetArrived(LLViewerWearable* wearable, void* userdata);
//--------------------------------------------------------------------
// Outfits

View File

@ -1,204 +0,0 @@
/**
* @file llagentwearablesfetch.cpp
* @brief LLAgentWearblesFetch class implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llagentwearablesfetch.h"
#include "llagent.h"
#include "llagentwearables.h"
#include "llappearancemgr.h"
#include "llinventoryfunctions.h"
#include "llstartup.h"
#include "llvoavatarself.h"
LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) :
LLInventoryFetchDescendentsObserver(cof_id)
{
if (isAgentAvatarValid())
{
gAgentAvatarp->startPhase("initial_wearables_fetch");
gAgentAvatarp->outputRezTiming("Initial wearables fetch started");
}
}
LLInitialWearablesFetch::~LLInitialWearablesFetch()
{
}
// virtual
void LLInitialWearablesFetch::done()
{
// Delay processing the actual results of this so it's not handled within
// gInventory.notifyObservers. The results will be handled in the next
// idle tick instead.
gInventory.removeObserver(this);
doOnIdleOneTime(boost::bind(&LLInitialWearablesFetch::processContents,this));
if (isAgentAvatarValid())
{
gAgentAvatarp->stopPhase("initial_wearables_fetch");
gAgentAvatarp->outputRezTiming("Initial wearables fetch done");
}
}
void LLInitialWearablesFetch::add(InitialWearableData &data)
{
mAgentInitialWearables.push_back(data);
}
// SUNSHINE CLEANUP - should not have to wait for this message to start resolving appearance. Where to hook in instead?
void LLInitialWearablesFetch::processContents()
{
if(!gAgentAvatarp) //no need to process wearables if the agent avatar is deleted.
{
delete this;
return ;
}
// Fetch the wearable items from the Current Outfit Folder
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t wearable_array;
LLFindWearables is_wearable;
llassert_always(mComplete.size() != 0);
gInventory.collectDescendentsIf(mComplete.front(), cat_array, wearable_array,
LLInventoryModel::EXCLUDE_TRASH, is_wearable);
LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
if (wearable_array.count() > 0)
{
gAgentWearables.notifyLoadingStarted();
LLAppearanceMgr::instance().updateAppearanceFromCOF();
}
else
{
// SUNSHINE CLEANUP - remove?
// if we're constructing the COF from the wearables message, we don't have a proper outfit link
LLAppearanceMgr::instance().setOutfitDirty(true);
processWearablesMessage();
}
delete this;
}
class LLFetchAndLinkObserver: public LLInventoryFetchItemsObserver
{
public:
LLFetchAndLinkObserver(uuid_vec_t& ids):
LLInventoryFetchItemsObserver(ids)
{
}
~LLFetchAndLinkObserver()
{
}
virtual void done()
{
gInventory.removeObserver(this);
// Link to all fetched items in COF.
LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
LLInventoryObject::const_object_list_t item_array;
for (uuid_vec_t::iterator it = mIDs.begin();
it != mIDs.end();
++it)
{
LLUUID id = *it;
LLConstPointer<LLInventoryObject> item = gInventory.getItem(*it);
if (!item)
{
llwarns << "fetch failed for item " << (*it) << "!" << llendl;
continue;
}
item_array.push_back(item);
}
link_inventory_array(LLAppearanceMgr::instance().getCOF(), item_array, link_waiter);
}
};
// SUNSHINE CLEANUP - remove dependency on this?
void LLInitialWearablesFetch::processWearablesMessage()
{
if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead.
{
const LLUUID current_outfit_id = LLAppearanceMgr::instance().getCOF();
uuid_vec_t ids;
for (U8 i = 0; i < mAgentInitialWearables.size(); ++i)
{
// Populate the current outfit folder with links to the wearables passed in the message
InitialWearableData *wearable_data = new InitialWearableData(mAgentInitialWearables[i]); // This will be deleted in the callback.
if (wearable_data->mAssetID.notNull())
{
ids.push_back(wearable_data->mItemID);
}
else
{
llinfos << "Invalid wearable, type " << wearable_data->mType << " itemID "
<< wearable_data->mItemID << " assetID " << wearable_data->mAssetID << llendl;
delete wearable_data;
}
}
// Add all current attachments to the requested items as well.
if (isAgentAvatarValid())
{
for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
{
LLViewerJointAttachment* attachment = iter->second;
if (!attachment) continue;
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
LLViewerObject* attached_object = (*attachment_iter);
if (!attached_object) continue;
const LLUUID& item_id = attached_object->getAttachmentItemID();
if (item_id.isNull()) continue;
ids.push_back(item_id);
}
}
}
// Need to fetch the inventory items for ids, then create links to them after they arrive.
LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids);
fetcher->startFetch();
// If no items to be fetched, done will never be triggered.
// TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition.
if (fetcher->isFinished())
{
fetcher->done();
}
else
{
gInventory.addObserver(fetcher);
}
}
else
{
LL_WARNS("Wearables") << "No current outfit folder items found and no initial wearables fallback message received." << LL_ENDL;
}
}

View File

@ -1,73 +0,0 @@
/**
* @file llagentwearablesinitialfetch.h
* @brief LLAgentWearablesInitialFetch class header file
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLAGENTWEARABLESINITIALFETCH_H
#define LL_LLAGENTWEARABLESINITIALFETCH_H
#include "llinventoryobserver.h"
#include "llwearabletype.h"
#include "lluuid.h"
//--------------------------------------------------------------------
// InitialWearablesFetch
//
// This grabs contents from the COF and processes them.
// The processing is handled in idle(), i.e. outside of done(),
// to avoid gInventory.notifyObservers recursion.
//--------------------------------------------------------------------
class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver
{
LOG_CLASS(LLInitialWearablesFetch);
public:
LLInitialWearablesFetch(const LLUUID& cof_id);
~LLInitialWearablesFetch();
virtual void done();
struct InitialWearableData
{
LLWearableType::EType mType;
LLUUID mItemID;
LLUUID mAssetID;
InitialWearableData(LLWearableType::EType type, LLUUID& itemID, LLUUID& assetID) :
mType(type),
mItemID(itemID),
mAssetID(assetID)
{}
};
void add(InitialWearableData &data);
protected:
void processWearablesMessage();
void processContents();
private:
typedef std::vector<InitialWearableData> initial_wearable_data_vec_t;
initial_wearable_data_vec_t mAgentInitialWearables; // Wearables from the old agent wearables msg
};
#endif // LL_AGENTWEARABLESINITIALFETCH_H