Merge branch 'master' into httptests

httptests
UbitUmarov 2016-11-16 13:07:23 +00:00
commit ec8393571f
42 changed files with 788 additions and 7947 deletions

2
.gitignore vendored
View File

@ -31,6 +31,7 @@
*/*/*/*/*/bin
*/*/*/*/*/*/bin
*/*/*/*/*/*/*/bin
.vs/
addon-modules/
bin/Debug/*.dll
bin/*.dll.mdb
@ -93,7 +94,6 @@ TAGS
Makefile.local
bin/.version
compile.bat
addon-modules
OpenSim/Data/Tests/test-results/
OpenSim/Framework/Serialization/Tests/test-results/
OpenSim/Framework/Servers/Tests/test-results/

File diff suppressed because it is too large Load Diff

View File

@ -286,7 +286,7 @@ namespace OpenSim.Groups
string requestingAgentID = request["RequestingAgentID"].ToString();
if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID))
NullResult(result, string.Format("Insufficient permissions.", agentID));
NullResult(result, string.Format("Insufficient permissions. {0}", agentID));
else
result["RESULT"] = "true";
}

View File

@ -193,7 +193,9 @@ namespace OpenSim.Data.MySQL
{
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm);
// cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm);
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1");
cmd.Parameters.AddWithValue("?uuid", principalID.ToString());
cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
@ -212,7 +214,10 @@ namespace OpenSim.Data.MySQL
{
cmd.Connection = dbcon;
cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm);
// cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm);
cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID");
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
cmd.Parameters.AddWithValue("?AssetID", assetID.ToString());

View File

@ -174,7 +174,9 @@ namespace OpenSim.Data.PGSQL
{
using (NpgsqlCommand cmd = new NpgsqlCommand())
{
cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1", m_Realm);
// cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1", m_Realm);
cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1");
UUID princID = UUID.Zero;
UUID.TryParse(principalID, out princID);
@ -194,11 +196,18 @@ namespace OpenSim.Data.PGSQL
{
using (NpgsqlCommand cmd = new NpgsqlCommand())
{
/*
cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions""
from inventoryitems
where ""avatarID"" = :PrincipalID
and ""assetID"" = :AssetID
group by ""assetID"" ", m_Realm);
*/
cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions""
from inventoryitems
where ""avatarID"" = :PrincipalID
and ""assetID"" = :AssetID
group by ""assetID"" ");
cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID));
cmd.Parameters.Add(m_database.CreateParameter("AssetID", assetID));

View File

@ -81,6 +81,7 @@ namespace OpenSim.Framework
public Vector3 ClientAgentPosition;
public bool UseClientAgentPosition;
public bool NeedsCameraCollision;
public AgentUpdateArgs()
{

View File

@ -120,14 +120,13 @@ namespace OpenSim.Region.ClientStack.Linden
public virtual void RegisterCaps(UUID agentID, Caps caps)
{
UUID capID = UUID.Random();
if (m_URL == "localhost")
{
m_log.DebugFormat("[GET_DISPLAY_NAMES]: /CAPS/agents/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
string capUrl = "/CAPS/" + UUID.Random() + "/";
// m_log.DebugFormat("[GET_DISPLAY_NAMES]: {0} in region {1}", capUrl, m_scene.RegionInfo.RegionName);
caps.RegisterHandler(
"GetDisplayNames",
new GetDisplayNamesHandler("/CAPS/agents" + capID + "/", m_UserManager, "GetDisplayNames", agentID.ToString()));
new GetDisplayNamesHandler(capUrl, m_UserManager, "GetDisplayNames", agentID.ToString()));
}
else
{

View File

@ -2856,6 +2856,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendSelectedPartsProprieties(List<ISceneEntity> parts)
{
/* not in use
// udp part
ObjectPropertiesPacket packet =
(ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
@ -2893,6 +2894,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
llsdBody.Add("ObjectData", array);
eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId);
*/
}
@ -4839,7 +4841,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates =
new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>();
List<SceneObjectPart> needPhysics = new List<SceneObjectPart>();
EntityUpdate iupdate;
Int32 timeinqueue; // this is just debugging code & can be dropped later
@ -4867,6 +4871,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (update.Entity is SceneObjectPart)
{
SceneObjectPart sop = (SceneObjectPart)update.Entity;
needPhysics.Add(sop);
ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop);
objectPropertiesBlocks.Value.Add(objPropDB);
propertyUpdates.Value.Add(update);
@ -4932,7 +4937,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// fpcnt++;
// fbcnt++;
}
}
if(needPhysics.Count > 0)
{
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
if(eq != null)
{
OSDArray array = new OSDArray();
foreach(SceneObjectPart sop in needPhysics)
{
OSDMap physinfo = new OSDMap(6);
physinfo["LocalID"] = sop.LocalId;
physinfo["Density"] = sop.Density;
physinfo["Friction"] = sop.Friction;
physinfo["GravityMultiplier"] = sop.GravityModifier;
physinfo["Restitution"] = sop.Restitution;
physinfo["PhysicsShapeType"] = (int)sop.PhysicsShapeType;
array.Add(physinfo);
}
OSDMap llsdBody = new OSDMap(1);
llsdBody.Add("ObjectData", array);
eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId);
}
}
// m_log.WarnFormat("[PACKETCOUNTS] queued {0} property packets with {1} blocks",ppcnt,pbcnt);
@ -6234,7 +6263,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
bool movement = CheckAgentMovementUpdateSignificance(x);
bool camera = CheckAgentCameraUpdateSignificance(x);
// Was there a significant movement/state change?
if (movement)
{
@ -6245,6 +6274,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation;
m_thisAgentUpdateArgs.State = x.State;
m_thisAgentUpdateArgs.NeedsCameraCollision = !camera;
UpdateAgent handlerAgentUpdate = OnAgentUpdate;
UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate;
@ -6253,7 +6284,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerAgentUpdate != null)
OnAgentUpdate(this, m_thisAgentUpdateArgs);
}
// Was there a significant camera(s) change?
@ -6264,6 +6295,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis;
m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis;
m_thisAgentUpdateArgs.NeedsCameraCollision = true;
UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate;
if (handlerAgentCameraUpdate != null)

View File

@ -161,6 +161,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Total byte count of unacked packets sent to this client</summary>
public int UnackedBytes;
private int m_packetsUnAckReported;
/// <summary>Total number of received packets that we have reported to the OnPacketStats event(s)</summary>
private int m_packetsReceivedReported;
/// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary>
@ -389,11 +390,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
int newPacketsReceived = PacketsReceived - m_packetsReceivedReported;
int newPacketsSent = PacketsSent - m_packetsSentReported;
int newPacketUnAck = UnackedBytes - m_packetsUnAckReported;
callback(newPacketsReceived, newPacketsSent, UnackedBytes);
m_packetsReceivedReported += newPacketsReceived;
m_packetsSentReported += newPacketsSent;
m_packetsUnAckReported += newPacketUnAck;
}
}

View File

