summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2009-11-02 14:10:56 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2009-11-02 14:10:56 -0500
commit86b1ee7703bb57c6b1e1c068cda02bfb9ed0721e (patch)
tree3f6b099fca5920cae4d93c4187ce614abfa9d83e /indra
parent7335c6276865061d8b4a549b7cf29f8a8df929a0 (diff)
Work in progress on attachment tracking.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llappearancemgr.cpp38
-rw-r--r--indra/newview/llappearancemgr.h6
-rw-r--r--indra/newview/llvoavatarself.cpp10
3 files changed, 48 insertions, 6 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 8e1f7775d2..c297f8db29 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -528,7 +528,7 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID
{
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
- gInventory.collectDescendents(getCOF(), cats, items,
+ gInventory.collectDescendents(category, cats, items,
LLInventoryModel::EXCLUDE_TRASH);
for (S32 i = 0; i < items.count(); ++i)
{
@@ -563,7 +563,7 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID
S32 size = items_by_type[i].size();
if (size <= 0)
continue;
- S32 start_index = max(0,size-max_per_type);
+ S32 start_index = llmax(0,size-max_per_type);
for (S32 j = start_index; j<size; j++)
{
items.push_back(items_by_type[i][j]);
@@ -1178,3 +1178,37 @@ void LLAppearanceManager::dumpItemArray(const LLInventoryModel::item_array_t& it
}
llinfos << llendl;
}
+
+
+std::set<LLUUID> LLAppearanceManager::sRegisteredAttachments;
+
+void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg)
+{
+ llinfos << msg << llendl;
+ for (std::set<LLUUID>::const_iterator it = atts.begin();
+ it != atts.end();
+ ++it)
+ {
+ LLUUID item_id = *it;
+ LLViewerInventoryItem *item = gInventory.getItem(item_id);
+ if (item)
+ llinfos << "atts " << item->getName() << llendl;
+ else
+ llinfos << "atts " << "UNKNOWN[" << item_id.asString() << "]" << llendl;
+ }
+ llinfos << llendl;
+}
+
+/* static */
+void LLAppearanceManager::registerAttachment(const LLUUID& item_id)
+{
+ sRegisteredAttachments.insert(item_id);
+ dumpAttachmentSet(sRegisteredAttachments,"after register:");
+}
+
+/* static */
+void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id)
+{
+ sRegisteredAttachments.erase(item_id);
+ dumpAttachmentSet(sRegisteredAttachments,"after unregister:");
+}
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index ea3ebdf4ea..45c6e23bae 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -68,6 +68,9 @@ public:
// For debugging - could be moved elsewhere.
static void dumpCat(const LLUUID& cat_id, const std::string& msg);
static void dumpItemArray(const LLInventoryModel::item_array_t& items, const std::string& msg);
+ static void unregisterAttachment(const LLUUID& item_id);
+ static void registerAttachment(const LLUUID& item_id);
+
private:
static void filterWearableItems(LLInventoryModel::item_array_t& items, S32 max_per_type);
@@ -94,6 +97,9 @@ private:
static void checkMandatoryWearableTypes(const LLUUID& category, std::set<EWearableType>& types_found);
static void purgeCOFBeforeRebuild(const LLUUID& category);
static void purgeCategory(const LLUUID& category, bool keep_outfit_links);
+
+ static std::set<LLUUID> sRegisteredAttachments;
+
};
#define SUPPORT_ENSEMBLES 0
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 758db538a2..44fd81f0d1 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1080,6 +1080,7 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view
if (attachment->isObjectAttached(viewer_object))
{
const LLUUID& attachment_id = viewer_object->getItemID();
+ LLAppearanceManager::registerAttachment(attachment_id);
LLViewerInventoryItem *item = gInventory.getItem(attachment_id);
if (item)
{
@@ -1096,12 +1097,12 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view
//virtual
BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
{
- const LLUUID item_id = viewer_object->getItemID();
+ const LLUUID attachment_id = viewer_object->getItemID();
if (LLVOAvatar::detachObject(viewer_object))
{
// the simulator should automatically handle permission revocation
- stopMotionFromSource(item_id);
+ stopMotionFromSource(attachment_id);
LLFollowCamMgr::setCameraActive(viewer_object->getID(), FALSE);
LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren();
@@ -1127,11 +1128,12 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
else
{
LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Removing attachment link:");
- LLAppearanceManager::removeItemLinks(item_id, false);
+ LLAppearanceManager::removeItemLinks(attachment_id, false);
+ LLAppearanceManager::unregisterAttachment(attachment_id);
}
// BAP - needs to change for label to track link.
- gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
+ gInventory.addChangedMask(LLInventoryObserver::LABEL, attachment_id);
gInventory.notifyObservers();
return TRUE;
}