aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-24 21:35:44 +0100
committerJustin Clark-Casey (justincc)2011-08-24 21:35:44 +0100
commit5eeee480d47b855774829c94aadcb69af8c0e8da (patch)
tree56af07c0b2f891265c641226be05109fabbc397a /OpenSim/Region/Framework/Scenes
parentget rid of pointless grp null check in attachObjectAssetStore() (diff)
downloadopensim-SC-5eeee480d47b855774829c94aadcb69af8c0e8da.zip
opensim-SC-5eeee480d47b855774829c94aadcb69af8c0e8da.tar.gz
opensim-SC-5eeee480d47b855774829c94aadcb69af8c0e8da.tar.bz2
opensim-SC-5eeee480d47b855774829c94aadcb69af8c0e8da.tar.xz
refactor: move Scene.Inventory.attachObjectAssetStore() into AttachmentsModule.AddSceneObjectAsAttachment()
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs84
1 files changed, 0 insertions, 84 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index ac73abd..9358e7b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1871,90 +1871,6 @@ namespace OpenSim.Region.Framework.Scenes
1871 } 1871 }
1872 } 1872 }
1873 1873
1874 public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, out UUID itemID)
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
1878 itemID = UUID.Zero;
1879
1880 Vector3 inventoryStoredPosition = new Vector3
1881 (((grp.AbsolutePosition.X > (int)Constants.RegionSize)
1882 ? Constants.RegionSize - 6
1883 : grp.AbsolutePosition.X)
1884 ,
1885 (grp.AbsolutePosition.Y > (int)Constants.RegionSize)
1886 ? Constants.RegionSize - 6
1887 : grp.AbsolutePosition.Y,
1888 grp.AbsolutePosition.Z);
1889
1890 Vector3 originalPosition = grp.AbsolutePosition;
1891
1892 grp.AbsolutePosition = inventoryStoredPosition;
1893
1894 // If we're being called from a script, then trying to serialize that same script's state will not complete
1895 // in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if
1896 // the client/server crashes rather than logging out normally, the attachment's scripts will resume
1897 // without state on relog. Arguably, this is what we want anyway.
1898 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false);
1899
1900 grp.AbsolutePosition = originalPosition;
1901
1902 AssetBase asset = CreateAsset(
1903 grp.GetPartName(grp.LocalId),
1904 grp.GetPartDescription(grp.LocalId),
1905 (sbyte)AssetType.Object,
1906 Utils.StringToBytes(sceneObjectXml),
1907 remoteClient.AgentId);
1908
1909 AssetService.Store(asset);
1910
1911 InventoryItemBase item = new InventoryItemBase();
1912 item.CreatorId = grp.RootPart.CreatorID.ToString();
1913 item.CreatorData = grp.RootPart.CreatorData;
1914 item.Owner = remoteClient.AgentId;
1915 item.ID = UUID.Random();
1916 item.AssetID = asset.FullID;
1917 item.Description = asset.Description;
1918 item.Name = asset.Name;
1919 item.AssetType = asset.Type;
1920 item.InvType = (int)InventoryType.Object;
1921
1922 InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object);
1923 if (folder != null)
1924 item.Folder = folder.ID;
1925 else // oopsies
1926 item.Folder = UUID.Zero;
1927
1928 if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions())
1929 {
1930 item.BasePermissions = grp.RootPart.NextOwnerMask;
1931 item.CurrentPermissions = grp.RootPart.NextOwnerMask;
1932 item.NextPermissions = grp.RootPart.NextOwnerMask;
1933 item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask;
1934 item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask;
1935 }
1936 else
1937 {
1938 item.BasePermissions = grp.RootPart.BaseMask;
1939 item.CurrentPermissions = grp.RootPart.OwnerMask;
1940 item.NextPermissions = grp.RootPart.NextOwnerMask;
1941 item.EveryOnePermissions = grp.RootPart.EveryoneMask;
1942 item.GroupPermissions = grp.RootPart.GroupMask;
1943 }
1944 item.CreationDate = Util.UnixTimeSinceEpoch();
1945
1946 // sets itemID so client can show item as 'attached' in inventory
1947 grp.SetFromItemID(item.ID);
1948
1949 if (AddInventoryItem(item))
1950 remoteClient.SendInventoryItemCreateUpdate(item, 0);
1951 else
1952 m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");
1953
1954 itemID = item.ID;
1955 return item.AssetID;
1956 }
1957
1958 /// <summary> 1874 /// <summary>
1959 /// Event Handler Rez an object into a scene 1875 /// Event Handler Rez an object into a scene
1960 /// Calls the non-void event handler 1876 /// Calls the non-void event handler