@ -323,7 +323,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected int m_elapsedMSSinceLastStatReport = 0;
/// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary>
protected int m_tickLastOutgoingPacketHandler;
protected double m_tickLastOutgoingPacketHandler;
/// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary>
protected int m_elapsedMSOutgoingPacketHandler;
@ -356,20 +356,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
protected ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
/// <summary>
/// Event used to signal when queued packets are available for sending.
/// </summary>
/// <remarks>
/// This allows the outbound loop to only operate when there is data to send rather than continuously polling.
/// Some data is sent immediately and not queued. That data would not trigger this event.
/// WRONG use. May be usefull in future revision
/// </remarks>
// protected AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false);
protected Pool<IncomingPacket> m_incomingPacketPool;
/// <summary>
@ -456,10 +444,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int now = start;
while (now == start)
now = Environment.TickCount;
TickCountResolution += (float)(now - start) * 0.1f;
TickCountResolution += (float)(now - start);
}
TickCountResolution = (float)Math.Ceiling(TickCountResolution);
m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms");
m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution * 0.1f + "ms");
TickCountResolution = 0f;
for (int i = 0; i < 100; i++)
{
double start = Util.GetTimeStampMS();
double now = start;
while (now == start)
now = Util.GetTimeStampMS();
TickCountResolution += (float)((now - start));
}
TickCountResolution = (float)Math.Round(TickCountResolution * 0.01f,6,MidpointRounding.AwayFromZero);
m_log.Info("[LLUDPSERVER]: Average Util.GetTimeStampMS resolution: " + TickCountResolution + "ms");
#endregion Environment.TickCount Measurement
@ -467,8 +467,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int sceneThrottleBps = 0;
bool usePools = false;
IConfig config = configSource.Configs["ClientStack.LindenUDP"];
if (config != null)
{
@ -927,10 +925,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
PacketPool.Instance.ReturnPacket(packet);
/// WRONG use. May be usefull in future revision
// if (packetQueued)
// m_dataPresentEvent.Set();
}
/// <summary>
@ -2079,14 +2073,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_sendPing = false;
// Update elapsed time
int thisTick = Environment.TickCount & Int32.MaxValue;
if (m_tickLastOutgoingPacketHandler > thisTick)
m_elapsedMSOutgoingPacketHandler += ((Int32.MaxValue - m_tickLastOutgoingPacketHandler) + thisTick);
else
m_elapsedMSOutgoingPacketHandler += (thisTick - m_tickLastOutgoingPacketHandler);
double thisTick = Util.GetTimeStampMS();
int deltaMS = (int)(thisTick - m_tickLastOutgoingPacketHandler);
m_tickLastOutgoingPacketHandler = thisTick;
// update some 1ms resolution chained timers
m_elapsedMSOutgoingPacketHandler += deltaMS;
// Check for pending outgoing resends every 100ms
if (m_elapsedMSOutgoingPacketHandler >= 100)
{
@ -2109,15 +2103,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_sendPing = true;
m_elapsed500MSOutgoingPacketHandler = 0;
}
#endregion Update Timers
// Use this for emergency monitoring -- bug hunting
//if (m_scene.EmergencyMonitoring)
// clientPacketHandler = MonitoredClientOutgoingPacketHandler;
//else
// clientPacketHandler = ClientOutgoingPacketHandler;
// Handle outgoing packets, resends, acknowledgements, and pings for each
// client. m_packetSent will be set to true if a packet is sent
Scene.ForEachClient(clientPacketHandler);
@ -2129,7 +2116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if(Scene.GetNumberOfClients() == 0)
{
Thread.Sleep(250); // be friendly to PIs, but how long ??
Thread.Sleep(100);
}
else if (!m_packetSent)
// Thread.Sleep((int)TickCountResolution); outch this is bad on linux
@ -2204,99 +2191,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary>
public long IncomingPacketsProcessed { get; protected set; }
protected void MonitoredClientOutgoingPacketHandler(IClientAPI client)
{
nticks++;
watch1.Start();
m_currentOutgoingClient = client;
try
{
if (client is LLClientView)
{
LLClientView llClient = (LLClientView)client;
LLUDPClient udpClient = llClient.UDPClient;
if (udpClient.IsConnected)
{
if (m_resendUnacked)
{
nticksUnack++;
watch2.Start();
HandleUnacked(llClient);
watch2.Stop();
avgResendUnackedTicks = (nticksUnack - 1)/(float)nticksUnack * avgResendUnackedTicks + (watch2.ElapsedTicks / (float)nticksUnack);
watch2.Reset();
}
if (m_sendAcks)
{
nticksAck++;
watch2.Start();
SendAcks(udpClient);
watch2.Stop();
avgSendAcksTicks = (nticksAck - 1) / (float)nticksAck * avgSendAcksTicks + (watch2.ElapsedTicks / (float)nticksAck);
watch2.Reset();
}
if (m_sendPing)
{
nticksPing++;
watch2.Start();
SendPing(udpClient);
watch2.Stop();
avgSendPingTicks = (nticksPing - 1) / (float)nticksPing * avgSendPingTicks + (watch2.ElapsedTicks / (float)nticksPing);
watch2.Reset();
}
watch2.Start();
// Dequeue any outgoing packets that are within the throttle limits
if (udpClient.DequeueOutgoing())
{
m_packetSent = true;
npacksSent++;
}
else
{
npackNotSent++;
}
watch2.Stop();
avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks);
watch2.Reset();
}
else
{
m_log.WarnFormat("[LLUDPSERVER]: Client is not connected");
}
}
}
catch (Exception ex)
{
m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler iteration for " + client.Name +
" threw an exception: " + ex.Message, ex);
}
watch1.Stop();
avgProcessingTicks = (nticks - 1) / (float)nticks * avgProcessingTicks + (watch1.ElapsedTicks / (float)nticks);
watch1.Reset();
// reuse this -- it's every ~100ms
if (Scene.EmergencyMonitoring && nticks % 100 == 0)
{
m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (TickCountRes: {5} sent: {6} notsent: {7})",
avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, TickCountResolution, npacksSent, npackNotSent);
npackNotSent = npacksSent = 0;
}
}
#endregion
protected void ProcessInPacket(IncomingPacket incomingPacket)

View File

@ -92,8 +92,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Asset = throttleConfig.GetInt("asset_default", 10500);
Total = Resend + Land + Wind + Cloud + Task + Texture + Asset;
// 3000000 bps default max
ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", 375000);
// 5120000 bps default max
ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", 640000);
if (ClientMaxRate > 1000000)
ClientMaxRate = 1000000; // no more than 8Mbps

View File

@ -62,8 +62,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary>
protected const float m_minimumDripRate = 1500;
/// <summary>Time of the last drip, in system ticks</summary>
protected Int32 m_lastDrip;
/// <summary>Time of the last drip</summary>
protected double m_lastDrip;
/// <summary>
/// The number of bytes that can be sent at this moment. This is the
@ -166,10 +166,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary>
protected float m_totalDripRequest;
public float TotalDripRequest
{
get { return m_totalDripRequest; }
set { m_totalDripRequest = value; }
}
{
get { return m_totalDripRequest; }
set { m_totalDripRequest = value; }
}
#endregion Properties
@ -193,9 +193,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Parent = parent;
RequestedDripRate = dripRate;
RequestedBurst = MaxBurst;
// TotalDripRequest = dripRate; // this will be overwritten when a child node registers
// MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst);
m_lastDrip = Util.EnvironmentTickCount() + 100000;
m_lastDrip = Util.GetTimeStampMS() + 50.0;
}
#endregion Constructor
@ -210,7 +208,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected float DripRateModifier()
{
float driprate = DripRate;
return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest;
return driprate >= TotalDripRequest ? 1.0f : (driprate / TotalDripRequest);
}
/// <summary>
@ -313,14 +311,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return;
}
Int32 now = Util.EnvironmentTickCount();
Int32 deltaMS = now - m_lastDrip;
double now = Util.GetTimeStampMS();
double deltaMS = now - m_lastDrip;
m_lastDrip = now;
if (deltaMS <= 0)
return;
m_tokenCount += deltaMS * DripRate * m_timeScale;
m_tokenCount += (float)deltaMS * DripRate * m_timeScale;
float burst = Burst;
if (m_tokenCount > burst)

View File

@ -45,10 +45,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private static readonly ILog m_log = LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
protected Timer m_logTimer = new Timer(10000);
protected List<GridInstantMessage> m_logData = new List<GridInstantMessage>();
protected string m_restUrl;
/// <value>
/// Is this module enabled?
/// </value>
@ -68,12 +64,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
"InstantMessageModule", "InstantMessageModule") !=
"InstantMessageModule")
return;
m_restUrl = config.Configs["Messaging"].GetString("LogURL", String.Empty);
}
m_enabled = true;
m_logTimer.AutoReset = false;
m_logTimer.Elapsed += LogTimerElapsed;
}
public virtual void AddRegion(Scene scene)
@ -153,20 +146,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
#endregion
/*
public virtual void OnViewerInstantMessage(IClientAPI client, GridInstantMessage im)
{
im.fromAgentName = client.FirstName + " " + client.LastName;
OnInstantMessage(client, im);
}
*/
public virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{
byte dialog = im.dialog;
if (client != null && dialog == (byte)InstantMessageDialog.MessageFromAgent)
LogInstantMesssage(im);
if (dialog != (byte)InstantMessageDialog.MessageFromAgent
&& dialog != (byte)InstantMessageDialog.StartTyping
&& dialog != (byte)InstantMessageDialog.StopTyping
@ -243,35 +233,5 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
//
OnInstantMessage(null, msg);
}
protected virtual void LogInstantMesssage(GridInstantMessage im)
{
if (m_logData.Count < 20)
{
// Restart the log write timer
m_logTimer.Stop();
}
if (!m_logTimer.Enabled)
m_logTimer.Start();
lock (m_logData)
{
m_logData.Add(im);
}
}
protected virtual void LogTimerElapsed(object source, ElapsedEventArgs e)
{
lock (m_logData)
{
if (m_restUrl != String.Empty && m_logData.Count > 0)
{
bool success = SynchronousRestObjectRequester.MakeRequest<List<GridInstantMessage>, bool>("POST", m_restUrl + "/LogMessages/", m_logData);
if (!success)
m_log.ErrorFormat("[INSTANT MESSAGE]: Failed to save log data");
}
m_logData.Clear();
}
}
}
}

View File

