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

user_profiles
Justin Clark-Casey (justincc) 2013-02-07 23:09:47 +00:00
commit 9e17dc3daa
34 changed files with 6152 additions and 4573 deletions

View File

@ -1311,7 +1311,7 @@ namespace OpenSim.Data.MySQL
prim.Density = (float)(double)row["Density"]; prim.Density = (float)(double)row["Density"];
prim.GravityModifier = (float)(double)row["GravityModifier"]; prim.GravityModifier = (float)(double)row["GravityModifier"];
prim.Friction = (float)(double)row["Friction"]; prim.Friction = (float)(double)row["Friction"];
prim.Bounciness = (float)(double)row["Restitution"]; prim.Restitution = (float)(double)row["Restitution"];
return prim; return prim;
} }
@ -1663,7 +1663,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("Density", (double)prim.Density); cmd.Parameters.AddWithValue("Density", (double)prim.Density);
cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier);
cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); cmd.Parameters.AddWithValue("Friction", (double)prim.Friction);
cmd.Parameters.AddWithValue("Restitution", (double)prim.Bounciness); cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution);
if (prim.DynAttrs.Count > 0) if (prim.DynAttrs.Count > 0)
cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml());

View File

@ -176,6 +176,10 @@ namespace OpenSim.Framework
} }
} }
/// <summary>
/// Validate the key used for storing separate data stores.
/// </summary>
/// <param name='key'></param>
private static void ValidateKey(string key) private static void ValidateKey(string key)
{ {
if (key.Length < MIN_STORE_NAME_LENGTH) if (key.Length < MIN_STORE_NAME_LENGTH)
@ -196,7 +200,8 @@ namespace OpenSim.Framework
} }
public void Add(KeyValuePair<string, OSDMap> kvp) public void Add(KeyValuePair<string, OSDMap> kvp)
{ {
ValidateKey(kvp.Key);
lock (this) lock (this)
m_map.Add(kvp.Key, kvp.Value); m_map.Add(kvp.Key, kvp.Value);
} }

View File

@ -124,7 +124,7 @@ namespace OpenSim.Framework
public delegate void ObjectDrop(uint localID, IClientAPI remoteClient); public delegate void ObjectDrop(uint localID, IClientAPI remoteClient);
public delegate void UpdatePrimFlags( public delegate void UpdatePrimFlags(
uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient); uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient);
public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
@ -1356,6 +1356,8 @@ namespace OpenSim.Framework
void SendObjectPropertiesReply(ISceneEntity Entity); void SendObjectPropertiesReply(ISceneEntity Entity);
void SendPartPhysicsProprieties(ISceneEntity Entity);
void SendAgentOffline(UUID[] agentIDs); void SendAgentOffline(UUID[] agentIDs);
void SendAgentOnline(UUID[] agentIDs); void SendAgentOnline(UUID[] agentIDs);

View File

