Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

This commit is contained in:
Diva Canto
2013-05-20 09:26:15 -07:00
19 changed files with 13719 additions and 13698 deletions

View File

@@ -426,7 +426,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("="))
assetServerURL = assetServerURL + "/";
m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", assetServerURL + id);
// m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", assetServerURL + id);
AssetService.Get(assetServerURL + id, InventoryAccessModule, AssetReceived);
return;
}

View File

@@ -937,6 +937,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
EnableChildAgents(sp);
// Finally, kill the agent we just created at the destination.
// XXX: Possibly this should be done asynchronously.
Scene.SimulationService.CloseAgent(finalDestination, sp.UUID);
}
@@ -1481,9 +1482,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return agent;
}
//AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
agent.ControllingClient.RequestClientInfo();
//m_log.Debug("BEFORE CROSS");
//Scene.DumpChildrenSeeds(UUID);
//DumpKnownRegions();
@@ -1543,15 +1541,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agent.CloseChildAgents(neighbourx, neighboury);
AgentHasMovedAway(agent, false);
// // the user may change their profile information in other region,
// // so the userinfo in UserProfileCache is not reliable any more, delete it
// // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
// if (agent.Scene.NeedSceneCacheClear(agent.UUID))
// {
// m_log.DebugFormat(
// "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
// }
//m_log.Debug("AFTER CROSS");
//Scene.DumpChildrenSeeds(UUID);

View File

@@ -317,7 +317,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
// s.RegionInfo.RegionName, destination.RegionHandle);
Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id, false); });
m_scenes[destination.RegionID].IncomingCloseAgent(id, false);
return true;
}

View File

@@ -422,13 +422,13 @@ namespace OpenSim.Region.Framework.Scenes
// is not allowed to change the export flag.
bool denyExportChange = false;
m_log.InfoFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions);
// m_log.DebugFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions);
// If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export
if ((item.BasePermissions & (uint)(PermissionMask.All | PermissionMask.Export)) != (uint)(PermissionMask.All | PermissionMask.Export) || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0 || item.CreatorIdAsUuid != item.Owner)
denyExportChange = true;
m_log.InfoFormat("[XXX]: Deny Export Update {0}", denyExportChange);
// m_log.DebugFormat("[XXX]: Deny Export Update {0}", denyExportChange);
// If it is already set, force it set and also force full perm
// else prevent setting it. It can and should never be set unless
@@ -452,7 +452,7 @@ namespace OpenSim.Region.Framework.Scenes
// If the new state is exportable, force full perm
if ((itemUpd.EveryOnePermissions & (uint)PermissionMask.Export) != 0)
{
m_log.InfoFormat("[XXX]: Force full perm");
// m_log.DebugFormat("[XXX]: Force full perm");
itemUpd.NextPermissions = (uint)(PermissionMask.All);
}
}

View File

@@ -3435,15 +3435,12 @@ namespace OpenSim.Region.Framework.Scenes
if (closeChildAgents && CapsModule != null)
CapsModule.RemoveCaps(agentID);
// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
// // this method is doing is HORRIBLE!!!
// Commented pending deletion since this method no longer appears to do anything at all
// avatar.Scene.NeedSceneCacheClear(avatar.UUID);
if (closeChildAgents && !isChildAgent)
{
List<ulong> regions = avatar.KnownRegionHandles;
regions.Remove(RegionInfo.RegionHandle);
// This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours.
m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
}

View File

@@ -222,9 +222,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst)
{
foreach (ulong handle in regionslst)
{
SendCloseChildAgent(agentID, handle);
}
Util.FireAndForget(delegate { SendCloseChildAgent(agentID, handle); });
}
public List<GridRegion> RequestNamedRegions(string name, int maxNumber)

View File

@@ -3137,10 +3137,8 @@ namespace OpenSim.Region.Framework.Scenes
if (byebyeRegions.Count > 0)
{
m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents");
Util.FireAndForget(delegate
{
m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions);
});
m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions);
}
foreach (ulong handle in byebyeRegions)

View File