@ -154,14 +154,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
bool inCache = false;
UserAccount account;
lock(m_Cache)
account = m_Cache.Get(userID, out inCache);
account = m_Cache.Get(userID, out inCache);
if (inCache)
return account;
account = UserAccountService.GetUserAccount(scopeID, userID);
lock(m_Cache)
m_Cache.Cache(userID, account);
m_Cache.Cache(userID, account);
return account;
}
@ -170,15 +168,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
bool inCache = false;
UserAccount account;
lock(m_Cache)
account = m_Cache.Get(firstName + " " + lastName, out inCache);
account = m_Cache.Get(firstName + " " + lastName, out inCache);
if (inCache)
return account;
account = UserAccountService.GetUserAccount(scopeID, firstName, lastName);
if (account != null)
lock(m_Cache)
m_Cache.Cache(account.PrincipalID, account);
m_Cache.Cache(account.PrincipalID, account);
return account;
}
@ -201,8 +197,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
if(UUID.TryParse(id, out uuid))
{
lock(m_Cache)
account = m_Cache.Get(uuid, out inCache);
account = m_Cache.Get(uuid, out inCache);
if (inCache)
ret.Add(account);
else
@ -216,12 +211,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
List<UserAccount> ext = UserAccountService.GetUserAccounts(scopeID, missing);
if(ext != null && ext.Count > 0)
{
ret.AddRange(ext);
foreach(UserAccount acc in ext)
{
if(acc != null)
lock(m_Cache)
m_Cache.Cache(acc.PrincipalID, acc);
{
ret.Add(acc);
m_Cache.Cache(acc.PrincipalID, acc);
}
}
}
return ret;

View File

@ -128,8 +128,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
// flags, title, etc. And country, don't forget country!
private void OnNewClient(IClientAPI client)
{
lock(m_Cache)
m_Cache.Remove(client.Name);
m_Cache.Remove(client.Name);
}
#region Overwritten methods from IUserAccountService
@ -138,15 +137,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
bool inCache = false;
UserAccount account;
lock(m_Cache)
account = m_Cache.Get(userID, out inCache);
account = m_Cache.Get(userID, out inCache);
if (inCache)
return account;
account = base.GetUserAccount(scopeID, userID);
lock(m_Cache)
if(account != null)
m_Cache.Cache(userID, account);
m_Cache.Cache(userID, account);
return account;
}
@ -155,15 +151,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
bool inCache = false;
UserAccount account;
lock(m_Cache)
account = m_Cache.Get(firstName + " " + lastName, out inCache);
account = m_Cache.Get(firstName + " " + lastName, out inCache);
if (inCache)
return account;
account = base.GetUserAccount(scopeID, firstName, lastName);
if (account != null)
lock(m_Cache)
m_Cache.Cache(account.PrincipalID, account);
m_Cache.Cache(account.PrincipalID, account);
return account;
}
@ -181,8 +175,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
if(UUID.TryParse(id, out uuid))
{
lock(m_Cache)
account = m_Cache.Get(uuid, out inCache);
account = m_Cache.Get(uuid, out inCache);
if (inCache)
accs.Add(account);
else
@ -195,16 +188,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
List<UserAccount> ext = base.GetUserAccounts(scopeID, missing);
if(ext != null && ext.Count >0 )
{
accs.AddRange(ext);
foreach(UserAccount acc in ext)
{
if(acc != null)
lock(m_Cache)
m_Cache.Cache(acc.PrincipalID, acc);
{
accs.Add(acc);
m_Cache.Cache(acc.PrincipalID, acc);
}
}
}
}
return accs;
}

View File

@ -36,7 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
public class UserAccountCache : IUserAccountCacheModule
{
private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours!
private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour!
private const double CACHE_NULL_EXPIRATION_SECONDS = 600; // 10minutes
// private static readonly ILog m_log =
// LogManager.GetLogger(
@ -44,6 +45,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
private ExpiringCache<UUID, UserAccount> m_UUIDCache;
private ExpiringCache<string, UUID> m_NameCache;
private object accessLock = new object();
public UserAccountCache()
{
@ -54,60 +56,77 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public void Cache(UUID userID, UserAccount account)
{
// Cache even null accounts
m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS);
if (account != null)
m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS);
lock(accessLock)
{
if (account == null)
m_UUIDCache.AddOrUpdate(userID, null, CACHE_NULL_EXPIRATION_SECONDS);
else
{
m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS);
m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS);
}
//m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
}
}
public void Invalidate(UUID userID)
{
m_UUIDCache.Remove(userID);
lock(accessLock)
m_UUIDCache.Remove(userID);
}
public UserAccount Get(UUID userID, out bool inCache)
{
UserAccount account = null;
inCache = false;
if (m_UUIDCache.TryGetValue(userID, out account))
lock(accessLock)
{
//m_log.DebugFormat("[USER CACHE]: Account {0} {1} found in cache", account.FirstName, account.LastName);
inCache = true;
return account;
if (m_UUIDCache.TryGetValue(userID, out account))
{
//m_log.DebugFormat("[USER CACHE]: Account {0} {1} found in cache", account.FirstName, account.LastName);
inCache = true;
return account;
}
}
return null;
}
public UserAccount Get(string name, out bool inCache)
{
inCache = false;
if (!m_NameCache.Contains(name))
return null;
lock(accessLock)
{
if (!m_NameCache.Contains(name))
return null;
UserAccount account = null;
UUID uuid = UUID.Zero;
if (m_NameCache.TryGetValue(name, out uuid))
if (m_UUIDCache.TryGetValue(uuid, out account))
UserAccount account = null;
UUID uuid = UUID.Zero;
if (m_NameCache.TryGetValue(name, out uuid))
{
inCache = true;
return account;
if (m_UUIDCache.TryGetValue(uuid, out account))
{
inCache = true;
return account;
}
}
}
return null;
}
public void Remove(string name)
{
if (!m_NameCache.Contains(name))
return;
UUID uuid = UUID.Zero;
if (m_NameCache.TryGetValue(name, out uuid))
lock(accessLock)
{
m_NameCache.Remove(name);
m_UUIDCache.Remove(uuid);
if (!m_NameCache.Contains(name))
return;
UUID uuid = UUID.Zero;
if (m_NameCache.TryGetValue(name, out uuid))
{
m_NameCache.Remove(name);
m_UUIDCache.Remove(uuid);
}
}
}
}

View File

@ -920,7 +920,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
return false;
}
string rawConsoleEndVector = rawComponents.Skip(2).Take(1).Single();
string rawConsoleEndVector = rawComponents.Skip(1).Take(1).Single();
if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector))
{

View File

@ -166,8 +166,6 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param>
public void SelectPrim(List<uint> primIDs, IClientAPI remoteClient)
{
List<ISceneEntity> needUpdates = new List<ISceneEntity>();
foreach(uint primLocalID in primIDs)
{
SceneObjectPart part = GetSceneObjectPart(primLocalID);
@ -179,8 +177,6 @@ namespace OpenSim.Region.Framework.Scenes
if (sog == null)
continue;
needUpdates.Add((ISceneEntity)part);
// waste of time because properties do not send prim flags as they should
// if a friend got or lost edit rights after login, a full update is needed
if(sog.OwnerID != remoteClient.AgentId)
@ -193,10 +189,9 @@ namespace OpenSim.Region.Framework.Scenes
part.IsSelected = true;
EventManager.TriggerParcelPrimCountTainted();
}
}
if(needUpdates.Count > 0)
remoteClient.SendSelectedPartsProprieties(needUpdates);
part.SendPropertiesToClient(remoteClient);
}
}
/// <summary>
@ -248,38 +243,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetSceneObjectPart(primLocalID);
if (part == null)
return;
/*
// A deselect packet contains all the local prims being deselected. However, since selection is still
// group based we only want the root prim to trigger a full update - otherwise on objects with many prims
// we end up sending many duplicate ObjectUpdates
if (part.ParentGroup.RootPart.LocalId != part.LocalId)
return;
// This is wrong, wrong, wrong. Selection should not be
// handled by group, but by prim. Legacy cruft.
// TODO: Make selection flagging per prim!
//
if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)
|| Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId))
part.ParentGroup.IsSelected = false;
part.ParentGroup.ScheduleGroupForFullUpdate();
// If it's not an attachment, and we are allowed to move it,
// then we might have done so. If we moved across a parcel
// boundary, we will need to recount prims on the parcels.
// For attachments, that makes no sense.
//
if (!part.ParentGroup.IsAttachment)
{
if (Permissions.CanEditObject(
part.UUID, remoteClient.AgentId)
|| Permissions.CanMoveObject(
part.UUID, remoteClient.AgentId))
EventManager.TriggerParcelPrimCountTainted();
}
*/
bool oldgprSelect = part.ParentGroup.IsSelected;
// This is wrong, wrong, wrong. Selection should not be
@ -614,7 +578,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.Error(
string.Format(
"[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e));
"[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e, folderID));
}
Thread.Sleep(20);
}

View File

@ -67,8 +67,6 @@ namespace OpenSim.Region.Framework.Scenes
#region Fields
public bool EmergencyMonitoring = false;
/// <summary>
/// Show debug information about animations.
/// </summary>
@ -4606,7 +4604,8 @@ Label_GroupsDone:
}
// TODO: This check should probably be in QueryAccess().
ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2);
ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID,
(float)RegionInfo.RegionSizeX * 0.5f, (float)RegionInfo.RegionSizeY * 0.5f);
if (nearestParcel == null)
{
m_log.InfoFormat(

View File

@ -287,7 +287,7 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception e)
{
m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e));
m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception {0}", e));
}
}

View File

