summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/llcommon/lluuid.h13
-rwxr-xr-xindra/newview/llinventorymodel.cpp24
-rwxr-xr-xindra/newview/llinventorymodel.h7
-rwxr-xr-xindra/newview/llinventoryobserver.cpp57
-rwxr-xr-xindra/newview/llinventoryobserver.h5
-rwxr-xr-xindra/newview/lllocationinputctrl.cpp8
-rwxr-xr-xindra/newview/llpanelplaces.cpp7
-rwxr-xr-xindra/newview/llpanelplaces.h2
-rwxr-xr-xindra/newview/llstartup.cpp11
-rwxr-xr-xindra/newview/llviewermessage.cpp20
10 files changed, 69 insertions, 85 deletions
diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h
index 7889828c85..82afc7225f 100755
--- a/indra/llcommon/lluuid.h
+++ b/indra/llcommon/lluuid.h
@@ -131,10 +131,14 @@ public:
};
typedef std::vector<LLUUID> uuid_vec_t;
-
-
-// Helper structure for ordering lluuids in stl containers.
-// eg: std::map<LLUUID, LLWidget*, lluuid_less> widget_map;
+typedef std::set<LLUUID> uuid_set_t;
+
+// Helper structure for ordering lluuids in stl containers. eg:
+// std::map<LLUUID, LLWidget*, lluuid_less> widget_map;
+//
+// (isn't this the default behavior anyway? I think we could
+// everywhere replace these with uuid_set_t, but someone should
+// verify.)
struct lluuid_less
{
bool operator()(const LLUUID& lhs, const LLUUID& rhs) const
@@ -144,7 +148,6 @@ struct lluuid_less
};
typedef std::set<LLUUID, lluuid_less> uuid_list_t;
-
/*
* Sub-classes for keeping transaction IDs and asset IDs
* straight.
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index be1a396fff..1ad70492ca 100755
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -774,9 +774,8 @@ bool LLInventoryModel::isInventoryUsable() const
// Calling this method with an inventory item will either change an
// existing item with a matching item_id, or will add the item to the
// current inventory.
-U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item)
+U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask)
{
- U32 mask = LLInventoryObserver::NONE;
if(item->getUUID().isNull())
{
return mask;
@@ -1454,6 +1453,7 @@ void LLInventoryModel::notifyObservers()
mModifyMask = LLInventoryObserver::NONE;
mChangedItemIDs.clear();
+ mAddedItemIDs.clear();
mIsNotifyObservers = FALSE;
}
@@ -1473,13 +1473,18 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent)
if (referent.notNull())
{
mChangedItemIDs.insert(referent);
- }
+
+ if (mask & LLInventoryObserver::ADD)
+ {
+ mAddedItemIDs.insert(referent);
+ }
- // Update all linked items. Starting with just LABEL because I'm
- // not sure what else might need to be accounted for this.
- if (mModifyMask & LLInventoryObserver::LABEL)
- {
- addChangedMaskForLinks(referent, LLInventoryObserver::LABEL);
+ // Update all linked items. Starting with just LABEL because I'm
+ // not sure what else might need to be accounted for this.
+ if (mask & LLInventoryObserver::LABEL)
+ {
+ addChangedMaskForLinks(referent, LLInventoryObserver::LABEL);
+ }
}
}
@@ -2646,10 +2651,11 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account)
}
U32 changes = 0x0;
+ U32 mask = account ? LLInventoryObserver::CREATE : 0x0;
//as above, this loop never seems to loop more than once per call
for (item_array_t::iterator it = items.begin(); it != items.end(); ++it)
{
- changes |= gInventory.updateItem(*it);
+ changes |= gInventory.updateItem(*it, mask);
}
gInventory.notifyObservers();
gViewerWindow->getWindow()->decBusyCount();
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 7afe1dea35..779319fa67 100755
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -73,7 +73,6 @@ public:
typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t;
typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t;
- typedef std::set<LLUUID> changed_items_t;
class fetchInventoryResponder : public LLHTTPClient::Responder
{
@@ -299,7 +298,7 @@ public:
// NOTE: In usage, you will want to perform cache accounting
// operations in LLInventoryModel::accountForUpdate() or
// LLViewerInventoryItem::updateServer() before calling this method.
- U32 updateItem(const LLViewerInventoryItem* item);
+ U32 updateItem(const LLViewerInventoryItem* item, U32 mask = 0);
// Change an existing item with the matching id or add
// the category. No notifcation will be sent to observers. This
@@ -472,7 +471,9 @@ public:
// been changed 'under the hood', but outside the control of the
// inventory. The next notify will include that notification.
void addChangedMask(U32 mask, const LLUUID& referent);
+ typedef uuid_set_t changed_items_t;
const changed_items_t& getChangedIDs() const { return mChangedItemIDs; }
+ const changed_items_t& getAddedIDs() const { return mAddedItemIDs; }
protected:
// Updates all linked items pointing to this id.
void addChangedMaskForLinks(const LLUUID& object_id, U32 mask);
@@ -483,6 +484,8 @@ private:
// Variables used to track what has changed since the last notify.
U32 mModifyMask;
changed_items_t mChangedItemIDs;
+ changed_items_t mAddedItemIDs;
+
//--------------------------------------------------------------------
// Observers
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 6042ab996d..011686bfdd 100755
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -467,7 +467,7 @@ void LLInventoryFetchComboObserver::startFetch()
void LLInventoryAddItemByAssetObserver::changed(U32 mask)
{
- if(!(mask & LLInventoryObserver::ADD))
+ if(!(mask & LLInventoryObserver::ADD) || !(mask & LLInventoryObserver::CREATE))
{
return;
}
@@ -478,20 +478,12 @@ void LLInventoryAddItemByAssetObserver::changed(U32 mask)
return;
}
- LLMessageSystem* msg = gMessageSystem;
- if (!(msg->getMessageName() && (0 == strcmp(msg->getMessageName(), "UpdateCreateInventoryItem"))))
+ const uuid_set_t& added = gInventory.getAddedIDs();
+ for (uuid_set_t::iterator it = added.begin(); it != added.end(); ++it)
{
- // this is not our message
- return; // to prevent a crash. EXT-7921;
- }
-
- LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem;
- S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
- for(S32 i = 0; i < num_blocks; ++i)
- {
- item->unpackMessage(msg, _PREHASH_InventoryData, i);
+ LLInventoryItem *item = gInventory.getItem(*it);
const LLUUID& asset_uuid = item->getAssetUUID();
- if (item->getUUID().notNull() && asset_uuid.notNull())
+ if (item && item->getUUID().notNull() && asset_uuid.notNull())
{
if (isAssetWatched(asset_uuid))
{
@@ -500,11 +492,11 @@ void LLInventoryAddItemByAssetObserver::changed(U32 mask)
}
}
}
-
+
if (mAddedItems.size() == mWatchedAssets.size())
{
- done();
LL_DEBUGS("Inventory_Move") << "All watched items are added & processed." << LL_ENDL;
+ done();
mAddedItems.clear();
// Unable to clean watched items here due to somebody can require to check them in current frame.
@@ -536,39 +528,12 @@ bool LLInventoryAddItemByAssetObserver::isAssetWatched( const LLUUID& asset_id )
void LLInventoryAddedObserver::changed(U32 mask)
{
- if (!(mask & LLInventoryObserver::ADD))
+ if (!(mask & LLInventoryObserver::ADD) || !(mask & LLInventoryObserver::CREATE))
{
return;
}
- // *HACK: If this was in response to a packet off
- // the network, figure out which item was updated.
- LLMessageSystem* msg = gMessageSystem;
-
- std::string msg_name = msg->getMessageName();
- if (msg_name.empty())
- {
- return;
- }
-
- // We only want newly created inventory items. JC
- if ( msg_name != "UpdateCreateInventoryItem")
- {
- return;
- }
-
- LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
- S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
- for (S32 i = 0; i < num_blocks; ++i)
- {
- titem->unpackMessage(msg, _PREHASH_InventoryData, i);
- if (!(titem->getUUID().isNull()))
- {
- //we don't do anything with null keys
- mAdded.push_back(titem->getUUID());
- }
- }
- if (!mAdded.empty())
+ if (!gInventory.getAddedIDs().empty())
{
done();
}
@@ -581,9 +546,9 @@ void LLInventoryCategoryAddedObserver::changed(U32 mask)
return;
}
- const LLInventoryModel::changed_items_t& changed_ids = gInventory.getChangedIDs();
+ const LLInventoryModel::changed_items_t& added_ids = gInventory.getAddedIDs();
- for (LLInventoryModel::changed_items_t::const_iterator cit = changed_ids.begin(); cit != changed_ids.end(); ++cit)
+ for (LLInventoryModel::changed_items_t::const_iterator cit = added_ids.begin(); cit != added_ids.end(); ++cit)
{
LLViewerInventoryCategory* cat = gInventory.getCategory(*cit);
diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h
index 73288242eb..dd30513844 100755
--- a/indra/newview/llinventoryobserver.h
+++ b/indra/newview/llinventoryobserver.h
@@ -58,6 +58,7 @@ public:
GESTURE = 64,
REBUILD = 128, // Item UI changed (e.g. item type different)
SORT = 256, // Folder needs to be resorted.
+ CREATE = 512, // With ADD, item has just been created.
ALL = 0xffffffff
};
LLInventoryObserver();
@@ -190,13 +191,11 @@ private:
class LLInventoryAddedObserver : public LLInventoryObserver
{
public:
- LLInventoryAddedObserver() : mAdded() {}
+ LLInventoryAddedObserver() {}
/*virtual*/ void changed(U32 mask);
protected:
virtual void done() = 0;
-
- uuid_vec_t mAdded;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 5022dba934..7b97b26a37 100755
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -107,8 +107,8 @@ public:
private:
/*virtual*/ void done()
{
- uuid_vec_t::const_iterator it = mAdded.begin(), end = mAdded.end();
- for(; it != end; ++it)
+ const uuid_set_t& added = gInventory.getAddedIDs();
+ for (uuid_set_t::const_iterator it = added.begin(); it != added.end(); ++it)
{
LLInventoryItem* item = gInventory.getItem(*it);
if (!item || item->getType() != LLAssetType::AT_LANDMARK)
@@ -124,8 +124,6 @@ private:
mInput->onLandmarkLoaded(lm);
}
}
-
- mAdded.clear();
}
LLLocationInputCtrl* mInput;
@@ -142,7 +140,7 @@ public:
private:
/*virtual*/ void changed(U32 mask)
{
- if (mask & (~(LLInventoryObserver::LABEL|LLInventoryObserver::INTERNAL|LLInventoryObserver::ADD)))
+ if (mask & (~(LLInventoryObserver::LABEL|LLInventoryObserver::INTERNAL|LLInventoryObserver::ADD|LLInventoryObserver::CREATE)))
{
mInput->updateAddLandmarkButton();
}
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index 730df2ea23..8cd54204e8 100755
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -168,8 +168,7 @@ public:
protected:
/*virtual*/ void done()
{
- mPlaces->showAddedLandmarkInfo(mAdded);
- mAdded.clear();
+ mPlaces->showAddedLandmarkInfo(gInventory.getAddedIDs());
}
private:
@@ -1100,9 +1099,9 @@ void LLPanelPlaces::changedGlobalPos(const LLVector3d &global_pos)
updateVerbs();
}
-void LLPanelPlaces::showAddedLandmarkInfo(const uuid_vec_t& items)
+void LLPanelPlaces::showAddedLandmarkInfo(const uuid_set_t& items)
{
- for (uuid_vec_t::const_iterator item_iter = items.begin();
+ for (uuid_set_t::const_iterator item_iter = items.begin();
item_iter != items.end();
++item_iter)
{
diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h
index 85bdc2c4e1..b3bc248bd9 100755
--- a/indra/newview/llpanelplaces.h
+++ b/indra/newview/llpanelplaces.h
@@ -69,7 +69,7 @@ public:
void changedGlobalPos(const LLVector3d &global_pos);
// Opens landmark info panel when agent creates or receives landmark.
- void showAddedLandmarkInfo(const uuid_vec_t& items);
+ void showAddedLandmarkInfo(const uuid_set_t& items);
void setItem(LLInventoryItem* item);
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 61d0855119..d440ba246a 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -313,6 +313,12 @@ void update_texture_fetch()
gTextureList.updateImages(0.10f);
}
+void set_flags_and_update_appearance()
+{
+ LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
+ LLAppearanceMgr::instance().updateAppearanceFromCOF(true, true, no_op);
+}
+
// Returns false to skip other idle processing. Should only return
// true when all initialization done.
bool idle_startup()
@@ -2039,12 +2045,9 @@ bool idle_startup()
if (isAgentAvatarValid() && !gAgent.isFirstLogin() && !gAgent.isOutfitChosen())
{
gAgentWearables.notifyLoadingStarted();
- callAfterCategoryFetch(LLAppearanceMgr::instance().getCOF(),
- boost::bind(&LLAppearanceMgr::updateAppearanceFromCOF,
- LLAppearanceMgr::getInstance(), true, true, no_op));
- LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
gAgent.setOutfitChosen(TRUE);
gAgentWearables.sendDummyAgentWearablesUpdate();
+ callAfterCategoryFetch(LLAppearanceMgr::instance().getCOF(), set_flags_and_update_appearance);
}
display_startup();
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 167c33f3ff..64cbc82578 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1001,7 +1001,12 @@ class LLOpenTaskOffer : public LLInventoryAddedObserver
protected:
/*virtual*/ void done()
{
- for (uuid_vec_t::iterator it = mAdded.begin(); it != mAdded.end();)
+ uuid_vec_t added;
+ for(uuid_set_t::const_iterator it = gInventory.getAddedIDs().begin(); it != gInventory.getAddedIDs().end(); ++it)
+ {
+ added.push_back(*it);
+ }
+ for (uuid_vec_t::iterator it = added.begin(); it != added.end();)
{
const LLUUID& item_uuid = *it;
bool was_moved = false;
@@ -1023,13 +1028,12 @@ protected:
if (was_moved)
{
- it = mAdded.erase(it);
+ it = added.erase(it);
}
else ++it;
}
- open_inventory_offer(mAdded, "");
- mAdded.clear();
+ open_inventory_offer(added, "");
}
};
@@ -1038,8 +1042,12 @@ class LLOpenTaskGroupOffer : public LLInventoryAddedObserver
protected:
/*virtual*/ void done()
{
- open_inventory_offer(mAdded, "group_offer");
- mAdded.clear();
+ uuid_vec_t added;
+ for(uuid_set_t::const_iterator it = gInventory.getAddedIDs().begin(); it != gInventory.getAddedIDs().end(); ++it)
+ {
+ added.push_back(*it);
+ }
+ open_inventory_offer(added, "group_offer");
gInventory.removeObserver(this);
delete this;
}