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
This commit is contained in:
Inusaito Sayori
2013-08-24 21:24:23 -04:00
parent 8fc74855da
commit 74698fa3d8

View File

@@ -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