@ -246,11 +246,11 @@ namespace OpenSim.Region.Framework.Scenes
// try to work around that scale down X and Y acording to region size, so reducing the resolution
//
// viewers need to scale up
float scaleX = m_parentScene.RegionInfo.RegionSizeX / Constants.RegionSize;
float scaleX = (float)m_parentScene.RegionInfo.RegionSizeX / (float)Constants.RegionSize;
if (scaleX == 0)
scaleX = 1.0f;
scaleX = 1.0f / scaleX;
float scaleY = m_parentScene.RegionInfo.RegionSizeY / Constants.RegionSize;
float scaleY = (float)m_parentScene.RegionInfo.RegionSizeY / (float)Constants.RegionSize;
if (scaleY == 0)
scaleY = 1.0f;
scaleY = 1.0f / scaleY;

View File

@ -781,6 +781,34 @@ namespace OpenSim.Region.Framework.Scenes
}
}
// requested Velocity for physics engines avatar motors
// only makes sense if there is a physical rep
public Vector3 TargetVelocity
{
get
{
if (PhysicsActor != null)
return PhysicsActor.TargetVelocity;
else
return Vector3.Zero;
}
set
{
if (PhysicsActor != null)
{
try
{
PhysicsActor.TargetVelocity = value;
}
catch (Exception e)
{
m_log.Error("[SCENE PRESENCE]: TARGETVELOCITY " + e.Message);
}
}
}
}
private Quaternion m_bodyRot = Quaternion.Identity;
/// <summary>
@ -2269,6 +2297,46 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="distance"></param>
///
private void checkCameraCollision()
{
if(!m_scene.PhysicsScene.SupportsRayCast())
return;
++m_movementUpdateCount;
if (m_movementUpdateCount < 1)
m_movementUpdateCount = 1;
if (m_doingCamRayCast || m_movementUpdateCount % NumMovementsBetweenRayCast != 0)
return;
if (m_followCamAuto && !m_mouseLook)
{
Vector3 posAdjusted = AbsolutePosition;
// posAdjusted.Z += 0.5f * Appearance.AvatarSize.Z - 0.5f;
// not good for tiny or huge avatars
posAdjusted.Z += 1.0f; // viewer current camera focus point
Vector3 tocam = CameraPosition - posAdjusted;
float distTocamlen = tocam.LengthSquared();
if (distTocamlen > 0.08f && distTocamlen < 400)
{
distTocamlen = (float)Math.Sqrt(distTocamlen);
tocam *= (1.0f / distTocamlen);
m_doingCamRayCast = true;
m_scene.PhysicsScene.RaycastWorld(posAdjusted, tocam, distTocamlen + 1.0f, RayCastCameraCallback);
return;
}
}
if (CameraConstraintActive)
{
Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -10000f); // not right...
UpdateCameraCollisionPlane(plane);
CameraConstraintActive = false;
}
}
private void UpdateCameraCollisionPlane(Vector4 plane)
{
if (m_lastCameraCollisionPlane != plane)
@ -2280,17 +2348,14 @@ namespace OpenSim.Region.Framework.Scenes
public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 pNormal)
{
const float POSITION_TOLERANCE = 0.02f;
const float ROTATION_TOLERANCE = 0.02f;
// const float POSITION_TOLERANCE = 0.02f;
// const float ROTATION_TOLERANCE = 0.02f;
m_doingCamRayCast = false;
if (hitYN && localid != LocalId)
{
SceneObjectGroup group = m_scene.GetGroupByPrim(localid);
bool IsPrim = group != null;
if (IsPrim)
if (localid != 0)
{
SceneObjectPart part = group.GetPart(localid);
SceneObjectPart part = m_scene.GetSceneObjectPart(localid);
if (part != null && !part.VolumeDetectActive)
{
CameraConstraintActive = true;
@ -2323,13 +2388,16 @@ namespace OpenSim.Region.Framework.Scenes
UpdateCameraCollisionPlane(plane);
}
}
else if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE))
// else if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
// !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE))
else if(CameraConstraintActive)
{
Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -9000f); // not right...
UpdateCameraCollisionPlane(plane);
CameraConstraintActive = false;
}
m_doingCamRayCast = false;
}
/// <summary>
@ -2414,38 +2482,8 @@ namespace OpenSim.Region.Framework.Scenes
// Raycast from the avatar's head to the camera to see if there's anything blocking the view
// this exclude checks may not be complete
if (m_movementUpdateCount % NumMovementsBetweenRayCast == 0 && m_scene.PhysicsScene.SupportsRayCast())
{
if (!m_doingCamRayCast && !m_mouseLook && ParentID == 0)
{
Vector3 posAdjusted = AbsolutePosition;
// posAdjusted.Z += 0.5f * Appearance.AvatarSize.Z - 0.5f;
posAdjusted.Z += 1.0f; // viewer current camera focus point
Vector3 tocam = CameraPosition - posAdjusted;
tocam.X = (float)Math.Round(tocam.X, 1);
tocam.Y = (float)Math.Round(tocam.Y, 1);
tocam.Z = (float)Math.Round(tocam.Z, 1);
float distTocamlen = tocam.Length();
if (distTocamlen > 0.3f)
{
tocam *= (1.0f / distTocamlen);
posAdjusted.X = (float)Math.Round(posAdjusted.X, 1);
posAdjusted.Y = (float)Math.Round(posAdjusted.Y, 1);
posAdjusted.Z = (float)Math.Round(posAdjusted.Z, 1);
m_doingCamRayCast = true;
m_scene.PhysicsScene.RaycastWorld(posAdjusted, tocam, distTocamlen + 1.0f, RayCastCameraCallback);
}
}
else if (CameraConstraintActive && (m_mouseLook || ParentID != 0))
{
Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -10000f); // not right...
UpdateCameraCollisionPlane(plane);
CameraConstraintActive = false;
}
}
if(agentData.NeedsCameraCollision && ParentID == 0) // condition parentID may be wrong
checkCameraCollision();
uint flagsForScripts = (uint)flags;
flags = RemoveIgnoredControls(flags, IgnoredControls);
@ -2714,14 +2752,10 @@ namespace OpenSim.Region.Framework.Scenes
// Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
if (IsChildAgent)
{
// // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
return;
}
++m_movementUpdateCount;
if (m_movementUpdateCount < 1)
m_movementUpdateCount = 1;
if(IsInTransit)
return;
// AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags;
@ -2731,7 +2765,7 @@ namespace OpenSim.Region.Framework.Scenes
// Use these three vectors to figure out what the agent is looking at
// Convert it to a Matrix and/or Quaternion
// this my need lock
// this may need lock
CameraAtAxis = agentData.CameraAtAxis;
CameraLeftAxis = agentData.CameraLeftAxis;
CameraUpAxis = agentData.CameraUpAxis;
@ -2745,24 +2779,28 @@ namespace OpenSim.Region.Framework.Scenes
DrawDistance = agentData.Far;
// Check if Client has camera in 'follow cam' or 'build' mode.
Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f)
&& (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false;
//m_log.DebugFormat("[FollowCam]: {0}", m_followCamAuto);
// Raycast from the avatar's head to the camera to see if there's anything blocking the view
if ((m_movementUpdateCount % NumMovementsBetweenRayCast) == 0 && m_scene.PhysicsScene.SupportsRayCast())
// Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
m_followCamAuto = false;
if(!m_mouseLook)
{
if (m_followCamAuto)
if((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f))
{
Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT;
m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback);
Vector3 camdif = new Vector3(1f, 0f, 0f) * Rotation;
float ftmp = camdif.X - CameraAtAxis.X;
if(Math.Abs(ftmp) < 0.1f)
{
ftmp = camdif.Y - CameraAtAxis.Y;
if(Math.Abs(ftmp) < 0.1f)
m_followCamAuto = true;
}
}
}
if(agentData.NeedsCameraCollision)
checkCameraCollision();
TriggerScenePresenceUpdated();
}
@ -3649,7 +3687,7 @@ namespace OpenSim.Region.Framework.Scenes
m_forceToApplyValid = true;
}
*/
Velocity = direc;
TargetVelocity = direc;
Animator.UpdateMovementAnimations();
}

View File