@ -54,6 +54,16 @@ namespace OpenSim.Framework.Servers.HttpServer
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
/// <summary>
/// This is a pending websocket request before it got an sucessful upgrade response.
/// The consumer must call handler.HandshakeAndUpgrade() to signal to the handler to
/// start the connection and optionally provide an origin authentication method.
/// </summary>
/// <param name="servicepath"></param>
/// <param name="handler"></param>
public delegate void WebSocketRequestDelegate(string servicepath, WebSocketHttpServerHandler handler);
/// <summary> /// <summary>
/// Gets or sets the debug level. /// Gets or sets the debug level.
/// </summary> /// </summary>
@ -87,6 +97,9 @@ namespace OpenSim.Framework.Servers.HttpServer
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers = protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
new Dictionary<string, PollServiceEventArgs>(); new Dictionary<string, PollServiceEventArgs>();
protected Dictionary<string, WebSocketRequestDelegate> m_WebSocketHandlers =
new Dictionary<string, WebSocketRequestDelegate>();
protected uint m_port; protected uint m_port;
protected uint m_sslport; protected uint m_sslport;
protected bool m_ssl; protected bool m_ssl;
@ -170,6 +183,22 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
} }
public void AddWebSocketHandler(string servicepath, WebSocketRequestDelegate handler)
{
lock (m_WebSocketHandlers)
{
if (!m_WebSocketHandlers.ContainsKey(servicepath))
m_WebSocketHandlers.Add(servicepath, handler);
}
}
public void RemoveWebSocketHandler(string servicepath)
{
lock (m_WebSocketHandlers)
if (m_WebSocketHandlers.ContainsKey(servicepath))
m_WebSocketHandlers.Remove(servicepath);
}
public List<string> GetStreamHandlerKeys() public List<string> GetStreamHandlerKeys()
{ {
lock (m_streamHandlers) lock (m_streamHandlers)
@ -409,9 +438,24 @@ namespace OpenSim.Framework.Servers.HttpServer
public void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request) public void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request)
{ {
OSHttpRequest req = new OSHttpRequest(context, request); OSHttpRequest req = new OSHttpRequest(context, request);
WebSocketRequestDelegate dWebSocketRequestDelegate = null;
lock (m_WebSocketHandlers)
{
if (m_WebSocketHandlers.ContainsKey(req.RawUrl))
dWebSocketRequestDelegate = m_WebSocketHandlers[req.RawUrl];
}
if (dWebSocketRequestDelegate != null)
{
dWebSocketRequestDelegate(req.Url.AbsolutePath, new WebSocketHttpServerHandler(req, context, 8192));
return;
}
OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
HandleRequest(req, resp); HandleRequest(req, resp);
// !!!HACK ALERT!!! // !!!HACK ALERT!!!
// There seems to be a bug in the underlying http code that makes subsequent requests // There seems to be a bug in the underlying http code that makes subsequent requests
@ -500,7 +544,7 @@ namespace OpenSim.Framework.Servers.HttpServer
LogIncomingToStreamHandler(request, requestHandler); LogIncomingToStreamHandler(request, requestHandler);
response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
if (requestHandler is IStreamedRequestHandler) if (requestHandler is IStreamedRequestHandler)
{ {
IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler;

View File

@ -98,7 +98,17 @@ namespace OpenSim.Framework.Servers.HttpServer
bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive); bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive);
bool AddJsonRPCHandler(string method, JsonRPCMethod handler); bool AddJsonRPCHandler(string method, JsonRPCMethod handler);
/// <summary>
/// Websocket HTTP server handlers.
/// </summary>
/// <param name="servicepath"></param>
/// <param name="handler"></param>
void AddWebSocketHandler(string servicepath, BaseHttpServer.WebSocketRequestDelegate handler);
void RemoveWebSocketHandler(string servicepath);
/// <summary> /// <summary>
/// Gets the XML RPC handler for given method name /// Gets the XML RPC handler for given method name
/// </summary> /// </summary>

File diff suppressed because it is too large Load Diff

View File

@ -70,6 +70,11 @@ namespace OpenSim.Framework.Servers.Tests
public void Close() { } public void Close() { }
public bool EndWhenDone { get { return false;} set { return;}} public bool EndWhenDone { get { return false;} set { return;}}
public HTTPNetworkContext GiveMeTheNetworkStreamIKnowWhatImDoing()
{
return new HTTPNetworkContext();
}
public event EventHandler<DisconnectedEventArgs> Disconnected = delegate { }; public event EventHandler<DisconnectedEventArgs> Disconnected = delegate { };
/// <summary> /// <summary>
/// A request have been received in the context. /// A request have been received in the context.

View File

@ -45,6 +45,7 @@ using System.Text.RegularExpressions;
using System.Xml; using System.Xml;
using System.Threading; using System.Threading;
using log4net; using log4net;
using log4net.Appender;
using Nini.Config; using Nini.Config;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenMetaverse; using OpenMetaverse;
@ -816,9 +817,22 @@ namespace OpenSim.Framework
return "."; return ".";
} }
public static string logFile()
{
foreach (IAppender appender in LogManager.GetRepository().GetAppenders())
{
if (appender is FileAppender)
{
return ((FileAppender)appender).File;
}
}
return "./OpenSim.log";
}
public static string logDir() public static string logDir()
{ {
return "."; return Path.GetDirectoryName(logFile());
} }
// From: http://coercedcode.blogspot.com/2008/03/c-generate-unique-filenames-within.html // From: http://coercedcode.blogspot.com/2008/03/c-generate-unique-filenames-within.html

View File

@ -96,6 +96,8 @@ namespace OpenSim.Region.ClientStack.Linden
// private static readonly string m_fetchInventoryPath = "0006/"; // private static readonly string m_fetchInventoryPath = "0006/";
private static readonly string m_copyFromNotecardPath = "0007/"; private static readonly string m_copyFromNotecardPath = "0007/";
// private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
private static readonly string m_getObjectPhysicsDataPath = "0101/";
/* 0102 - 0103 RESERVED */
private static readonly string m_UpdateAgentInformationPath = "0500/"; private static readonly string m_UpdateAgentInformationPath = "0500/";
// These are callbacks which will be setup by the scene so that we can update scene data when we // These are callbacks which will be setup by the scene so that we can update scene data when we
@ -204,6 +206,8 @@ namespace OpenSim.Region.ClientStack.Linden
m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData);
m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler("POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation); IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler("POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation);
m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler);
@ -873,6 +877,37 @@ namespace OpenSim.Region.ClientStack.Linden
return LLSDHelpers.SerialiseLLSDReply(response); return LLSDHelpers.SerialiseLLSDReply(response);
} }
public string GetObjectPhysicsData(string request, string path,
string param, IOSHttpRequest httpRequest,
IOSHttpResponse httpResponse)
{
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
OSDMap resp = new OSDMap();
OSDArray object_ids = (OSDArray)req["object_ids"];
for (int i = 0 ; i < object_ids.Count ; i++)
{
UUID uuid = object_ids[i].AsUUID();
SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid);
if (obj != null)
{
OSDMap object_data = new OSDMap();
object_data["PhysicsShapeType"] = obj.PhysicsShapeType;
object_data["Density"] = obj.Density;
object_data["Friction"] = obj.Friction;
object_data["Restitution"] = obj.Restitution;
object_data["GravityMultiplier"] = obj.GravityModifier;
resp[uuid.ToString()] = object_data;
}
}
string response = OSDParser.SerializeLLSDXmlString(resp);
return response;
}
public string UpdateAgentInformation(string request, string path, public string UpdateAgentInformation(string request, string path,
string param, IOSHttpRequest httpRequest, string param, IOSHttpRequest httpRequest,
IOSHttpResponse httpResponse) IOSHttpResponse httpResponse)

