diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 30c8e4cf82..5798a64f76 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -1723,5 +1723,9 @@ namespace OpenSim.Client.MXP.ClientStack public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } } diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs index bc48123cf2..906947e7fc 100644 --- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs +++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs @@ -1208,6 +1208,10 @@ namespace OpenSim.Client.Sirikata.ClientStack { } + public void StopFlying(ISceneEntity presence) + { + } + #endregion } } diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index e6d1c48b07..13a27f59c8 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -1223,5 +1223,9 @@ namespace OpenSim.Client.VWoHTTP.ClientStack public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 71174d2e6c..d85b101a67 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1310,5 +1310,7 @@ namespace OpenSim.Framework void SendChangeUserRights(UUID agentID, UUID friendID, int rights); void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId); + + void StopFlying(ISceneEntity presence); } } diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 518f2ea9f9..f3ac1914a0 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.7CM"; + private const string VERSION_NUMBER = "0.7.1CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index b2df0bdb3a..f0718419d7 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -11873,5 +11873,60 @@ namespace OpenSim.Region.ClientStack.LindenUDP dialog.Buttons = buttons; OutPacket(dialog, ThrottleOutPacketType.Task); } + + public void StopFlying(ISceneEntity p) + { + if (p is ScenePresence) + { + ScenePresence presence = p as ScenePresence; + // It turns out to get the agent to stop flying, you have to feed it stop flying velocities + // There's no explicit message to send the client to tell it to stop flying.. it relies on the + // velocity, collision plane and avatar height + + // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air + // when the avatar stands up + + Vector3 pos = presence.AbsolutePosition; + + if (presence.Appearance.AvatarHeight != 127.0f) + pos += new Vector3(0f, 0f, (presence.Appearance.AvatarHeight/6f)); + else + pos += new Vector3(0f, 0f, (1.56f/6f)); + + presence.AbsolutePosition = pos; + + // attach a suitable collision plane regardless of the actual situation to force the LLClient to land. + // Collision plane below the avatar's position a 6th of the avatar's height is suitable. + // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a + // certain amount.. because the LLClient wouldn't land in that situation anyway. + + // why are we still testing for this really old height value default??? + if (presence.Appearance.AvatarHeight != 127.0f) + presence.CollisionPlane = new Vector4(0, 0, 0, pos.Z - presence.Appearance.AvatarHeight/6f); + else + presence.CollisionPlane = new Vector4(0, 0, 0, pos.Z - (1.56f/6f)); + + + ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = + CreateImprovedTerseBlock(p, false); + + const float TIME_DILATION = 1.0f; + ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); + + + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; + + packet.ObjectData[0] = block; + + OutPacket(packet, ThrottleOutPacketType.Task, true); + } + + //ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, + // AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient))); + + } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 60d1720ba7..b4f1ed6205 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -219,40 +219,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver CreateFoldersForPath(destFolder, archivePathSectionToCreate, resolvedFolders, loadedNodes); return destFolder; - - /* - string[] rawFolders = filePath.Split(new char[] { '/' }); - - // Find the folders that do exist along the path given - int i = 0; - bool noFolder = false; - InventoryFolderImpl foundFolder = rootDestinationFolder; - while (!noFolder && i < rawFolders.Length) - { - InventoryFolderImpl folder = foundFolder.FindFolderByPath(rawFolders[i]); - if (null != folder) - { - m_log.DebugFormat("[INVENTORY ARCHIVER]: Found folder {0}", folder.Name); - foundFolder = folder; - i++; - } - else - { - noFolder = true; - } - } - - // Create any folders that did not previously exist - while (i < rawFolders.Length) - { - m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawFolders[i]); - - UUID newFolderId = UUID.Random(); - m_userInfo.CreateFolder( - rawFolders[i++], newFolderId, (ushort)AssetType.Folder, foundFolder.ID); - foundFolder = foundFolder.GetChildFolder(newFolderId); - } - */ } /// diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 59cd386c0c..00bd27aaba 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests public void TestIarV0_1WithEscapedChars() { TestHelper.InMethod(); - log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); string itemName = "You & you are a mean/man/"; string humanEscapedItemName = @"You & you are a mean\/man\/"; @@ -505,7 +505,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests /// Test replication of an archive path to the user's inventory. /// [Test] - public void TestReplicateArchivePathToUserInventory() + public void TestNewIarPath() { TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); @@ -540,5 +540,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b"); Assert.That(folder2, Is.Not.Null, "Could not find folder b"); } + + /// + /// Test replication of a partly existing archive path to the user's inventory. + /// + [Test] + public void TestPartExistingIarPath() + { + TestHelper.InMethod(); + //log4net.Config.XmlConfigurator.Configure(); + + Scene scene = SceneSetupHelpers.SetupScene("inventory"); + UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); + + string folder1ExistingName = "a"; + string folder2Name = "b"; + string itemName = "c.lsl"; + + InventoryFolderBase folder1 + = UserInventoryTestUtils.CreateInventoryFolder( + scene.InventoryService, ua1.PrincipalID, folder1ExistingName); + + string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); + string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); + string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); + + string itemArchivePath + = string.Format( + "{0}{1}{2}{3}", + ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName); + + new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) + .ReplicateArchivePathToUserInventory( + itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), + new Dictionary(), new List()); + + InventoryFolderBase folder1Post + = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName); + Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID)); + /* + InventoryFolderBase folder2 + = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b"); + Assert.That(folder2, Is.Not.Null); + InventoryItemBase item = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, folder2, itemName); + Assert.That(item, Is.Not.Null); + */ + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index c3338120a4..2f1e9dd74e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -154,17 +154,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer private void OnInstantMessage(IClientAPI client, GridInstantMessage im) { m_log.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog); + Scene scene = FindClientScene(client.AgentId); if (scene == null) // Something seriously wrong here. return; - if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) { //m_log.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0])); + if (im.binaryBucket.Length < 17) // Invalid + return; + UUID receipientID = new UUID(im.toAgentID); ScenePresence user = scene.GetScenePresence(receipientID); UUID copyID; @@ -420,8 +423,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { // Check if this is ours to handle // - m_log.Info("OnGridInstantMessage"); - Scene scene = FindClientScene(new UUID(msg.toAgentID)); if (scene == null) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 266621f924..5e2c04c488 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -180,6 +180,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); sp.Teleport(position); + + foreach (SceneObjectGroup grp in sp.Attachments) + sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT); } else // Another region possibly in another simulator { diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index b71b5f61a5..b96d95a09c 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs @@ -70,10 +70,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap #region IMapImageGenerator Members - public byte[] WriteJpeg2000Image(string gradientmap) + public Bitmap CreateMapTile(string gradientmap) { - byte[] imageData = null; - bool drawPrimVolume = true; bool textureTerrain = false; @@ -98,32 +96,36 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } terrainRenderer.Initialise(m_scene, m_config); - using (Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize)) + Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + //long t = System.Environment.TickCount; + //for (int i = 0; i < 10; ++i) { + terrainRenderer.TerrainToBitmap(mapbmp); + //} + //t = System.Environment.TickCount - t; + //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); + + + if (drawPrimVolume) { - //long t = System.Environment.TickCount; - //for (int i = 0; i < 10; ++i) { - terrainRenderer.TerrainToBitmap(mapbmp); - //} - //t = System.Environment.TickCount - t; - //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); - - - if (drawPrimVolume) - { - DrawObjectVolume(m_scene, mapbmp); - } - - try - { - imageData = OpenJPEG.EncodeFromImage(mapbmp, true); - } - catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke - { - m_log.Error("Failed generating terrain map: " + e); - } + DrawObjectVolume(m_scene, mapbmp); } - return imageData; + return mapbmp; + } + + public byte[] WriteJpeg2000Image(string gradientmap) + { + try + { + using (Bitmap mapbmp = CreateMapTile(gradientmap)) + return OpenJPEG.EncodeFromImage(mapbmp, true); + } + catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke + { + m_log.Error("Failed generating terrain map: " + e); + } + + return null; } #endregion diff --git a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs index a297cf310b..fef2ef3995 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs @@ -37,6 +37,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { public class ShadedMapTileRenderer : IMapTileTerrainRenderer { + private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -221,8 +223,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap try { - Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255); - mapbmp.SetPixel(x, yr, water); + mapbmp.SetPixel(x, yr, WATER_COLOR); } catch (ArgumentException) { diff --git a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs index 4ecad74316..8b34f6ebdc 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs @@ -136,6 +136,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c"); private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200); + private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95); + #endregion @@ -406,8 +408,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0 - Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255); - mapbmp.SetPixel(x, yr, water); + mapbmp.SetPixel(x, yr, WATER_COLOR); } } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index c6fb18d8f3..0e849e542c 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -1002,41 +1002,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap public void RegenerateMaptile(byte[] data) { - // Overwrites the local Asset cache with new maptile data - // Assets are single write, this causes the asset server to ignore this update, - // but the local asset cache does not - - // this is on purpose! The net result of this is the region always has the most up to date - // map tile while protecting the (grid) asset database from bloat caused by a new asset each - // time a mapimage is generated! - UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; - int lastMapRefresh = 0; - int twoDays = 172800; -// int RefreshSeconds = twoDays; - - try - { - lastMapRefresh = Convert.ToInt32(m_scene.RegionInfo.lastMapRefresh); - } - catch (ArgumentException) - { - } - catch (FormatException) - { - } - catch (OverflowException) - { - } - m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE"); m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random(); AssetBase asset = new AssetBase( m_scene.RegionInfo.RegionSettings.TerrainImageID, - "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(), + "terrainImage_" + m_scene.RegionInfo.RegionID.ToString(), (sbyte)AssetType.Texture, m_scene.RegionInfo.RegionID.ToString()); asset.Data = data; diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index a84a3c8cf3..8ec5bb5e5c 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -1164,5 +1164,9 @@ namespace OpenSim.Region.Examples.SimpleModule public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } } diff --git a/OpenSim/Region/Framework/Interfaces/ITerrain.cs b/OpenSim/Region/Framework/Interfaces/ITerrain.cs index f5662cbcf6..b42e872e6f 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrain.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrain.cs @@ -73,6 +73,7 @@ namespace OpenSim.Region.Framework.Interfaces public interface IMapImageGenerator { + System.Drawing.Bitmap CreateMapTile(string gradientmap); byte[] WriteJpeg2000Image(string gradientmap); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index c4cff126e3..c3cdca8604 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -681,7 +681,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (TaskInventoryItem item in items) { m_items.Add(item.ItemID, item); - m_part.TriggerScriptChangedEvent(Changed.INVENTORY); +// m_part.TriggerScriptChangedEvent(Changed.INVENTORY); } m_items.LockItemsForWrite(false); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8cd3ac6d76..b6f67f7327 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1098,27 +1098,7 @@ namespace OpenSim.Region.Framework.Scenes public void StopFlying() { - // It turns out to get the agent to stop flying, you have to feed it stop flying velocities - // There's no explicit message to send the client to tell it to stop flying.. it relies on the - // velocity, collision plane and avatar height - - // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air - // when the avatar stands up - - if (m_avHeight != 127.0f) - { - AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (m_avHeight / 6f)); - } - else - { - AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f)); - } - - m_updateCount = UPDATE_COUNT; //KF: Trigger Anim updates to catch falling anim. - - ControllingClient.SendPrimUpdate(this, PrimUpdateFlags.Position); - //ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, - // AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient))); + ControllingClient.StopFlying(this); } public void AddNeighbourRegion(ulong regionHandle, string cap) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index f7544ac2ee..5bdaa17f69 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -221,7 +221,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization sr = new StringReader(parts[i].OuterXml); reader = new XmlTextReader(sr); SceneObjectPart part = SceneObjectPart.FromXml(reader); + + int originalLinkNum = part.LinkNum; + sceneObject.AddPart(part); + + // SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum. + // We override that here + if (originalLinkNum != 0) + part.LinkNum = originalLinkNum; + part.StoreUndoState(); reader.Close(); sr.Close(); diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 2ed8fbffab..d72ee6f681 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1689,5 +1689,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index e43ef788ef..c3edba2658 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -1171,5 +1171,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0a4544c83e..9f3e3548ef 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2862,6 +2862,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // objects rezzed with this method are die_at_edge by default. new_group.RootPart.SetDieAtEdge(true); + new_group.ResumeScripts(); + m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( "object_rez", new Object[] { new LSL_String( diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp index 23138efc4a..f02d2d90dc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp @@ -18,10 +18,10 @@ - + diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 57924b7ab5..6a61da665c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -28,17 +28,18 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; using System.Net; using System.Reflection; using log4net; using Mono.Addins; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; -using OpenSim.Server.Base; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -62,7 +63,7 @@ namespace OpenSim.Services.Connectors.SimianGrid #region ISharedRegionModule public Type ReplaceableInterface { get { return null; } } - public void RegionLoaded(Scene scene) { } + public void RegionLoaded(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { UploadMapTile(scene); } } public void PostInitialise() { } public void Close() { } @@ -358,6 +359,83 @@ namespace OpenSim.Services.Connectors.SimianGrid #endregion IGridService + private void UploadMapTile(IScene scene) + { + string errorMessage = null; + + // Create a PNG map tile and upload it to the AddMapTile API + byte[] pngData = Utils.EmptyBytes; + IMapImageGenerator tileGenerator = scene.RequestModuleInterface(); + if (tileGenerator == null) + { + m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator"); + return; + } + + using (Image mapTile = tileGenerator.CreateMapTile("defaultstripe.png")) + { + using (MemoryStream stream = new MemoryStream()) + { + mapTile.Save(stream, ImageFormat.Png); + pngData = stream.ToArray(); + } + } + + List postParameters = new List() + { + new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()), + new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()), + new MultipartForm.File("Tile", "tile.png", "image/png", pngData) + }; + + // Make the remote storage request + try + { + HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl); + + HttpWebResponse response = MultipartForm.Post(request, postParameters); + using (Stream responseStream = response.GetResponseStream()) + { + string responseStr = null; + + try + { + responseStr = responseStream.GetStreamString(); + OSD responseOSD = OSDParser.Deserialize(responseStr); + if (responseOSD.Type == OSDType.Map) + { + OSDMap responseMap = (OSDMap)responseOSD; + if (responseMap["Success"].AsBoolean()) + m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile"); + else + errorMessage = "Upload failed: " + responseMap["Message"].AsString(); + } + else + { + errorMessage = "Response format was invalid:\n" + responseStr; + } + } + catch (Exception ex) + { + if (!String.IsNullOrEmpty(responseStr)) + errorMessage = "Failed to parse the response:\n" + responseStr; + else + errorMessage = "Failed to retrieve the response: " + ex.Message; + } + } + } + catch (WebException ex) + { + errorMessage = ex.Message; + } + + if (!String.IsNullOrEmpty(errorMessage)) + { + m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}", + pngData.Length, scene.RegionInfo.RegionName, errorMessage); + } + } + private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) { NameValueCollection requestArgs = new NameValueCollection diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index ebbf4ffbd7..f8304c0134 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -1224,5 +1224,9 @@ namespace OpenSim.Tests.Common.Mock public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } } diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs index 6dc993f069..f9a80b05b2 100644 --- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs @@ -36,25 +36,29 @@ namespace OpenSim.Tests.Common public class AssetHelpers { /// - /// Create an asset from the given data + /// Create a notecard asset with a random uuid and dummy text. /// - public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, byte[] data, UUID creatorID) + /// /param> + /// + public static AssetBase CreateAsset(UUID creatorId) { - AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)assetType, creatorID.ToString()); - asset.Data = data; - return asset; - } - - /// - /// Create an asset from the given data - /// - public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, string data, UUID creatorID) - { - return CreateAsset(assetUuid, assetType, Encoding.ASCII.GetBytes(data), creatorID); + return CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); } /// - /// Create an asset from the given scene object + /// Create and store a notecard asset with a random uuid and dummy text. + /// + /// /param> + /// + public static AssetBase CreateAsset(Scene scene, UUID creatorId) + { + AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); + scene.AssetService.Store(asset); + return asset; + } + + /// + /// Create an asset from the given scene object. /// /// /// @@ -67,5 +71,23 @@ namespace OpenSim.Tests.Common Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog)), sog.OwnerID); } + + /// + /// Create an asset from the given data. + /// + public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, string data, UUID creatorID) + { + return CreateAsset(assetUuid, assetType, Encoding.ASCII.GetBytes(data), creatorID); + } + + /// + /// Create an asset from the given data. + /// + public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, byte[] data, UUID creatorID) + { + AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)assetType, creatorID.ToString()); + asset.Data = data; + return asset; + } } } diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs index 7e0c5672df..c57363aa94 100644 --- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs +++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs @@ -28,6 +28,7 @@ using System; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; namespace OpenSim.Tests.Common @@ -39,6 +40,23 @@ namespace OpenSim.Tests.Common { public static readonly string PATH_DELIMITER = "/"; + public static InventoryItemBase CreateInventoryItem( + Scene scene, string itemName, UUID itemId, string folderPath, UUID userId) + { + InventoryItemBase item = new InventoryItemBase(); + item.Name = itemName; + item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID; + item.ID = itemId; + + // Really quite bad since the objs folder could be moved in the future and confuse the tests + InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); + + item.Folder = objsFolder.ID; + scene.AddInventoryItem(userId, item); + + return item; + } + /// /// Create inventory folders starting from the user's root folder. ///