@ -125,13 +125,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
+ " With the 'full' option child agents are also shown.",
(mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd)));
scene.AddCommand(
"Comms", this, "emergency-monitoring",
"emergency-monitoring",
"Go on/off emergency monitoring mode",
"Go on/off emergency monitoring mode",
HandleEmergencyMonitoring);
scene.AddCommand(
"Comms", this, "show client stats",
"show client stats [first_name last_name]",
@ -197,24 +190,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
return report.ToString();
}
protected void HandleEmergencyMonitoring(string module, string[] cmd)
{
bool mode = true;
if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on"))
{
mode = true;
MainConsole.Instance.Output("Emergency Monitoring ON");
}
else
{
mode = false;
MainConsole.Instance.Output("Emergency Monitoring OFF");
}
foreach (Scene s in m_scenes.Values)
s.EmergencyMonitoring = mode;
}
protected string GetColumnEntry(string entry, int maxLength, int columnPadding)
{
return string.Format(

View File

@ -108,10 +108,6 @@ public class BSActorAvatarMove : BSActor
{
if (m_velocityMotor != null)
{
// if (targ == OMV.Vector3.Zero)
// Util.PrintCallStack();
//
// Console.WriteLine("SetVelocityAndTarget, {0} {1}", vel, targ);
m_velocityMotor.Reset();
m_velocityMotor.SetTarget(targ);
m_velocityMotor.SetCurrent(vel);
@ -128,7 +124,7 @@ public class BSActorAvatarMove : BSActor
m_waitingForLowVelocityForStationary = true;
}
// If a movement motor has not been created, create one and start the hovering.
// If a movement motor has not been created, create one and start the movement
private void ActivateAvatarMove()
{
if (m_velocityMotor == null)
@ -161,7 +157,7 @@ public class BSActorAvatarMove : BSActor
}
}
// Called just before the simulation step. Update the vertical position for hoverness.
// Called just before the simulation step.
private void Mover(float timeStep)
{
// Don't do movement while the object is selected.

View File

@ -449,6 +449,7 @@ public sealed class BSCharacter : BSPhysObject
public override OMV.Vector3 GeometricCenter { get { return OMV.Vector3.Zero; } }
public override OMV.Vector3 CenterOfMass { get { return OMV.Vector3.Zero; } }
// PhysicsActor.TargetVelocity
// Sets the target in the motor. This starts the changing of the avatar's velocity.
public override OMV.Vector3 TargetVelocity
{
@ -459,7 +460,7 @@ public sealed class BSCharacter : BSPhysObject
set
{
DetailLog("{0},BSCharacter.setTargetVelocity,call,vel={1}", LocalID, value);
m_targetVelocity = value;
base.m_targetVelocity = value;
OMV.Vector3 targetVel = value;
if (_setAlwaysRun && !_flying)
targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 1f);
@ -472,32 +473,12 @@ public sealed class BSCharacter : BSPhysObject
public override OMV.Vector3 Velocity {
get { return RawVelocity; }
set {
RawVelocity = value;
OMV.Vector3 vel = RawVelocity;
DetailLog("{0}: set Velocity = {1}", LocalID, value);
PhysScene.TaintedObject(LocalID, "BSCharacter.setVelocity", delegate()
if (m_moveActor != null)
{
if (m_moveActor != null)
m_moveActor.SetVelocityAndTarget(vel, vel, true /* inTaintTime */);
DetailLog("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, vel);
ForceVelocity = vel;
});
}
}
public override OMV.Vector3 ForceVelocity {
get { return RawVelocity; }
set {
PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity");
// Util.PrintCallStack();
DetailLog("{0}: set ForceVelocity = {1}", LocalID, value);
RawVelocity = value;
PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity);
PhysScene.PE.Activate(PhysBody, true);
// m_moveActor.SetVelocityAndTarget(OMV.Vector3.Zero, OMV.Vector3.Zero, false /* inTaintTime */);
m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, false /* inTaintTime */);
}
base.Velocity = value;
}
}
@ -506,11 +487,23 @@ public sealed class BSCharacter : BSPhysObject
{
if (m_moveActor != null)
{
m_moveActor.SetVelocityAndTarget(OMV.Vector3.Zero, OMV.Vector3.Zero, false /* inTaintTime */);
// m_moveActor.SetVelocityAndTarget(OMV.Vector3.Zero, OMV.Vector3.Zero, false /* inTaintTime */);
m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, false /* inTaintTime */);
}
base.SetMomentum(momentum);
}
public override OMV.Vector3 ForceVelocity {
get { return RawVelocity; }
set {
PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity");
DetailLog("{0}: BSCharacter.ForceVelocity.set = {1}", LocalID, value);
RawVelocity = Util.ClampV(value, BSParam.MaxLinearVelocity);
PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity);
PhysScene.PE.Activate(PhysBody, true);
}
}
public override OMV.Vector3 Torque {
get { return RawTorque; }

View File

@ -230,15 +230,22 @@ public abstract class BSPhysObject : PhysicsActor
// Update the physical location and motion of the object. Called with data from Bullet.
public abstract void UpdateProperties(EntityProperties entprop);
// The position value as known by BulletSim. Does not effect the physics engine.
public virtual OMV.Vector3 RawPosition { get; set; }
// Set position in BulletSim and the physics engined to a value immediately. Must be called at taint time.
public abstract OMV.Vector3 ForcePosition { get; set; }
// The orientation value as known by BulletSim. Does not effect the physics engine.
public virtual OMV.Quaternion RawOrientation { get; set; }
// Set orientation in BulletSim and the physics engine to a value immediately. Must be called at taint time.
public abstract OMV.Quaternion ForceOrientation { get; set; }
// The velocity value as known by BulletSim. Does not effect the physics engine.
public virtual OMV.Vector3 RawVelocity { get; set; }
// Set velocity in BulletSim and the physics engined to a value immediately. Must be called at taint time.
public abstract OMV.Vector3 ForceVelocity { get; set; }
// The rotational velocity value as known by BulletSim. Does not effect the physics engine.
public OMV.Vector3 RawRotationalVelocity { get; set; }
// RawForce is a constant force applied to object (see Force { set; } )
@ -252,17 +259,28 @@ public abstract class BSPhysObject : PhysicsActor
public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force);
public abstract void AddForce(bool inTaintTime, OMV.Vector3 force);
// PhysicsActor.Velocity
public override OMV.Vector3 Velocity
{
get { return RawVelocity; }
set
{
// This sets the velocity now. BSCharacter will override to clear target velocity
// before calling this.
RawVelocity = value;
PhysScene.TaintedObject(LocalID, TypeName + ".SetVelocity", delegate () {
// DetailLog("{0},BSPhysObject.Velocity.set,vel={1}", LocalID, RawVelocity);
ForceVelocity = RawVelocity;
});
}
}
// PhysicsActor.SetMomentum
// All the physics engined use this as a way of forcing the velocity to something.
// All the physics engines use this as a way of forcing the velocity to something.
// BSCharacter overrides this so it can set the target velocity to zero before calling this.
public override void SetMomentum(OMV.Vector3 momentum)
{
// This doesn't just set Velocity=momentum because velocity is ramped up to (see MoveActor)
RawVelocity = momentum;
PhysScene.TaintedObject(LocalID, TypeName + ".SetMomentum", delegate()
{
// DetailLog("{0},BSPrim.SetMomentum,taint,vel={1}", LocalID, RawVelocity);
ForceVelocity = RawVelocity;
});
this.Velocity = momentum;
}
public override OMV.Vector3 RotationalVelocity {

View File

@ -787,17 +787,6 @@ public class BSPrim : BSPhysObject
}
}
}
public override OMV.Vector3 Velocity {
get { return RawVelocity; }
set {
RawVelocity = value;
PhysScene.TaintedObject(LocalID, "BSPrim.setVelocity", delegate()
{
// DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, RawVelocity);
ForceVelocity = RawVelocity;
});
}
}
public override OMV.Vector3 ForceVelocity {
get { return RawVelocity; }
set {

View File

@ -632,6 +632,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
}
public override Vector3 TargetVelocity
{
get
{
return m_targetVelocity;
}
set
{
if (value.IsFinite())
{
AddChange(changes.TargetVelocity, value);
}
else
{
m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character");
}
}
}
public override Vector3 Torque
{
get { return Vector3.Zero; }
@ -689,7 +708,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
else
{
AddChange(changes.Velocity, force);
AddChange(changes.TargetVelocity, force);
}
}
else
@ -1671,16 +1690,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
AvatarGeomAndBodyDestroy();
float oldsz = m_size.Z;
m_size = pSize;
AvatarGeomAndBodyCreation(_position.X, _position.Y,
_position.Z + (m_size.Z - oldsz) * 0.5f);
Velocity = Vector3.Zero;
// Velocity = Vector3.Zero;
m_targetVelocity = Vector3.Zero;
_parent_scene.actor_name_map[collider] = (PhysicsActor)this;
_parent_scene.actor_name_map[capsule] = (PhysicsActor)this;
@ -1738,6 +1755,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
private void changeVelocity(Vector3 newVel)
{
_velocity = newVel;
setFreeMove();
if (Body != IntPtr.Zero)
d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
}
private void changeTargetVelocity(Vector3 newVel)
{
m_pidControllerActive = true;
m_freemove = false;
@ -1881,6 +1907,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
changeVelocity((Vector3)arg);
break;
case changes.TargetVelocity:
changeTargetVelocity((Vector3)arg);
break;
// case changes.Acceleration:
// changeacceleration((Vector3)arg);
// break;

View File

@ -1157,6 +1157,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_building = true; // control must set this to false when done
AddChange(changes.Add, null);
// get basic mass parameters
ODEPhysRepData repData = _parent_scene.m_meshWorker.NewActorPhysRep(this, _pbs, _size, m_shapetype);
@ -1165,8 +1167,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_OBBOffset = repData.OBBOffset;
UpdatePrimBodyData();
AddChange(changes.Add, null);
}
private void resetCollisionAccounting()
@ -3805,6 +3805,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
changevelocity((Vector3)arg);
break;
case changes.TargetVelocity:
break;
// case changes.Acceleration:
// changeacceleration((Vector3)arg);
// break;
@ -3933,8 +3936,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
donullchange();
break;
default:
donullchange();
break;

View File

@ -112,6 +112,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
OriOffset, // not in use
// arg Vector3 new position in local coords. Changes prim position in object
Velocity,
TargetVelocity,
AngVelocity,
Acceleration,
Force,
@ -1220,8 +1221,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
/// <param name="obj"></param>
public void RemoveCollisionEventReporting(PhysicsActor obj)
{
if (_collisionEventPrim.Contains(obj) && !_collisionEventPrimRemove.Contains(obj))
_collisionEventPrimRemove.Add(obj);
lock(_collisionEventPrimRemove)
{
if (_collisionEventPrim.Contains(obj) && !_collisionEventPrimRemove.Contains(obj))
_collisionEventPrimRemove.Add(obj);
}
}
public override float TimeDilation
@ -1758,10 +1762,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
prm.SleeperAddCollisionEvents();
sleepers.Clear();
foreach (PhysicsActor obj in _collisionEventPrimRemove)
_collisionEventPrim.Remove(obj);
lock(_collisionEventPrimRemove)
{
foreach (PhysicsActor obj in _collisionEventPrimRemove)
_collisionEventPrim.Remove(obj);
_collisionEventPrimRemove.Clear();
_collisionEventPrimRemove.Clear();
}
// do a ode simulation step
d.WorldQuickStep(world, ODE_STEPSIZE);

View File

@ -395,6 +395,10 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
{
// m_log.DebugFormat("[MESH]: experimental mesh proxy generation for {0}", primName);
// for ubOde we have a diferent mesh use priority
// priority is to use full mesh then decomposition
// SL does the oposite
bool usemesh = false;
coords = new List<Coord>();
@ -443,16 +447,10 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
if (physicsParms != null)
usemesh = true;
else
{
m_log.WarnFormat("[MESH]: Data for PRIM shape type not found for prim {0}",primName);
return false;
}
}
if(!usemesh && (map.ContainsKey("physics_convex")))
physicsParms = (OSDMap)map["physics_convex"];
if (physicsParms == null)
{
@ -555,160 +553,168 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
range = range - min;
range *= invMaxU16;
if (!convex && cmap.ContainsKey("HullList") && cmap.ContainsKey("Positions"))
if(!convex)
{
List<int> hsizes = new List<int>();
int totalpoints = 0;
data = cmap["HullList"].AsBinary();
for (i = 0; i < data.Length; i++)
// if mesh data not present and not convex then we need convex decomposition data
if (cmap.ContainsKey("HullList") && cmap.ContainsKey("Positions"))
{
t1 = data[i];
if (t1 == 0)
t1 = 256;
totalpoints += t1;
hsizes.Add(t1);
}
data = cmap["Positions"].AsBinary();
int ptr = 0;
int vertsoffset = 0;
if (totalpoints == data.Length / 6) // 2 bytes per coord, 3 coords per point
{
foreach (int hullsize in hsizes)
List<int> hsizes = new List<int>();
int totalpoints = 0;
data = cmap["HullList"].AsBinary();
for (i = 0; i < data.Length; i++)
{
for (i = 0; i < hullsize; i++ )
{
t1 = data[ptr++];
t1 += data[ptr++] << 8;
t2 = data[ptr++];
t2 += data[ptr++] << 8;
t3 = data[ptr++];
t3 += data[ptr++] << 8;
t1 = data[i];
if (t1 == 0)
t1 = 256;
totalpoints += t1;
hsizes.Add(t1);
}
f3 = new float3((t1 * range.X + min.X),
(t2 * range.Y + min.Y),
(t3 * range.Z + min.Z));
vs.Add(f3);
}
data = cmap["Positions"].AsBinary();
int ptr = 0;
int vertsoffset = 0;
if(hullsize <3)
if (totalpoints == data.Length / 6) // 2 bytes per coord, 3 coords per point
{
foreach (int hullsize in hsizes)
{
vs.Clear();
continue;
}
if (hullsize <5)
{
foreach (float3 point in vs)
for (i = 0; i < hullsize; i++ )
{
c.X = point.x;
c.Y = point.y;
c.Z = point.z;
t1 = data[ptr++];
t1 += data[ptr++] << 8;
t2 = data[ptr++];
t2 += data[ptr++] << 8;
t3 = data[ptr++];
t3 += data[ptr++] << 8;
f3 = new float3((t1 * range.X + min.X),
(t2 * range.Y + min.Y),
(t3 * range.Z + min.Z));
vs.Add(f3);
}
if(hullsize <3)
{
vs.Clear();
continue;
}
if (hullsize <5)
{
foreach (float3 point in vs)
{
c.X = point.x;
c.Y = point.y;
c.Z = point.z;
coords.Add(c);
}
f = new Face(vertsoffset, vertsoffset + 1, vertsoffset + 2);
faces.Add(f);
if (hullsize == 4)
{
// not sure about orientation..
f = new Face(vertsoffset, vertsoffset + 2, vertsoffset + 3);
faces.Add(f);
f = new Face(vertsoffset, vertsoffset + 3, vertsoffset + 1);
faces.Add(f);
f = new Face(vertsoffset + 3, vertsoffset + 2, vertsoffset + 1);
faces.Add(f);
}
vertsoffset += vs.Count;
vs.Clear();
continue;
}
/*
if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f))
{
vs.Clear();
continue;
}
nverts = hullr.Vertices.Count;
nindexs = hullr.Indices.Count;
if (nindexs % 3 != 0)
{
vs.Clear();
continue;
}
for (i = 0; i < nverts; i++)
{
c.X = hullr.Vertices[i].x;
c.Y = hullr.Vertices[i].y;
c.Z = hullr.Vertices[i].z;
coords.Add(c);
}
f = new Face(vertsoffset, vertsoffset + 1, vertsoffset + 2);
faces.Add(f);
if (hullsize == 4)
for (i = 0; i < nindexs; i += 3)
{
// not sure about orientation..
f = new Face(vertsoffset, vertsoffset + 2, vertsoffset + 3);
faces.Add(f);
f = new Face(vertsoffset, vertsoffset + 3, vertsoffset + 1);
faces.Add(f);
f = new Face(vertsoffset + 3, vertsoffset + 2, vertsoffset + 1);
t1 = hullr.Indices[i];
if (t1 > nverts)
break;
t2 = hullr.Indices[i + 1];
if (t2 > nverts)
break;
t3 = hullr.Indices[i + 2];
if (t3 > nverts)
break;
f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3);
faces.Add(f);
}
vertsoffset += vs.Count;
vs.Clear();
continue;
}
/*
if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f))
{
vs.Clear();
continue;
}
*/
List<int> indices;
if (!HullUtils.ComputeHull(vs, out indices))
{
vs.Clear();
continue;
}
nverts = hullr.Vertices.Count;
nindexs = hullr.Indices.Count;
nverts = vs.Count;
nindexs = indices.Count;
if (nindexs % 3 != 0)
{
vs.Clear();
continue;
}
if (nindexs % 3 != 0)
{
vs.Clear();
continue;
}
for (i = 0; i < nverts; i++)
{
c.X = hullr.Vertices[i].x;
c.Y = hullr.Vertices[i].y;
c.Z = hullr.Vertices[i].z;
coords.Add(c);
}
for (i = 0; i < nverts; i++)
{
c.X = vs[i].x;
c.Y = vs[i].y;
c.Z = vs[i].z;
coords.Add(c);
}
for (i = 0; i < nindexs; i += 3)
{
t1 = hullr.Indices[i];
if (t1 > nverts)
break;
t2 = hullr.Indices[i + 1];
if (t2 > nverts)
break;
t3 = hullr.Indices[i + 2];
if (t3 > nverts)
break;
f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3);
faces.Add(f);
}
*/
List<int> indices;
if (!HullUtils.ComputeHull(vs, out indices))
{
for (i = 0; i < nindexs; i += 3)
{
t1 = indices[i];
if (t1 > nverts)
break;
t2 = indices[i + 1];
if (t2 > nverts)
break;
t3 = indices[i + 2];
if (t3 > nverts)
break;
f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3);
faces.Add(f);
}
vertsoffset += nverts;
vs.Clear();
continue;
}
nverts = vs.Count;
nindexs = indices.Count;
if (nindexs % 3 != 0)
{
vs.Clear();
continue;
}
for (i = 0; i < nverts; i++)
{
c.X = vs[i].x;
c.Y = vs[i].y;
c.Z = vs[i].z;
coords.Add(c);
}
for (i = 0; i < nindexs; i += 3)
{
t1 = indices[i];
if (t1 > nverts)
break;
t2 = indices[i + 1];
if (t2 > nverts)
break;
t3 = indices[i + 2];
if (t3 > nverts)
break;
f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3);
faces.Add(f);
}
vertsoffset += nverts;
vs.Clear();
}
if (coords.Count > 0 && faces.Count > 0)
return true;
}
else
{
// if neither mesh or decomposition present, warn and use convex
m_log.WarnFormat("[MESH]: Data for PRIM shape type ( mesh or decomposition) not found for prim {0}",primName);
}
if (coords.Count > 0 && faces.Count > 0)
return true;
}
vs.Clear();
if (cmap.ContainsKey("BoundingVerts"))

