diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 37 |
2 files changed, 46 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 2189670..435ce77 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -542,12 +542,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
542 | } | 542 | } |
543 | 543 | ||
544 | group.SetAttachmentPoint(Convert.ToByte(AttachmentPt)); | 544 | group.SetAttachmentPoint(Convert.ToByte(AttachmentPt)); |
545 | group.AbsolutePosition = attachPos; | ||
545 | 546 | ||
546 | // Saves and gets assetID | 547 | // Saves and gets assetID |
548 | UUID itemId; | ||
547 | if (group.GetFromAssetID() == UUID.Zero) | 549 | if (group.GetFromAssetID() == UUID.Zero) |
548 | { | 550 | { |
549 | m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId); | 551 | m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); |
550 | } | 552 | } |
553 | else | ||
554 | { | ||
555 | itemId = group.GetFromAssetID(); | ||
556 | } | ||
557 | |||
558 | m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); | ||
559 | |||
551 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos); | 560 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos); |
552 | // In case it is later dropped again, don't let | 561 | // In case it is later dropped again, don't let |
553 | // it get cleaned up | 562 | // it get cleaned up |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index e2a0eec..8f38d39 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1815,8 +1815,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1815 | } | 1815 | } |
1816 | } | 1816 | } |
1817 | 1817 | ||
1818 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId) | 1818 | public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) |
1819 | { | 1819 | { |
1820 | itemID = UUID.Zero; | ||
1820 | if (grp != null) | 1821 | if (grp != null) |
1821 | { | 1822 | { |
1822 | string sceneObjectXml = grp.ToXmlString(); | 1823 | string sceneObjectXml = grp.ToXmlString(); |
@@ -1866,6 +1867,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1866 | userInfo.AddItem(item); | 1867 | userInfo.AddItem(item); |
1867 | remoteClient.SendInventoryItemCreateUpdate(item); | 1868 | remoteClient.SendInventoryItemCreateUpdate(item); |
1868 | 1869 | ||
1870 | itemID = item.ID; | ||
1869 | return item.AssetID; | 1871 | return item.AssetID; |
1870 | } | 1872 | } |
1871 | return UUID.Zero; | 1873 | return UUID.Zero; |
@@ -2356,6 +2358,39 @@ namespace OpenSim.Region.Environment.Scenes | |||
2356 | m_innerScene.AttachObject(controllingClient, localID, attachPoint, rot, pos); | 2358 | m_innerScene.AttachObject(controllingClient, localID, attachPoint, rot, pos); |
2357 | } | 2359 | } |
2358 | 2360 | ||
2361 | public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) | ||
2362 | { | ||
2363 | if (null == itemID) | ||
2364 | { | ||
2365 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID."); | ||
2366 | return; | ||
2367 | } | ||
2368 | |||
2369 | if (0 == AttachmentPt) | ||
2370 | { | ||
2371 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error attachment point."); | ||
2372 | return; | ||
2373 | } | ||
2374 | |||
2375 | if (null == att.RootPart) | ||
2376 | { | ||
2377 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment for a prim without the rootpart!"); | ||
2378 | return; | ||
2379 | } | ||
2380 | |||
2381 | ScenePresence presence; | ||
2382 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | ||
2383 | { | ||
2384 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, att.UUID); | ||
2385 | IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); | ||
2386 | if (ava != null) | ||
2387 | { | ||
2388 | m_log.InfoFormat("[SCENE INVENTORY]: Saving avatar attachment. AgentID:{0} ItemID:{1} AttachmentPoint:{2}", remoteClient.AgentId, itemID, AttachmentPt); | ||
2389 | ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
2390 | } | ||
2391 | } | ||
2392 | } | ||
2393 | |||
2359 | public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) | 2394 | public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) |
2360 | { | 2395 | { |
2361 | SceneObjectPart part = GetSceneObjectPart(itemID); | 2396 | SceneObjectPart part = GetSceneObjectPart(itemID); |