View File

@ -807,5 +807,13 @@ namespace OpenSim.Region.ClientStack.Linden
{ {
return EventQueueHelper.BuildEvent(eventName, eventBody); return EventQueueHelper.BuildEvent(eventName, eventBody);
} }
public void partPhysicsProperties(uint localID, byte physhapetype,
float density, float friction, float bounce, float gravmod,UUID avatarID)
{
OSD item = EventQueueHelper.partPhysicsProperties(localID, physhapetype,
density, friction, bounce, gravmod);
Enqueue(item, avatarID);
}
} }
} }

View File

@ -395,5 +395,25 @@ namespace OpenSim.Region.ClientStack.Linden
return message; return message;
} }
public static OSD partPhysicsProperties(uint localID, byte physhapetype,
float density, float friction, float bounce, float gravmod)
{
OSDMap physinfo = new OSDMap(6);
physinfo["LocalID"] = localID;
physinfo["Density"] = density;
physinfo["Friction"] = friction;
physinfo["GravityMultiplier"] = gravmod;
physinfo["Restitution"] = bounce;
physinfo["PhysicsShapeType"] = (int)physhapetype;
OSDArray array = new OSDArray(1);
array.Add(physinfo);
OSDMap llsdBody = new OSDMap(1);
llsdBody.Add("ObjectData", array);
return BuildEvent("ObjectPhysicsProperties", llsdBody);
}
} }
} }

View File

@ -2627,6 +2627,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
public void SendPartPhysicsProprieties(ISceneEntity entity)
{
SceneObjectPart part = (SceneObjectPart)entity;
if (part != null && AgentId != UUID.Zero)
{
try
{
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
uint localid = part.LocalId;
byte physshapetype = part.PhysicsShapeType;
float density = part.Density;
float friction = part.Friction;
float bounce = part.Restitution;
float gravmod = part.GravityModifier;
eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId);
}
}
catch (Exception ex)
{
m_log.Error("Unable to send part Physics Proprieties - exception: " + ex.ToString());
}
part.UpdatePhysRequired = false;
}
}
public void SendGroupNameReply(UUID groupLLUID, string GroupName) public void SendGroupNameReply(UUID groupLLUID, string GroupName)
{ {
@ -7035,10 +7063,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// 46,47,48 are special positions within the packet // 46,47,48 are special positions within the packet
// This may change so perhaps we need a better way // This may change so perhaps we need a better way
// of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?)
bool UsePhysics = (data[46] != 0) ? true : false; /*
bool IsTemporary = (data[47] != 0) ? true : false; bool UsePhysics = (data[46] != 0) ? true : false;
bool IsPhantom = (data[48] != 0) ? true : false; bool IsTemporary = (data[47] != 0) ? true : false;
handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); bool IsPhantom = (data[48] != 0) ? true : false;
handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this);
*/
bool UsePhysics = flags.AgentData.UsePhysics;
bool IsPhantom = flags.AgentData.IsPhantom;
bool IsTemporary = flags.AgentData.IsTemporary;
ObjectFlagUpdatePacket.ExtraPhysicsBlock[] blocks = flags.ExtraPhysics;
ExtraPhysicsData physdata = new ExtraPhysicsData();
if (blocks == null || blocks.Length == 0)
{
physdata.PhysShapeType = PhysShapeType.invalid;
}
else
{
ObjectFlagUpdatePacket.ExtraPhysicsBlock phsblock = blocks[0];
physdata.PhysShapeType = (PhysShapeType)phsblock.PhysicsShapeType;
physdata.Bounce = phsblock.Restitution;
physdata.Density = phsblock.Density;
physdata.Friction = phsblock.Friction;
physdata.GravitationModifier = phsblock.GravityMultiplier;
}
handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this);
} }
return true; return true;
} }

View File

@ -59,5 +59,7 @@ namespace OpenSim.Region.Framework.Interfaces
void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID); void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID);
OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono); OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono);
OSD BuildEvent(string eventName, OSD eventBody); OSD BuildEvent(string eventName, OSD eventBody);
void partPhysicsProperties(uint localID, byte physhapetype, float density, float friction, float bounce, float gravmod, UUID avatarID);
} }
} }

View File

@ -1408,7 +1408,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="SetPhantom"></param> /// <param name="SetPhantom"></param>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
protected internal void UpdatePrimFlags( protected internal void UpdatePrimFlags(
uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, IClientAPI remoteClient) uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient)
{ {
SceneObjectGroup group = GetGroupByPrim(localID); SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null) if (group != null)
@ -1416,7 +1416,28 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
{ {
// VolumeDetect can't be set via UI and will always be off when a change is made there // VolumeDetect can't be set via UI and will always be off when a change is made there
group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false); // now only change volume dtc if phantom off
if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data
{
bool vdtc;
if (SetPhantom) // if phantom keep volumedtc
vdtc = group.RootPart.VolumeDetectActive;
else // else turn it off
vdtc = false;
group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, vdtc);
}
else
{
SceneObjectPart part = GetSceneObjectPart(localID);
if (part != null)
{
part.UpdateExtraPhysics(PhysData);
if (part.UpdatePhysRequired)
remoteClient.SendPartPhysicsProprieties(part);
}
}
} }
} }
} }