View File

@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
void SetMinEventDelay(UUID itemID, double delay);
int GetStartParameter(UUID itemID);
void SetScriptState(UUID itemID, bool state);
void SetScriptState(UUID itemID, bool state, bool self);
bool GetScriptState(UUID itemID);
void SetState(UUID itemID, string newState);
void ApiResetScript(UUID itemID);

View File

@ -521,7 +521,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((item = GetScriptByName(name)) != UUID.Zero)
{
m_ScriptEngine.SetScriptState(item, run == 0 ? false : true);
m_ScriptEngine.SetScriptState(item, run == 0 ? false : true, item == m_item.ItemID);
}
else
{
@ -14358,6 +14358,91 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return contacts.ToArray();
}
private ContactResult? GroundIntersection2(Vector3 rayStart, Vector3 rayEnd)
{
// get work copies
float sx = rayStart.X;
float ex = rayEnd.X;
float sy = rayStart.Y;
float ey = rayEnd.Y;
float dx = ex - sx;
float dy = ey - sy;
// region size info
float rsx = World.RegionInfo.RegionSizeX;
float tmp;
// region bounds
if(sx < 0)
{
if(ex < 0) // totally outside
return null;
if(dx <= 0) // out and going away
return null;
else if(ex >= rsx)
ex = rsx - 0.001f;
tmp = -sx / dx;
sy += dy * dx;
sx = 0;
}
else if(sx >= rsx)
{
if(ex >= rsx) // totally outside
return null;
if(dx >= 0) // out and going away
return null;
else if(ex < 0)
ex = 0;
tmp = (rsx - sx) / dx;
sy += dy * dx;
sx = rsx - 0.001f;
}
float rsy = World.RegionInfo.RegionSizeY;
if(sy < 0)
{
if(dy <= 0) // out and going away
return null;
else if(ey >= rsy)
ey = rsy - 0.001f;
tmp = -sy / dy;
sx += dy * dx;
sy = 0;
}
else if(sy >= rsy)
{
if(dy >= 0) // out and going away
return null;
else if(ey < 0)
ey = 0;
tmp = (rsy - sy) / dy;
sx += dy * dx;
sy = rsy - 0.001f;
}
if(sx < 0 || sx >= rsx)
return null;
float sz = rayStart.Z;
float ez = rayEnd.Z;
float dz = ez - sz;
float dist = dx * dx + dy * dy + dz * dz;
if(dist < 0.001)
return null;
dist = (float)Math.Sqrt(dist);
tmp = 1.0f / dist;
Vector3 rayn = new Vector3(dx * tmp, dy * tmp, dz * tmp);
ContactResult? result = null;
return result;
}
private ContactResult? GroundIntersection(Vector3 rayStart, Vector3 rayEnd)
{
double[,] heightfield = World.Heightmap.GetDoubles();
@ -16024,8 +16109,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
catch (InvalidCastException e)
{
Error(originFunc,string.Format(
" error running rule #{1}: arg #{2} ",
rulesParsed, idx - idxStart) + e.Message);
" error running rule #{0}: arg #{1} {2}",
rulesParsed, idx - idxStart, e.Message));
}
finally
{

View File

@ -295,7 +295,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
idx++;
try
{
iQ = rules.GetQuaternionItem(idx);
iQ = rules.GetVector4Item(idx);
}
catch (InvalidCastException)
{
@ -319,7 +319,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
idx++;
try
{
iQ = rules.GetQuaternionItem(idx);
iQ = rules.GetVector4Item(idx);
}
catch (InvalidCastException)
{
@ -342,7 +342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
idx++;
try
{
iQ = rules.GetQuaternionItem(idx);
iQ = rules.GetVector4Item(idx);
}
catch (InvalidCastException)
{
@ -532,7 +532,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
idx++;
try
{
iQ = rules.GetQuaternionItem(idx);
iQ = rules.GetVector4Item(idx);
}
catch (InvalidCastException)
{
@ -654,7 +654,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
idx++;
iQ = rules.GetQuaternionItem(idx);
iQ = rules.GetVector4Item(idx);
try
{
wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);

View File

@ -924,26 +924,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
try
{
// DISPLAY ERROR INWORLD
string text = FormatException(e);
if (text.Length > 1000)
text = text.Substring(0, 1000);
Engine.World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647,
Part.AbsolutePosition,
Part.Name, Part.UUID, false);
if(e.InnerException != null && e.InnerException is ScriptException)
{
string text = e.InnerException.Message +
"(script: " + ScriptName +
" event: " + data.EventName +
" at " + Part.AbsolutePosition + ")";
if (text.Length > 1000)
text = text.Substring(0, 1000);
Engine.World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647,
Part.AbsolutePosition,
Part.Name, Part.UUID, false);
m_log.Debug(string.Format(
"[SCRIPT INSTANCE]: {0} (at event {1}, part {2} {3} at {4} in {5}",
e.InnerException.Message,
data.EventName,
PrimName,
Part.UUID,
Part.AbsolutePosition,
Part.ParentGroup.Scene.Name));
}
else
{
// DISPLAY ERROR INWORLD
string text = FormatException(e);
if (text.Length > 1000)
text = text.Substring(0, 1000);
Engine.World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647,
Part.AbsolutePosition,
Part.Name, Part.UUID, false);
m_log.Debug(string.Format(
"[SCRIPT INSTANCE]: Runtime error in script {0} (event {1}), part {2} {3} at {4} in {5} ",
ScriptName,
data.EventName,
PrimName,
Part.UUID,
Part.AbsolutePosition,
Part.ParentGroup.Scene.Name),
e);
m_log.Debug(string.Format(
"[SCRIPT INSTANCE]: Runtime error in script {0} (event {1}), part {2} {3} at {4} in {5} ",
ScriptName,
data.EventName,
PrimName,
Part.UUID,
Part.AbsolutePosition,
Part.ParentGroup.Scene.Name),
e);
}
}
catch (Exception)
{

View File

@ -700,6 +700,31 @@ namespace OpenSim.Region.ScriptEngine.Shared
}
}
// use LSL_Types.Quaternion to parse and store a vector4 for lightShare
public LSL_Types.Quaternion GetVector4Item(int itemIndex)
{
if (Data[itemIndex] is LSL_Types.Quaternion)
{
LSL_Types.Quaternion q = (LSL_Types.Quaternion)Data[itemIndex];
return q;
}
else if(Data[itemIndex] is OpenMetaverse.Quaternion)
{
LSL_Types.Quaternion q = new LSL_Types.Quaternion(
(OpenMetaverse.Quaternion)Data[itemIndex]);
q.Normalize();
return q;
}
else
{
throw new InvalidCastException(string.Format(
"{0} expected but {1} given",
typeof(LSL_Types.Quaternion).Name,
Data[itemIndex] != null ?
Data[itemIndex].GetType().Name : "null"));
}
}
public LSL_Types.Quaternion GetQuaternionItem(int itemIndex)
{
if (Data[itemIndex] is LSL_Types.Quaternion)

View File

@ -1854,15 +1854,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return instance;
}
public void SetScriptState(UUID itemID, bool running)
public void SetScriptState(UUID itemID, bool running, bool self)
{
IScriptInstance instance = GetInstance(itemID);
if (instance != null)
{
if (running)
instance.Start();
instance.Start();
else
instance.Stop(100);
{
if(self)
{
instance.Running = false;
throw new EventAbortException();
}
else
instance.Stop(100);
}
}
}

View File

@ -72,11 +72,8 @@ namespace OpenSim.Services.AuthenticationService
{
realID = UUID.Zero;
m_log.DebugFormat("[AUTH SERVICE]: Authenticating for {0}, user account service present: {1}", principalID, m_UserAccountService != null);
m_log.DebugFormat("[AUTH SERVICE]: Authenticating for {0}", principalID);
AuthenticationData data = m_Database.Get(principalID);
UserAccount user = null;
if (m_UserAccountService != null)
user = m_UserAccountService.GetUserAccount(UUID.Zero, principalID);
if (data == null || data.Data == null)
{
@ -100,53 +97,7 @@ namespace OpenSim.Services.AuthenticationService
return GetToken(principalID, lifetime);
}
if (user == null)
{
m_log.DebugFormat("[PASS AUTH]: No user record for {0}", principalID);
return String.Empty;
}
int impersonateFlag = 1 << 6;
if ((user.UserFlags & impersonateFlag) == 0)
return String.Empty;
m_log.DebugFormat("[PASS AUTH]: Attempting impersonation");
List<UserAccount> accounts = m_UserAccountService.GetUserAccountsWhere(UUID.Zero, "UserLevel >= 200");
if (accounts == null || accounts.Count == 0)
return String.Empty;
foreach (UserAccount a in accounts)
{
data = m_Database.Get(a.PrincipalID);
if (data == null || data.Data == null ||
!data.Data.ContainsKey("passwordHash") ||
!data.Data.ContainsKey("passwordSalt"))
{
continue;
}
// m_log.DebugFormat("[PASS AUTH]: Trying {0}", data.PrincipalID);
hashed = Util.Md5Hash(password + ":" +
data.Data["passwordSalt"].ToString());
if (data.Data["passwordHash"].ToString() == hashed)
{
m_log.DebugFormat("[PASS AUTH]: {0} {1} impersonating {2}, proceeding with login", a.FirstName, a.LastName, principalID);
realID = a.PrincipalID;
return GetToken(principalID, lifetime);
}
// else
// {
// m_log.DebugFormat(
// "[AUTH SERVICE]: Salted hash {0} of given password did not match salted hash of {1} for PrincipalID {2}. Authentication failure.",
// hashed, data.Data["passwordHash"], data.PrincipalID);
// }
}
m_log.DebugFormat("[PASS AUTH]: Impersonation of {0} failed", principalID);
m_log.DebugFormat("[AUTH SERVICE]: Authenticating FAIL for {0} ", principalID);
return String.Empty;
}
}

