From 74698fa3d829c609da3e8234f7a301d020cd30b4 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Sat, 24 Aug 2013 21:24:23 -0400 Subject: [PATCH] Yet another attempt to solve Issue 929, bridge autodetach This time we go through with the bridge attach but we setup a callback to detach once attachment process has gone through --- indra/newview/llvoavatar.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index dfdd754ba..9f7ad95fd 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6191,6 +6191,17 @@ void LLVOAvatar::removeChild(LLViewerObject *childp) } } +namespace +{ + boost::signals2::connection sDetachBridgeConnection; + void detach_bridge(const LLViewerObject* obj, const LLViewerObject* bridge) + { + if (obj != bridge) return; + sDetachBridgeConnection.disconnect(); + LLVOAvatarSelf::detachAttachmentIntoInventory(obj->getAttachmentItemID()); + } +} + LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* viewer_object) { S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getState()); @@ -6211,8 +6222,7 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi if (isSelf() && attachmentID == 127 && gSavedSettings.getBOOL("SGDetachBridge")) { llinfos << "Bridge detected! detaching" << llendl; - LLVOAvatarSelf::detachAttachmentIntoInventory(viewer_object->getAttachmentItemID()); - return 0; + sDetachBridgeConnection = gAgentAvatarp->setAttachmentCallback(boost::bind(detach_bridge, _1, viewer_object)); } // attachment = get_if_there(mAttachmentPoints, 1, (LLViewerJointAttachment*)NULL); // Arbitrary using 1 (chest) // [SL:KB] - Patch: Appearance-LegacyMultiAttachment | Checked: 2010-08-28 (Catznip-2.2.0a) | Added: Catznip2.1.2a