View File

@ -1042,6 +1042,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
public UpdateRequired UpdateFlag { get; set; } public UpdateRequired UpdateFlag { get; set; }
public bool UpdatePhysRequired { get; set; }
/// <summary> /// <summary>
/// Used for media on a prim. /// Used for media on a prim.
@ -1390,7 +1391,7 @@ namespace OpenSim.Region.Framework.Scenes
public float Density { get; set; } public float Density { get; set; }
public float GravityModifier { get; set; } public float GravityModifier { get; set; }
public float Friction { get; set; } public float Friction { get; set; }
public float Bounciness { get; set; } public float Restitution { get; set; }
#endregion Public Properties with only Get #endregion Public Properties with only Get
@ -3964,8 +3965,8 @@ namespace OpenSim.Region.Framework.Scenes
GravityModifier = physdata.GravitationModifier; GravityModifier = physdata.GravitationModifier;
if(Friction != physdata.Friction) if(Friction != physdata.Friction)
Friction = physdata.Friction; Friction = physdata.Friction;
if(Bounciness != physdata.Bounce) if(Restitution != physdata.Bounce)
Bounciness = physdata.Bounce; Restitution = physdata.Bounce;
} }
/// <summary> /// <summary>
/// Update the flags on this prim. This covers properties such as phantom, physics and temporary. /// Update the flags on this prim. This covers properties such as phantom, physics and temporary.

View File

@ -618,7 +618,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader) private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader)
{ {
obj.Bounciness = reader.ReadElementContentAsFloat("Bounce", String.Empty); obj.Restitution = reader.ReadElementContentAsFloat("Bounce", String.Empty);
} }
private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader) private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader)
@ -1295,8 +1295,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("Density", sop.Density.ToString().ToLower()); writer.WriteElementString("Density", sop.Density.ToString().ToLower());
if (sop.Friction != 0.6f) if (sop.Friction != 0.6f)
writer.WriteElementString("Friction", sop.Friction.ToString().ToLower()); writer.WriteElementString("Friction", sop.Friction.ToString().ToLower());
if (sop.Bounciness != 0.5f) if (sop.Restitution != 0.5f)
writer.WriteElementString("Bounce", sop.Bounciness.ToString().ToLower()); writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower());
if (sop.GravityModifier != 1.0f) if (sop.GravityModifier != 1.0f)
writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower());

View File

@ -1678,5 +1678,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data) public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
{ {
} }
public void SendPartPhysicsProprieties(ISceneEntity entity)
{
}
} }
} }

View File

