aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
authorMelanie2010-03-06 12:37:24 +0000
committerMelanie2010-03-06 12:37:24 +0000
commit8180c72cbc9cafff247d614ac14db29499fc32a9 (patch)
treefd92204394e657b805e094a237ffecaf50066df6 /OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-8180c72cbc9cafff247d614ac14db29499fc32a9.zip
opensim-SC-8180c72cbc9cafff247d614ac14db29499fc32a9.tar.gz
opensim-SC-8180c72cbc9cafff247d614ac14db29499fc32a9.tar.bz2
opensim-SC-8180c72cbc9cafff247d614ac14db29499fc32a9.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs109
1 files changed, 2 insertions, 107 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 9cbaffc..eb51019 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1862,39 +1862,11 @@ namespace OpenSim.Region.Framework.Scenes
1862 1862
1863 if (att == null) 1863 if (att == null)
1864 { 1864 {
1865 DetachSingleAttachmentToInv(itemID, remoteClient); 1865 AttachmentsModule.ShowDetachInUserInventory(itemID, remoteClient);
1866 return UUID.Zero; 1866 return UUID.Zero;
1867 } 1867 }
1868 1868
1869 return RezSingleAttachment(att, remoteClient, itemID, AttachmentPt); 1869 return AttachmentsModule.SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
1870 }
1871
1872 /// <summary>
1873 /// Update the user inventory to reflect an attachment
1874 /// </summary>
1875 /// <param name="att"></param>
1876 /// <param name="remoteClient"></param>
1877 /// <param name="itemID"></param>
1878 /// <param name="AttachmentPt"></param>
1879 /// <returns></returns>
1880 public UUID RezSingleAttachment(SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
1881 {
1882 m_log.DebugFormat(
1883 "[USER INVENTORY]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
1884 remoteClient.Name, att.Name, itemID);
1885
1886 if (!att.IsDeleted)
1887 AttachmentPt = att.RootPart.AttachmentPoint;
1888
1889 ScenePresence presence;
1890 if (TryGetAvatar(remoteClient.AgentId, out presence))
1891 {
1892 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1893 item = InventoryService.GetItem(item);
1894
1895 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
1896 }
1897 return att.UUID;
1898 } 1870 }
1899 1871
1900 public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, 1872 public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
@@ -1906,65 +1878,6 @@ namespace OpenSim.Region.Framework.Scenes
1906 } 1878 }
1907 } 1879 }
1908 1880
1909 /// <summary>
1910 /// Attach an object.
1911 /// </summary>
1912 /// <param name="controllingClient"></param>
1913 /// <param name="localID"></param>
1914 /// <param name="attachPoint"></param>
1915 /// <param name="rot"></param>
1916 /// <param name="pos"></param>
1917 /// <param name="silent"></param>
1918 /// <returns>true if the object was successfully attached, false otherwise</returns>
1919 public bool AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent)
1920 {
1921 return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent);
1922 }
1923
1924 /// <summary>
1925 /// This registers the item as attached in a user's inventory
1926 /// </summary>
1927 /// <param name="remoteClient"></param>
1928 /// <param name="AttachmentPt"></param>
1929 /// <param name="itemID"></param>
1930 /// <param name="att"></param>
1931 public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
1932 {
1933// m_log.DebugFormat(
1934// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}",
1935// att.Name, remoteClient.Name, AttachmentPt, itemID);
1936
1937 if (UUID.Zero == itemID)
1938 {
1939 m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID.");
1940 return;
1941 }
1942
1943 if (0 == AttachmentPt)
1944 {
1945 m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error attachment point.");
1946 return;
1947 }
1948
1949 if (null == att.RootPart)
1950 {
1951 m_log.Error("[SCENE INVENTORY]: Unable to save attachment for a prim without the rootpart!");
1952 return;
1953 }
1954
1955 ScenePresence presence;
1956 if (TryGetAvatar(remoteClient.AgentId, out presence))
1957 {
1958 // XXYY!!
1959 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1960 item = InventoryService.GetItem(item);
1961 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
1962
1963 if (m_AvatarFactory != null)
1964 m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
1965 }
1966 }
1967
1968 public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) 1881 public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient)
1969 { 1882 {
1970 SceneObjectPart part = GetSceneObjectPart(itemID); 1883 SceneObjectPart part = GetSceneObjectPart(itemID);
@@ -1995,24 +1908,6 @@ namespace OpenSim.Region.Framework.Scenes
1995 SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); 1908 SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero);
1996 } 1909 }
1997 1910
1998 public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
1999 {
2000 ScenePresence presence;
2001 if (TryGetAvatar(remoteClient.AgentId, out presence))
2002 {
2003 presence.Appearance.DetachAttachment(itemID);
2004
2005 // Save avatar attachment information
2006 if (m_AvatarFactory != null)
2007 {
2008 m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", ItemID: " + itemID);
2009 m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
2010 }
2011 }
2012
2013 m_sceneGraph.DetachSingleAttachmentToInv(itemID, remoteClient);
2014 }
2015
2016 public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) 1911 public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
2017 { 1912 {
2018 EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID); 1913 EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID);