From 79bb641310775c56cb742c5ea938d5681117585c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 21 Aug 2014 14:18:35 -0400 Subject: MAINT-4158 WIP - fix for bug caused by multiple wearables with the same asset id --- indra/newview/llagentwearables.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llagentwearables.cpp') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 49fedb8df8..3928bbadc8 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1009,6 +1009,10 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it continue; } + // Don't care about this case - ordering of wearables with the same asset id has no effect. + // Causes the two-alphas error case in MAINT-4158. + // We should actually disallow wearing two wearables with the same asset id. +#if 0 if (curr_wearable->getName() != new_item->getName() || curr_wearable->getItemID() != new_item->getUUID()) { @@ -1019,6 +1023,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it mismatched++; continue; } +#endif // If we got here, everything matches. matched++; } -- cgit v1.2.3 From 30c1d67d957ec7f895dd690ec34b5459fc9082de Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 14 Nov 2014 09:25:43 -0500 Subject: MAINT-4537 WIP - order of operations during outfit change --- indra/newview/llagentwearables.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'indra/newview/llagentwearables.cpp') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 3928bbadc8..a7acdb0520 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1248,9 +1248,11 @@ void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &ty } } -// Combines userRemoveMulipleAttachments() and userAttachMultipleAttachments() logic to -// get attachments into desired state with minimal number of adds/removes. -void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array) +// Given a desired set of attachments, find what objects need to be +// removed, and what additional inventory items need to be added. +void LLAgentWearables::findAttachmentsAddRemoveInfo(LLInventoryModel::item_array_t& obj_item_array, + llvo_vec_t& objects_to_remove, + LLInventoryModel::item_array_t& items_to_add) { // Possible cases: // already wearing but not in request set -> take off. @@ -1269,7 +1271,6 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj } // Build up list of objects to be removed and items currently attached. - llvo_vec_t objects_to_remove; for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); iter != gAgentAvatarp->mAttachmentPoints.end();) { @@ -1309,7 +1310,6 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj } } - LLInventoryModel::item_array_t items_to_add; for (LLInventoryModel::item_array_t::iterator it = obj_item_array.begin(); it != obj_item_array.end(); ++it) @@ -1328,6 +1328,17 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj // S32 remove_count = objects_to_remove.size(); // S32 add_count = items_to_add.size(); // LL_INFOS() << "remove " << remove_count << " add " << add_count << LL_ENDL; +} + +// Combines userRemoveMulipleAttachments() and userAttachMultipleAttachments() logic to +// get attachments into desired state with minimal number of adds/removes. +void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array) +{ + llvo_vec_t objects_to_remove; + LLInventoryModel::item_array_t items_to_add; + findAttachmentsAddRemoveInfo(obj_item_array, + objects_to_remove, + items_to_add); // Remove everything in objects_to_remove userRemoveMultipleAttachments(objects_to_remove); @@ -1353,6 +1364,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo ++it) { LLViewerObject *objectp = *it; + gAgentAvatarp->resetJointPositionsOnDetach(objectp); gMessageSystem->nextBlockFast(_PREHASH_ObjectData); gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); } -- cgit v1.2.3 From 9c4397b6ee6d1a2a2c43d5d886b178753a4833d8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 14 Nov 2014 15:41:03 -0500 Subject: MAINT-4537 WIP - joint position management during outfit changes --- indra/newview/llagentwearables.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llagentwearables.cpp') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index a7acdb0520..964c5110d1 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1088,7 +1088,6 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it if (isAgentAvatarValid()) { gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); - gAgentAvatarp->updateVisualParams(); // If we have not yet declouded, we may want to use // baked texture UUIDs sent from the first objectUpdate message @@ -1106,6 +1105,12 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it notifyLoadingFinished(); + // Have to copy wearable params to avatar + gAgentAvatarp->writeWearablesToAvatar(); + + // ... before this will do anything. + gAgentAvatarp->updateVisualParams(); + gAgentAvatarp->dumpAvatarTEs("setWearableOutfit"); LL_DEBUGS("Avatar") << "setWearableOutfit() end" << LL_ENDL; -- cgit v1.2.3 From b1884d40f5ba74d1d39be1abad7dc416905c6caf Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Sat, 15 Nov 2014 14:29:39 -0500 Subject: MAINT-4537 WIP - more joint position management during outfit changes --- indra/newview/llagentwearables.cpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'indra/newview/llagentwearables.cpp') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 964c5110d1..585f14df3d 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1257,6 +1257,7 @@ void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &ty // removed, and what additional inventory items need to be added. void LLAgentWearables::findAttachmentsAddRemoveInfo(LLInventoryModel::item_array_t& obj_item_array, llvo_vec_t& objects_to_remove, + llvo_vec_t& objects_to_retain, LLInventoryModel::item_array_t& items_to_add) { // Possible cases: @@ -1310,6 +1311,7 @@ void LLAgentWearables::findAttachmentsAddRemoveInfo(LLInventoryModel::item_array { // LL_INFOS() << "found object to keep, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << LL_ENDL; current_item_ids.insert(object_item_id); + objects_to_retain.push_back(objectp); } } } @@ -1335,23 +1337,6 @@ void LLAgentWearables::findAttachmentsAddRemoveInfo(LLInventoryModel::item_array // LL_INFOS() << "remove " << remove_count << " add " << add_count << LL_ENDL; } -// Combines userRemoveMulipleAttachments() and userAttachMultipleAttachments() logic to -// get attachments into desired state with minimal number of adds/removes. -void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array) -{ - llvo_vec_t objects_to_remove; - LLInventoryModel::item_array_t items_to_add; - findAttachmentsAddRemoveInfo(obj_item_array, - objects_to_remove, - items_to_add); - - // Remove everything in objects_to_remove - userRemoveMultipleAttachments(objects_to_remove); - - // Add everything in items_to_add - userAttachMultipleAttachments(items_to_add); -} - void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remove) { if (!isAgentAvatarValid()) return; @@ -1369,7 +1354,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo ++it) { LLViewerObject *objectp = *it; - gAgentAvatarp->resetJointPositionsOnDetach(objectp); + //gAgentAvatarp->resetJointPositionsOnDetach(objectp); gMessageSystem->nextBlockFast(_PREHASH_ObjectData); gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); } -- cgit v1.2.3 From 7b6131fbf9c083d7d81f5f791ffe104df4f40aa3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Sat, 15 Nov 2014 14:36:30 -0500 Subject: MAINT-4537 WIP - comments and cleanup --- indra/newview/llagentwearables.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llagentwearables.cpp') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 585f14df3d..f06ffb4fb3 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1105,10 +1105,10 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it notifyLoadingFinished(); - // Have to copy wearable params to avatar + // Copy wearable params to avatar. gAgentAvatarp->writeWearablesToAvatar(); - // ... before this will do anything. + // Then update the avatar based on the copied params. gAgentAvatarp->updateVisualParams(); gAgentAvatarp->dumpAvatarTEs("setWearableOutfit"); -- cgit v1.2.3