@ -0,0 +1,174 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using OpenSim.Framework.Servers;
using Mono.Addins;
using log4net;
using Nini.Config;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Framework.Servers.HttpServer;
namespace OpenSim.Region.OptionalModules.WebSocketEchoModule
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebSocketEchoModule")]
public class WebSocketEchoModule : ISharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool enabled;
public string Name { get { return "WebSocketEchoModule"; } }
public Type ReplaceableInterface { get { return null; } }
private HashSet<WebSocketHttpServerHandler> _activeHandlers = new HashSet<WebSocketHttpServerHandler>();
public void Initialise(IConfigSource pConfig)
{
enabled =(pConfig.Configs["WebSocketEcho"] != null);
if (enabled)
m_log.DebugFormat("[WebSocketEchoModule]: INITIALIZED MODULE");
}
/// <summary>
/// This method sets up the callback to WebSocketHandlerCallback below when a HTTPRequest comes in for /echo
/// </summary>
public void PostInitialise()
{
if (enabled)
MainServer.Instance.AddWebSocketHandler("/echo", WebSocketHandlerCallback);
}
// This gets called by BaseHttpServer and gives us an opportunity to set things on the WebSocket handler before we turn it on
public void WebSocketHandlerCallback(string path, WebSocketHttpServerHandler handler)
{
SubscribeToEvents(handler);
handler.SetChunksize(8192);
handler.NoDelay_TCP_Nagle = true;
handler.HandshakeAndUpgrade();
}
//These are our normal events
public void SubscribeToEvents(WebSocketHttpServerHandler handler)
{
handler.OnClose += HandlerOnOnClose;
handler.OnText += HandlerOnOnText;
handler.OnUpgradeCompleted += HandlerOnOnUpgradeCompleted;
handler.OnData += HandlerOnOnData;
handler.OnPong += HandlerOnOnPong;
}
public void UnSubscribeToEvents(WebSocketHttpServerHandler handler)
{
handler.OnClose -= HandlerOnOnClose;
handler.OnText -= HandlerOnOnText;
handler.OnUpgradeCompleted -= HandlerOnOnUpgradeCompleted;
handler.OnData -= HandlerOnOnData;
handler.OnPong -= HandlerOnOnPong;
}
private void HandlerOnOnPong(object sender, PongEventArgs pongdata)
{
m_log.Info("[WebSocketEchoModule]: Got a pong.. ping time: " + pongdata.PingResponseMS);
}
private void HandlerOnOnData(object sender, WebsocketDataEventArgs data)
{
WebSocketHttpServerHandler obj = sender as WebSocketHttpServerHandler;
obj.SendData(data.Data);
m_log.Info("[WebSocketEchoModule]: We received a bunch of ugly non-printable bytes");
obj.SendPingCheck();
}
private void HandlerOnOnUpgradeCompleted(object sender, UpgradeCompletedEventArgs completeddata)
{
WebSocketHttpServerHandler obj = sender as WebSocketHttpServerHandler;
_activeHandlers.Add(obj);
}
private void HandlerOnOnText(object sender, WebsocketTextEventArgs text)
{
WebSocketHttpServerHandler obj = sender as WebSocketHttpServerHandler;
obj.SendMessage(text.Data);
m_log.Info("[WebSocketEchoModule]: We received this: " + text.Data);
}
// Remove the references to our handler
private void HandlerOnOnClose(object sender, CloseEventArgs closedata)
{
WebSocketHttpServerHandler obj = sender as WebSocketHttpServerHandler;
UnSubscribeToEvents(obj);
lock (_activeHandlers)
_activeHandlers.Remove(obj);
obj.Dispose();
}
// Shutting down.. so shut down all sockets.
// Note.. this should be done outside of an ienumerable if you're also hook to the close event.
public void Close()
{
if (!enabled)
return;
// We convert this to a for loop so we're not in in an IEnumerable when the close
//call triggers an event which then removes item from _activeHandlers that we're enumerating
WebSocketHttpServerHandler[] items = new WebSocketHttpServerHandler[_activeHandlers.Count];
_activeHandlers.CopyTo(items);
for (int i = 0; i < items.Length; i++)
{
items[i].Close(string.Empty);
items[i].Dispose();
}
_activeHandlers.Clear();
MainServer.Instance.RemoveWebSocketHandler("/echo");
}
public void AddRegion(Scene scene)
{
m_log.DebugFormat("[WebSocketEchoModule]: REGION {0} ADDED", scene.RegionInfo.RegionName);
}
public void RemoveRegion(Scene scene)
{
m_log.DebugFormat("[WebSocketEchoModule]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
}
public void RegionLoaded(Scene scene)
{
m_log.DebugFormat("[WebSocketEchoModule]: REGION {0} LOADED", scene.RegionInfo.RegionName);
}
}
}

View File

@ -146,7 +146,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
{ {
foreach (PhysParameterEntry ppe in physScene.GetParameterList()) foreach (PhysParameterEntry ppe in physScene.GetParameterList())
{ {
float val = 0.0f; string val = string.Empty;
if (physScene.GetPhysicsParameter(ppe.name, out val)) if (physScene.GetPhysicsParameter(ppe.name, out val))
{ {
WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, ppe.name, val); WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, ppe.name, val);
@ -159,7 +159,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
} }
else else
{ {
float val = 0.0f; string val = string.Empty;
if (physScene.GetPhysicsParameter(parm, out val)) if (physScene.GetPhysicsParameter(parm, out val))
{ {
WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, parm, val); WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, parm, val);
@ -185,21 +185,12 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
return; return;
} }
string parm = "xxx"; string parm = "xxx";
float val = 0f; string valparm = String.Empty;
uint localID = (uint)PhysParameterEntry.APPLY_TO_NONE; // set default value uint localID = (uint)PhysParameterEntry.APPLY_TO_NONE; // set default value
try try
{ {
parm = cmdparms[2]; parm = cmdparms[2];
string valparm = cmdparms[3].ToLower(); valparm = cmdparms[3].ToLower();
if (valparm == "true")
val = PhysParameterEntry.NUMERIC_TRUE;
else
{
if (valparm == "false")
val = PhysParameterEntry.NUMERIC_FALSE;
else
val = float.Parse(valparm, Culture.NumberFormatInfo);
}
if (cmdparms.Length > 4) if (cmdparms.Length > 4)
{ {
if (cmdparms[4].ToLower() == "all") if (cmdparms[4].ToLower() == "all")
@ -224,7 +215,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
IPhysicsParameters physScene = scene.PhysicsScene as IPhysicsParameters; IPhysicsParameters physScene = scene.PhysicsScene as IPhysicsParameters;
if (physScene != null) if (physScene != null)
{ {
if (!physScene.SetPhysicsParameter(parm, val, localID)) if (!physScene.SetPhysicsParameter(parm, valparm, localID))
{ {
WriteError("Failed set of parameter '{0}' for region '{1}'", parm, scene.RegionInfo.RegionName); WriteError("Failed set of parameter '{0}' for region '{1}'", parm, scene.RegionInfo.RegionName);
} }

View File

@ -54,6 +54,22 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
private MockScriptEngine m_engine; private MockScriptEngine m_engine;
private ScriptModuleCommsModule m_smcm; private ScriptModuleCommsModule m_smcm;
[TestFixtureSetUp]
public void FixtureInit()
{
// Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
}
[TestFixtureTearDown]
public void TearDown()
{
// We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
// threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
// tests really shouldn't).
Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
}
[SetUp] [SetUp]
public override void SetUp() public override void SetUp()
{ {
@ -85,7 +101,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
private object InvokeOp(string name, params object[] args) private object InvokeOp(string name, params object[] args)
{ {
return m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, name, args); return InvokeOpOnHost(name, UUID.Zero, args);
}
private object InvokeOpOnHost(string name, UUID hostId, params object[] args)
{
return m_smcm.InvokeOperation(hostId, UUID.Zero, name, args);
} }
[Test] [Test]
@ -193,6 +214,44 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
Assert.That(value, Is.EqualTo("Times")); Assert.That(value, Is.EqualTo("Times"));
} }
/// <summary>
/// Test for reading and writing json to a notecard
/// </summary>
/// <remarks>
/// TODO: Really needs to test correct receipt of the link_message event. Could do this by directly fetching
/// it via the MockScriptEngine or perhaps by a dummy script instance.
/// </remarks>
[Test]
public void TestJsonWriteReadNotecard()
{
TestHelpers.InMethod();
TestHelpers.EnableLogging();
string notecardName = "nc1";
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
m_scene.AddSceneObject(so);
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
// Write notecard
UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName);
Assert.That(writeNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
TaskInventoryItem nc1Item = so.RootPart.Inventory.GetInventoryItem(notecardName);
Assert.That(nc1Item, Is.Not.Null);
// TODO: Should probably independently check the contents.
// Read notecard
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName);
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
string value = (string)InvokeOp("JsonGetValue", storeId, "Hello");
Assert.That(value, Is.EqualTo("World"));
}
public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; } public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; }
} }
} }

