diff options
-rwxr-xr-x | indra/llcharacter/lljoint.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/app_settings/logcontrol.xml | 1 | ||||
-rwxr-xr-x | indra/newview/llagentwearables.cpp | 12 | ||||
-rwxr-xr-x | indra/newview/llappearancemgr.cpp | 113 | ||||
-rwxr-xr-x | indra/newview/llappearancemgr.h | 9 | ||||
-rwxr-xr-x | indra/newview/llattachmentsmgr.cpp | 97 | ||||
-rwxr-xr-x | indra/newview/llattachmentsmgr.h | 20 | ||||
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 26 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 18 |
9 files changed, 220 insertions, 78 deletions
diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 6f22a7c6b7..40695bfa24 100755 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -290,7 +290,7 @@ const LLVector3& LLJoint::getPosition() bool do_debug_joint(const std::string& name) { - return true; + return false; } //-------------------------------------------------------------------- diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 15cb5bc0eb..29639bb9c2 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,6 +42,7 @@ </array> <key>tags</key> <array> + <string>Avatar</string> <!-- sample entry for debugging specific items <string>Inventory</string> <string>SceneLoadTiming</string> diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index f06ffb4fb3..69eb478cd8 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1344,6 +1344,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo if (objects_to_remove.empty()) return; + LL_DEBUGS("Avatar") << "ATT [ObjectDetach] removing " << objects_to_remove.size() << " objects" << LL_ENDL; gMessageSystem->newMessage("ObjectDetach"); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -1357,14 +1358,23 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo //gAgentAvatarp->resetJointPositionsOnDetach(objectp); gMessageSystem->nextBlockFast(_PREHASH_ObjectData); gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); + const LLUUID& item_id = objectp->getAttachmentItemID(); + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LL_DEBUGS("Avatar") << "ATT removing object, item is " << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL; } gMessageSystem->sendReliable(gAgent.getRegionHost()); } +// FIXME this is basically the same code as LLAttachmentsMgr::onIdle() +// should consolidate. void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array) { // Build a compound message to send all the objects that need to be rezzed. S32 obj_count = obj_item_array.size(); + if (obj_count > 0) + { + LL_DEBUGS("Avatar") << "ATT [RezMultipleAttachmentsFromInv] attaching multiple, total obj_count " << obj_count << LL_ENDL; + } // Limit number of packets to send const S32 MAX_PACKETS_TO_SEND = 10; @@ -1396,6 +1406,8 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra } const LLInventoryItem* item = obj_item_array.at(i).get(); + LL_DEBUGS("Avatar") << "ATT requesting " << item->getName() + << " " << item->getLinkedUUID() << LL_ENDL; msg->nextBlockFast(_PREHASH_ObjectData ); msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID()); msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner()); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d7ef5fcba7..00e63adc93 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -525,6 +525,12 @@ LLUpdateAppearanceAndEditWearableOnDestroy::LLUpdateAppearanceAndEditWearableOnD { } +LLRequestAppearanceUpdateOnDestroy::~LLRequestAppearanceUpdateOnDestroy() +{ + LL_DEBUGS("Avatar") << "ATT requesting server appearance update" << LL_ENDL; + LLAppearanceMgr::instance().requestServerAppearanceUpdate(); +} + void edit_wearable_and_customize_avatar(LLUUID item_id) { // Start editing the item if previously requested. @@ -828,6 +834,12 @@ void LLWearableHoldingPattern::onAllComplete() // pre-attachment states. gAgentAvatarp->clearAttachmentPosOverrides(); + if (objects_to_remove.size() || items_to_add.size()) + { + LL_DEBUGS("Avatar") << "ATT will remove " << objects_to_remove.size() + << " and add " << items_to_add.size() << " items" << LL_ENDL; + } + // Take off the attachments that will no longer be in the outfit. LLAgentWearables::userRemoveMultipleAttachments(objects_to_remove); @@ -1402,20 +1414,26 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, break; case LLAssetType::AT_BODYPART: - // TODO: investigate wearables may not be loaded at this point EXT-8231 - - // Remove the existing wearables of the same type. - // Remove existing body parts anyway because we must not be able to wear e.g. two skins. - removeCOFLinksOfType(item_to_wear->getWearableType()); - if (!cb && do_update) { - cb = new LLUpdateAppearanceAndEditWearableOnDestroy(item_id_to_wear); + // TODO: investigate wearables may not be loaded at this point EXT-8231 + + // Remove the existing wearables of the same type. + // Remove existing body parts anyway because we must not be able to wear e.g. two skins. + removeCOFLinksOfType(item_to_wear->getWearableType()); + if (!cb && do_update) + { + cb = new LLUpdateAppearanceAndEditWearableOnDestroy(item_id_to_wear); + } + addCOFItemLink(item_to_wear, cb); } - addCOFItemLink(item_to_wear, cb); break; case LLAssetType::AT_OBJECT: - rez_attachment(item_to_wear, NULL, replace); + { + LL_DEBUGS("Avatar") << "ATT wearing object. calling rez_attachment, item " << item_to_wear->getName() + << " id " << item_to_wear->getLinkedUUID() << LL_ENDL; + rez_attachment(item_to_wear, NULL, replace); + } break; default: return false;; @@ -3230,7 +3248,7 @@ void RequestAgentUpdateAppearanceResponder::onRequestRequested() } // Actually send the request. - LL_DEBUGS("Avatar") << "Will send request for cof_version " << cof_version << LL_ENDL; + LL_DEBUGS("Avatar") << "ATT sending bake request for cof_version " << cof_version << LL_ENDL; mRetryPolicy->reset(); sendRequest(); } @@ -3703,6 +3721,11 @@ void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove) { const LLUUID& id_to_remove = *it; const LLUUID& linked_item_id = gInventory.getLinkedItemID(id_to_remove); + LLViewerInventoryItem *item = gInventory.getItem(linked_item_id); + if (item && item->getType() == LLAssetType::AT_OBJECT) + { + LL_DEBUGS("Avatar") << "ATT removing attachment " << item->getName() << " id " << item->getUUID() << LL_ENDL; + } removeCOFItemLinks(linked_item_id, cb); addDoomedTempAttachment(linked_item_id); } @@ -3710,10 +3733,9 @@ void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove) void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove) { - LLUUID linked_item_id = gInventory.getLinkedItemID(id_to_remove); - LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy; - removeCOFItemLinks(linked_item_id, cb); - addDoomedTempAttachment(linked_item_id); + uuid_vec_t ids_to_remove; + ids_to_remove.push_back(id_to_remove); + removeItemsFromAvatar(ids_to_remove); } @@ -3898,37 +3920,48 @@ void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg) void LLAppearanceMgr::registerAttachment(const LLUUID& item_id) { - gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); - - if (mAttachmentInvLinkEnabled) - { - // we have to pass do_update = true to call LLAppearanceMgr::updateAppearanceFromCOF. - // it will trigger gAgentWariables.notifyLoadingFinished() - // But it is not acceptable solution. See EXT-7777 - if (!isLinkedInCOF(item_id)) - { - LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy(); - LLAppearanceMgr::addCOFItemLink(item_id, cb); // Add COF link for item. - } - } - else - { - //LL_INFOS() << "no link changes, inv link not enabled" << LL_ENDL; - } + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LL_DEBUGS("Avatar") << "ATT registering attachment " + << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL; + gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); + + if (mAttachmentInvLinkEnabled) + { + // we have to pass do_update = true to call LLAppearanceMgr::updateAppearanceFromCOF. + // it will trigger gAgentWariables.notifyLoadingFinished() + // But it is not acceptable solution. See EXT-7777 + if (!isLinkedInCOF(item_id)) + { + LL_DEBUGS("Avatar") << "ATT adding COF link for attachment " + << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL; + // FIXME replace with just a call to request bake update? + LLPointer<LLInventoryCallback> cb = new LLRequestAppearanceUpdateOnDestroy(); + LLAppearanceMgr::addCOFItemLink(item_id, cb); // Add COF link for item. + } + } + else + { + //LL_INFOS() << "no link changes, inv link not enabled" << LL_ENDL; + } } void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id) { - gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LL_DEBUGS("Avatar") << "unregistering attachment " + << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL; + gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); - if (mAttachmentInvLinkEnabled) - { - LLAppearanceMgr::removeCOFItemLinks(item_id); - } - else - { - //LL_INFOS() << "no link changes, inv link not enabled" << LL_ENDL; - } + if (mAttachmentInvLinkEnabled) + { + LL_DEBUGS("Avatar") << "removing COF link for attachment " + << (item ? item->getName() : "UNKNOWN") << " " << item_id << LL_ENDL; + LLAppearanceMgr::removeCOFItemLinks(item_id); + } + else + { + //LL_INFOS() << "no link changes, inv link not enabled" << LL_ENDL; + } } BOOL LLAppearanceMgr::getIsInCOF(const LLUUID& obj_id) const diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 7742a19c07..3799c89757 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -311,6 +311,15 @@ private: LLUUID mItemID; }; +class LLRequestAppearanceUpdateOnDestroy: public LLInventoryCallback +{ +public: + LLRequestAppearanceUpdateOnDestroy() {} + ~LLRequestAppearanceUpdateOnDestroy(); + + /* virtual */ void fire(const LLUUID& item_id) {} +}; + LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string& name); // Invoke a given callable after category contents are fully fetched. diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 256980eb04..a38bae207d 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -28,6 +28,7 @@ #include "llattachmentsmgr.h" #include "llagent.h" +#include "llappearancemgr.h" #include "llinventorymodel.h" #include "lltooldraganddrop.h" // pack_permissions_slam #include "llviewerinventory.h" @@ -47,6 +48,10 @@ void LLAttachmentsMgr::addAttachment(const LLUUID& item_id, const U8 attachment_pt, const BOOL add) { + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LL_DEBUGS("Avatar") << "ATT adding attachment to mPendingAttachments " + << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; + AttachmentsInfo attachment; attachment.mItemID = item_id; attachment.mAttachmentPt = attachment_pt; @@ -68,12 +73,90 @@ void LLAttachmentsMgr::onIdle() return; } - S32 obj_count = mPendingAttachments.size(); + linkPendingAttachments(); +} + +class LLAttachAfterLinkCallback: public LLInventoryCallback +{ +public: + LLAttachAfterLinkCallback(const LLAttachmentsMgr::attachments_vec_t& to_link_and_attach): + mToLinkAndAttach(to_link_and_attach) + { + } + + ~LLAttachAfterLinkCallback() + { + LL_DEBUGS("Avatar") << "destructor" << LL_ENDL; + for (LLAttachmentsMgr::attachments_vec_t::const_iterator it = mToLinkAndAttach.begin(); + it != mToLinkAndAttach.end(); ++it) + { + const LLAttachmentsMgr::AttachmentsInfo& att_info = *it; + if (!LLAppearanceMgr::instance().isLinkedInCOF(att_info.mItemID)) + { + LLViewerInventoryItem *item = gInventory.getItem(att_info.mItemID); + LL_WARNS() << "ATT COF link creation failed for att item " << (item ? item->getName() : "UNKNOWN") << " id " + << att_info.mItemID << LL_ENDL; + } + } + LLAppearanceMgr::instance().requestServerAppearanceUpdate(); + LLAttachmentsMgr::instance().requestAttachments(mToLinkAndAttach); + } + + /* virtual */ void fire(const LLUUID& inv_item) + { + LL_DEBUGS("Avatar") << inv_item << LL_ENDL; + } + +private: + LLAttachmentsMgr::attachments_vec_t mToLinkAndAttach; +}; + +void LLAttachmentsMgr::linkPendingAttachments() +{ + if (mPendingAttachments.size()) + { + LLPointer<LLInventoryCallback> cb = new LLAttachAfterLinkCallback(mPendingAttachments); + LLInventoryObject::const_object_list_t inv_items_to_link; + for (attachments_vec_t::const_iterator it = mPendingAttachments.begin(); + it != mPendingAttachments.end(); ++it) + { + const AttachmentsInfo& att_info = *it; + LLViewerInventoryItem *item = gInventory.getItem(att_info.mItemID); + if (item) + { + inv_items_to_link.push_back(item); + } + else + { + LL_WARNS() << "ATT unable to link requested attachment " << att_info.mItemID + << ", item not found in inventory" << LL_ENDL; + } + } + link_inventory_array(LLAppearanceMgr::instance().getCOF(), inv_items_to_link, cb); + + mPendingAttachments.clear(); + } + +} + +// FIXME this is basically the same code as LLAgentWearables::userAttachMultipleAttachments(), +// should consolidate. +void LLAttachmentsMgr::requestAttachments(const attachments_vec_t& attachment_requests) +{ + // Make sure we got a region before trying anything else + if( !gAgent.getRegion() ) + { + return; + } + + S32 obj_count = attachment_requests.size(); if (obj_count == 0) { return; } - + LL_DEBUGS("Avatar") << "ATT [RezMultipleAttachmentsFromInv] attaching multiple from attachment_requests," + " total obj_count " << obj_count << LL_ENDL; + // Limit number of packets to send const S32 MAX_PACKETS_TO_SEND = 10; const S32 OBJECTS_PER_PACKET = 4; @@ -89,8 +172,8 @@ void LLAttachmentsMgr::onIdle() S32 i = 0; - for (attachments_vec_t::const_iterator iter = mPendingAttachments.begin(); - iter != mPendingAttachments.end(); + for (attachments_vec_t::const_iterator iter = attachment_requests.begin(); + iter != attachment_requests.end(); ++iter) { if( 0 == (i % OBJECTS_PER_PACKET) ) @@ -110,9 +193,11 @@ void LLAttachmentsMgr::onIdle() LLViewerInventoryItem* item = gInventory.getItem(attachment.mItemID); if (!item) { - LL_INFOS() << "Attempted to add non-existant item ID:" << attachment.mItemID << LL_ENDL; + LL_INFOS() << "Attempted to add non-existent item ID:" << attachment.mItemID << LL_ENDL; continue; } + LL_DEBUGS("Avatar") << "ATT requesting from attachment_requests " << item->getName() + << " " << item->getLinkedUUID() << LL_ENDL; S32 attachment_pt = attachment.mAttachmentPt; if (attachment.mAdd) attachment_pt |= ATTACHMENT_ADD; @@ -132,6 +217,4 @@ void LLAttachmentsMgr::onIdle() } i++; } - - mPendingAttachments.clear(); } diff --git a/indra/newview/llattachmentsmgr.h b/indra/newview/llattachmentsmgr.h index 1d8ab74dfd..c145fa032b 100755 --- a/indra/newview/llattachmentsmgr.h +++ b/indra/newview/llattachmentsmgr.h @@ -49,24 +49,28 @@ class LLViewerInventoryItem; class LLAttachmentsMgr: public LLSingleton<LLAttachmentsMgr> { public: + struct AttachmentsInfo + { + LLUUID mItemID; + U8 mAttachmentPt; + BOOL mAdd; + }; + typedef std::vector<AttachmentsInfo> attachments_vec_t; + LLAttachmentsMgr(); virtual ~LLAttachmentsMgr(); void addAttachment(const LLUUID& item_id, const U8 attachment_pt, const BOOL add); + void requestAttachments(const attachments_vec_t& attachment_requests); static void onIdle(void *); + protected: void onIdle(); -private: - struct AttachmentsInfo - { - LLUUID mItemID; - U8 mAttachmentPt; - BOOL mAdd; - }; + void linkPendingAttachments(); - typedef std::vector<AttachmentsInfo> attachments_vec_t; +private: attachments_vec_t mPendingAttachments; }; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 1910656066..32d1da434e 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -5371,9 +5371,11 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach (gAgentAvatarp->attachmentWasRequested(item_id) || gAgentAvatarp->isWearingAttachment(item_id))) { - LL_WARNS() << "duplicate attachment request, ignoring" << LL_ENDL; + LL_WARNS() << "ATT duplicate attachment request, ignoring" << LL_ENDL; return; } + + LL_DEBUGS("Avatar") << "ATT add rez request for " << item->getName() << " id " << item_id << LL_ENDL; gAgentAvatarp->addAttachmentRequest(item_id); S32 attach_pt = 0; @@ -5424,33 +5426,13 @@ bool confirm_attachment_rez(const LLSD& notification, const LLSD& response) if (itemp) { - /* - { - U8 attachment_pt = notification["payload"]["attachment_point"].asInteger(); - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_RezSingleAttachmentFromInv); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_ObjectData); - msg->addUUIDFast(_PREHASH_ItemID, itemp->getUUID()); - msg->addUUIDFast(_PREHASH_OwnerID, itemp->getPermissions().getOwner()); - msg->addU8Fast(_PREHASH_AttachmentPt, attachment_pt); - pack_permissions_slam(msg, itemp->getFlags(), itemp->getPermissions()); - msg->addStringFast(_PREHASH_Name, itemp->getName()); - msg->addStringFast(_PREHASH_Description, itemp->getDescription()); - msg->sendReliable(gAgent.getRegion()->getHost()); - return false; - } - */ - // Queue up attachments to be sent in next idle tick, this way the // attachments are batched up all into one message versus each attachment // being sent in its own separate attachments message. U8 attachment_pt = notification["payload"]["attachment_point"].asInteger(); BOOL is_add = notification["payload"]["is_add"].asBoolean(); + LL_DEBUGS("Avatar") << "ATT calling addAttachment " << (itemp ? itemp->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; LLAttachmentsMgr::instance().addAttachment(item_id, attachment_pt, is_add); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 444a26779a..89b80c7bda 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5739,10 +5739,21 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi //----------------------------------------------------------------------------- const LLViewerJointAttachment *LLVOAvatar::attachObject(LLViewerObject *viewer_object) { + if (isSelf()) + { + const LLUUID& item_id = viewer_object->getAttachmentItemID(); + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LL_DEBUGS("Avatar") << "ATT attaching object " + << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; + } LLViewerJointAttachment* attachment = getTargetAttachmentPoint(viewer_object); if (!attachment || !attachment->addObject(viewer_object)) { + const LLUUID& item_id = viewer_object->getAttachmentItemID(); + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LL_DEBUGS("Avatar") << "ATT attach failed " + << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; return 0; } @@ -5802,6 +5813,13 @@ void LLVOAvatar::lazyAttach() LLPointer<LLViewerObject> cur_attachment = mPendingAttachment[i]; if (cur_attachment->mDrawable) { + if (isSelf()) + { + const LLUUID& item_id = cur_attachment->getAttachmentItemID(); + LLViewerInventoryItem *item = gInventory.getItem(item_id); + LL_DEBUGS("Avatar") << "ATT attaching object " + << (item ? item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL; + } if (!attachObject(cur_attachment)) { // Drop it LL_WARNS() << "attachObject() failed for " |