View File

@ -323,7 +323,7 @@ namespace OpenSim.Services.Connectors
}
else
m_log.Error(string.Format(
"[ESTATE CONNECTOR]: WebException for {0} {1} {2} ",
"[ESTATE CONNECTOR]: WebException for {0} {1} {2} {3}",
verb, uri, formdata, e));
}
}

View File

@ -221,7 +221,7 @@ namespace OpenSim.Tests.Common
throw new System.NotImplementedException ();
}
public void SetScriptState(UUID itemID, bool state)
public void SetScriptState(UUID itemID, bool state, bool self)
{
throw new System.NotImplementedException ();
}

View File

@ -729,12 +729,6 @@
;; then you might want to try setting this to false.
; mesh_sculpted_prim = true
;# {use_NINJA_physics_joints} {[Startup]physics:OpenDynamicsEngine} {Use jointed (NINJA) physics?} {true false} false
;; If you would like physics joints to be enabled through a special naming
;; convention in the client, set this to true.
;; (see NINJA Physics, http://opensimulator.org/wiki/NINJA_Physics)
; use_NINJA_physics_joints = false
[RemoteAdmin]
;; This is the remote admin module, which uses XMLRPC requests to
;; manage regions from a web interface.
@ -1171,17 +1165,21 @@
;; several options to control NPCs creation
;# {AllowNotOwned} {} {allow NPCs to be created not Owned} {true false} true
;; allow NPCs to be created not Owned {true false} default: true
; AllowNotOwned = false
; AllowNotOwned = true
;# {AllowSenseAsAvatar} {} {allow NPCs to set to be sensed as Avatars} {true false} true
;; allow NPCs to set to be sensed as Avatars {true false} default: true
; AllowSenseAsAvatar = false
; AllowSenseAsAvatar = true
;# {AllowCloneOtherAvatars} {} {allow NPCs to created cloning any avatar in region} {true false} true
;; allow NPCs to created cloning any avatar in region {true false} default: true
; AllowCloneOtherAvatars = false
; AllowCloneOtherAvatars = true
;# {NoNPCGroup} {} {if true NPCs will have no group title, if false display "- NPC -"} {true false} true
;; if true NPCs will have no group title, if false display "- NPC -" for easy identification {true false} default: true
; NoNPCGroup = false
; NoNPCGroup = true
[Terrain]

View File

@ -128,9 +128,16 @@
; Increasing this number will increase memory usage.
MaxPrimUndos = 20
; Minimum size for non-physical prims.This can be overridden in the region config file (as
; NonPhysicalPrimMin!).
; NonPhysicalPrimMin = 0.001
; Maximum size of non physical prims. Affects resizing of existing prims. This can be overridden in the region config file (as NonPhysicalPrimMax!).
NonPhysicalPrimMax = 256
; Minimum size where a prim can be physical. This can be overridden in the region config file.
; PhysicalPrimMin = 0.01
; Maximum size of physical prims. Affects resizing of existing prims. This can be overridden in the region config file.
PhysicalPrimMax = 64
@ -304,14 +311,27 @@
; ## SCRIPT ENGINE
; ##
;; Default script engine to use. Currently, we only have XEngine
DefaultScriptEngine = "XEngine"
; Http proxy setting for llHTTPRequest and dynamic texture loading, if
; required
; HttpProxy = "http://proxy.com:8080"
; If you're using HttpProxy, then you can set HttpProxyExceptions to a
; list of regular expressions for URLs that you don't want to go through
; the proxy.
; For example, servers inside your firewall.
; Separate patterns with a ';'
; HttpProxyExceptions = ".mydomain.com;localhost"
; ##
; ## EMAIL MODULE
; ##
;; The email module requires some configuration. It needs an SMTP
;; server to send mail through.
;emailmodule = DefaultEmailModule
; ##
; ## ANIMATIONS
; ##
@ -324,6 +344,10 @@
; won't look right until the physics engine supports it
; (i.e delays takeoff for a moment)
; #
; # statistics
; #
; Simulator statistics are output to the console periodically at debug level INFO.
; Setting this to zero disables this output.
; LogShowStatsSeconds = 3600
@ -362,16 +386,41 @@
; system with reduced logging
LogOverloads = True
; #
; # Telehubs
; #
; SpawnPointRouting adjusts the landing for incoming avatars.
; "closest" will place the avatar at the SpawnPoint located in the closest
; available spot to the destination (typically map click/landmark).
; "random" will place the avatar on a randomly selected spawnpoint;
; "sequence" will place the avatar on the next sequential SpawnPoint
; SpawnPointRouting = closest
; TelehubAllowLandmark allows users with landmarks to override telehub
; routing and land at the landmark coordinates when set to true
; default is false
; TelehubAllowLandmark = false
[Map]
; Map tile options.
; If true, then maptiles are generated using the MapImageModule below.
; If false then the texture referenced by MaptileStaticUUID is used instead, which can also be overridden
; in individual region config file(s). If you do not want to upload map tiles at all, then you will need
; both to set this to false and comment out the [Modules] MapImageServiceModule setting in config-include/
;GenerateMaptiles = true
;WorldMapModule = "WorldMap"
; The module to use in order to generate map images.
; MapImageModule is the default. Warp3DImageModule is an alternative experimental module that can
; generate better images.
;MapImageModule = "MapImageModule"
; World map blacklist timeout in seconds
;BlacklistTimeout = 600
; Set to false to not generate any maptiles
;GenerateMaptiles = true
; Refresh (in seconds) the map tile periodically
;MaptileRefresh = 0
@ -399,6 +448,8 @@
; ## PERMISSIONS
; ##
; Permission modules to use, separated by comma.
; Possible modules are DefaultPermissionsModule, PrimLimitsModule
;permissionmodules = "DefaultPermissionsModule"
; If set to false, then, in theory, the server never carries out permission checks (allowing anybody to copy
@ -407,12 +458,22 @@
; Default is true
serverside_object_permissions = true
allow_grid_gods = false
; This allows somne control over permissions
; This allows some control over permissions
; please note that this still doesn't duplicate SL, and is not intended to
; This allows grid users with a UserLevel of 200 or more to assume god
; powers in the regions in this simulator.
allow_grid_gods = false
; Allow region owners to assume god powers in their regions
;region_owner_is_god = true
; Allow region managers to assume god powers in regions they manage
;region_manager_is_god = false
; Allow parcel owners to assume god powers in their parcels
; you really may not want this...
;parcel_owner_is_god = false
; Control user types that are allowed to create new scripts
@ -1078,16 +1139,6 @@
; number^2 physical level of detail of the sculpt texture. 16x16 - 256 verticies
mesh_physical_lod = 16
; ##
; ## Joint support
; ##
; If you would like physics joints to be enabled through a special naming
; convention in the client, set this to true.
; (See NINJA Physics documentation, http://opensimulator.org/wiki/NINJA_Physics)
; Default is false
;use_NINJA_physics_joints = true
; ##
; ## additional meshing options
; ##
@ -1097,7 +1148,7 @@
; If you would rather have mesh proxies for simple prims, you can set this to
; true. Note that this will increase memory usage and region startup time.
; Default is false.
;force_simple_prim_meshing = true
;force_simple_prim_meshing = false
[BulletSim]
@ -2075,7 +2126,19 @@
[NPC]
;; Enable Non Player Character (NPC) facilities
Enabled = false
;; several options to control NPCs creation
;; allow NPCs to be created not Owned {true false} default: true
; AllowNotOwned = true
;; allow NPCs to set to be sensed as Avatars {true false} default: true
; AllowSenseAsAvatar = true
;; allow NPCs to created cloning any avatar in region {true false} default: true
; AllowCloneOtherAvatars = true
;; if true NPCs will have no group title, if false display "- NPC -" for easy identification {true false} default: true
; NoNPCGroup = true
[Terrain]
; Values can be "pinhead-island" or "flat"