View File

@ -1234,5 +1234,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data) public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
{ {
} }
public void SendPartPhysicsProprieties(ISceneEntity entity)
{
}
} }
} }

View File

@ -220,7 +220,7 @@ public static class BSParam
(s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); },
(s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ),
new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes",
ConfigurationParameters.numericFalse, ConfigurationParameters.numericTrue,
(s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); },
(s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); }, (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); },
(s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ), (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ),
@ -641,24 +641,6 @@ public static class BSParam
return (b == ConfigurationParameters.numericTrue ? true : false); return (b == ConfigurationParameters.numericTrue ? true : false);
} }
private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v)
{
BSScene physScene = pPhysScene;
physScene.TaintedObject("BSParam.ResetBroadphasePoolTainted", delegate()
{
physScene.PE.ResetBroadphasePool(physScene.World);
});
}
private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v)
{
BSScene physScene = pPhysScene;
physScene.TaintedObject("BSParam.ResetConstraintSolver", delegate()
{
physScene.PE.ResetConstraintSolver(physScene.World);
});
}
// Search through the parameter definitions and return the matching // Search through the parameter definitions and return the matching
// ParameterDefn structure. // ParameterDefn structure.
// Case does not matter as names are compared after converting to lower case. // Case does not matter as names are compared after converting to lower case.
@ -722,6 +704,22 @@ public static class BSParam
} }
} }
private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v)
{
BSScene physScene = pPhysScene;
physScene.TaintedObject("BSParam.ResetBroadphasePoolTainted", delegate()
{
physScene.PE.ResetBroadphasePool(physScene.World);
});
}
private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v)
{
BSScene physScene = pPhysScene;
physScene.TaintedObject("BSParam.ResetConstraintSolver", delegate()
{
physScene.PE.ResetConstraintSolver(physScene.World);
});
}
} }
} }

View File

@ -75,6 +75,7 @@ public abstract class BSPhysObject : PhysicsActor
PhysicsScene = parentScene; PhysicsScene = parentScene;
LocalID = localID; LocalID = localID;
PhysObjectName = name; PhysObjectName = name;
Name = name; // PhysicsActor also has the name of the object. Someday consolidate.
TypeName = typeName; TypeName = typeName;
// We don't have any physical representation yet. // We don't have any physical representation yet.

View File