@@ -289,6 +289,9 @@ namespace OpenSim.Region.Framework.Scenes
private void statsHeartBeat(object sender, EventArgs e)
{
if (!m_scene.Active)
return;
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[22];
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();

View File

@@ -79,6 +79,8 @@ namespace OpenSim.Region.Physics.Meshing
private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh
private List<List<Vector3>> mConvexHulls = null;
private Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>();
public Meshmerizer(IConfigSource config)
@@ -358,6 +360,61 @@ namespace OpenSim.Region.Physics.Meshing
physicsParms = (OSDMap)map["physics_shape"]; // old asset format
else if (map.ContainsKey("physics_mesh"))
physicsParms = (OSDMap)map["physics_mesh"]; // new asset format
else if (map.ContainsKey("medium_lod"))
physicsParms = (OSDMap)map["medium_lod"]; // if no physics mesh, try to fall back to medium LOD display mesh
else if (map.ContainsKey("high_lod"))
physicsParms = (OSDMap)map["high_lod"]; // if all else fails, use highest LOD display mesh and hope it works :)
if (map.ContainsKey("physics_convex"))
{ // pull this out also in case physics engine can use it
try
{
OSDMap convexBlock = (OSDMap)map["physics_convex"];
if (convexBlock.ContainsKey("HullList"))
{
byte[] hullList = convexBlock["HullList"].AsBinary();
Vector3 min = new Vector3(-0.5f, -0.5f, -0.5f);
if (convexBlock.ContainsKey("Min")) min = convexBlock["Min"].AsVector3();
Vector3 max = new Vector3(0.5f, 0.5f, 0.5f);
if (convexBlock.ContainsKey("Max")) max = convexBlock["Max"].AsVector3();
// decompress and decode hull points
byte[] posBytes = DecompressOsd(convexBlock["Positions"].AsBinary()).AsBinary();
List<List<Vector3>> hulls = new List<List<Vector3>>();
int posNdx = 0;
foreach (byte cnt in hullList)
{
int count = cnt == 0 ? 256 : cnt;
List<Vector3> hull = new List<Vector3>();
for (int i = 0; i < count; i++)
{
ushort uX = Utils.BytesToUInt16(posBytes, posNdx); posNdx += 2;
ushort uY = Utils.BytesToUInt16(posBytes, posNdx); posNdx += 2;
ushort uZ = Utils.BytesToUInt16(posBytes, posNdx); posNdx += 2;
Vector3 pos = new Vector3(
Utils.UInt16ToFloat(uX, min.X, max.X),
Utils.UInt16ToFloat(uY, min.Y, max.Y),
Utils.UInt16ToFloat(uZ, min.Z, max.Z)
);
hull.Add(pos);
}
hulls.Add(hull);
}
mConvexHulls = hulls;
}
}
catch (Exception e)
{
m_log.WarnFormat("[MESH]: exception decoding convex block: {0}", e.Message);
}
}
if (physicsParms == null)
{
@@ -377,27 +434,7 @@ namespace OpenSim.Region.Physics.Meshing
// byte[] decompressed = new byte[physSize * 5];
try
{
using (MemoryStream inMs = new MemoryStream(meshBytes))
{
using (MemoryStream outMs = new MemoryStream())
{
using (ZOutputStream zOut = new ZOutputStream(outMs))
{
byte[] readBuffer = new byte[2048];
int readLen = 0;
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
{
zOut.Write(readBuffer, 0, readLen);
}
zOut.Flush();
outMs.Seek(0, SeekOrigin.Begin);
byte[] decompressedBuf = outMs.GetBuffer();
decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf);
}
}
}
decodedMeshOsd = DecompressOsd(meshBytes);
}
catch (Exception e)
{
@@ -424,6 +461,41 @@ namespace OpenSim.Region.Physics.Meshing
return true;
}
/// <summary>
/// decompresses a gzipped OSD object
/// </summary>
/// <param name="decodedOsd"></param> the OSD object
/// <param name="meshBytes"></param>
/// <returns></returns>
private static OSD DecompressOsd(byte[] meshBytes)
{
OSD decodedOsd = null;
using (MemoryStream inMs = new MemoryStream(meshBytes))
{
using (MemoryStream outMs = new MemoryStream())
{
using (ZOutputStream zOut = new ZOutputStream(outMs))
{
byte[] readBuffer = new byte[2048];
int readLen = 0;
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
{
zOut.Write(readBuffer, 0, readLen);
}
zOut.Flush();
outMs.Seek(0, SeekOrigin.Begin);
byte[] decompressedBuf = outMs.GetBuffer();
decodedOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf);
}
}
}
return decodedOsd;
}
/// <summary>
/// Generate the co-ords and faces necessary to construct a mesh from the sculpt data the accompanies a prim.
/// </summary>
@@ -700,6 +772,27 @@ namespace OpenSim.Region.Physics.Meshing
return true;
}
/// <summary>
/// temporary prototype code - please do not use until the interface has been finalized!
/// </summary>
/// <param name="size">value to scale the hull points by</param>
/// <returns>a list of hulls if they exist and have been successfully decoded, otherwise null</returns>
public List<List<Vector3>> GetConvexHulls(Vector3 size)
{
if (mConvexHulls == null)
return null;
List<List<Vector3>> hulls = new List<List<Vector3>>();
foreach (var hull in mConvexHulls)
{
List<Vector3> verts = new List<Vector3>();
foreach (var vert in hull)
verts.Add(vert * size);
}
return hulls;
}
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
{
return CreateMesh(primName, primShape, size, lod, false, true);

View File

@@ -544,21 +544,33 @@ namespace OpenSim.Region.ScriptEngine.Shared
set {m_data = value; }
}
// Function to obtain LSL type from an index. This is needed
// because LSL lists allow for multiple types, and safely
// iterating in them requires a type check.
/// <summary>
/// Obtain LSL type from an index.
/// </summary>
/// <remarks>
/// This is needed because LSL lists allow for multiple types, and safely
/// iterating in them requires a type check.
/// </remarks>
/// <returns></returns>
/// <param name='itemIndex'></param>
public Type GetLSLListItemType(int itemIndex)
{
return m_data[itemIndex].GetType();
}
// Member functions to obtain item as specific types.
// For cases where implicit conversions would apply if items
// were not in a list (e.g. integer to float, but not float
// to integer) functions check for alternate types so as to
// down-cast from Object to the correct type.
// Note: no checks for item index being valid are performed
/// <summary>
/// Obtain float from an index.
/// </summary>
/// <remarks>
/// For cases where implicit conversions would apply if items
/// were not in a list (e.g. integer to float, but not float
/// to integer) functions check for alternate types so as to
/// down-cast from Object to the correct type.
/// Note: no checks for item index being valid are performed
/// </remarks>
/// <returns></returns>
/// <param name='itemIndex'></param>
public LSL_Types.LSLFloat GetLSLFloatItem(int itemIndex)
{
if (m_data[itemIndex] is LSL_Types.LSLInteger)
@@ -589,26 +601,14 @@ namespace OpenSim.Region.ScriptEngine.Shared
public LSL_Types.LSLString GetLSLStringItem(int itemIndex)
{
if (m_data[itemIndex] is LSL_Types.key)
{
return (LSL_Types.key)m_data[itemIndex];
}
else if (m_data[itemIndex] is String)
{
return new LSL_Types.LSLString((string)m_data[itemIndex]);
}
else if (m_data[itemIndex] is LSL_Types.LSLFloat)
{
return new LSL_Types.LSLString((LSLFloat)m_data[itemIndex]);
}
else if (m_data[itemIndex] is LSL_Types.LSLInteger)
{
return new LSL_Types.LSLString((LSLInteger)m_data[itemIndex]);
}
else
{
return (LSL_Types.LSLString)m_data[itemIndex];
}
if (m_data[itemIndex] is LSL_Types.key)
{
return (LSL_Types.key)m_data[itemIndex];
}
else
{
return new LSL_Types.LSLString(m_data[itemIndex].ToString());
}
}
public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex)