Merge branch 'master' into careminster

avinationmerge
Melanie 2009-12-05 19:53:54 +00:00
commit 43a6fa1d01
18 changed files with 171 additions and 41 deletions

View File

@ -413,8 +413,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController
ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>();
if (null == terrainModule) throw new Exception("terrain module not available");
terrainModule.LoadFromFile(file);
if (Uri.IsWellFormedUriString(file, UriKind.Absolute))
{
m_log.Info("[RADMIN]: Terrain path is URL");
Uri result;
if (Uri.TryCreate(file, UriKind.RelativeOrAbsolute, out result))
{
// the url is valid
string fileType = file.Substring(file.LastIndexOf('/') + 1);
terrainModule.LoadFromStream(fileType, result);
}
}
else
{
terrainModule.LoadFromFile(file);
}
responseData["success"] = false;
response.Value = responseData;

View File

@ -479,7 +479,9 @@ namespace OpenSim.Data.MySQL
}
else
{
m_log.Warn("[REGION DB]: Database contains an orphan child prim " + prim.UUID + " pointing to missing parent " + prim.ParentUUID);
m_log.WarnFormat(
"[REGION DB]: Database contains an orphan child prim {0} {1} at {2} in region {3} pointing to missing parent {4}. This prim will not be loaded.",
prim.Name, prim.UUID, prim.AbsolutePosition, regionID, prim.ParentUUID);
}
}
}

View File

@ -724,12 +724,20 @@ namespace OpenSim.Framework.Servers.HttpServer
}
catch(Exception e)
{
string errorMessage
= String.Format(
"Requested method [{0}] from {1} threw exception: {2} {3}",
methodName, request.RemoteIPEndPoint.Address, e.Message, e.StackTrace);
m_log.ErrorFormat("[BASE HTTP SERVER]: {0}", errorMessage);
// if the registered XmlRpc method threw an exception, we pass a fault-code along
xmlRpcResponse = new XmlRpcResponse();
// Code probably set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
xmlRpcResponse.SetFault(-32603, String.Format("Requested method [{0}] threw exception: {1}",
methodName, e.Message));
xmlRpcResponse.SetFault(-32603, errorMessage);
}
// if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here
response.KeepAlive = m_rpcHandlersKeepAlive[methodName];
}

View File

@ -188,7 +188,15 @@ namespace OpenSim.Framework.Servers.HttpServer
try
{
IPAddress addr = IPAddress.Parse(req.Headers["remote_addr"]);
int port = Int32.Parse(req.Headers["remote_port"]);
// sometimes req.Headers["remote_port"] returns a comma separated list, so use
// the first one in the list and log it
string[] strPorts = req.Headers["remote_port"].Split(new char[] { ',' });
if (strPorts.Length > 1)
{
_log.ErrorFormat("[OSHttpRequest]: format exception on addr/port {0}:{1}, ignoring",
req.Headers["remote_addr"], req.Headers["remote_port"]);
}
int port = Int32.Parse(strPorts[0]);
_remoteIPEndPoint = new IPEndPoint(addr, port);
}
catch (FormatException)

View File

@ -201,6 +201,7 @@ namespace OpenSim.Grid.UserServer.Modules
}
return response;
}
public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request, IPEndPoint remoteClient)
{
XmlRpcResponse response = new XmlRpcResponse();

View File

@ -5504,6 +5504,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)
{

View File

@ -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)

View File

@ -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;
@ -258,6 +259,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain
}
}
/// <summary>
/// Loads a terrain file from the specified URI
/// </summary>
/// <param name="filename">The name of the terrain to load</param>
/// <param name="pathToTerrainHeightmap">The URI to the terrain height map</param>
public void LoadFromStream(string filename, Uri pathToTerrainHeightmap)
{
LoadFromStream(filename, URIFetch(pathToTerrainHeightmap));
}
/// <summary>
/// Loads a terrain file from a stream and installs it in the scene.
/// </summary>
@ -267,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
{
foreach (KeyValuePair<string, ITerrainLoader> 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);
}
/// <summary>
/// Modify Land
/// </summary>

View File

@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// </param>
/// <param name="stream"></param>
void LoadFromStream(string filename, Stream stream);
void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap);
/// <summary>
/// Save a terrain to a stream.
/// </summary>

View File

@ -2397,6 +2397,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);
}
}
}

View File

@ -3046,6 +3046,7 @@ 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;
UserProfile.HomeLocation = position;
UserProfile.HomeLookAt = lookAt;
CommsManager.UserService.UpdateUserProfile(UserProfile);

View File

@ -2776,8 +2776,13 @@ namespace OpenSim.Region.Framework.Scenes
{
if (part.Scale.X > 10.0 || part.Scale.Y > 10.0 || part.Scale.Z > 10.0)
{
UsePhysics = false; // Reset physics
break;
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;
}
}
}

View File

@ -269,8 +269,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
{
@ -317,9 +318,19 @@ namespace OpenSim.Region.Framework.Scenes
m_items.LockItemsForRead(true);
if (m_items.ContainsKey(itemId))
{
TaskInventoryItem item = m_items[itemId];
if (m_items.ContainsKey(itemId))
{
CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource);
}
else
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"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);
}
m_items.LockItemsForRead(false);
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
}
else
{
@ -347,8 +358,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);
}
}
@ -542,8 +554,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);
}
m_items.LockItemsForWrite(false);

View File

@ -3060,7 +3060,9 @@ namespace OpenSim.Region.Framework.Scenes
// The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents(
// as of this comment the interval is set in AddToPhysicalScene
if (Animator!=null)
Animator.UpdateMovementAnimations();
CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList;
@ -3072,7 +3074,7 @@ namespace OpenSim.Region.Framework.Scenes
m_lastColCount = coldata.Count;
}
if (coldata.Count != 0)
if (coldata.Count != 0 && Animator != null)
{
switch (Animator.CurrentMovementAnimation)
{

View File

@ -1243,7 +1243,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;
}

View File

@ -743,6 +743,8 @@ namespace OpenSim.Region.Physics.OdePlugin
break;
}
}
if (returnMass > _parent_scene.maximumMassObject)
returnMass = _parent_scene.maximumMassObject;
return returnMass;
}// end CalculateMass
@ -753,6 +755,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);

View File

@ -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);
}
}

View File

@ -91,7 +91,7 @@
; Maximum total size, and maximum size where a prim can be physical
NonPhysicalPrimMax = 256
PhysicalPrimMax = 10
PhysicalPrimMax = 10 ; (I think this was moved to the Regions.ini!)
ClampPrimSize = false
; Region crossing
@ -597,6 +597,9 @@
body_motor_joint_maxforce_tensor_linux = 5
body_motor_joint_maxforce_tensor_win = 5
; Maximum mass an object can be before it is clamped
maximum_mass_object = 10000.01
; ##
; ## Sculpted Prim settings
; ##