@ -876,14 +876,39 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
// will use the next time since it's pinned and shared memory. // will use the next time since it's pinned and shared memory.
// Some of the values require calling into the physics engine to get the new // Some of the values require calling into the physics engine to get the new
// value activated ('terrainFriction' for instance). // value activated ('terrainFriction' for instance).
public bool SetPhysicsParameter(string parm, float val, uint localID) public bool SetPhysicsParameter(string parm, string val, uint localID)
{ {
bool ret = false; bool ret = false;
float valf = 0f;
if (val.ToLower() == "true")
{
valf = PhysParameterEntry.NUMERIC_TRUE;
}
else
{
if (val.ToLower() == "false")
{
valf = PhysParameterEntry.NUMERIC_FALSE;
}
else
{
try
{
valf = float.Parse(val);
}
catch
{
valf = 0f;
}
}
}
BSParam.ParameterDefn theParam; BSParam.ParameterDefn theParam;
if (BSParam.TryGetParameter(parm, out theParam)) if (BSParam.TryGetParameter(parm, out theParam))
{ {
// Set the value in the C# code // Set the value in the C# code
theParam.setter(this, parm, localID, val); theParam.setter(this, parm, localID, valf);
// Optionally set the parameter in the unmanaged code // Optionally set the parameter in the unmanaged code
if (theParam.onObject != null) if (theParam.onObject != null)
@ -898,16 +923,16 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
case PhysParameterEntry.APPLY_TO_NONE: case PhysParameterEntry.APPLY_TO_NONE:
// This will cause a call into the physical world if some operation is specified (SetOnObject). // This will cause a call into the physical world if some operation is specified (SetOnObject).
objectIDs.Add(TERRAIN_ID); objectIDs.Add(TERRAIN_ID);
TaintedUpdateParameter(parm, objectIDs, val); TaintedUpdateParameter(parm, objectIDs, valf);
break; break;
case PhysParameterEntry.APPLY_TO_ALL: case PhysParameterEntry.APPLY_TO_ALL:
lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys); lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
TaintedUpdateParameter(parm, objectIDs, val); TaintedUpdateParameter(parm, objectIDs, valf);
break; break;
default: default:
// setting only one localID // setting only one localID
objectIDs.Add(localID); objectIDs.Add(localID);
TaintedUpdateParameter(parm, objectIDs, val); TaintedUpdateParameter(parm, objectIDs, valf);
break; break;
} }
} }
@ -942,14 +967,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
// Get parameter. // Get parameter.
// Return 'false' if not able to get the parameter. // Return 'false' if not able to get the parameter.
public bool GetPhysicsParameter(string parm, out float value) public bool GetPhysicsParameter(string parm, out string value)
{ {
float val = 0f; string val = String.Empty;
bool ret = false; bool ret = false;
BSParam.ParameterDefn theParam; BSParam.ParameterDefn theParam;
if (BSParam.TryGetParameter(parm, out theParam)) if (BSParam.TryGetParameter(parm, out theParam))
{ {
val = theParam.getter(this); val = theParam.getter(this).ToString();
ret = true; ret = true;
} }
value = val; value = val;

View File

@ -608,7 +608,7 @@ public sealed class BSShapeCollection : IDisposable
// Since we're recreating new, get rid of the reference to the previous shape // Since we're recreating new, get rid of the reference to the previous shape
DereferenceShape(prim.PhysShape, shapeCallback); DereferenceShape(prim.PhysShape, shapeCallback);
newShape = CreatePhysicalMesh(prim.PhysObjectName, newMeshKey, prim.BaseShape, prim.Size, lod); newShape = CreatePhysicalMesh(prim, newMeshKey, prim.BaseShape, prim.Size, lod);
// Take evasive action if the mesh was not constructed. // Take evasive action if the mesh was not constructed.
newShape = VerifyMeshCreated(newShape, prim); newShape = VerifyMeshCreated(newShape, prim);
@ -619,7 +619,7 @@ public sealed class BSShapeCollection : IDisposable
return true; // 'true' means a new shape has been added to this prim return true; // 'true' means a new shape has been added to this prim
} }
private BulletShape CreatePhysicalMesh(string objName, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) private BulletShape CreatePhysicalMesh(BSPhysObject prim, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
{ {
BulletShape newShape = new BulletShape(); BulletShape newShape = new BulletShape();
@ -631,7 +631,7 @@ public sealed class BSShapeCollection : IDisposable
} }
else else
{ {
IMesh meshData = PhysicsScene.mesher.CreateMesh(objName, pbs, size, lod, IMesh meshData = PhysicsScene.mesher.CreateMesh(prim.PhysObjectName, pbs, size, lod,
false, // say it is not physical so a bounding box is not built false, // say it is not physical so a bounding box is not built
false // do not cache the mesh and do not use previously built versions false // do not cache the mesh and do not use previously built versions
); );
@ -651,18 +651,20 @@ public sealed class BSShapeCollection : IDisposable
realIndicesIndex = 0; realIndicesIndex = 0;
for (int tri = 0; tri < indices.Length; tri += 3) for (int tri = 0; tri < indices.Length; tri += 3)
{ {
// Compute displacements into vertex array for each vertex of the triangle
int v1 = indices[tri + 0] * 3; int v1 = indices[tri + 0] * 3;
int v2 = indices[tri + 1] * 3; int v2 = indices[tri + 1] * 3;
int v3 = indices[tri + 2] * 3; int v3 = indices[tri + 2] * 3;
if (!((verticesAsFloats[v1 + 0] == verticesAsFloats[v2 + 0] // Check to see if any two of the vertices are the same
if (!( ( verticesAsFloats[v1 + 0] == verticesAsFloats[v2 + 0]
&& verticesAsFloats[v1 + 1] == verticesAsFloats[v2 + 1] && verticesAsFloats[v1 + 1] == verticesAsFloats[v2 + 1]
&& verticesAsFloats[v1 + 2] == verticesAsFloats[v2 + 2]) && verticesAsFloats[v1 + 2] == verticesAsFloats[v2 + 2])
|| (verticesAsFloats[v2 + 0] == verticesAsFloats[v3 + 0] || ( verticesAsFloats[v2 + 0] == verticesAsFloats[v3 + 0]
&& verticesAsFloats[v2 + 1] == verticesAsFloats[v3 + 1] && verticesAsFloats[v2 + 1] == verticesAsFloats[v3 + 1]
&& verticesAsFloats[v2 + 2] == verticesAsFloats[v3 + 2]) && verticesAsFloats[v2 + 2] == verticesAsFloats[v3 + 2])
|| (verticesAsFloats[v1 + 0] == verticesAsFloats[v3 + 0] || ( verticesAsFloats[v1 + 0] == verticesAsFloats[v3 + 0]
&& verticesAsFloats[v1 + 1] == verticesAsFloats[v3 + 1] && verticesAsFloats[v1 + 1] == verticesAsFloats[v3 + 1]
&& verticesAsFloats[v1 + 2] == verticesAsFloats[v3 + 2])) && verticesAsFloats[v1 + 2] == verticesAsFloats[v3 + 2]) )
) )
{ {
// None of the vertices of the triangles are the same. This is a good triangle; // None of the vertices of the triangles are the same. This is a good triangle;
@ -676,8 +678,16 @@ public sealed class BSShapeCollection : IDisposable
DetailLog("{0},BSShapeCollection.CreatePhysicalMesh,origTri={1},realTri={2},numVerts={3}", DetailLog("{0},BSShapeCollection.CreatePhysicalMesh,origTri={1},realTri={2},numVerts={3}",
BSScene.DetailLogZero, indices.Length / 3, realIndicesIndex / 3, verticesAsFloats.Length / 3); BSScene.DetailLogZero, indices.Length / 3, realIndicesIndex / 3, verticesAsFloats.Length / 3);
newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, if (realIndicesIndex != 0)
realIndicesIndex, indices, verticesAsFloats.Length/3, verticesAsFloats); {
newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World,
realIndicesIndex, indices, verticesAsFloats.Length / 3, verticesAsFloats);
}
else
{
PhysicsScene.Logger.ErrorFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}",
LogHeader, prim.PhysObjectName, prim.RawPosition, PhysicsScene.Name);
}
} }
} }
newShape.shapeKey = newMeshKey; newShape.shapeKey = newMeshKey;

