summaryrefslogtreecommitdiff
path: root/indra/newview/llagentwearables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llagentwearables.cpp')
-rw-r--r--indra/newview/llagentwearables.cpp159
1 files changed, 75 insertions, 84 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index a1ce556458..342f9a5d80 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -2,25 +2,31 @@
* @file llagentwearables.cpp
* @brief LLAgentWearables class implementation
*
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, 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.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
- * 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.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
- * 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
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
*
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
@@ -41,7 +47,7 @@
#include "llinventorypanel.h"
#include "llmd5.h"
#include "llnotificationsutil.h"
-#include "lloutfitobserver.h"
+#include "llpaneloutfitsinventory.h"
#include "llsidepanelappearance.h"
#include "llsidetray.h"
#include "lltexlayer.h"
@@ -160,7 +166,6 @@ struct LLAgentDumper
LLAgentWearables::LLAgentWearables() :
mWearablesLoaded(FALSE)
-, mCOFChangeInProgress(false)
{
}
@@ -173,14 +178,6 @@ void LLAgentWearables::cleanup()
{
}
-// static
-void LLAgentWearables::initClass()
-{
- // this can not be called from constructor because its instance is global and is created too early.
- // Subscribe to "COF is Saved" signal to notify observers about this (Loading indicator for ex.).
- LLOutfitObserver::instance().addCOFSavedCallback(boost::bind(&LLAgentWearables::notifyLoadingFinished, &gAgentWearables));
-}
-
void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
{
if (avatar)
@@ -378,8 +375,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
gAgent.sendReliableMessage();
}
-void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update,
- const std::string new_name)
+void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update)
{
LLWearable* old_wearable = getWearable(type, index);
if (old_wearable && (old_wearable->isDirty() || old_wearable->isOldVersion()))
@@ -397,14 +393,6 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
LLInventoryItem* item = gInventory.getItem(old_item_id);
if (item)
{
- std::string item_name = item->getName();
- bool name_changed = false;
- if (!new_name.empty() && (new_name != item->getName()))
- {
- llinfos << "saveWearable changing name from " << item->getName() << " to " << new_name << llendl;
- item_name = new_name;
- name_changed = true;
- }
// Update existing inventory item
LLPointer<LLViewerInventoryItem> template_item =
new LLViewerInventoryItem(item->getUUID(),
@@ -413,7 +401,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
new_wearable->getAssetID(),
new_wearable->getAssetType(),
item->getInventoryType(),
- item_name,
+ item->getName(),
item->getDescription(),
item->getSaleInfo(),
item->getFlags(),
@@ -421,10 +409,6 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
template_item->setTransactionID(new_wearable->getTransactionID());
template_item->updateServer(FALSE);
gInventory.updateItem(template_item);
- if (name_changed)
- {
- gInventory.notifyObservers();
- }
}
else
{
@@ -518,11 +502,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index)
{
LLWearable* wearable = getWearable(type, index);
- llassert(wearable);
- if (wearable)
- {
- wearable->revertValues();
- }
+ wearable->revertValues();
gAgent.sendAgentSetAppearance();
}
@@ -554,7 +534,6 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
{
LLWearable* old_wearable = getWearable((LLWearableType::EType)i,j);
llassert(old_wearable);
- if (!old_wearable) continue;
std::string old_name = old_wearable->getName();
old_wearable->setName(new_name);
@@ -816,7 +795,7 @@ void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
if (wearable)
{
mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
- gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
+ gAgentAvatarp->wearableUpdated(wearable->getType(), FALSE);
wearable->setLabelUpdated();
}
}
@@ -941,19 +920,13 @@ BOOL LLAgentWearables::isWearingItem(const LLUUID& item_id) const
// static
// ! BACKWARDS COMPATIBILITY ! When we stop supporting viewer1.23, we can assume
// that viewers have a Current Outfit Folder and won't need this message, and thus
-// we can remove/ignore this whole function. EXCEPT gAgentWearables.notifyLoadingStarted
+// we can remove/ignore this whole function.
void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data)
{
// We should only receive this message a single time. Ignore subsequent AgentWearablesUpdates
// that may result from AgentWearablesRequest having been sent more than once.
if (mInitialWearablesUpdateReceived)
return;
-
- // notify subscribers that wearables started loading. See EXT-7777
- // *TODO: find more proper place to not be called from deprecated method.
- // Seems such place is found: LLInitialWearablesFetch::processContents()
- gAgentWearables.notifyLoadingStarted();
-
mInitialWearablesUpdateReceived = true;
LLUUID agent_id;
@@ -1235,7 +1208,7 @@ void LLAgentWearables::createStandardWearablesAllDone()
mWearablesLoaded = TRUE;
checkWearablesLoaded();
- notifyLoadingFinished();
+ mLoadedSignal();
updateServer();
@@ -1243,6 +1216,45 @@ void LLAgentWearables::createStandardWearablesAllDone()
gAgentAvatarp->onFirstTEMessageReceived();
}
+
+class LLShowCreatedOutfit: public LLInventoryCallback
+{
+public:
+ LLShowCreatedOutfit(LLUUID& folder_id):
+ mFolderID(folder_id)
+ {
+ }
+
+ virtual ~LLShowCreatedOutfit()
+ {
+ LLSD key;
+ LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key);
+ LLPanelOutfitsInventory *outfit_panel =
+ dynamic_cast<LLPanelOutfitsInventory*>(LLSideTray::getInstance()->getPanel("panel_outfits_inventory"));
+ // TODO: add handling "My Outfits" tab.
+ if (outfit_panel && outfit_panel->isCOFPanelActive())
+ {
+ outfit_panel->getRootFolder()->clearSelection();
+ outfit_panel->getRootFolder()->setSelectionByID(mFolderID, TRUE);
+ }
+ LLAccordionCtrlTab* tab_outfits = outfit_panel ? outfit_panel->findChild<LLAccordionCtrlTab>("tab_outfits") : 0;
+ if (tab_outfits && !tab_outfits->getDisplayChildren())
+ {
+ tab_outfits->changeOpenClose(tab_outfits->getDisplayChildren());
+ }
+
+ LLAppearanceMgr::instance().updateIsDirty();
+ LLAppearanceMgr::instance().updatePanelOutfitName("");
+ }
+
+ virtual void fire(const LLUUID&)
+ {
+ }
+
+private:
+ LLUUID mFolderID;
+};
+
void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
{
LLUUID first_item_id = getWearableItemID((LLWearableType::EType)type, index);
@@ -1448,7 +1460,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
// Start rendering & update the server
mWearablesLoaded = TRUE;
checkWearablesLoaded();
- notifyLoadingFinished();
+ mLoadedSignal();
queryWearableCache();
updateServer();
@@ -1879,10 +1891,11 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra
msg->nextBlockFast(_PREHASH_ObjectData );
msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID());
msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner());
- if (gSavedSettings.getBOOL("MultipleAttachments"))
- msg->addU8Fast(_PREHASH_AttachmentPt, 0 | ATTACHMENT_ADD );
- else
- msg->addU8Fast(_PREHASH_AttachmentPt, 0 ); // Wear at the previous or default attachment point
+#if ENABLE_MULTIATTACHMENTS
+ msg->addU8Fast(_PREHASH_AttachmentPt, 0 | ATTACHMENT_ADD );
+#else
+ msg->addU8Fast(_PREHASH_AttachmentPt, 0 ); // Wear at the previous or default attachment point
+#endif
pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
msg->addStringFast(_PREHASH_Name, item->getName());
msg->addStringFast(_PREHASH_Description, item->getDescription());
@@ -1932,7 +1945,7 @@ void LLAgentWearables::updateWearablesLoaded()
mWearablesLoaded = (itemUpdatePendingCount()==0);
if (mWearablesLoaded)
{
- notifyLoadingFinished();
+ mLoadedSignal();
}
}
@@ -1952,11 +1965,7 @@ void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count)
{
LLWearable *wearable = getWearable((LLWearableType::EType)type,count);
- llassert(wearable);
- if (wearable)
- {
- wearable->animateParams(delta, upload_bake);
- }
+ wearable->animateParams(delta, upload_bake);
}
}
}
@@ -2090,25 +2099,7 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
}
}
-boost::signals2::connection LLAgentWearables::addLoadingStartedCallback(loading_started_callback_t cb)
-{
- return mLoadingStartedSignal.connect(cb);
-}
-
boost::signals2::connection LLAgentWearables::addLoadedCallback(loaded_callback_t cb)
{
return mLoadedSignal.connect(cb);
}
-
-void LLAgentWearables::notifyLoadingStarted()
-{
- mCOFChangeInProgress = true;
- mLoadingStartedSignal();
-}
-
-void LLAgentWearables::notifyLoadingFinished()
-{
- mCOFChangeInProgress = false;
- mLoadedSignal();
-}
-// EOF