summaryrefslogtreecommitdiff
path: root/indra/newview/llappearancemgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappearancemgr.cpp')
-rw-r--r--indra/newview/llappearancemgr.cpp79
1 files changed, 62 insertions, 17 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index cc676550ab..ff5439d610 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -27,6 +27,7 @@
#include "llviewerprecompiledheaders.h"
#include <boost/lexical_cast.hpp>
+#include <boost/foreach.hpp>
#include "llaccordionctrltab.h"
#include "llagent.h"
#include "llagentcamera.h"
@@ -60,6 +61,8 @@
#include "llcoros.h"
#include "lleventcoro.h"
+#include "llavatarpropertiesprocessor.h"
+
#if LL_MSVC
// disable boost::lexical_cast warning
#pragma warning (disable:4702)
@@ -1515,6 +1518,26 @@ void LLAppearanceMgr::replaceCurrentOutfit(const LLUUID& new_outfit)
wearInventoryCategory(cat, false, false);
}
+// Remove existing photo link from outfit folder.
+void LLAppearanceMgr::removeOutfitPhoto(const LLUUID& outfit_id)
+{
+ LLInventoryModel::cat_array_t sub_cat_array;
+ LLInventoryModel::item_array_t outfit_item_array;
+ gInventory.collectDescendents(
+ outfit_id,
+ sub_cat_array,
+ outfit_item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
+ BOOST_FOREACH(LLViewerInventoryItem* outfit_item, outfit_item_array)
+ {
+ LLViewerInventoryItem* linked_item = outfit_item->getLinkedItem();
+ if (linked_item != NULL && linked_item->getActualType() == LLAssetType::AT_TEXTURE)
+ {
+ gInventory.removeItem(outfit_item->getUUID());
+ }
+ }
+}
+
// Open outfit renaming dialog.
void LLAppearanceMgr::renameOutfit(const LLUUID& outfit_id)
{
@@ -2943,6 +2966,16 @@ void LLAppearanceMgr::updateIsDirty()
gInventory.collectDescendentsIf(base_outfit, outfit_cats, outfit_items,
LLInventoryModel::EXCLUDE_TRASH, collector);
+ for (U32 i = 0; i < outfit_items.size(); ++i)
+ {
+ LLViewerInventoryItem* linked_item = outfit_items.at(i)->getLinkedItem();
+ if (linked_item != NULL && linked_item->getActualType() == LLAssetType::AT_TEXTURE)
+ {
+ outfit_items.erase(outfit_items.begin() + i);
+ break;
+ }
+ }
+
if(outfit_items.size() != cof_items.size())
{
LL_DEBUGS("Avatar") << "item count different - base " << outfit_items.size() << " cof " << cof_items.size() << LL_ENDL;
@@ -3090,6 +3123,14 @@ void appearance_mgr_update_dirty_state()
{
if (LLAppearanceMgr::instanceExists())
{
+ LLAppearanceMgr& app_mgr = LLAppearanceMgr::instance();
+ LLUUID image_id = app_mgr.getOutfitImage();
+ if(image_id.notNull())
+ {
+ LLPointer<LLInventoryCallback> cb = NULL;
+ link_inventory_object(app_mgr.getBaseOutfitUUID(), image_id, cb);
+ }
+
LLAppearanceMgr::getInstance()->updateIsDirty();
LLAppearanceMgr::getInstance()->setOutfitLocked(false);
gAgentWearables.notifyLoadingFinished();
@@ -3099,7 +3140,21 @@ void appearance_mgr_update_dirty_state()
void update_base_outfit_after_ordering()
{
LLAppearanceMgr& app_mgr = LLAppearanceMgr::instance();
-
+ LLInventoryModel::cat_array_t sub_cat_array;
+ LLInventoryModel::item_array_t outfit_item_array;
+ gInventory.collectDescendents(app_mgr.getBaseOutfitUUID(),
+ sub_cat_array,
+ outfit_item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
+ BOOST_FOREACH(LLViewerInventoryItem* outfit_item, outfit_item_array)
+ {
+ LLViewerInventoryItem* linked_item = outfit_item->getLinkedItem();
+ if (linked_item != NULL && linked_item->getActualType() == LLAssetType::AT_TEXTURE)
+ {
+ app_mgr.setOutfitImage(linked_item->getLinkedUUID());
+ }
+ }
+
LLPointer<LLInventoryCallback> dirty_state_updater =
new LLBoostFuncInventoryCallback(no_op_inventory_func, appearance_mgr_update_dirty_state);
@@ -3359,15 +3414,9 @@ void LLAppearanceMgr::requestServerAppearanceUpdate()
{
if (!mOutstandingAppearanceBakeRequest)
{
-#ifdef APPEARANCEBAKE_AS_IN_AIS_QUEUE
mRerequestAppearanceBake = false;
LLCoprocedureManager::CoProcedure_t proc = boost::bind(&LLAppearanceMgr::serverAppearanceUpdateCoro, this, _1);
LLCoprocedureManager::instance().enqueueCoprocedure("AIS", "LLAppearanceMgr::serverAppearanceUpdateCoro", proc);
-#else
- LLCoros::instance().launch("serverAppearanceUpdateCoro",
- boost::bind(&LLAppearanceMgr::serverAppearanceUpdateCoro, this));
-
-#endif
}
else
{
@@ -3375,17 +3424,8 @@ void LLAppearanceMgr::requestServerAppearanceUpdate()
}
}
-#ifdef APPEARANCEBAKE_AS_IN_AIS_QUEUE
void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter)
-#else
-void LLAppearanceMgr::serverAppearanceUpdateCoro()
-#endif
{
-#ifndef APPEARANCEBAKE_AS_IN_AIS_QUEUE
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(
- new LLCoreHttpUtil::HttpCoroutineAdapter("serverAppearanceUpdateCoro", LLCore::HttpRequest::DEFAULT_POLICY_ID));
-#endif
-
mRerequestAppearanceBake = false;
if (!gAgent.getRegion())
{
@@ -3493,10 +3533,15 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro()
// on multiple machines.
if (result.has("expected"))
{
-
S32 expectedCofVersion = result["expected"].asInteger();
LL_WARNS("Avatar") << "Server expected " << expectedCofVersion << " as COF version" << LL_ENDL;
+ // Force an update texture request for ourself. The message will return
+ // through the UDP and be handled in LLVOAvatar::processAvatarAppearance
+ // this should ensure that we receive a new canonical COF from the sim
+ // host. Hopefully it will return before the timeout.
+ LLAvatarPropertiesProcessor::getInstance()->sendAvatarTexturesRequest(gAgent.getID());
+
bRetry = true;
// Wait for a 1/2 second before trying again. Just to keep from asking too quickly.
if (++retryCount > BAKE_RETRY_MAX_COUNT)