View File

@ -60,14 +60,14 @@ namespace OpenSim.Region.Physics.Manager
// Set parameter on a specific or all instances. // Set parameter on a specific or all instances.
// Return 'false' if not able to set the parameter. // Return 'false' if not able to set the parameter.
bool SetPhysicsParameter(string parm, float value, uint localID); bool SetPhysicsParameter(string parm, string value, uint localID);
// Get parameter. // Get parameter.
// Return 'false' if not able to get the parameter. // Return 'false' if not able to get the parameter.
bool GetPhysicsParameter(string parm, out float value); bool GetPhysicsParameter(string parm, out string value);
// Get parameter from a particular object // Get parameter from a particular object
// TODO: // TODO:
// bool GetPhysicsParameter(string parm, out float value, uint localID); // bool GetPhysicsParameter(string parm, out string value, uint localID);
} }
} }

View File

@ -7602,7 +7602,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ExtraPhysicsData physdata = new ExtraPhysicsData(); ExtraPhysicsData physdata = new ExtraPhysicsData();
physdata.Density = part.Density; physdata.Density = part.Density;
physdata.Bounce = part.Bounciness; physdata.Bounce = part.Restitution;
physdata.GravitationModifier = part.GravityModifier; physdata.GravitationModifier = part.GravityModifier;
physdata.PhysShapeType = (PhysShapeType)shape_type; physdata.PhysShapeType = (PhysShapeType)shape_type;

View File

@ -420,7 +420,7 @@ namespace OpenSim.Region.UserStatistics
Encoding encoding = Encoding.ASCII; Encoding encoding = Encoding.ASCII;
int sizeOfChar = encoding.GetByteCount("\n"); int sizeOfChar = encoding.GetByteCount("\n");
byte[] buffer = encoding.GetBytes("\n"); byte[] buffer = encoding.GetBytes("\n");
string logfile = Util.logDir() + "/" + "OpenSim.log"; string logfile = Util.logFile();
FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Int64 tokenCount = 0; Int64 tokenCount = 0;
Int64 endPosition = fs.Length / sizeOfChar; Int64 endPosition = fs.Length / sizeOfChar;

View File

@ -85,7 +85,7 @@ namespace OpenSim.Tests.Common
public bool PostScriptEvent(UUID itemID, string name, object[] args) public bool PostScriptEvent(UUID itemID, string name, object[] args)
{ {
throw new System.NotImplementedException (); return false;
} }
public bool PostObjectEvent(UUID itemID, string name, object[] args) public bool PostObjectEvent(UUID itemID, string name, object[] args)

View File

@ -1276,5 +1276,10 @@ namespace OpenSim.Tests.Common.Mock
public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data) public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
{ {
} }
public void SendPartPhysicsProprieties(ISceneEntity entity)
{
}
} }
} }

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1466,6 +1466,8 @@
</Files> </Files>
</Project> </Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack.LindenCaps" path="OpenSim/Region/ClientStack/Linden/Caps" type="Library"> <Project frameworkVersion="v3_5" name="OpenSim.Region.ClientStack.LindenCaps" path="OpenSim/Region/ClientStack/Linden/Caps" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
@ -1508,6 +1510,7 @@
</Files> </Files>
</Project> </Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.CoreModules" path="OpenSim/Region/CoreModules" type="Library"> <Project frameworkVersion="v3_5" name="OpenSim.Region.CoreModules" path="OpenSim/Region/CoreModules" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>