aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-24 20:49:23 +0100
committerJustin Clark-Casey (justincc)2011-08-24 20:49:23 +0100
commitcf3ffe5bb4c6a8bea9599b6143c2f7793500c984 (patch)
tree80ff937e194c85ec7f599bb6e254c239c69f0b56 /OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
parentrename AttachmentsModule.ShowDetachInUserInventory() to DetachSingleAttachmen... (diff)
downloadopensim-SC_OLD-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.zip
opensim-SC_OLD-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.tar.gz
opensim-SC_OLD-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.tar.bz2
opensim-SC_OLD-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.tar.xz
Fix llAttachToAvatar()
Apart from one obvious bug, this was failing because attempting to serialize the script from inside the script (as part of saving the attachment as an inventory asset) was triggering an extremely long delay. So we now don't do this. The state will be serialized anyway when the avatar normally logs out. The worst that can happen is that if the client/server crashes, the attachment scripts start without previous state.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs14
1 files changed, 11 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index afc1a4f..94126f0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1873,6 +1873,8 @@ namespace OpenSim.Region.Framework.Scenes
1873 1873
1874 public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) 1874 public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID)
1875 { 1875 {
1876// m_log.DebugFormat("[SCENE]: Called attachObjectAssetStore for object {0} {1} for {2} {3} {4}", grp.Name, grp.LocalId, remoteClient.Name, remoteClient.AgentId, AgentId);
1877
1876 itemID = UUID.Zero; 1878 itemID = UUID.Zero;
1877 if (grp != null) 1879 if (grp != null)
1878 { 1880 {
@@ -1881,16 +1883,20 @@ namespace OpenSim.Region.Framework.Scenes
1881 ? 250 1883 ? 250
1882 : grp.AbsolutePosition.X) 1884 : grp.AbsolutePosition.X)
1883 , 1885 ,
1884 (grp.AbsolutePosition.X > (int)Constants.RegionSize) 1886 (grp.AbsolutePosition.Y > (int)Constants.RegionSize)
1885 ? 250 1887 ? 250
1886 : grp.AbsolutePosition.X, 1888 : grp.AbsolutePosition.Y,
1887 grp.AbsolutePosition.Z); 1889 grp.AbsolutePosition.Z);
1888 1890
1889 Vector3 originalPosition = grp.AbsolutePosition; 1891 Vector3 originalPosition = grp.AbsolutePosition;
1890 1892
1891 grp.AbsolutePosition = inventoryStoredPosition; 1893 grp.AbsolutePosition = inventoryStoredPosition;
1892 1894
1893 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); 1895 // If we're being called from a script, then trying to serialize that same script's state will not complete
1896 // in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if
1897 // the client/server crashes rather than logging out normally, the attachment's scripts will resume
1898 // without state on relog. Arguably, this is what we want anyway.
1899 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false);
1894 1900
1895 grp.AbsolutePosition = originalPosition; 1901 grp.AbsolutePosition = originalPosition;
1896 1902
@@ -1900,6 +1906,7 @@ namespace OpenSim.Region.Framework.Scenes
1900 (sbyte)AssetType.Object, 1906 (sbyte)AssetType.Object,
1901 Utils.StringToBytes(sceneObjectXml), 1907 Utils.StringToBytes(sceneObjectXml),
1902 remoteClient.AgentId); 1908 remoteClient.AgentId);
1909
1903 AssetService.Store(asset); 1910 AssetService.Store(asset);
1904 1911
1905 InventoryItemBase item = new InventoryItemBase(); 1912 InventoryItemBase item = new InventoryItemBase();
@@ -1948,6 +1955,7 @@ namespace OpenSim.Region.Framework.Scenes
1948 itemID = item.ID; 1955 itemID = item.ID;
1949 return item.AssetID; 1956 return item.AssetID;
1950 } 1957 }
1958
1951 return UUID.Zero; 1959 return UUID.Zero;
1952 } 1960 }
1953 1961