From 30fe88b80892e4538dc2b6f71992c3f51d35e95a Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 3 Dec 2009 02:44:12 +1100 Subject: * Terrain uploads via the Estate Tools now support a multitude of file formats. Specifically: . bmp, .raw, .r32 & .r64. (in ascending order of precision) * It uses file length as the detection routine (as each of these formats has a distinct size in bytes for a 256x256 array.) - more formats should be possible to add. --- .../World/Estate/EstateManagementModule.cs | 50 ++++++++++++++-------- 1 file changed, 31 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index e3a395e..b1dcb14 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -471,20 +471,45 @@ namespace OpenSim.Region.CoreModules.World.Estate if (terr != null) { m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName); - if (File.Exists(Util.dataDir() + "/terrain.raw")) - { - File.Delete(Util.dataDir() + "/terrain.raw"); - } + try { - FileStream input = new FileStream(Util.dataDir() + "/terrain.raw", FileMode.CreateNew); + + string localfilename = "terrain.raw"; + + if (terrainData.Length == 851968) + { + localfilename = Path.Combine(Util.dataDir(),"terrain.raw"); // It's a .LLRAW + } + + if (terrainData.Length == 196662) // 24-bit 256x256 Bitmap + localfilename = Path.Combine(Util.dataDir(), "terrain.bmp"); + + if (terrainData.Length == 256 * 256 * 4) // It's a .R32 + localfilename = Path.Combine(Util.dataDir(), "terrain.r32"); + + if (terrainData.Length == 256 * 256 * 8) // It's a .R64 + localfilename = Path.Combine(Util.dataDir(), "terrain.r64"); + + if (File.Exists(localfilename)) + { + File.Delete(localfilename); + } + + FileStream input = new FileStream(localfilename, FileMode.CreateNew); input.Write(terrainData, 0, terrainData.Length); input.Close(); + + FileInfo x = new FileInfo(localfilename); + + terr.LoadFromFile(localfilename); + remoteClient.SendAlertMessage("Your terrain was loaded as a ." + x.Extension + " file. It may take a few moments to appear."); + } catch (IOException e) { m_log.ErrorFormat("[TERRAIN]: Error Saving a terrain file uploaded via the estate tools. It gave us the following error: {0}", e.ToString()); - remoteClient.SendAlertMessage("There was an IO Exception loading your terrain. Please check free space"); + remoteClient.SendAlertMessage("There was an IO Exception loading your terrain. Please check free space."); return; } @@ -502,29 +527,16 @@ namespace OpenSim.Region.CoreModules.World.Estate return; } - - - - - try - { - terr.LoadFromFile(Util.dataDir() + "/terrain.raw"); - remoteClient.SendAlertMessage("Your terrain was loaded. Give it a minute or two to apply"); - } catch (Exception e) { m_log.ErrorFormat("[TERRAIN]: Error loading a terrain file uploaded via the estate tools. It gave us the following error: {0}", e.ToString()); remoteClient.SendAlertMessage("There was a general error loading your terrain. Please fix the terrain file and try again"); } - } else { remoteClient.SendAlertMessage("Unable to apply terrain. Cannot get an instance of the terrain module"); } - - - } private void handleUploadTerrain(IClientAPI remote_client, string clientFileName) -- cgit v1.1 From f7b2f0e61e2a8bb397fd4bf97103a4bac8d17b23 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Dec 2009 17:55:56 +0000 Subject: Add position and region of prim items with missing assets in log reports --- .../Framework/Scenes/SceneObjectPartInventory.cs | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 7a0d7b7..22eedba 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -259,8 +259,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat( "[PRIM INVENTORY]: " + - "Couldn't start script {0}, {1} since asset ID {2} could not be found", - item.Name, item.ItemID, item.AssetID); + "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", + item.Name, item.ItemID, m_part.AbsolutePosition, + m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); } else { @@ -312,8 +313,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat( "[PRIM INVENTORY]: " + - "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}", - itemId, m_part.Name, m_part.UUID); + "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", + itemId, m_part.Name, m_part.UUID, + m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); } } } @@ -333,8 +335,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat( "[PRIM INVENTORY]: " + - "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2}", - itemId, m_part.Name, m_part.UUID); + "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", + itemId, m_part.Name, m_part.UUID, + m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); } } @@ -522,8 +525,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat( "[PRIM INVENTORY]: " + - "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory", - item.ItemID, m_part.Name, m_part.UUID); + "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", + item.ItemID, m_part.Name, m_part.UUID, + m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); } } @@ -579,8 +583,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.ErrorFormat( "[PRIM INVENTORY]: " + - "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory", - itemID, m_part.Name, m_part.UUID); + "Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", + itemID, m_part.Name, m_part.UUID, + m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); } } -- cgit v1.1 From af04cd1ae00c5533df5b6be6333bd58ce13aa1a9 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 3 Dec 2009 01:50:54 -0500 Subject: * If the position that comes in on Scene.SetHomeRezPoint has a component that is 255.5, replace the component with the user's position in the simulator. * Fixes mantis 4414: http://opensimulator.org/mantis/view.php?id=4414 --- OpenSim/Region/Framework/Scenes/Scene.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8788ced..08b7115 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3034,6 +3034,25 @@ namespace OpenSim.Region.Framework.Scenes // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around. // TODO: The HomeRegion property can be removed then, too UserProfile.HomeRegion = RegionInfo.RegionHandle; + + // Linden Client limitation.. + if (position.X == 255.5f || position.Y == 255.5f) + { + ScenePresence avatar = null; + if (TryGetAvatar(remoteClient.AgentId, out avatar)) + { + if (position.X == 255.5f) + { + position.X = avatar.AbsolutePosition.X; + } + if (position.Y == 255.5f) + { + position.Y = avatar.AbsolutePosition.Y; + } + } + + } + UserProfile.HomeLocation = position; UserProfile.HomeLookAt = lookAt; CommsManager.UserService.UpdateUserProfile(UserProfile); -- cgit v1.1 From d9a20edfb0ec916f40a6dc116955f966c86d83c8 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 3 Dec 2009 02:02:04 -0500 Subject: * Move code from that last commit to LLClientView since it's a linden client specific limitation, it moves to the Linden Specific client handler. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 18 ++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index c2aa8e2..ffe6fe9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -5521,6 +5521,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId) { + // Linden Client limitation.. + if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.X == 255.5f + || avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y == 255.5f) + { + ScenePresence avatar = null; + if (((Scene)m_scene).TryGetAvatar(AgentId, out avatar)) + { + if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.X == 255.5f) + { + avSetStartLocationRequestPacket.StartLocationData.LocationPos.X = avatar.AbsolutePosition.X; + } + if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y == 255.5f) + { + avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y = avatar.AbsolutePosition.Y; + } + } + + } TeleportLocationRequest handlerSetStartLocationRequest = OnSetStartLocationRequest; if (handlerSetStartLocationRequest != null) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 08b7115..a22fb5f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3034,24 +3034,6 @@ namespace OpenSim.Region.Framework.Scenes // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around. // TODO: The HomeRegion property can be removed then, too UserProfile.HomeRegion = RegionInfo.RegionHandle; - - // Linden Client limitation.. - if (position.X == 255.5f || position.Y == 255.5f) - { - ScenePresence avatar = null; - if (TryGetAvatar(remoteClient.AgentId, out avatar)) - { - if (position.X == 255.5f) - { - position.X = avatar.AbsolutePosition.X; - } - if (position.Y == 255.5f) - { - position.Y = avatar.AbsolutePosition.Y; - } - } - - } UserProfile.HomeLocation = position; UserProfile.HomeLookAt = lookAt; -- cgit v1.1 From 781db43a7665cf0c219889e85eadd7cdc4e8b79b Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Thu, 3 Dec 2009 20:21:10 -0500 Subject: * Fixes the 10x10x10 hard physics limitation. (wierdly, you have to set this for each region in your Regions.ini[PhysicalPrimMax = 10(default)]) * Adds a configurable maximum object mass before the mass is clamped. Default is 10000.01. Configurable by changing maximum_mass_object in the [ODEPhysicsSettings] section. * Clamping the mass is important for limiting the amount of CPU an object can consume in physics calculations. Too high, and the object overcomes restitution forces by gravity alone. This generates more collisions potentially leading to 'deep think'. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 +++- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 3 +++ OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7359011..6badaf5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2589,7 +2589,9 @@ namespace OpenSim.Region.Framework.Scenes { foreach (SceneObjectPart part in m_parts.Values) { - if (part.Scale.X > 10.0 || part.Scale.Y > 10.0 || part.Scale.Z > 10.0) + if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax || + part.Scale.Y > m_scene.RegionInfo.PhysPrimMax || + part.Scale.Z > m_scene.RegionInfo.PhysPrimMax) { UsePhysics = false; // Reset physics break; diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 9e9c36f..d241574 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -723,6 +723,8 @@ namespace OpenSim.Region.Physics.OdePlugin break; } } + if (returnMass > _parent_scene.maximumMassObject) + returnMass = _parent_scene.maximumMassObject; return returnMass; }// end CalculateMass @@ -733,6 +735,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (Body != (IntPtr) 0) { float newmass = CalculateMass(); + //m_log.Info("[PHYSICS]: New Mass: " + newmass.ToString()); d.MassSetBoxTotal(out pMass, newmass, _size.X, _size.Y, _size.Z); diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index a0aba2a..0384d6e 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -207,6 +207,7 @@ namespace OpenSim.Region.Physics.OdePlugin private float avMovementDivisorWalk = 1.3f; private float avMovementDivisorRun = 0.8f; private float minimumGroundFlightOffset = 3f; + public float maximumMassObject = 10000.01f; public bool meshSculptedPrim = true; public bool forceSimplePrimMeshing = false; @@ -480,6 +481,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false); minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f); + maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f); } } -- cgit v1.1 From c0f3a4c8332f235e998714214011c5412bdcacf0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Dec 2009 18:26:58 +0000 Subject: Allow terrain heightmaps to be loaded directly from URIs via the remote admin plugin See http://opensimulator.org/mantis/view.php?id=4418 Thanks StrawberryFride See --- .../CoreModules/World/Terrain/TerrainModule.cs | 32 +++++++++++++++++++++- .../Region/Framework/Interfaces/ITerrainModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 ++++ 3 files changed, 38 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index ba271fd..a40828b 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Reflection; +using System.Net; using log4net; using Nini.Config; using OpenMetaverse; @@ -259,6 +260,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain } /// + /// Loads a terrain file from the specified URI + /// + /// The name of the terrain to load + /// The URI to the terrain height map + public void LoadFromStream(string filename, Uri pathToTerrainHeightmap) + { + LoadFromStream(filename, URIFetch(pathToTerrainHeightmap)); + } + + /// /// Loads a terrain file from a stream and installs it in the scene. /// /// Filename to terrain file. Type is determined by extension. @@ -267,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain { foreach (KeyValuePair loader in m_loaders) { - if (@filename.EndsWith(loader.Key)) + if (filename.EndsWith(loader.Key)) { lock (m_scene) { @@ -295,6 +306,25 @@ namespace OpenSim.Region.CoreModules.World.Terrain throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename)); } + private static Stream URIFetch(Uri uri) + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); + + // request.Credentials = credentials; + + request.ContentLength = 0; + request.KeepAlive = false; + + WebResponse response = request.GetResponse(); + Stream file = response.GetResponseStream(); + + if (response.ContentLength == 0) + throw new Exception(String.Format("{0} returned an empty file", uri.ToString())); + + // return new BufferedStream(file, (int) response.ContentLength); + return new BufferedStream(file, 1000000); + } + /// /// Modify Land /// diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs index 2dcba0c..7caac55 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// void LoadFromStream(string filename, Stream stream); - + void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); /// /// Save a terrain to a stream. /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 09d02f4..0b0c205 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2393,6 +2393,12 @@ namespace OpenSim.Region.Framework.Scenes InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); item = InventoryService.GetItem(item); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); + + if (m_AvatarFactory != null) + { + m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); + } + } } -- cgit v1.1 From c4b6010fb34268c9426f7241a38ba892b93780d1 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 5 Dec 2009 13:01:21 -0500 Subject: * Fixes mantis 4416. Animator is dereferenced on logout --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 +++-- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b2cd249..a3ceecb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2932,14 +2932,15 @@ namespace OpenSim.Region.Framework.Scenes //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) // The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents( // as of this comment the interval is set in AddToPhysicalScene - Animator.UpdateMovementAnimations(); + if (Animator!=null) + Animator.UpdateMovementAnimations(); CollisionEventUpdate collisionData = (CollisionEventUpdate)e; Dictionary coldata = collisionData.m_objCollisionList; CollisionPlane = Vector4.UnitW; - if (coldata.Count != 0) + if (coldata.Count != 0 && Animator != null) { switch (Animator.CurrentMovementAnimation) { diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 1bc4a25..40fbde1 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -1221,7 +1221,10 @@ namespace OpenSim.Region.Physics.OdePlugin { if (m_eventsubscription > m_requestedUpdateFrequency) { - base.SendCollisionUpdate(CollisionEventsThisFrame); + if (CollisionEventsThisFrame != null) + { + base.SendCollisionUpdate(CollisionEventsThisFrame); + } CollisionEventsThisFrame = new CollisionEventUpdate(); m_eventsubscription = 0; } -- cgit v1.1