fix merge
commit
a680d8b8d7
|
@ -359,6 +359,42 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
notice = false;
|
notice = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (startupConfig.GetBoolean("SkipDelayOnEmptyRegion", false))
|
||||||
|
{
|
||||||
|
m_log.Info("[RADMIN]: Counting affected avatars");
|
||||||
|
int agents = 0;
|
||||||
|
|
||||||
|
if (restartAll)
|
||||||
|
{
|
||||||
|
foreach (Scene s in m_application.SceneManager.Scenes)
|
||||||
|
{
|
||||||
|
foreach (ScenePresence sp in s.GetScenePresences())
|
||||||
|
{
|
||||||
|
if (!sp.IsChildAgent && !sp.IsNPC)
|
||||||
|
agents++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (ScenePresence sp in rebootedScene.GetScenePresences())
|
||||||
|
{
|
||||||
|
if (!sp.IsChildAgent && !sp.IsNPC)
|
||||||
|
agents++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.InfoFormat("[RADMIN]: Avatars in region: {0}", agents);
|
||||||
|
|
||||||
|
if (agents == 0)
|
||||||
|
{
|
||||||
|
m_log.Info("[RADMIN]: No avatars detected, shutting down without delay");
|
||||||
|
|
||||||
|
times.Clear();
|
||||||
|
times.Add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<Scene> restartList;
|
List<Scene> restartList;
|
||||||
|
|
||||||
if (restartAll)
|
if (restartAll)
|
||||||
|
@ -376,10 +412,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
// m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0} {1}", e.Message, e.StackTrace);
|
m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0} {1}", e.Message, e.StackTrace);
|
||||||
responseData["rebooting"] = false;
|
responseData["rebooting"] = false;
|
||||||
|
|
||||||
throw e;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Restart Region request complete");
|
m_log.Info("[RADMIN]: Restart Region request complete");
|
||||||
|
|
|
@ -36,7 +36,7 @@ using MySql.Data.MySqlClient;
|
||||||
namespace OpenSim.Data.MySQL
|
namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A database interface class to a user profile storage system
|
/// Common code for a number of database modules
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MySqlFramework
|
public class MySqlFramework
|
||||||
{
|
{
|
||||||
|
@ -44,14 +44,24 @@ namespace OpenSim.Data.MySQL
|
||||||
log4net.LogManager.GetLogger(
|
log4net.LogManager.GetLogger(
|
||||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected string m_connectionString;
|
protected string m_connectionString = String.Empty;
|
||||||
protected object m_dbLock = new object();
|
protected MySqlTransaction m_trans = null;
|
||||||
|
|
||||||
|
// Constructor using a connection string. Instances constructed
|
||||||
|
// this way will open a new connection for each call.
|
||||||
protected MySqlFramework(string connectionString)
|
protected MySqlFramework(string connectionString)
|
||||||
{
|
{
|
||||||
m_connectionString = connectionString;
|
m_connectionString = connectionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Constructor using a connection object. Instances constructed
|
||||||
|
// this way will use the connection object and never create
|
||||||
|
// new connections.
|
||||||
|
protected MySqlFramework(MySqlTransaction trans)
|
||||||
|
{
|
||||||
|
m_trans = trans;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// All non queries are funneled through one connection
|
// All non queries are funneled through one connection
|
||||||
|
@ -59,33 +69,48 @@ namespace OpenSim.Data.MySQL
|
||||||
//
|
//
|
||||||
protected int ExecuteNonQuery(MySqlCommand cmd)
|
protected int ExecuteNonQuery(MySqlCommand cmd)
|
||||||
{
|
{
|
||||||
lock (m_dbLock)
|
if (m_trans == null)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
try
|
dbcon.Open();
|
||||||
{
|
return ExecuteNonQueryWithConnection(cmd, dbcon);
|
||||||
dbcon.Open();
|
|
||||||
cmd.Connection = dbcon;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Error(e.Message, e);
|
|
||||||
m_log.Error(Environment.StackTrace.ToString());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Error(e.Message, e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ExecuteNonQueryWithTransaction(cmd, m_trans);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int ExecuteNonQueryWithTransaction(MySqlCommand cmd, MySqlTransaction trans)
|
||||||
|
{
|
||||||
|
cmd.Transaction = trans;
|
||||||
|
return ExecuteNonQueryWithConnection(cmd, trans.Connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int ExecuteNonQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cmd.Connection = dbcon;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error(e.Message, e);
|
||||||
|
m_log.Error(Environment.StackTrace.ToString());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error(e.Message, e);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,14 +53,27 @@ namespace OpenSim.Data.MySQL
|
||||||
get { return GetType().Assembly; }
|
get { return GetType().Assembly; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MySQLGenericTableHandler(MySqlTransaction trans,
|
||||||
|
string realm, string storeName) : base(trans)
|
||||||
|
{
|
||||||
|
m_Realm = realm;
|
||||||
|
|
||||||
|
CommonConstruct(storeName);
|
||||||
|
}
|
||||||
|
|
||||||
public MySQLGenericTableHandler(string connectionString,
|
public MySQLGenericTableHandler(string connectionString,
|
||||||
string realm, string storeName) : base(connectionString)
|
string realm, string storeName) : base(connectionString)
|
||||||
{
|
{
|
||||||
m_Realm = realm;
|
m_Realm = realm;
|
||||||
m_connectionString = connectionString;
|
|
||||||
|
|
||||||
|
CommonConstruct(storeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void CommonConstruct(string storeName)
|
||||||
|
{
|
||||||
if (storeName != String.Empty)
|
if (storeName != String.Empty)
|
||||||
{
|
{
|
||||||
|
// We always use a new connection for any Migrations
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
@ -110,6 +123,11 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual T[] Get(string[] fields, string[] keys)
|
public virtual T[] Get(string[] fields, string[] keys)
|
||||||
|
{
|
||||||
|
return Get(fields, keys, String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual T[] Get(string[] fields, string[] keys, string options)
|
||||||
{
|
{
|
||||||
if (fields.Length != keys.Length)
|
if (fields.Length != keys.Length)
|
||||||
return new T[0];
|
return new T[0];
|
||||||
|
@ -126,8 +144,8 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
string where = String.Join(" and ", terms.ToArray());
|
string where = String.Join(" and ", terms.ToArray());
|
||||||
|
|
||||||
string query = String.Format("select * from {0} where {1}",
|
string query = String.Format("select * from {0} where {1} {2}",
|
||||||
m_Realm, where);
|
m_Realm, where, options);
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
|
|
||||||
|
@ -136,73 +154,93 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
protected T[] DoQuery(MySqlCommand cmd)
|
protected T[] DoQuery(MySqlCommand cmd)
|
||||||
|
{
|
||||||
|
if (m_trans == null)
|
||||||
|
{
|
||||||
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
{
|
||||||
|
dbcon.Open();
|
||||||
|
|
||||||
|
return DoQueryWithConnection(cmd, dbcon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return DoQueryWithTransaction(cmd, m_trans);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected T[] DoQueryWithTransaction(MySqlCommand cmd, MySqlTransaction trans)
|
||||||
|
{
|
||||||
|
cmd.Transaction = trans;
|
||||||
|
|
||||||
|
return DoQueryWithConnection(cmd, trans.Connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected T[] DoQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon)
|
||||||
{
|
{
|
||||||
List<T> result = new List<T>();
|
List<T> result = new List<T>();
|
||||||
|
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
cmd.Connection = dbcon;
|
||||||
|
|
||||||
|
using (IDataReader reader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
if (reader == null)
|
||||||
cmd.Connection = dbcon;
|
return new T[0];
|
||||||
|
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
CheckColumnNames(reader);
|
||||||
|
|
||||||
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
if (reader == null)
|
T row = new T();
|
||||||
return new T[0];
|
|
||||||
|
|
||||||
CheckColumnNames(reader);
|
foreach (string name in m_Fields.Keys)
|
||||||
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
{
|
||||||
T row = new T();
|
if (reader[name] is DBNull)
|
||||||
|
|
||||||
foreach (string name in m_Fields.Keys)
|
|
||||||
{
|
{
|
||||||
if (reader[name] is DBNull)
|
continue;
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (m_Fields[name].FieldType == typeof(bool))
|
|
||||||
{
|
|
||||||
int v = Convert.ToInt32(reader[name]);
|
|
||||||
m_Fields[name].SetValue(row, v != 0 ? true : false);
|
|
||||||
}
|
|
||||||
else if (m_Fields[name].FieldType == typeof(UUID))
|
|
||||||
{
|
|
||||||
m_Fields[name].SetValue(row, DBGuid.FromDB(reader[name]));
|
|
||||||
}
|
|
||||||
else if (m_Fields[name].FieldType == typeof(int))
|
|
||||||
{
|
|
||||||
int v = Convert.ToInt32(reader[name]);
|
|
||||||
m_Fields[name].SetValue(row, v);
|
|
||||||
}
|
|
||||||
else if (m_Fields[name].FieldType == typeof(uint))
|
|
||||||
{
|
|
||||||
uint v = Convert.ToUInt32(reader[name]);
|
|
||||||
m_Fields[name].SetValue(row, v);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_Fields[name].SetValue(row, reader[name]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (m_Fields[name].FieldType == typeof(bool))
|
||||||
if (m_DataField != null)
|
|
||||||
{
|
{
|
||||||
Dictionary<string, string> data =
|
int v = Convert.ToInt32(reader[name]);
|
||||||
new Dictionary<string, string>();
|
m_Fields[name].SetValue(row, v != 0 ? true : false);
|
||||||
|
}
|
||||||
foreach (string col in m_ColumnNames)
|
else if (m_Fields[name].FieldType == typeof(UUID))
|
||||||
{
|
{
|
||||||
data[col] = reader[col].ToString();
|
m_Fields[name].SetValue(row, DBGuid.FromDB(reader[name]));
|
||||||
if (data[col] == null)
|
}
|
||||||
data[col] = String.Empty;
|
else if (m_Fields[name].FieldType == typeof(int))
|
||||||
}
|
{
|
||||||
|
int v = Convert.ToInt32(reader[name]);
|
||||||
m_DataField.SetValue(row, data);
|
m_Fields[name].SetValue(row, v);
|
||||||
|
}
|
||||||
|
else if (m_Fields[name].FieldType == typeof(uint))
|
||||||
|
{
|
||||||
|
uint v = Convert.ToUInt32(reader[name]);
|
||||||
|
m_Fields[name].SetValue(row, v);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_Fields[name].SetValue(row, reader[name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Add(row);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_DataField != null)
|
||||||
|
{
|
||||||
|
Dictionary<string, string> data =
|
||||||
|
new Dictionary<string, string>();
|
||||||
|
|
||||||
|
foreach (string col in m_ColumnNames)
|
||||||
|
{
|
||||||
|
data[col] = reader[col].ToString();
|
||||||
|
if (data[col] == null)
|
||||||
|
data[col] = String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_DataField.SetValue(row, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Add(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,14 +395,23 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public object DoQueryScalar(MySqlCommand cmd)
|
public object DoQueryScalar(MySqlCommand cmd)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
if (m_trans == null)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
cmd.Connection = dbcon;
|
{
|
||||||
|
dbcon.Open();
|
||||||
|
cmd.Connection = dbcon;
|
||||||
|
|
||||||
|
return cmd.ExecuteScalar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmd.Connection = m_trans.Connection;
|
||||||
|
cmd.Transaction = m_trans;
|
||||||
|
|
||||||
return cmd.ExecuteScalar();
|
return cmd.ExecuteScalar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ namespace OpenSim.Data.MySQL
|
||||||
"LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " +
|
"LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " +
|
||||||
"AttachedPosY, AttachedPosZ, " +
|
"AttachedPosY, AttachedPosZ, " +
|
||||||
"PhysicsShapeType, Density, GravityModifier, " +
|
"PhysicsShapeType, Density, GravityModifier, " +
|
||||||
"Friction, Restitution, Vehicle, DynAttrs, " +
|
"Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " +
|
||||||
"RotationAxisLocks" +
|
"RotationAxisLocks" +
|
||||||
") values (" + "?UUID, " +
|
") values (" + "?UUID, " +
|
||||||
"?CreationDate, ?Name, ?Text, " +
|
"?CreationDate, ?Name, ?Text, " +
|
||||||
|
@ -224,7 +224,7 @@ namespace OpenSim.Data.MySQL
|
||||||
"?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " +
|
"?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " +
|
||||||
"?AttachedPosY, ?AttachedPosZ, " +
|
"?AttachedPosY, ?AttachedPosZ, " +
|
||||||
"?PhysicsShapeType, ?Density, ?GravityModifier, " +
|
"?PhysicsShapeType, ?Density, ?GravityModifier, " +
|
||||||
"?Friction, ?Restitution, ?Vehicle, ?DynAttrs," +
|
"?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," +
|
||||||
"?RotationAxisLocks)";
|
"?RotationAxisLocks)";
|
||||||
|
|
||||||
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
||||||
|
@ -1452,6 +1452,11 @@ namespace OpenSim.Data.MySQL
|
||||||
prim.VehicleParams = vehicle;
|
prim.VehicleParams = vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhysicsInertiaData pdata = null;
|
||||||
|
if (row["PhysInertia"].ToString() != String.Empty)
|
||||||
|
pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString());
|
||||||
|
prim.PhysicsInertia = pdata;
|
||||||
|
|
||||||
return prim;
|
return prim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1810,6 +1815,11 @@ namespace OpenSim.Data.MySQL
|
||||||
else
|
else
|
||||||
cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
|
cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
|
||||||
|
|
||||||
|
if (prim.PhysicsInertia != null)
|
||||||
|
cmd.Parameters.AddWithValue("PhysInertia", prim.PhysicsInertia.ToXml2());
|
||||||
|
else
|
||||||
|
cmd.Parameters.AddWithValue("PhysInertia", String.Empty);
|
||||||
|
|
||||||
if (prim.VehicleParams != null)
|
if (prim.VehicleParams != null)
|
||||||
cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2());
|
cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2());
|
||||||
else
|
else
|
||||||
|
|
|
@ -461,3 +461,9 @@ BEGIN;
|
||||||
ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
|
ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
:VERSION 57 #----- Add physics inertia data
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
|
||||||
|
COMMIT;
|
||||||
|
|
|
@ -435,7 +435,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
|
cmd.CommandText = String.Format("delete from {0} where \"TMStamp\"::abstime::timestamp < now() - INTERVAL '2 week'", m_Realm);
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
|
|
||||||
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm);
|
cmd.CommandText = String.Format("delete from {0} where \"TMStamp\"::abstime::timestamp < now() - INTERVAL '2 week'", m_Realm);
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,10 +350,11 @@ namespace OpenSim.Data.PGSQL
|
||||||
""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX,
|
""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX,
|
||||||
""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook,
|
""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook,
|
||||||
""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice,
|
""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice,
|
||||||
""SaleType"" = :SaleType, ""ColorR"" = :ColorR, ""ColorG"" = :ColorG, ""ColorB"" = :ColorB, ""ColorA"" = :ColorA, ""ParticleSystem"" = :ParticleSystem,
|
""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution,
|
||||||
|
""PassCollisions"" = :PassCollisions, ""RotationAxisLocks"" = :RotationAxisLocks, ""RezzerID"" = :RezzerID,
|
||||||
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
|
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
|
||||||
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs,
|
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs,
|
||||||
""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution
|
""PhysInertia"" = :PhysInertia
|
||||||
WHERE ""UUID"" = :UUID ;
|
WHERE ""UUID"" = :UUID ;
|
||||||
|
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
|
@ -367,7 +368,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"",
|
""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"",
|
||||||
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
|
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
|
||||||
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
|
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
|
||||||
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution""
|
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""PhysInertia""
|
||||||
) Select
|
) Select
|
||||||
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
|
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
|
||||||
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
|
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
|
||||||
|
@ -378,7 +379,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
:OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ,
|
:OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ,
|
||||||
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
|
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
|
||||||
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
|
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
|
||||||
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution
|
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :PhysInertia
|
||||||
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
|
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
|
||||||
";
|
";
|
||||||
|
|
||||||
|
@ -1678,6 +1679,12 @@ namespace OpenSim.Data.PGSQL
|
||||||
prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
|
prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
|
||||||
prim.GroupID = new UUID((Guid)primRow["GroupID"]);
|
prim.GroupID = new UUID((Guid)primRow["GroupID"]);
|
||||||
prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
|
prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
|
||||||
|
|
||||||
|
if (primRow["RezzerID"] != DBNull.Value)
|
||||||
|
prim.RezzerID = new UUID((Guid)primRow["RezzerID"]);
|
||||||
|
else
|
||||||
|
prim.RezzerID = UUID.Zero;
|
||||||
|
|
||||||
prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
|
prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
|
||||||
prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
|
prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
|
||||||
prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
|
prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
|
||||||
|
@ -1796,6 +1803,13 @@ namespace OpenSim.Data.PGSQL
|
||||||
prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]);
|
prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]);
|
||||||
prim.Friction = Convert.ToSingle(primRow["Friction"]);
|
prim.Friction = Convert.ToSingle(primRow["Friction"]);
|
||||||
prim.Restitution = Convert.ToSingle(primRow["Restitution"]);
|
prim.Restitution = Convert.ToSingle(primRow["Restitution"]);
|
||||||
|
prim.RotationAxisLocks = Convert.ToByte(primRow["RotationAxisLocks"]);
|
||||||
|
|
||||||
|
|
||||||
|
PhysicsInertiaData pdata = null;
|
||||||
|
if (!(primRow["PhysInertia"] is System.DBNull))
|
||||||
|
pdata = PhysicsInertiaData.FromXml2(primRow["PhysInertia"].ToString());
|
||||||
|
prim.PhysicsInertia = pdata;
|
||||||
|
|
||||||
return prim;
|
return prim;
|
||||||
}
|
}
|
||||||
|
@ -2097,6 +2111,7 @@ namespace OpenSim.Data.PGSQL
|
||||||
parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID));
|
parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID));
|
||||||
parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID));
|
parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID));
|
||||||
parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID));
|
parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID));
|
||||||
|
parameters.Add(_Database.CreateParameter("RezzerID", prim.RezzerID));
|
||||||
parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask));
|
parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask));
|
||||||
parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask));
|
parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask));
|
||||||
parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask));
|
parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask));
|
||||||
|
@ -2196,10 +2211,28 @@ namespace OpenSim.Data.PGSQL
|
||||||
parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
|
parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
|
||||||
parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
|
parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
|
||||||
|
|
||||||
parameters.Add(_Database.CreateParameter("PassTouches", prim.PassTouches));
|
parameters.Add(_Database.CreateParameter("PassTouches", (bool)prim.PassTouches));
|
||||||
|
parameters.Add(_Database.CreateParameter("PassCollisions", prim.PassCollisions));
|
||||||
|
|
||||||
|
|
||||||
|
if (prim.PassTouches)
|
||||||
|
parameters.Add(_Database.CreateParameter("PassTouches", true));
|
||||||
|
else
|
||||||
|
parameters.Add(_Database.CreateParameter("PassTouches", false));
|
||||||
|
|
||||||
|
if (prim.PassCollisions)
|
||||||
|
parameters.Add(_Database.CreateParameter("PassCollisions", 1));
|
||||||
|
else
|
||||||
|
parameters.Add(_Database.CreateParameter("PassCollisions", 0));
|
||||||
|
|
||||||
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
|
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
|
||||||
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
|
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
|
||||||
|
|
||||||
|
if (prim.PhysicsInertia != null)
|
||||||
|
parameters.Add(_Database.CreateParameter("PhysInertia", prim.PhysicsInertia.ToXml2()));
|
||||||
|
else
|
||||||
|
parameters.Add(_Database.CreateParameter("PhysInertia", String.Empty));
|
||||||
|
|
||||||
|
|
||||||
if (prim.DynAttrs.CountNamespaces > 0)
|
if (prim.DynAttrs.CountNamespaces > 0)
|
||||||
parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
|
parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
|
||||||
|
@ -2211,12 +2244,13 @@ namespace OpenSim.Data.PGSQL
|
||||||
parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier));
|
parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier));
|
||||||
parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction));
|
parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction));
|
||||||
parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution));
|
parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution));
|
||||||
|
parameters.Add(_Database.CreateParameter("RotationAxisLocks", prim.RotationAxisLocks));
|
||||||
|
|
||||||
return parameters.ToArray();
|
return parameters.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the primshape parameters for stroing in DB.
|
/// Creates the primshape parameters for storing in DB.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="prim">Basic data of SceneObjectpart prim.</param>
|
/// <param name="prim">Basic data of SceneObjectpart prim.</param>
|
||||||
/// <param name="sceneGroupID">The scene group ID.</param>
|
/// <param name="sceneGroupID">The scene group ID.</param>
|
||||||
|
|
|
@ -1195,3 +1195,19 @@ CREATE TABLE bakedterrain
|
||||||
);
|
);
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
:VERSION 45 #---- Add RezzerID filed in table prims
|
||||||
|
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE prims ADD "RezzerID" uuid NULL;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
:VERSION 46 #---- Add physics inertia data to table prims
|
||||||
|
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE prims ADD "PhysInertia" TEXT;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
|
@ -371,3 +371,9 @@ BEGIN;
|
||||||
ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
|
ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
:VERSION 36 #----- Add physics inertia data
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
|
||||||
|
COMMIT;
|
||||||
|
|
|
@ -1843,6 +1843,12 @@ namespace OpenSim.Data.SQLite
|
||||||
if (vehicle != null)
|
if (vehicle != null)
|
||||||
prim.VehicleParams = vehicle;
|
prim.VehicleParams = vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhysicsInertiaData pdata = null;
|
||||||
|
if (!(row["PhysInertia"] is DBNull) && row["PhysInertia"].ToString() != String.Empty)
|
||||||
|
pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString());
|
||||||
|
prim.PhysicsInertia = pdata;
|
||||||
|
|
||||||
return prim;
|
return prim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2266,6 +2272,11 @@ namespace OpenSim.Data.SQLite
|
||||||
else
|
else
|
||||||
row["Vehicle"] = String.Empty;
|
row["Vehicle"] = String.Empty;
|
||||||
|
|
||||||
|
if (prim.PhysicsInertia != null)
|
||||||
|
row["PhysInertia"] = prim.PhysicsInertia.ToXml2();
|
||||||
|
else
|
||||||
|
row["PhysInertia"] = String.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -47,8 +47,9 @@ namespace OpenSim.Framework
|
||||||
/// Get an asset by its id.
|
/// Get an asset by its id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name='id'></param>
|
/// <param name='id'></param>
|
||||||
/// <returns>null if the asset does not exist.</returns>
|
/// <param name='asset'>Will be set to null if no asset was found</param>
|
||||||
AssetBase Get(string id);
|
/// <returns>False if the asset has been negative-cached</returns>
|
||||||
|
bool Get(string id, out AssetBase asset);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check whether an asset with the specified id exists in the cache.
|
/// Check whether an asset with the specified id exists in the cache.
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace OpenSim.Framework
|
||||||
public delegate void GenericCall4(Packet packet, IClientAPI remoteClient);
|
public delegate void GenericCall4(Packet packet, IClientAPI remoteClient);
|
||||||
|
|
||||||
public delegate void DeRezObject(
|
public delegate void DeRezObject(
|
||||||
IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID);
|
IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID, bool AddToReturns = true);
|
||||||
|
|
||||||
public delegate void GenericCall5(IClientAPI remoteClient, bool status);
|
public delegate void GenericCall5(IClientAPI remoteClient, bool status);
|
||||||
|
|
||||||
|
@ -685,9 +685,10 @@ namespace OpenSim.Framework
|
||||||
ExtraData = 1 << 20,
|
ExtraData = 1 << 20,
|
||||||
Sound = 1 << 21,
|
Sound = 1 << 21,
|
||||||
Joint = 1 << 22,
|
Joint = 1 << 22,
|
||||||
FullUpdate = 0x3fffffff,
|
FullUpdate = 0x0fffffff,
|
||||||
CancelKill = 0x7fffffff,
|
SendInTransit = 0x20000000,
|
||||||
Kill = 0x80000000
|
CancelKill = 0x4fffffff, // 1 << 30
|
||||||
|
Kill = 0x80000000 // 1 << 31
|
||||||
}
|
}
|
||||||
|
|
||||||
/* included in .net 4.0
|
/* included in .net 4.0
|
||||||
|
@ -1112,7 +1113,7 @@ namespace OpenSim.Framework
|
||||||
/// <param name="localID"></param>
|
/// <param name="localID"></param>
|
||||||
void SendKillObject(List<uint> localID);
|
void SendKillObject(List<uint> localID);
|
||||||
|
|
||||||
void SendPartFullUpdate(ISceneEntity ent, uint? parentID);
|
// void SendPartFullUpdate(ISceneEntity ent, uint? parentID);
|
||||||
|
|
||||||
void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
|
void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
|
||||||
void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
|
void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
|
||||||
|
@ -1187,7 +1188,8 @@ namespace OpenSim.Framework
|
||||||
void SetAgentThrottleSilent(int throttle, int setting);
|
void SetAgentThrottleSilent(int throttle, int setting);
|
||||||
int GetAgentThrottleSilent(int throttle);
|
int GetAgentThrottleSilent(int throttle);
|
||||||
|
|
||||||
void SendAvatarDataImmediate(ISceneEntity avatar);
|
void SendEntityFullUpdateImmediate(ISceneEntity entity);
|
||||||
|
void SendEntityTerseUpdateImmediate(ISceneEntity entity);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send a positional, velocity, etc. update to the viewer for a given entity.
|
/// Send a positional, velocity, etc. update to the viewer for a given entity.
|
||||||
|
|
|
@ -47,6 +47,8 @@ namespace OpenSim.Framework.Monitoring
|
||||||
// Subcommand used to list other stats.
|
// Subcommand used to list other stats.
|
||||||
public const string ListSubCommand = "list";
|
public const string ListSubCommand = "list";
|
||||||
|
|
||||||
|
public static string StatsPassword { get; set; }
|
||||||
|
|
||||||
// All subcommands
|
// All subcommands
|
||||||
public static HashSet<string> SubCommands = new HashSet<string> { AllSubCommand, ListSubCommand };
|
public static HashSet<string> SubCommands = new HashSet<string> { AllSubCommand, ListSubCommand };
|
||||||
|
|
||||||
|
@ -302,6 +304,17 @@ namespace OpenSim.Framework.Monitoring
|
||||||
int response_code = 200;
|
int response_code = 200;
|
||||||
string contenttype = "text/json";
|
string contenttype = "text/json";
|
||||||
|
|
||||||
|
if (StatsPassword != String.Empty && (!request.ContainsKey("pass") || request["pass"].ToString() != StatsPassword))
|
||||||
|
{
|
||||||
|
responsedata["int_response_code"] = response_code;
|
||||||
|
responsedata["content_type"] = "text/plain";
|
||||||
|
responsedata["keepalive"] = false;
|
||||||
|
responsedata["str_response_string"] = "Access denied";
|
||||||
|
responsedata["access_control_allow_origin"] = "*";
|
||||||
|
|
||||||
|
return responsedata;
|
||||||
|
}
|
||||||
|
|
||||||
string pCategoryName = StatsManager.AllSubCommand;
|
string pCategoryName = StatsManager.AllSubCommand;
|
||||||
string pContainerName = StatsManager.AllSubCommand;
|
string pContainerName = StatsManager.AllSubCommand;
|
||||||
string pStatName = StatsManager.AllSubCommand;
|
string pStatName = StatsManager.AllSubCommand;
|
||||||
|
|
|
@ -212,7 +212,17 @@ namespace OpenSim.Framework
|
||||||
// Check that we are permitted to make calls to this endpoint.
|
// Check that we are permitted to make calls to this endpoint.
|
||||||
bool foundIpv4Address = false;
|
bool foundIpv4Address = false;
|
||||||
|
|
||||||
IPAddress[] addresses = Dns.GetHostAddresses(url.Host);
|
IPAddress[] addresses = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
addresses = Dns.GetHostAddresses(url.Host);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// If there is a DNS error, we can't stop the script!
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (IPAddress addr in addresses)
|
foreach (IPAddress addr in addresses)
|
||||||
{
|
{
|
||||||
|
@ -253,4 +263,4 @@ namespace OpenSim.Framework
|
||||||
return allowed;
|
return allowed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,262 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenMetaverse;
|
||||||
|
using System.Text;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
public class PhysicsInertiaData
|
||||||
|
{
|
||||||
|
public float TotalMass; // the total mass of a linkset
|
||||||
|
public Vector3 CenterOfMass; // the center of mass position relative to root part position
|
||||||
|
public Vector3 Inertia; // (Ixx, Iyy, Izz) moment of inertia relative to center of mass and principal axis in local coords
|
||||||
|
public Vector4 InertiaRotation; // if principal axis don't match local axis, the principal axis rotation
|
||||||
|
// or the upper triangle of the inertia tensor
|
||||||
|
// Ixy (= Iyx), Ixz (= Izx), Iyz (= Izy))
|
||||||
|
|
||||||
|
public PhysicsInertiaData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public PhysicsInertiaData(PhysicsInertiaData source)
|
||||||
|
{
|
||||||
|
TotalMass = source.TotalMass;
|
||||||
|
CenterOfMass = source.CenterOfMass;
|
||||||
|
Inertia = source.Inertia;
|
||||||
|
InertiaRotation = source.InertiaRotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
private XmlTextWriter writer;
|
||||||
|
|
||||||
|
private void XWint(string name, int i)
|
||||||
|
{
|
||||||
|
writer.WriteElementString(name, i.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void XWfloat(string name, float f)
|
||||||
|
{
|
||||||
|
writer.WriteElementString(name, f.ToString(Utils.EnUsCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void XWVector(string name, Vector3 vec)
|
||||||
|
{
|
||||||
|
writer.WriteStartElement(name);
|
||||||
|
writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture));
|
||||||
|
writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture));
|
||||||
|
writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture));
|
||||||
|
writer.WriteEndElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void XWVector4(string name, Vector4 quat)
|
||||||
|
{
|
||||||
|
writer.WriteStartElement(name);
|
||||||
|
writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture));
|
||||||
|
writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture));
|
||||||
|
writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture));
|
||||||
|
writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture));
|
||||||
|
writer.WriteEndElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ToXml2(XmlTextWriter twriter)
|
||||||
|
{
|
||||||
|
writer = twriter;
|
||||||
|
writer.WriteStartElement("PhysicsInertia");
|
||||||
|
|
||||||
|
XWfloat("MASS", TotalMass);
|
||||||
|
XWVector("CM", CenterOfMass);
|
||||||
|
XWVector("INERTIA", Inertia);
|
||||||
|
XWVector4("IROT", InertiaRotation);
|
||||||
|
|
||||||
|
writer.WriteEndElement();
|
||||||
|
writer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlReader reader;
|
||||||
|
|
||||||
|
private int XRint()
|
||||||
|
{
|
||||||
|
return reader.ReadElementContentAsInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
private float XRfloat()
|
||||||
|
{
|
||||||
|
return reader.ReadElementContentAsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 XRvector()
|
||||||
|
{
|
||||||
|
Vector3 vec;
|
||||||
|
reader.ReadStartElement();
|
||||||
|
vec.X = reader.ReadElementContentAsFloat();
|
||||||
|
vec.Y = reader.ReadElementContentAsFloat();
|
||||||
|
vec.Z = reader.ReadElementContentAsFloat();
|
||||||
|
reader.ReadEndElement();
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector4 XRVector4()
|
||||||
|
{
|
||||||
|
Vector4 q;
|
||||||
|
reader.ReadStartElement();
|
||||||
|
q.X = reader.ReadElementContentAsFloat();
|
||||||
|
q.Y = reader.ReadElementContentAsFloat();
|
||||||
|
q.Z = reader.ReadElementContentAsFloat();
|
||||||
|
q.W = reader.ReadElementContentAsFloat();
|
||||||
|
reader.ReadEndElement();
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool EReadProcessors(
|
||||||
|
Dictionary<string, Action> processors,
|
||||||
|
XmlReader xtr)
|
||||||
|
{
|
||||||
|
bool errors = false;
|
||||||
|
|
||||||
|
string nodeName = string.Empty;
|
||||||
|
while (xtr.NodeType != XmlNodeType.EndElement)
|
||||||
|
{
|
||||||
|
nodeName = xtr.Name;
|
||||||
|
|
||||||
|
Action p = null;
|
||||||
|
if (processors.TryGetValue(xtr.Name, out p))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
p();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
errors = true;
|
||||||
|
if (xtr.NodeType == XmlNodeType.EndElement)
|
||||||
|
xtr.Read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xtr.ReadOuterXml(); // ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ToXml2()
|
||||||
|
{
|
||||||
|
using (StringWriter sw = new StringWriter())
|
||||||
|
{
|
||||||
|
using (XmlTextWriter xwriter = new XmlTextWriter(sw))
|
||||||
|
{
|
||||||
|
ToXml2(xwriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sw.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PhysicsInertiaData FromXml2(string text)
|
||||||
|
{
|
||||||
|
if (text == String.Empty)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
UTF8Encoding enc = new UTF8Encoding();
|
||||||
|
MemoryStream ms = new MemoryStream(enc.GetBytes(text));
|
||||||
|
XmlTextReader xreader = new XmlTextReader(ms);
|
||||||
|
|
||||||
|
PhysicsInertiaData v = new PhysicsInertiaData();
|
||||||
|
bool error;
|
||||||
|
|
||||||
|
v.FromXml2(xreader, out error);
|
||||||
|
|
||||||
|
xreader.Close();
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PhysicsInertiaData FromXml2(XmlReader reader)
|
||||||
|
{
|
||||||
|
PhysicsInertiaData data = new PhysicsInertiaData();
|
||||||
|
|
||||||
|
bool errors = false;
|
||||||
|
|
||||||
|
data.FromXml2(reader, out errors);
|
||||||
|
if (errors)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FromXml2(XmlReader _reader, out bool errors)
|
||||||
|
{
|
||||||
|
errors = false;
|
||||||
|
reader = _reader;
|
||||||
|
|
||||||
|
Dictionary<string, Action> m_XmlProcessors = new Dictionary<string, Action>();
|
||||||
|
|
||||||
|
m_XmlProcessors.Add("MASS", ProcessXR_Mass);
|
||||||
|
m_XmlProcessors.Add("CM", ProcessXR_CM);
|
||||||
|
m_XmlProcessors.Add("INERTIA", ProcessXR_Inertia);
|
||||||
|
m_XmlProcessors.Add("IROT", ProcessXR_InertiaRotation);
|
||||||
|
|
||||||
|
reader.ReadStartElement("PhysicsInertia", String.Empty);
|
||||||
|
|
||||||
|
errors = EReadProcessors(
|
||||||
|
m_XmlProcessors,
|
||||||
|
reader);
|
||||||
|
|
||||||
|
reader.ReadEndElement();
|
||||||
|
reader = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessXR_Mass()
|
||||||
|
{
|
||||||
|
TotalMass = XRfloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessXR_CM()
|
||||||
|
{
|
||||||
|
CenterOfMass = XRvector();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessXR_Inertia()
|
||||||
|
{
|
||||||
|
Inertia = XRvector();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessXR_InertiaRotation()
|
||||||
|
{
|
||||||
|
InertiaRotation = XRVector4();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -328,6 +328,70 @@ namespace OpenSim.Framework
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PrimitiveBaseShape CreateMesh(int numberOfFaces, UUID meshAssetID)
|
||||||
|
{
|
||||||
|
PrimitiveBaseShape shape = new PrimitiveBaseShape();
|
||||||
|
|
||||||
|
shape._pathScaleX = 100;
|
||||||
|
shape._pathScaleY = 100;
|
||||||
|
|
||||||
|
if(numberOfFaces <= 0) // oops ?
|
||||||
|
numberOfFaces = 1;
|
||||||
|
|
||||||
|
switch(numberOfFaces)
|
||||||
|
{
|
||||||
|
case 1: // torus
|
||||||
|
shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
|
||||||
|
shape.PathCurve = (byte)Extrusion.Curve1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: // torus with hollow (a sl viewer whould see 4 faces on a hollow sphere)
|
||||||
|
shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
|
||||||
|
shape.PathCurve = (byte)Extrusion.Curve1;
|
||||||
|
shape.ProfileHollow = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: // cylinder
|
||||||
|
shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
|
||||||
|
shape.PathCurve = (byte)Extrusion.Straight;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4: // cylinder with hollow
|
||||||
|
shape.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
|
||||||
|
shape.PathCurve = (byte)Extrusion.Straight;
|
||||||
|
shape.ProfileHollow = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5: // prism
|
||||||
|
shape.ProfileCurve = (byte)ProfileShape.EquilateralTriangle | (byte)HollowShape.Triangle;
|
||||||
|
shape.PathCurve = (byte)Extrusion.Straight;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6: // box
|
||||||
|
shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle;
|
||||||
|
shape.PathCurve = (byte)Extrusion.Straight;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7: // box with hollow
|
||||||
|
shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle;
|
||||||
|
shape.PathCurve = (byte)Extrusion.Straight;
|
||||||
|
shape.ProfileHollow = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // 8 faces box with cut
|
||||||
|
shape.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle;
|
||||||
|
shape.PathCurve = (byte)Extrusion.Straight;
|
||||||
|
shape.ProfileBegin = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
shape.SculptEntry = true;
|
||||||
|
shape.SculptType = (byte)OpenMetaverse.SculptType.Mesh;
|
||||||
|
shape.SculptTexture = meshAssetID;
|
||||||
|
|
||||||
|
return shape;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetScale(float side)
|
public void SetScale(float side)
|
||||||
{
|
{
|
||||||
_scale = new Vector3(side, side, side);
|
_scale = new Vector3(side, side, side);
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace OpenSim.Framework
|
||||||
private float m_physPrimMin = 0;
|
private float m_physPrimMin = 0;
|
||||||
private int m_physPrimMax = 0;
|
private int m_physPrimMax = 0;
|
||||||
private bool m_clampPrimSize = false;
|
private bool m_clampPrimSize = false;
|
||||||
private int m_objectCapacity = 0;
|
private int m_objectCapacity = 15000;
|
||||||
private int m_maxPrimsPerUser = -1;
|
private int m_maxPrimsPerUser = -1;
|
||||||
private int m_linksetCapacity = 0;
|
private int m_linksetCapacity = 0;
|
||||||
private string m_regionType = String.Empty;
|
private string m_regionType = String.Empty;
|
||||||
|
@ -753,7 +753,7 @@ namespace OpenSim.Framework
|
||||||
m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
|
m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
|
||||||
allKeys.Remove("ClampPrimSize");
|
allKeys.Remove("ClampPrimSize");
|
||||||
|
|
||||||
m_objectCapacity = config.GetInt("MaxPrims", 15000);
|
m_objectCapacity = config.GetInt("MaxPrims", m_objectCapacity);
|
||||||
allKeys.Remove("MaxPrims");
|
allKeys.Remove("MaxPrims");
|
||||||
|
|
||||||
m_maxPrimsPerUser = config.GetInt("MaxPrimsPerUser", -1);
|
m_maxPrimsPerUser = config.GetInt("MaxPrimsPerUser", -1);
|
||||||
|
|
|
@ -57,6 +57,7 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
protected OpenSimAppender m_consoleAppender;
|
protected OpenSimAppender m_consoleAppender;
|
||||||
protected FileAppender m_logFileAppender;
|
protected FileAppender m_logFileAppender;
|
||||||
|
protected FileAppender m_statsLogFileAppender;
|
||||||
|
|
||||||
protected DateTime m_startuptime;
|
protected DateTime m_startuptime;
|
||||||
protected string m_startupDirectory = Environment.CurrentDirectory;
|
protected string m_startupDirectory = Environment.CurrentDirectory;
|
||||||
|
@ -156,6 +157,10 @@ namespace OpenSim.Framework.Servers
|
||||||
{
|
{
|
||||||
m_logFileAppender = (FileAppender)appender;
|
m_logFileAppender = (FileAppender)appender;
|
||||||
}
|
}
|
||||||
|
else if (appender.Name == "StatsLogFileAppender")
|
||||||
|
{
|
||||||
|
m_statsLogFileAppender = (FileAppender)appender;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null == m_consoleAppender)
|
if (null == m_consoleAppender)
|
||||||
|
@ -185,6 +190,18 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
m_log.InfoFormat("[SERVER BASE]: Logging started to file {0}", m_logFileAppender.File);
|
m_log.InfoFormat("[SERVER BASE]: Logging started to file {0}", m_logFileAppender.File);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_statsLogFileAppender != null && startupConfig != null)
|
||||||
|
{
|
||||||
|
string cfgStatsFileName = startupConfig.GetString("StatsLogFile", null);
|
||||||
|
if (cfgStatsFileName != null)
|
||||||
|
{
|
||||||
|
m_statsLogFileAppender.File = cfgStatsFileName;
|
||||||
|
m_statsLogFileAppender.ActivateOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.InfoFormat("[SERVER BASE]: Stats Logging started to file {0}", m_statsLogFileAppender.File);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -63,22 +63,34 @@ namespace OpenSim.Framework
|
||||||
None = 0,
|
None = 0,
|
||||||
|
|
||||||
// folded perms
|
// folded perms
|
||||||
foldedTransfer = 1,
|
FoldedTransfer = 1,
|
||||||
foldedModify = 1 << 1,
|
FoldedModify = 1 << 1,
|
||||||
foldedCopy = 1 << 2,
|
FoldedCopy = 1 << 2,
|
||||||
|
FoldedExport = 1 << 3,
|
||||||
|
|
||||||
foldedMask = 0x07,
|
// DO NOT USE THIS FOR NEW WORK. IT IS DEPRECATED AND
|
||||||
|
// EXISTS ONLY TO REACT TO EXISTING OBJECTS HAVING IT.
|
||||||
|
// NEW CODE SHOULD NEVER SET THIS BIT!
|
||||||
|
// Use InventoryItemFlags.ObjectSlamPerm in the Flags field of
|
||||||
|
// this legacy slam bit. It comes from prior incomplete
|
||||||
|
// understanding of the code and the prohibition on
|
||||||
|
// reading viewer code that used to be in place.
|
||||||
|
Slam = (1 << 4),
|
||||||
|
|
||||||
|
FoldedMask = 0x0f,
|
||||||
|
|
||||||
//
|
//
|
||||||
Transfer = 1 << 13,
|
Transfer = 1 << 13, // 0x02000
|
||||||
Modify = 1 << 14,
|
Modify = 1 << 14, // 0x04000
|
||||||
Copy = 1 << 15,
|
Copy = 1 << 15, // 0x08000
|
||||||
Export = 1 << 16,
|
Export = 1 << 16, // 0x10000
|
||||||
Move = 1 << 19,
|
Move = 1 << 19, // 0x80000
|
||||||
Damage = 1 << 20,
|
Damage = 1 << 20, // 0x100000 does not seem to be in use
|
||||||
// All does not contain Export, which is special and must be
|
// All does not contain Export, which is special and must be
|
||||||
// explicitly given
|
// explicitly given
|
||||||
All = (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19)
|
All = 0x8e000,
|
||||||
|
AllAndExport = 0x9e000,
|
||||||
|
AllEffective = 0x9e000
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1180,7 +1192,7 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
foreach (IAppender appender in LogManager.GetRepository().GetAppenders())
|
foreach (IAppender appender in LogManager.GetRepository().GetAppenders())
|
||||||
{
|
{
|
||||||
if (appender is FileAppender)
|
if (appender is FileAppender && appender.Name == "LogFileAppender")
|
||||||
{
|
{
|
||||||
return ((FileAppender)appender).File;
|
return ((FileAppender)appender).File;
|
||||||
}
|
}
|
||||||
|
@ -1189,6 +1201,19 @@ namespace OpenSim.Framework
|
||||||
return "./OpenSim.log";
|
return "./OpenSim.log";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string statsLogFile()
|
||||||
|
{
|
||||||
|
foreach (IAppender appender in LogManager.GetRepository().GetAppenders())
|
||||||
|
{
|
||||||
|
if (appender is FileAppender && appender.Name == "StatsLogFileAppender")
|
||||||
|
{
|
||||||
|
return ((FileAppender)appender).File;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "./OpenSimStats.log";
|
||||||
|
}
|
||||||
|
|
||||||
public static string logDir()
|
public static string logDir()
|
||||||
{
|
{
|
||||||
return Path.GetDirectoryName(logFile());
|
return Path.GetDirectoryName(logFile());
|
||||||
|
|
|
@ -113,7 +113,8 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
if (dataCache.Check(item.TextureID.ToString()))
|
if (dataCache.Check(item.TextureID.ToString()))
|
||||||
{
|
{
|
||||||
AssetBase assetItem = dataCache.Get(item.TextureID.ToString());
|
AssetBase assetItem;
|
||||||
|
dataCache.Get(item.TextureID.ToString(), out assetItem);
|
||||||
if (assetItem != null)
|
if (assetItem != null)
|
||||||
{
|
{
|
||||||
itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data));
|
itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data));
|
||||||
|
|
|
@ -211,6 +211,7 @@ namespace OpenSim
|
||||||
if (managedStatsURI != String.Empty)
|
if (managedStatsURI != String.Empty)
|
||||||
{
|
{
|
||||||
string urlBase = String.Format("/{0}/", managedStatsURI);
|
string urlBase = String.Format("/{0}/", managedStatsURI);
|
||||||
|
StatsManager.StatsPassword = managedStatsPassword;
|
||||||
MainServer.Instance.AddHTTPHandler(urlBase, StatsManager.HandleStatsRequest);
|
MainServer.Instance.AddHTTPHandler(urlBase, StatsManager.HandleStatsRequest);
|
||||||
m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase);
|
m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,7 @@ namespace OpenSim
|
||||||
|
|
||||||
public string userStatsURI = String.Empty;
|
public string userStatsURI = String.Empty;
|
||||||
public string managedStatsURI = String.Empty;
|
public string managedStatsURI = String.Empty;
|
||||||
|
public string managedStatsPassword = String.Empty;
|
||||||
|
|
||||||
protected bool m_autoCreateClientStack = true;
|
protected bool m_autoCreateClientStack = true;
|
||||||
|
|
||||||
|
@ -239,6 +240,7 @@ namespace OpenSim
|
||||||
m_permsModules = new List<string>(permissionModules.Split(','));
|
m_permsModules = new List<string>(permissionModules.Split(','));
|
||||||
|
|
||||||
managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty);
|
managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty);
|
||||||
|
managedStatsPassword = startupConfig.GetString("ManagedStatsRemoteFetchPassword", String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the simulation data service
|
// Load the simulation data service
|
||||||
|
@ -481,15 +483,14 @@ namespace OpenSim
|
||||||
while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
|
while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
|
||||||
SetUpEstateOwner(scene);
|
SetUpEstateOwner(scene);
|
||||||
|
|
||||||
|
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
|
||||||
|
|
||||||
// Prims have to be loaded after module configuration since some modules may be invoked during the load
|
// Prims have to be loaded after module configuration since some modules may be invoked during the load
|
||||||
scene.LoadPrimsFromStorage(regionInfo.originRegionID);
|
scene.LoadPrimsFromStorage(regionInfo.originRegionID);
|
||||||
|
|
||||||
// TODO : Try setting resource for region xstats here on scene
|
// TODO : Try setting resource for region xstats here on scene
|
||||||
MainServer.Instance.AddStreamHandler(new RegionStatsHandler(regionInfo));
|
MainServer.Instance.AddStreamHandler(new RegionStatsHandler(regionInfo));
|
||||||
|
|
||||||
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
|
|
||||||
scene.EventManager.TriggerParcelPrimCountUpdate();
|
|
||||||
|
|
||||||
if (scene.SnmpService != null)
|
if (scene.SnmpService != null)
|
||||||
{
|
{
|
||||||
scene.SnmpService.BootInfo("Grid Registration in progress", scene);
|
scene.SnmpService.BootInfo("Grid Registration in progress", scene);
|
||||||
|
|
|
@ -946,17 +946,26 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
|
OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
|
||||||
|
|
||||||
|
PrimitiveBaseShape pbs = null;
|
||||||
|
if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
|
||||||
|
{
|
||||||
|
int meshindx = inner_instance_list["mesh"].AsInteger();
|
||||||
|
if (meshAssets.Count > meshindx)
|
||||||
|
pbs = PrimitiveBaseShape.CreateMesh(face_list.Count, meshAssets[meshindx]);
|
||||||
|
}
|
||||||
|
if(pbs == null) // fallback
|
||||||
|
pbs = PrimitiveBaseShape.CreateBox();
|
||||||
|
|
||||||
Primitive.TextureEntry textureEntry
|
Primitive.TextureEntry textureEntry
|
||||||
= new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);
|
= new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);
|
||||||
|
|
||||||
|
|
||||||
OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
|
|
||||||
for (uint face = 0; face < face_list.Count; face++)
|
for (uint face = 0; face < face_list.Count; face++)
|
||||||
{
|
{
|
||||||
OSDMap faceMap = (OSDMap)face_list[(int)face];
|
OSDMap faceMap = (OSDMap)face_list[(int)face];
|
||||||
Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face);
|
|
||||||
|
Primitive.TextureEntryFace f = textureEntry.CreateFace(face); //clone the default
|
||||||
if (faceMap.ContainsKey("fullbright"))
|
if (faceMap.ContainsKey("fullbright"))
|
||||||
f.Fullbright = faceMap["fullbright"].AsBoolean();
|
f.Fullbright = faceMap["fullbright"].AsBoolean();
|
||||||
if (faceMap.ContainsKey("diffuse_color"))
|
if (faceMap.ContainsKey("diffuse_color"))
|
||||||
|
@ -986,51 +995,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
if (textures.Count > textureNum)
|
if (textures.Count > textureNum)
|
||||||
f.TextureID = textures[textureNum];
|
f.TextureID = textures[textureNum];
|
||||||
else
|
|
||||||
f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE;
|
|
||||||
|
|
||||||
textureEntry.FaceTextures[face] = f;
|
textureEntry.FaceTextures[face] = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
pbs.TextureEntry = textureEntry.GetBytes();
|
pbs.TextureEntry = textureEntry.GetBytes();
|
||||||
|
|
||||||
if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
|
|
||||||
{
|
|
||||||
int meshindx = inner_instance_list["mesh"].AsInteger();
|
|
||||||
if (meshAssets.Count > meshindx)
|
|
||||||
{
|
|
||||||
pbs.SculptEntry = true;
|
|
||||||
pbs.SculptType = (byte)SculptType.Mesh;
|
|
||||||
pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction
|
|
||||||
// data will be requested from asset on rez (i hope)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// faces number to pbs shape
|
|
||||||
switch(face_list.Count)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
pbs.ProfileCurve = (byte)ProfileCurve.Circle;
|
|
||||||
pbs.PathCurve = (byte)PathCurve.Circle;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
case 4:
|
|
||||||
pbs.ProfileCurve = (byte)ProfileCurve.Circle;
|
|
||||||
pbs.PathCurve = (byte)PathCurve.Line;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
pbs.ProfileCurve = (byte)ProfileCurve.EqualTriangle;
|
|
||||||
pbs.PathCurve = (byte)PathCurve.Line;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
pbs.ProfileCurve = (byte)ProfileCurve.Square;
|
|
||||||
pbs.PathCurve = (byte)PathCurve.Line;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector3 position = inner_instance_list["position"].AsVector3();
|
Vector3 position = inner_instance_list["position"].AsVector3();
|
||||||
Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
|
Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
|
|
||||||
OSD r = OSDParser.DeserializeLLSDXml((string)request["requestbody"]);
|
OSD r = OSDParser.DeserializeLLSDXml((string)request["requestbody"]);
|
||||||
|
if (r.Type != OSDType.Map) // not a proper req
|
||||||
|
return responsedata;
|
||||||
|
|
||||||
//UUID session_id = UUID.Zero;
|
//UUID session_id = UUID.Zero;
|
||||||
bool bypass_raycast = false;
|
bool bypass_raycast = false;
|
||||||
uint everyone_mask = 0;
|
uint everyone_mask = 0;
|
||||||
|
@ -157,9 +160,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
int state = 0;
|
int state = 0;
|
||||||
int lastattach = 0;
|
int lastattach = 0;
|
||||||
|
|
||||||
if (r.Type != OSDType.Map) // not a proper req
|
|
||||||
return responsedata;
|
|
||||||
|
|
||||||
OSDMap rm = (OSDMap)r;
|
OSDMap rm = (OSDMap)r;
|
||||||
|
|
||||||
if (rm.ContainsKey("ObjectData")) //v2
|
if (rm.ContainsKey("ObjectData")) //v2
|
||||||
|
@ -307,8 +307,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Vector3 pos = m_scene.GetNewRezLocation(ray_start, ray_end, ray_target_id, rotation, (bypass_raycast) ? (byte)1 : (byte)0, (ray_end_is_intersection) ? (byte)1 : (byte)0, true, scale, false);
|
Vector3 pos = m_scene.GetNewRezLocation(ray_start, ray_end, ray_target_id, rotation, (bypass_raycast) ? (byte)1 : (byte)0, (ray_end_is_intersection) ? (byte)1 : (byte)0, true, scale, false);
|
||||||
|
|
||||||
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
|
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
|
||||||
|
@ -359,6 +357,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
rootpart.NextOwnerMask = next_owner_mask;
|
rootpart.NextOwnerMask = next_owner_mask;
|
||||||
rootpart.Material = (byte)material;
|
rootpart.Material = (byte)material;
|
||||||
|
|
||||||
|
obj.AggregatePerms();
|
||||||
|
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
|
||||||
|
|
||||||
responsedata["int_response_code"] = 200; //501; //410; //404;
|
responsedata["int_response_code"] = 200; //501; //410; //404;
|
||||||
|
|
|
@ -335,6 +335,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
grp.AbsolutePosition = obj.Position;
|
grp.AbsolutePosition = obj.Position;
|
||||||
prim.RotationOffset = obj.Rotation;
|
prim.RotationOffset = obj.Rotation;
|
||||||
|
|
||||||
|
|
||||||
// Required for linking
|
// Required for linking
|
||||||
grp.RootPart.ClearUpdateSchedule();
|
grp.RootPart.ClearUpdateSchedule();
|
||||||
|
|
||||||
|
|
|
@ -3950,24 +3950,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send an ObjectUpdate packet with information about an avatar
|
/// Send an ObjectUpdate packet with information about an avatar
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendAvatarDataImmediate(ISceneEntity avatar)
|
public void SendEntityFullUpdateImmediate(ISceneEntity ent)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}",
|
// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}",
|
||||||
// avatar.Name, avatar.UUID, Name, AgentId);
|
// avatar.Name, avatar.UUID, Name, AgentId);
|
||||||
|
|
||||||
ScenePresence presence = avatar as ScenePresence;
|
if (ent == null)
|
||||||
if (presence == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
|
ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
|
||||||
objupdate.Header.Zerocoded = true;
|
objupdate.Header.Zerocoded = true;
|
||||||
|
|
||||||
objupdate.RegionData.RegionHandle = presence.RegionHandle;
|
|
||||||
// objupdate.RegionData.TimeDilation = ushort.MaxValue;
|
|
||||||
objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
|
objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
|
||||||
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
|
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
|
|
||||||
|
if(ent is ScenePresence)
|
||||||
|
{
|
||||||
|
ScenePresence presence = ent as ScenePresence;
|
||||||
|
objupdate.RegionData.RegionHandle = presence.RegionHandle;
|
||||||
|
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
|
||||||
|
}
|
||||||
|
else if(ent is SceneObjectPart)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = ent as SceneObjectPart;
|
||||||
|
objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||||
|
objupdate.ObjectData[0] = CreatePrimUpdateBlock(part, (ScenePresence)SceneAgent);
|
||||||
|
}
|
||||||
|
|
||||||
|
OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
|
||||||
|
|
||||||
|
// We need to record the avatar local id since the root prim of an attachment points to this.
|
||||||
|
// m_attachmentsSent.Add(avatar.LocalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}",
|
||||||
|
// avatar.Name, avatar.UUID, Name, AgentId);
|
||||||
|
|
||||||
|
if (ent == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ImprovedTerseObjectUpdatePacket objupdate =
|
||||||
|
(ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
|
||||||
|
objupdate.Header.Zerocoded = true;
|
||||||
|
|
||||||
|
objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
|
||||||
|
objupdate.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
|
if(ent is ScenePresence)
|
||||||
|
{
|
||||||
|
ScenePresence presence = ent as ScenePresence;
|
||||||
|
objupdate.RegionData.RegionHandle = presence.RegionHandle;
|
||||||
|
objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false);
|
||||||
|
}
|
||||||
|
else if(ent is SceneObjectPart)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = ent as SceneObjectPart;
|
||||||
|
objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||||
|
objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false);
|
||||||
|
}
|
||||||
|
|
||||||
OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
|
OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
|
||||||
|
|
||||||
|
@ -4021,7 +4065,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
#region Primitive Packet/Data Sending Methods
|
#region Primitive Packet/Data Sending Methods
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate one of the object update packets based on PrimUpdateFlags
|
/// Generate one of the object update packets based on PrimUpdateFlags
|
||||||
/// and broadcast the packet to clients
|
/// and broadcast the packet to clients
|
||||||
|
@ -4044,10 +4087,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
*/
|
*/
|
||||||
if (entity is SceneObjectPart)
|
if (entity is SceneObjectPart)
|
||||||
{
|
{
|
||||||
SceneObjectPart e = (SceneObjectPart)entity;
|
SceneObjectPart p = (SceneObjectPart)entity;
|
||||||
SceneObjectGroup g = e.ParentGroup;
|
SceneObjectGroup g = p.ParentGroup;
|
||||||
if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId)
|
if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId)
|
||||||
return; // Don't send updates for other people's HUDs
|
return; // Don't send updates for other people's HUDs
|
||||||
|
|
||||||
|
if((updateFlags ^ PrimUpdateFlags.SendInTransit) == 0)
|
||||||
|
{
|
||||||
|
List<uint> partIDs = (new List<uint> {p.LocalId});
|
||||||
|
lock (m_entityProps.SyncRoot)
|
||||||
|
m_entityProps.Remove(partIDs);
|
||||||
|
lock (m_entityUpdates.SyncRoot)
|
||||||
|
m_entityUpdates.Remove(partIDs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
//double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||||
|
@ -4126,14 +4179,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// Vector3 mycamera = Vector3.Zero;
|
// Vector3 mycamera = Vector3.Zero;
|
||||||
Vector3 mypos = Vector3.Zero;
|
Vector3 mypos = Vector3.Zero;
|
||||||
ScenePresence mysp = (ScenePresence)SceneAgent;
|
ScenePresence mysp = (ScenePresence)SceneAgent;
|
||||||
if(mysp != null && !mysp.IsDeleted)
|
|
||||||
|
// we should have a presence
|
||||||
|
if(mysp == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(doCulling)
|
||||||
{
|
{
|
||||||
cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f;
|
cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f;
|
||||||
// mycamera = mysp.CameraPosition;
|
// mycamera = mysp.CameraPosition;
|
||||||
mypos = mysp.AbsolutePosition;
|
mypos = mysp.AbsolutePosition;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
doCulling = false;
|
|
||||||
|
|
||||||
while (maxUpdatesBytes > 0)
|
while (maxUpdatesBytes > 0)
|
||||||
{
|
{
|
||||||
|
@ -4154,9 +4210,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
SceneObjectPart part = (SceneObjectPart)update.Entity;
|
SceneObjectPart part = (SceneObjectPart)update.Entity;
|
||||||
SceneObjectGroup grp = part.ParentGroup;
|
SceneObjectGroup grp = part.ParentGroup;
|
||||||
if (grp.inTransit)
|
if (grp.inTransit && !update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
|
||||||
continue;
|
continue;
|
||||||
|
/* debug
|
||||||
|
if (update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
if (grp.IsDeleted)
|
if (grp.IsDeleted)
|
||||||
{
|
{
|
||||||
// Don't send updates for objects that have been marked deleted.
|
// Don't send updates for objects that have been marked deleted.
|
||||||
|
@ -4213,14 +4275,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
part.Shape.LightEntry = false;
|
part.Shape.LightEntry = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
|
|
||||||
{
|
|
||||||
// Ensure that mesh has at least 8 valid faces
|
|
||||||
part.Shape.ProfileBegin = 12500;
|
|
||||||
part.Shape.ProfileEnd = 0;
|
|
||||||
part.Shape.ProfileHollow = 27500;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doCulling && !grp.IsAttachment)
|
if(doCulling && !grp.IsAttachment)
|
||||||
|
@ -4248,14 +4302,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
|
|
||||||
{
|
|
||||||
// Ensure that mesh has at least 8 valid faces
|
|
||||||
part.Shape.ProfileBegin = 12500;
|
|
||||||
part.Shape.ProfileEnd = 0;
|
|
||||||
part.Shape.ProfileHollow = 27500;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (update.Entity is ScenePresence)
|
else if (update.Entity is ScenePresence)
|
||||||
{
|
{
|
||||||
|
@ -4330,7 +4376,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (update.Entity is ScenePresence)
|
if (update.Entity is ScenePresence)
|
||||||
ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
|
ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
|
||||||
else
|
else
|
||||||
ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId);
|
ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, mysp);
|
||||||
objectUpdateBlocks.Add(ablock);
|
objectUpdateBlocks.Add(ablock);
|
||||||
objectUpdates.Value.Add(update);
|
objectUpdates.Value.Add(update);
|
||||||
maxUpdatesBytes -= ablock.Length;
|
maxUpdatesBytes -= ablock.Length;
|
||||||
|
@ -4462,6 +4508,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
|
|
||||||
// hack.. dont use
|
// hack.. dont use
|
||||||
|
/*
|
||||||
public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
|
public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
|
||||||
{
|
{
|
||||||
if (ent is SceneObjectPart)
|
if (ent is SceneObjectPart)
|
||||||
|
@ -4472,7 +4519,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
|
packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
|
||||||
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
|
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId);
|
ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, mysp);
|
||||||
if (parentID.HasValue)
|
if (parentID.HasValue)
|
||||||
{
|
{
|
||||||
blk.ParentID = parentID.Value;
|
blk.ParentID = parentID.Value;
|
||||||
|
@ -4488,7 +4535,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
|
// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public void ReprioritizeUpdates()
|
public void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
lock (m_entityUpdates.SyncRoot)
|
lock (m_entityUpdates.SyncRoot)
|
||||||
|
@ -5726,28 +5773,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return update;
|
return update;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID)
|
// protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID)
|
||||||
|
protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart part, ScenePresence sp)
|
||||||
{
|
{
|
||||||
byte[] objectData = new byte[60];
|
byte[] objectData = new byte[60];
|
||||||
data.RelativePosition.ToBytes(objectData, 0);
|
part.RelativePosition.ToBytes(objectData, 0);
|
||||||
data.Velocity.ToBytes(objectData, 12);
|
part.Velocity.ToBytes(objectData, 12);
|
||||||
data.Acceleration.ToBytes(objectData, 24);
|
part.Acceleration.ToBytes(objectData, 24);
|
||||||
|
|
||||||
Quaternion rotation = data.RotationOffset;
|
Quaternion rotation = part.RotationOffset;
|
||||||
rotation.Normalize();
|
rotation.Normalize();
|
||||||
rotation.ToBytes(objectData, 36);
|
rotation.ToBytes(objectData, 36);
|
||||||
data.AngularVelocity.ToBytes(objectData, 48);
|
part.AngularVelocity.ToBytes(objectData, 48);
|
||||||
|
|
||||||
ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
|
ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
|
||||||
update.ClickAction = (byte)data.ClickAction;
|
update.ClickAction = (byte)part.ClickAction;
|
||||||
update.CRC = 0;
|
update.CRC = 0;
|
||||||
update.ExtraParams = data.Shape.ExtraParams ?? Utils.EmptyBytes;
|
update.ExtraParams = part.Shape.ExtraParams ?? Utils.EmptyBytes;
|
||||||
update.FullID = data.UUID;
|
update.FullID = part.UUID;
|
||||||
update.ID = data.LocalId;
|
update.ID = part.LocalId;
|
||||||
//update.JointAxisOrAnchor = Vector3.Zero; // These are deprecated
|
//update.JointAxisOrAnchor = Vector3.Zero; // These are deprecated
|
||||||
//update.JointPivot = Vector3.Zero;
|
//update.JointPivot = Vector3.Zero;
|
||||||
//update.JointType = 0;
|
//update.JointType = 0;
|
||||||
update.Material = data.Material;
|
update.Material = part.Material;
|
||||||
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
|
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
|
||||||
/*
|
/*
|
||||||
if (data.ParentGroup.IsAttachment)
|
if (data.ParentGroup.IsAttachment)
|
||||||
|
@ -5776,68 +5824,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (data.ParentGroup.IsAttachment)
|
if (part.ParentGroup.IsAttachment)
|
||||||
{
|
{
|
||||||
if (data.IsRoot)
|
if (part.IsRoot)
|
||||||
{
|
{
|
||||||
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID);
|
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + part.ParentGroup.FromItemID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
update.NameValue = Utils.EmptyBytes;
|
update.NameValue = Utils.EmptyBytes;
|
||||||
|
|
||||||
int st = (int)data.ParentGroup.AttachmentPoint;
|
int st = (int)part.ParentGroup.AttachmentPoint;
|
||||||
update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ;
|
update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
update.NameValue = Utils.EmptyBytes;
|
update.NameValue = Utils.EmptyBytes;
|
||||||
update.State = data.Shape.State; // not sure about this
|
update.State = part.Shape.State; // not sure about this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
update.ObjectData = objectData;
|
update.ObjectData = objectData;
|
||||||
update.ParentID = data.ParentID;
|
update.ParentID = part.ParentID;
|
||||||
update.PathBegin = data.Shape.PathBegin;
|
update.PathBegin = part.Shape.PathBegin;
|
||||||
update.PathCurve = data.Shape.PathCurve;
|
update.PathCurve = part.Shape.PathCurve;
|
||||||
update.PathEnd = data.Shape.PathEnd;
|
update.PathEnd = part.Shape.PathEnd;
|
||||||
update.PathRadiusOffset = data.Shape.PathRadiusOffset;
|
update.PathRadiusOffset = part.Shape.PathRadiusOffset;
|
||||||
update.PathRevolutions = data.Shape.PathRevolutions;
|
update.PathRevolutions = part.Shape.PathRevolutions;
|
||||||
update.PathScaleX = data.Shape.PathScaleX;
|
update.PathScaleX = part.Shape.PathScaleX;
|
||||||
update.PathScaleY = data.Shape.PathScaleY;
|
update.PathScaleY = part.Shape.PathScaleY;
|
||||||
update.PathShearX = data.Shape.PathShearX;
|
update.PathShearX = part.Shape.PathShearX;
|
||||||
update.PathShearY = data.Shape.PathShearY;
|
update.PathShearY = part.Shape.PathShearY;
|
||||||
update.PathSkew = data.Shape.PathSkew;
|
update.PathSkew = part.Shape.PathSkew;
|
||||||
update.PathTaperX = data.Shape.PathTaperX;
|
update.PathTaperX = part.Shape.PathTaperX;
|
||||||
update.PathTaperY = data.Shape.PathTaperY;
|
update.PathTaperY = part.Shape.PathTaperY;
|
||||||
update.PathTwist = data.Shape.PathTwist;
|
update.PathTwist = part.Shape.PathTwist;
|
||||||
update.PathTwistBegin = data.Shape.PathTwistBegin;
|
update.PathTwistBegin = part.Shape.PathTwistBegin;
|
||||||
update.PCode = data.Shape.PCode;
|
update.PCode = part.Shape.PCode;
|
||||||
update.ProfileBegin = data.Shape.ProfileBegin;
|
update.ProfileBegin = part.Shape.ProfileBegin;
|
||||||
update.ProfileCurve = data.Shape.ProfileCurve;
|
update.ProfileCurve = part.Shape.ProfileCurve;
|
||||||
update.ProfileEnd = data.Shape.ProfileEnd;
|
|
||||||
update.ProfileHollow = data.Shape.ProfileHollow;
|
if(part.Shape.SculptType == (byte)SculptType.Mesh) // filter out hack
|
||||||
update.PSBlock = data.ParticleSystem ?? Utils.EmptyBytes;
|
update.ProfileCurve = (byte)(part.Shape.ProfileCurve & 0x0f);
|
||||||
update.TextColor = data.GetTextColor().GetBytes(false);
|
else
|
||||||
update.TextureAnim = data.TextureAnimation ?? Utils.EmptyBytes;
|
update.ProfileCurve = part.Shape.ProfileCurve;
|
||||||
update.TextureEntry = data.Shape.TextureEntry ?? Utils.EmptyBytes;
|
|
||||||
update.Scale = data.Shape.Scale;
|
update.ProfileEnd = part.Shape.ProfileEnd;
|
||||||
update.Text = Util.StringToBytes256(data.Text);
|
update.ProfileHollow = part.Shape.ProfileHollow;
|
||||||
update.MediaURL = Util.StringToBytes256(data.MediaUrl);
|
update.PSBlock = part.ParticleSystem ?? Utils.EmptyBytes;
|
||||||
|
update.TextColor = part.GetTextColor().GetBytes(false);
|
||||||
|
update.TextureAnim = part.TextureAnimation ?? Utils.EmptyBytes;
|
||||||
|
update.TextureEntry = part.Shape.TextureEntry ?? Utils.EmptyBytes;
|
||||||
|
update.Scale = part.Shape.Scale;
|
||||||
|
update.Text = Util.StringToBytes256(part.Text);
|
||||||
|
update.MediaURL = Util.StringToBytes256(part.MediaUrl);
|
||||||
|
|
||||||
#region PrimFlags
|
#region PrimFlags
|
||||||
|
|
||||||
PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(recipientID, data.UUID);
|
PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(part, sp);
|
||||||
|
|
||||||
// Don't send the CreateSelected flag to everyone
|
// Don't send the CreateSelected flag to everyone
|
||||||
flags &= ~PrimFlags.CreateSelected;
|
flags &= ~PrimFlags.CreateSelected;
|
||||||
|
|
||||||
if (recipientID == data.OwnerID)
|
if (sp.UUID == part.OwnerID)
|
||||||
{
|
{
|
||||||
if (data.CreateSelected)
|
if (part.CreateSelected)
|
||||||
{
|
{
|
||||||
// Only send this flag once, then unset it
|
// Only send this flag once, then unset it
|
||||||
flags |= PrimFlags.CreateSelected;
|
flags |= PrimFlags.CreateSelected;
|
||||||
data.CreateSelected = false;
|
part.CreateSelected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5849,21 +5903,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
#endregion PrimFlags
|
#endregion PrimFlags
|
||||||
|
|
||||||
if (data.Sound != UUID.Zero)
|
if (part.Sound != UUID.Zero)
|
||||||
{
|
{
|
||||||
update.Sound = data.Sound;
|
update.Sound = part.Sound;
|
||||||
update.OwnerID = data.OwnerID;
|
update.OwnerID = part.OwnerID;
|
||||||
update.Gain = (float)data.SoundGain;
|
update.Gain = (float)part.SoundGain;
|
||||||
update.Radius = (float)data.SoundRadius;
|
update.Radius = (float)part.SoundRadius;
|
||||||
update.Flags = data.SoundFlags;
|
update.Flags = part.SoundFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ((PCode)data.Shape.PCode)
|
switch ((PCode)part.Shape.PCode)
|
||||||
{
|
{
|
||||||
case PCode.Grass:
|
case PCode.Grass:
|
||||||
case PCode.Tree:
|
case PCode.Tree:
|
||||||
case PCode.NewTree:
|
case PCode.NewTree:
|
||||||
update.Data = new byte[] { data.Shape.State };
|
update.Data = new byte[] { part.Shape.State };
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
update.Data = Utils.EmptyBytes;
|
update.Data = Utils.EmptyBytes;
|
||||||
|
@ -7753,10 +7807,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
ObjectDuplicate handlerObjectDuplicate = null;
|
ObjectDuplicate handlerObjectDuplicate = null;
|
||||||
|
|
||||||
for (int i = 0; i < dupe.ObjectData.Length; i++)
|
handlerObjectDuplicate = OnObjectDuplicate;
|
||||||
|
if (handlerObjectDuplicate != null)
|
||||||
{
|
{
|
||||||
handlerObjectDuplicate = OnObjectDuplicate;
|
for (int i = 0; i < dupe.ObjectData.Length; i++)
|
||||||
if (handlerObjectDuplicate != null)
|
|
||||||
{
|
{
|
||||||
UUID rezGroupID = dupe.AgentData.GroupID;
|
UUID rezGroupID = dupe.AgentData.GroupID;
|
||||||
if(!IsGroupMember(rezGroupID))
|
if(!IsGroupMember(rezGroupID))
|
||||||
|
|
|
@ -369,7 +369,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||||
else if (Cache != null)
|
else if (Cache != null)
|
||||||
{
|
{
|
||||||
string assetName = "j2kCache_" + AssetId.ToString();
|
string assetName = "j2kCache_" + AssetId.ToString();
|
||||||
AssetBase layerDecodeAsset = Cache.Get(assetName);
|
AssetBase layerDecodeAsset;
|
||||||
|
Cache.Get(assetName, out layerDecodeAsset);
|
||||||
|
|
||||||
if (layerDecodeAsset != null)
|
if (layerDecodeAsset != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -260,10 +260,9 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
/// Cache doesn't guarantee in any situation that asset is stored to it.
|
/// Cache doesn't guarantee in any situation that asset is stored to it.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public AssetBase Get(string id)
|
public bool Get(string id, out AssetBase assetBase)
|
||||||
{
|
{
|
||||||
m_getCount++;
|
m_getCount++;
|
||||||
AssetBase assetBase;
|
|
||||||
if (m_cache.TryGetValue(id, out assetBase))
|
if (m_cache.TryGetValue(id, out assetBase))
|
||||||
m_hitCount++;
|
m_hitCount++;
|
||||||
|
|
||||||
|
@ -284,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
// if (null == assetBase)
|
// if (null == assetBase)
|
||||||
// m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id);
|
// m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id);
|
||||||
|
|
||||||
return assetBase;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -115,7 +115,10 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
public bool Check(string id)
|
public bool Check(string id)
|
||||||
{
|
{
|
||||||
// XXX This is probably not an efficient implementation.
|
// XXX This is probably not an efficient implementation.
|
||||||
return Get(id) != null;
|
AssetBase asset;
|
||||||
|
if (!Get(id, out asset))
|
||||||
|
return false;
|
||||||
|
return asset != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Cache(AssetBase asset)
|
public void Cache(AssetBase asset)
|
||||||
|
@ -129,9 +132,10 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
// We don't do negative caching
|
// We don't do negative caching
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetBase Get(string id)
|
public bool Get(string id, out AssetBase asset)
|
||||||
{
|
{
|
||||||
return (AssetBase)m_Cache.Get(id);
|
asset = (AssetBase)m_Cache.Get(id);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Expire(string id)
|
public void Expire(string id)
|
||||||
|
|
|
@ -474,6 +474,8 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
{
|
{
|
||||||
using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
|
using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||||
{
|
{
|
||||||
|
if (stream.Length == 0) // Empty file will trigger exception below
|
||||||
|
return null;
|
||||||
BinaryFormatter bformatter = new BinaryFormatter();
|
BinaryFormatter bformatter = new BinaryFormatter();
|
||||||
|
|
||||||
asset = (AssetBase)bformatter.Deserialize(stream);
|
asset = (AssetBase)bformatter.Deserialize(stream);
|
||||||
|
@ -531,15 +533,26 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For IAssetService
|
||||||
public AssetBase Get(string id)
|
public AssetBase Get(string id)
|
||||||
{
|
{
|
||||||
|
AssetBase asset;
|
||||||
|
Get(id, out asset);
|
||||||
|
return asset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Get(string id, out AssetBase asset)
|
||||||
|
{
|
||||||
|
asset = null;
|
||||||
|
|
||||||
m_Requests++;
|
m_Requests++;
|
||||||
|
|
||||||
object dummy;
|
object dummy;
|
||||||
if (m_negativeCache.TryGetValue(id, out dummy))
|
if (m_negativeCache.TryGetValue(id, out dummy))
|
||||||
return null;
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
AssetBase asset = null;
|
|
||||||
asset = GetFromWeakReference(id);
|
asset = GetFromWeakReference(id);
|
||||||
if (asset != null && m_updateFileTimeOnCacheHit)
|
if (asset != null && m_updateFileTimeOnCacheHit)
|
||||||
{
|
{
|
||||||
|
@ -578,13 +591,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l));
|
GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(asset == null)
|
return true;
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return asset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Check(string id)
|
public bool Check(string id)
|
||||||
|
@ -599,7 +606,9 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
|
|
||||||
public AssetBase GetCached(string id)
|
public AssetBase GetCached(string id)
|
||||||
{
|
{
|
||||||
return Get(id);
|
AssetBase asset;
|
||||||
|
Get(id, out asset);
|
||||||
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Expire(string id)
|
public void Expire(string id)
|
||||||
|
@ -797,6 +806,9 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
catch (UnauthorizedAccessException e)
|
||||||
|
{
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (stream != null)
|
if (stream != null)
|
||||||
|
@ -1227,19 +1239,23 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
|
|
||||||
public AssetMetadata GetMetadata(string id)
|
public AssetMetadata GetMetadata(string id)
|
||||||
{
|
{
|
||||||
AssetBase asset = Get(id);
|
AssetBase asset;
|
||||||
|
Get(id, out asset);
|
||||||
return asset.Metadata;
|
return asset.Metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] GetData(string id)
|
public byte[] GetData(string id)
|
||||||
{
|
{
|
||||||
AssetBase asset = Get(id);
|
AssetBase asset;
|
||||||
|
Get(id, out asset);
|
||||||
return asset.Data;
|
return asset.Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Get(string id, object sender, AssetRetrieved handler)
|
public bool Get(string id, object sender, AssetRetrieved handler)
|
||||||
{
|
{
|
||||||
AssetBase asset = Get(id);
|
AssetBase asset;
|
||||||
|
if (!Get(id, out asset))
|
||||||
|
return false;
|
||||||
handler(id, sender, asset);
|
handler(id, sender, asset);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1270,7 +1286,9 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
|
|
||||||
public bool UpdateContent(string id, byte[] data)
|
public bool UpdateContent(string id, byte[] data)
|
||||||
{
|
{
|
||||||
AssetBase asset = Get(id);
|
AssetBase asset;
|
||||||
|
if (!Get(id, out asset))
|
||||||
|
return false;
|
||||||
asset.Data = data;
|
asset.Data = data;
|
||||||
Cache(asset);
|
Cache(asset);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -131,14 +131,15 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
// We don't do negative caching
|
// We don't do negative caching
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetBase Get(string id)
|
public bool Get(string id, out AssetBase asset)
|
||||||
{
|
{
|
||||||
Object asset = null;
|
Object a = null;
|
||||||
m_Cache.TryGet(id, out asset);
|
m_Cache.TryGet(id, out a);
|
||||||
|
|
||||||
Debug(asset);
|
Debug(a);
|
||||||
|
|
||||||
return (AssetBase)asset;
|
asset = (AssetBase)a;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Expire(string id)
|
public void Expire(string id)
|
||||||
|
|
|
@ -481,14 +481,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
|
// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
|
||||||
// group.Name, group.LocalId, sp.Name, attachmentPt, silent);
|
// group.Name, group.LocalId, sp.Name, attachmentPt, silent);
|
||||||
|
|
||||||
if (sp.GetAttachments().Contains(group))
|
|
||||||
{
|
|
||||||
// m_log.WarnFormat(
|
|
||||||
// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
|
|
||||||
// group.Name, group.LocalId, sp.Name, AttachmentPt);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (group.GetSittingAvatarsCount() != 0)
|
if (group.GetSittingAvatarsCount() != 0)
|
||||||
{
|
{
|
||||||
|
@ -500,6 +492,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
|
||||||
|
if (attachments.Contains(group))
|
||||||
|
{
|
||||||
|
// if (DebugLevel > 0)
|
||||||
|
// m_log.WarnFormat(
|
||||||
|
// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
|
||||||
|
// group.Name, group.LocalId, sp.Name, attachmentPt);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Vector3 attachPos = group.AbsolutePosition;
|
Vector3 attachPos = group.AbsolutePosition;
|
||||||
|
|
||||||
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
|
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
|
||||||
|
@ -533,7 +536,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
{
|
{
|
||||||
attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint;
|
attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint;
|
||||||
attachPos = group.RootPart.AttachedPos;
|
attachPos = group.RootPart.AttachedPos;
|
||||||
group.HasGroupChanged = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we still didn't find a suitable attachment point.......
|
// if we still didn't find a suitable attachment point.......
|
||||||
|
@ -544,18 +546,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
attachPos = Vector3.Zero;
|
attachPos = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
|
|
||||||
|
|
||||||
if (attachments.Contains(group))
|
|
||||||
{
|
|
||||||
if (DebugLevel > 0)
|
|
||||||
m_log.WarnFormat(
|
|
||||||
"[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
|
|
||||||
group.Name, group.LocalId, sp.Name, attachmentPt);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we already have 5, remove the oldest until only 4 are left. Skip over temp ones
|
// If we already have 5, remove the oldest until only 4 are left. Skip over temp ones
|
||||||
while (attachments.Count >= 5)
|
while (attachments.Count >= 5)
|
||||||
{
|
{
|
||||||
|
@ -579,7 +569,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
lock (sp.AttachmentsSyncLock)
|
lock (sp.AttachmentsSyncLock)
|
||||||
{
|
{
|
||||||
group.AttachmentPoint = attachmentPt;
|
group.AttachmentPoint = attachmentPt;
|
||||||
group.AbsolutePosition = attachPos;
|
group.RootPart.AttachedPos = attachPos;
|
||||||
|
|
||||||
if (addToInventory && sp.PresenceType != PresenceType.Npc)
|
if (addToInventory && sp.PresenceType != PresenceType.Npc)
|
||||||
UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append);
|
UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append);
|
||||||
|
@ -956,7 +946,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
m_scene.DeleteFromStorage(so.UUID);
|
m_scene.DeleteFromStorage(so.UUID);
|
||||||
m_scene.EventManager.TriggerParcelPrimCountTainted();
|
m_scene.EventManager.TriggerParcelPrimCountTainted();
|
||||||
|
|
||||||
so.AttachedAvatar = sp.UUID;
|
|
||||||
|
|
||||||
foreach (SceneObjectPart part in so.Parts)
|
foreach (SceneObjectPart part in so.Parts)
|
||||||
{
|
{
|
||||||
|
@ -969,11 +958,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
so.AbsolutePosition = attachOffset;
|
|
||||||
so.RootPart.AttachedPos = attachOffset;
|
|
||||||
so.IsAttachment = true;
|
|
||||||
so.RootPart.SetParentLocalId(sp.LocalId);
|
so.RootPart.SetParentLocalId(sp.LocalId);
|
||||||
|
so.AttachedAvatar = sp.UUID;
|
||||||
so.AttachmentPoint = attachmentpoint;
|
so.AttachmentPoint = attachmentpoint;
|
||||||
|
so.RootPart.AttachedPos = attachOffset;
|
||||||
|
so.AbsolutePosition = attachOffset;
|
||||||
|
so.IsAttachment = true;
|
||||||
|
|
||||||
sp.AddAttachment(so);
|
sp.AddAttachment(so);
|
||||||
|
|
||||||
|
@ -1322,7 +1312,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (part == null)
|
if (part == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
|
SceneObjectGroup group = part.ParentGroup;
|
||||||
|
|
||||||
|
if (!m_scene.Permissions.CanTakeObject(group, sp))
|
||||||
{
|
{
|
||||||
remoteClient.SendAgentAlertMessage(
|
remoteClient.SendAgentAlertMessage(
|
||||||
"You don't have sufficient permissions to attach this object", false);
|
"You don't have sufficient permissions to attach this object", false);
|
||||||
|
@ -1334,7 +1326,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
AttachmentPt &= 0x7f;
|
AttachmentPt &= 0x7f;
|
||||||
|
|
||||||
// Calls attach with a Zero position
|
// Calls attach with a Zero position
|
||||||
SceneObjectGroup group = part.ParentGroup;
|
|
||||||
if (AttachObject(sp, group , AttachmentPt, false, true, append))
|
if (AttachObject(sp, group , AttachmentPt, false, true, append))
|
||||||
{
|
{
|
||||||
if (DebugLevel > 0)
|
if (DebugLevel > 0)
|
||||||
|
|
|
@ -299,7 +299,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
if (bakedTextureFace == null)
|
if (bakedTextureFace == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString());
|
AssetBase asset;
|
||||||
|
cache.Get(bakedTextureFace.TextureID.ToString(), out asset);
|
||||||
|
|
||||||
if (asset != null && asset.Local)
|
if (asset != null && asset.Local)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private bool enabled = true;
|
private bool enabled = true;
|
||||||
|
private bool m_UseNewAvnCode = false;
|
||||||
private List<Scene> m_SceneList = new List<Scene>();
|
private List<Scene> m_SceneList = new List<Scene>();
|
||||||
private string m_RestURL = String.Empty;
|
private string m_RestURL = String.Empty;
|
||||||
IMessageTransferModule m_TransferModule = null;
|
IMessageTransferModule m_TransferModule = null;
|
||||||
|
@ -82,6 +83,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
|
m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
|
||||||
|
m_UseNewAvnCode = cnf.GetBoolean("UseNewAvnCode", m_UseNewAvnCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
|
@ -244,68 +246,73 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene scene = FindScene(new UUID(im.fromAgentID));
|
if(m_UseNewAvnCode)
|
||||||
if (scene == null)
|
|
||||||
scene = m_SceneList[0];
|
|
||||||
|
|
||||||
// Avination new code
|
|
||||||
// SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
|
|
||||||
// "POST", m_RestURL+"/SaveMessage/?scope=" +
|
|
||||||
// scene.RegionInfo.ScopeID.ToString(), im);
|
|
||||||
|
|
||||||
// current opensim and osgrid compatible
|
|
||||||
bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
|
|
||||||
"POST", m_RestURL+"/SaveMessage/", im, 10000);
|
|
||||||
// current opensim and osgrid compatible end
|
|
||||||
|
|
||||||
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
|
||||||
{
|
{
|
||||||
IClientAPI client = FindClient(new UUID(im.fromAgentID));
|
Scene scene = FindScene(new UUID(im.fromAgentID));
|
||||||
if (client == null)
|
if (scene == null)
|
||||||
return;
|
scene = m_SceneList[0];
|
||||||
/* Avination new code
|
|
||||||
if (reply.Message == String.Empty)
|
|
||||||
reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
|
|
||||||
|
|
||||||
bool sendReply = true;
|
UUID scopeID = scene.RegionInfo.ScopeID;
|
||||||
|
SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
|
||||||
|
"POST", m_RestURL+"/SaveMessage/?scope=" + scopeID.ToString(), im, 20000);
|
||||||
|
|
||||||
switch (reply.Disposition)
|
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||||
{
|
{
|
||||||
case 0: // Normal
|
IClientAPI client = FindClient(new UUID(im.fromAgentID));
|
||||||
break;
|
if (client == null)
|
||||||
case 1: // Only once per user
|
return;
|
||||||
if (m_repliesSent.ContainsKey(client) && m_repliesSent[client].Contains(new UUID(im.toAgentID)))
|
|
||||||
|
if (string.IsNullOrEmpty(reply.Message))
|
||||||
|
reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
|
||||||
|
|
||||||
|
bool sendReply = true;
|
||||||
|
|
||||||
|
switch (reply.Disposition)
|
||||||
{
|
{
|
||||||
sendReply = false;
|
case 0: // Normal
|
||||||
|
break;
|
||||||
|
case 1: // Only once per user
|
||||||
|
if (m_repliesSent.ContainsKey(client) && m_repliesSent[client].Contains(new UUID(im.toAgentID)))
|
||||||
|
sendReply = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_repliesSent.ContainsKey(client))
|
||||||
|
m_repliesSent[client] = new List<UUID>();
|
||||||
|
m_repliesSent[client].Add(new UUID(im.toAgentID));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (sendReply)
|
||||||
{
|
{
|
||||||
if (!m_repliesSent.ContainsKey(client))
|
client.SendInstantMessage(new GridInstantMessage(
|
||||||
m_repliesSent[client] = new List<UUID>();
|
null, new UUID(im.toAgentID),
|
||||||
m_repliesSent[client].Add(new UUID(im.toAgentID));
|
"System", new UUID(im.fromAgentID),
|
||||||
|
(byte)InstantMessageDialog.MessageFromAgent,
|
||||||
|
reply.Message,
|
||||||
|
false, new Vector3()));
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
|
||||||
|
"POST", m_RestURL+"/SaveMessage/", im, 20000);
|
||||||
|
|
||||||
if (sendReply)
|
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||||
{
|
{
|
||||||
|
IClientAPI client = FindClient(new UUID(im.fromAgentID));
|
||||||
|
if (client == null)
|
||||||
|
return;
|
||||||
|
|
||||||
client.SendInstantMessage(new GridInstantMessage(
|
client.SendInstantMessage(new GridInstantMessage(
|
||||||
null, new UUID(im.toAgentID),
|
|
||||||
"System", new UUID(im.fromAgentID),
|
|
||||||
(byte)InstantMessageDialog.MessageFromAgent,
|
|
||||||
reply.Message,
|
|
||||||
false, new Vector3()));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// current opensim and osgrid compatible
|
|
||||||
client.SendInstantMessage(new GridInstantMessage(
|
|
||||||
null, new UUID(im.toAgentID),
|
null, new UUID(im.toAgentID),
|
||||||
"System", new UUID(im.fromAgentID),
|
"System", new UUID(im.fromAgentID),
|
||||||
(byte)InstantMessageDialog.MessageFromAgent,
|
(byte)InstantMessageDialog.MessageFromAgent,
|
||||||
"User is not logged in. "+
|
"User is not logged in. "+
|
||||||
(success ? "Message saved." : "Message not saved"),
|
(success ? "Message saved." : "Message not saved"),
|
||||||
false, new Vector3()));
|
false, new Vector3()));
|
||||||
// current opensim and osgrid compatible end
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
||||||
|
|
||||||
if (profileConfig == null)
|
if (profileConfig == null)
|
||||||
{
|
{
|
||||||
m_log.Debug("[PROFILES]: UserProfiles disabled, no configuration");
|
//m_log.Debug("[PROFILES]: UserProfiles disabled, no configuration");
|
||||||
Enabled = false;
|
Enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1703,11 +1703,81 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return agent;
|
return agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CrossAgentCreateFarChild(ScenePresence agent, GridRegion neighbourRegion, Vector3 pos, EntityTransferContext ctx)
|
||||||
|
{
|
||||||
|
ulong regionhandler = neighbourRegion.RegionHandle;
|
||||||
|
|
||||||
|
if(agent.knowsNeighbourRegion(regionhandler))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
string reason;
|
||||||
|
ulong currentRegionHandler = agent.Scene.RegionInfo.RegionHandle;
|
||||||
|
GridRegion source = new GridRegion(agent.Scene.RegionInfo);
|
||||||
|
|
||||||
|
AgentCircuitData currentAgentCircuit =
|
||||||
|
agent.Scene.AuthenticateHandler.GetAgentCircuitData(agent.ControllingClient.CircuitCode);
|
||||||
|
AgentCircuitData agentCircuit = agent.ControllingClient.RequestClientInfo();
|
||||||
|
agentCircuit.startpos = pos;
|
||||||
|
agentCircuit.child = true;
|
||||||
|
|
||||||
|
agentCircuit.Appearance = new AvatarAppearance();
|
||||||
|
agentCircuit.Appearance.AvatarHeight = agent.Appearance.AvatarHeight;
|
||||||
|
|
||||||
|
if (currentAgentCircuit != null)
|
||||||
|
{
|
||||||
|
agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs;
|
||||||
|
agentCircuit.IPAddress = currentAgentCircuit.IPAddress;
|
||||||
|
agentCircuit.Viewer = currentAgentCircuit.Viewer;
|
||||||
|
agentCircuit.Channel = currentAgentCircuit.Channel;
|
||||||
|
agentCircuit.Mac = currentAgentCircuit.Mac;
|
||||||
|
agentCircuit.Id0 = currentAgentCircuit.Id0;
|
||||||
|
}
|
||||||
|
|
||||||
|
agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
|
||||||
|
agent.AddNeighbourRegion(neighbourRegion, agentCircuit.CapsPath);
|
||||||
|
|
||||||
|
IPEndPoint endPoint = neighbourRegion.ExternalEndPoint;
|
||||||
|
if (Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason))
|
||||||
|
{
|
||||||
|
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
||||||
|
int newSizeX = neighbourRegion.RegionSizeX;
|
||||||
|
int newSizeY = neighbourRegion.RegionSizeY;
|
||||||
|
|
||||||
|
if (m_eqModule != null)
|
||||||
|
{
|
||||||
|
#region IP Translation for NAT
|
||||||
|
IClientIPEndpoint ipepClient;
|
||||||
|
if (agent.ClientView.TryGet(out ipepClient))
|
||||||
|
endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
|
||||||
|
|
||||||
|
m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " +
|
||||||
|
"and EstablishAgentCommunication with seed cap {8}", LogHeader,
|
||||||
|
source.RegionName, agent.Name,
|
||||||
|
neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, newSizeX, newSizeY , capsPath);
|
||||||
|
|
||||||
|
m_eqModule.EnableSimulator(regionhandler,
|
||||||
|
endPoint, agent.UUID, newSizeX, newSizeY);
|
||||||
|
m_eqModule.EstablishAgentCommunication(agent.UUID, endPoint, capsPath,
|
||||||
|
regionhandler, newSizeX, newSizeY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
agent.ControllingClient.InformClientOfNeighbour(regionhandler, endPoint);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
agent.RemoveNeighbourRegion(regionhandler);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx)
|
public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx)
|
||||||
{
|
{
|
||||||
int ts = Util.EnvironmentTickCount();
|
int ts = Util.EnvironmentTickCount();
|
||||||
|
bool sucess = true;
|
||||||
|
string reason = String.Empty;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
AgentData cAgent = new AgentData();
|
AgentData cAgent = new AgentData();
|
||||||
agent.CopyTo(cAgent,true);
|
agent.CopyTo(cAgent,true);
|
||||||
|
|
||||||
|
@ -1725,18 +1795,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// Beyond this point, extra cleanup is needed beyond removing transit state
|
// Beyond this point, extra cleanup is needed beyond removing transit state
|
||||||
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring);
|
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring);
|
||||||
|
|
||||||
if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx))
|
if (sucess && !agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx))
|
||||||
|
{
|
||||||
|
sucess = false;
|
||||||
|
reason = "agent update failed";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!sucess)
|
||||||
{
|
{
|
||||||
// region doesn't take it
|
// region doesn't take it
|
||||||
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
|
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
|
||||||
|
|
||||||
m_log.WarnFormat(
|
m_log.WarnFormat(
|
||||||
"[ENTITY TRANSFER MODULE]: Region {0} would not accept update for agent {1} on cross attempt. Returning to original region.",
|
"[ENTITY TRANSFER MODULE]: agent {0} crossing to {1} failed: {2}",
|
||||||
neighbourRegion.RegionName, agent.Name);
|
agent.Name, neighbourRegion.RegionName, reason);
|
||||||
|
|
||||||
ReInstantiateScripts(agent);
|
ReInstantiateScripts(agent);
|
||||||
if(agent.ParentID == 0 && agent.ParentUUID == UUID.Zero)
|
if(agent.ParentID == 0 && agent.ParentUUID == UUID.Zero)
|
||||||
|
{
|
||||||
agent.AddToPhysicalScene(isFlying);
|
agent.AddToPhysicalScene(isFlying);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1777,7 +1855,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
|
||||||
|
|
||||||
Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0);
|
Vector3 vel2 = Vector3.Zero;
|
||||||
|
if((agent.crossingFlags & 2) != 0)
|
||||||
|
vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0);
|
||||||
|
|
||||||
if (m_eqModule != null)
|
if (m_eqModule != null)
|
||||||
{
|
{
|
||||||
|
@ -1804,7 +1884,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
// this may need the attachments
|
// this may need the attachments
|
||||||
|
|
||||||
agent.HasMovedAway(true);
|
agent.HasMovedAway((agent.crossingFlags & 8) == 0);
|
||||||
|
|
||||||
agent.MakeChildAgent(neighbourRegion.RegionHandle);
|
agent.MakeChildAgent(neighbourRegion.RegionHandle);
|
||||||
|
|
||||||
|
@ -2135,7 +2215,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY,
|
sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY,
|
||||||
0f);
|
0f);
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region NotFoundLocationCache class
|
#region NotFoundLocationCache class
|
||||||
// A collection of not found locations to make future lookups 'not found' lookups quick.
|
// A collection of not found locations to make future lookups 'not found' lookups quick.
|
||||||
|
@ -2620,7 +2700,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
// FIXME: It would be better to never add the scene object at all rather than add it and then delete
|
// FIXME: It would be better to never add the scene object at all rather than add it and then delete
|
||||||
// it
|
// it
|
||||||
if (!Scene.Permissions.CanObjectEntry(so.UUID, true, so.AbsolutePosition))
|
if (!Scene.Permissions.CanObjectEntry(so, true, so.AbsolutePosition))
|
||||||
{
|
{
|
||||||
// Deny non attachments based on parcel settings
|
// Deny non attachments based on parcel settings
|
||||||
//
|
//
|
||||||
|
|
|
@ -541,16 +541,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
#region Permissions
|
#region Permissions
|
||||||
|
|
||||||
private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene)
|
private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
|
||||||
{
|
{
|
||||||
if (m_bypassPermissions) return true;
|
if (m_bypassPermissions) return true;
|
||||||
|
|
||||||
if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(stealer))
|
if(sp == null || sog == null)
|
||||||
{
|
return false;
|
||||||
SceneObjectGroup sog = null;
|
|
||||||
if (m_Scene.TryGetSceneObjectGroup(objectID, out sog) && sog.OwnerID == stealer)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
|
if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(sp.UUID))
|
||||||
|
{
|
||||||
|
if (sog.OwnerID == sp.UUID)
|
||||||
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -427,20 +427,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
originalRotations[objectGroup.UUID] = inventoryStoredRotation;
|
originalRotations[objectGroup.UUID] = inventoryStoredRotation;
|
||||||
|
|
||||||
// Restore attachment data after trip through the sim
|
// Restore attachment data after trip through the sim
|
||||||
if (objectGroup.RootPart.AttachPoint > 0)
|
if (objectGroup.AttachmentPoint > 0)
|
||||||
{
|
{
|
||||||
inventoryStoredPosition = objectGroup.RootPart.AttachedPos;
|
inventoryStoredPosition = objectGroup.RootPart.AttachedPos;
|
||||||
inventoryStoredRotation = objectGroup.RootPart.AttachRotation;
|
inventoryStoredRotation = objectGroup.RootPart.AttachRotation;
|
||||||
}
|
if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree &&
|
||||||
|
objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree)
|
||||||
|
objectGroup.RootPart.Shape.LastAttachPoint = (byte)objectGroup.AttachmentPoint;
|
||||||
|
|
||||||
// Trees could be attached and it's been done, but it makes
|
|
||||||
// no sense. State must be preserved because it's the tree type
|
|
||||||
if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree &&
|
|
||||||
objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree)
|
|
||||||
{
|
|
||||||
objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
|
|
||||||
if (objectGroup.RootPart.AttachPoint > 0)
|
|
||||||
objectGroup.RootPart.Shape.LastAttachPoint = objectGroup.RootPart.AttachPoint;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
objectGroup.AbsolutePosition = inventoryStoredPosition;
|
objectGroup.AbsolutePosition = inventoryStoredPosition;
|
||||||
|
@ -605,15 +599,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
perms &= ~(uint)PermissionMask.Transfer;
|
perms &= ~(uint)PermissionMask.Transfer;
|
||||||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||||
perms &= ~(uint)PermissionMask.Modify;
|
perms &= ~(uint)PermissionMask.Modify;
|
||||||
|
|
||||||
item.BasePermissions = perms & so.RootPart.NextOwnerMask;
|
// item.BasePermissions = perms & so.RootPart.NextOwnerMask;
|
||||||
|
|
||||||
|
uint nextp = so.RootPart.NextOwnerMask | (uint)PermissionMask.FoldedMask;
|
||||||
|
item.BasePermissions = perms & nextp;
|
||||||
item.CurrentPermissions = item.BasePermissions;
|
item.CurrentPermissions = item.BasePermissions;
|
||||||
item.NextPermissions = perms & so.RootPart.NextOwnerMask;
|
item.NextPermissions = perms & so.RootPart.NextOwnerMask;
|
||||||
item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask;
|
item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask;
|
||||||
item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
|
item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
|
||||||
|
|
||||||
// apply next owner perms on rez
|
// apply next owner perms on rez
|
||||||
item.CurrentPermissions |= SceneObjectGroup.SLAM;
|
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1124,7 +1121,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
|
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
|
||||||
|
|
||||||
if ((rootPart.OwnerID != item.Owner) ||
|
if ((rootPart.OwnerID != item.Owner) ||
|
||||||
(item.CurrentPermissions & 16) != 0 ||
|
(item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 ||
|
||||||
(item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
|
(item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
|
||||||
{
|
{
|
||||||
//Need to kill the for sale here
|
//Need to kill the for sale here
|
||||||
|
@ -1136,32 +1133,48 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
foreach (SceneObjectPart part in so.Parts)
|
foreach (SceneObjectPart part in so.Parts)
|
||||||
{
|
{
|
||||||
part.GroupMask = 0; // DO NOT propagate here
|
part.GroupMask = 0; // DO NOT propagate here
|
||||||
|
if( part.OwnerID != part.GroupID)
|
||||||
part.LastOwnerID = part.OwnerID;
|
part.LastOwnerID = part.OwnerID;
|
||||||
part.OwnerID = item.Owner;
|
part.OwnerID = item.Owner;
|
||||||
part.RezzerID = item.Owner;
|
part.RezzerID = item.Owner;
|
||||||
part.Inventory.ChangeInventoryOwner(item.Owner);
|
part.Inventory.ChangeInventoryOwner(item.Owner);
|
||||||
|
|
||||||
// This applies the base mask from the item as the next
|
// Reconstruct the original item's base permissions. They
|
||||||
// permissions for the object. This is correct because the
|
// can be found in the lower (folded) bits.
|
||||||
// giver's base mask was masked by the giver's next owner
|
if ((item.BasePermissions & (uint)PermissionMask.FoldedMask) != 0)
|
||||||
// mask, so the base mask equals the original next owner mask.
|
{
|
||||||
part.NextOwnerMask = item.BasePermissions;
|
// We have permissions stored there so use them
|
||||||
|
part.NextOwnerMask = ((item.BasePermissions & 7) << 13);
|
||||||
|
if ((item.BasePermissions & (uint)PermissionMask.FoldedExport) != 0)
|
||||||
|
part.NextOwnerMask |= (uint)PermissionMask.Export;
|
||||||
|
part.NextOwnerMask |= (uint)PermissionMask.Move;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This is a legacy object and we can't avoid the issues that
|
||||||
|
// caused perms loss or escalation before, treat it the legacy
|
||||||
|
// way.
|
||||||
|
part.NextOwnerMask = item.NextPermissions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
so.ApplyNextOwnerPermissions();
|
so.ApplyNextOwnerPermissions();
|
||||||
|
|
||||||
// In case the user has changed flags on a received item
|
// In case the user has changed flags on a received item
|
||||||
// we have to apply those changes after the slam. Else we
|
// we have to apply those changes after the slam. Else we
|
||||||
// get a net loss of permissions
|
// get a net loss of permissions.
|
||||||
|
// On legacy objects, this opts for a loss of permissions rather
|
||||||
|
// than the previous handling that allowed escalation.
|
||||||
foreach (SceneObjectPart part in so.Parts)
|
foreach (SceneObjectPart part in so.Parts)
|
||||||
{
|
{
|
||||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
|
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
|
||||||
{
|
{
|
||||||
|
part.GroupMask = item.GroupPermissions & part.BaseMask;
|
||||||
part.EveryoneMask = item.EveryOnePermissions & part.BaseMask;
|
part.EveryoneMask = item.EveryOnePermissions & part.BaseMask;
|
||||||
part.NextOwnerMask = item.NextPermissions & part.BaseMask;
|
part.NextOwnerMask = item.NextPermissions & part.BaseMask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1180,6 +1193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
rootPart.TrimPermissions();
|
rootPart.TrimPermissions();
|
||||||
|
so.AggregateDeepPerms();
|
||||||
|
|
||||||
if (isAttachment)
|
if (isAttachment)
|
||||||
so.FromItemID = item.ID;
|
so.FromItemID = item.ID;
|
||||||
|
|
|
@ -957,9 +957,14 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||||
|
|
||||||
public virtual bool IsLocalGridUser(UUID uuid)
|
public virtual bool IsLocalGridUser(UUID uuid)
|
||||||
{
|
{
|
||||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
|
lock (m_Scenes)
|
||||||
if (account == null || (account != null && !account.LocalToGrid))
|
{
|
||||||
return false;
|
if (m_Scenes.Count == 0)
|
||||||
|
return true;
|
||||||
|
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
|
||||||
|
if (account == null || (account != null && !account.LocalToGrid))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,17 +83,17 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private Dictionary<UUID, UrlData> m_RequestMap =
|
protected Dictionary<UUID, UrlData> m_RequestMap =
|
||||||
new Dictionary<UUID, UrlData>();
|
new Dictionary<UUID, UrlData>();
|
||||||
|
|
||||||
private Dictionary<string, UrlData> m_UrlMap =
|
protected Dictionary<string, UrlData> m_UrlMap =
|
||||||
new Dictionary<string, UrlData>();
|
new Dictionary<string, UrlData>();
|
||||||
|
|
||||||
private uint m_HttpsPort = 0;
|
protected uint m_HttpsPort = 0;
|
||||||
private IHttpServer m_HttpServer = null;
|
protected IHttpServer m_HttpServer = null;
|
||||||
private IHttpServer m_HttpsServer = null;
|
protected IHttpServer m_HttpsServer = null;
|
||||||
|
|
||||||
public string ExternalHostNameForLSL { get; private set; }
|
public string ExternalHostNameForLSL { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The default maximum number of urls
|
/// The default maximum number of urls
|
||||||
|
@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return null; }
|
get { return typeof(IUrlModule); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -453,7 +453,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void RemoveUrl(UrlData data)
|
protected void RemoveUrl(UrlData data)
|
||||||
{
|
{
|
||||||
if (data.isSsl)
|
if (data.isSsl)
|
||||||
m_HttpsServer.RemoveHTTPHandler("", "/lslhttps/"+data.urlcode.ToString()+"/");
|
m_HttpsServer.RemoveHTTPHandler("", "/lslhttps/"+data.urlcode.ToString()+"/");
|
||||||
|
@ -461,7 +461,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
m_HttpServer.RemoveHTTPHandler("", "/lslhttp/"+data.urlcode.ToString()+"/");
|
m_HttpServer.RemoveHTTPHandler("", "/lslhttp/"+data.urlcode.ToString()+"/");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hashtable NoEvents(UUID requestID, UUID sessionID)
|
protected Hashtable NoEvents(UUID requestID, UUID sessionID)
|
||||||
{
|
{
|
||||||
Hashtable response = new Hashtable();
|
Hashtable response = new Hashtable();
|
||||||
UrlData url;
|
UrlData url;
|
||||||
|
@ -499,7 +499,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HasEvents(UUID requestID, UUID sessionID)
|
protected bool HasEvents(UUID requestID, UUID sessionID)
|
||||||
{
|
{
|
||||||
UrlData url=null;
|
UrlData url=null;
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Drop(UUID requestID, UUID sessionID)
|
protected void Drop(UUID requestID, UUID sessionID)
|
||||||
{
|
{
|
||||||
UrlData url = null;
|
UrlData url = null;
|
||||||
lock (m_RequestMap)
|
lock (m_RequestMap)
|
||||||
|
@ -552,7 +552,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hashtable GetEvents(UUID requestID, UUID sessionID)
|
protected Hashtable GetEvents(UUID requestID, UUID sessionID)
|
||||||
{
|
{
|
||||||
UrlData url = null;
|
UrlData url = null;
|
||||||
RequestData requestData = null;
|
RequestData requestData = null;
|
||||||
|
@ -757,7 +757,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnScriptReset(uint localID, UUID itemID)
|
protected void OnScriptReset(uint localID, UUID itemID)
|
||||||
{
|
{
|
||||||
ScriptRemoved(itemID);
|
ScriptRemoved(itemID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,12 +85,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
|
||||||
|
|
||||||
public LocalUserProfilesServicesConnector()
|
public LocalUserProfilesServicesConnector()
|
||||||
{
|
{
|
||||||
m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector no params");
|
//m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector no params");
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalUserProfilesServicesConnector(IConfigSource source)
|
public LocalUserProfilesServicesConnector(IConfigSource source)
|
||||||
{
|
{
|
||||||
m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector instantiated directly.");
|
//m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector instantiated directly.");
|
||||||
InitialiseService(source);
|
InitialiseService(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
|
||||||
IConfig config = source.Configs[ConfigName];
|
IConfig config = source.Configs[ConfigName];
|
||||||
if (config == null)
|
if (config == null)
|
||||||
{
|
{
|
||||||
m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: UserProfilesService missing from OpenSim.ini");
|
//m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: UserProfilesService missing from OpenSim.ini");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,4 +225,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,7 +209,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
{
|
{
|
||||||
asset = m_Cache.Get(id);
|
if (!m_Cache.Get(id, out asset))
|
||||||
|
return null;
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
return asset;
|
return asset;
|
||||||
|
@ -238,10 +239,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
|
|
||||||
public AssetBase GetCached(string id)
|
public AssetBase GetCached(string id)
|
||||||
{
|
{
|
||||||
|
AssetBase asset = null;
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
return m_Cache.Get(id);
|
m_Cache.Get(id, out asset);
|
||||||
|
|
||||||
return null;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetMetadata GetMetadata(string id)
|
public AssetMetadata GetMetadata(string id)
|
||||||
|
@ -250,8 +252,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
{
|
{
|
||||||
if (m_Cache != null)
|
if (!m_Cache.Get(id, out asset))
|
||||||
m_Cache.Get(id);
|
return null;
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
return asset.Metadata;
|
return asset.Metadata;
|
||||||
|
@ -273,8 +275,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
{
|
{
|
||||||
if (m_Cache != null)
|
if (!m_Cache.Get(id, out asset))
|
||||||
m_Cache.Get(id);
|
return null;
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
return asset.Data;
|
return asset.Data;
|
||||||
|
@ -292,7 +294,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
asset = m_Cache.Get(id);
|
{
|
||||||
|
if (!m_Cache.Get(id, out asset))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
|
@ -382,7 +387,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
asset = m_Cache.Get(id);
|
m_Cache.Get(id, out asset);
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,7 +158,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
|
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
asset = m_Cache.Get(id);
|
{
|
||||||
|
if (!m_Cache.Get(id, out asset))
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (asset == null)
|
if (asset == null)
|
||||||
{
|
{
|
||||||
|
@ -177,17 +180,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id);
|
// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id);
|
||||||
|
|
||||||
|
AssetBase asset = null;
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
return m_Cache.Get(id);
|
m_Cache.Get(id, out asset);
|
||||||
|
|
||||||
return null;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetMetadata GetMetadata(string id)
|
public AssetMetadata GetMetadata(string id)
|
||||||
{
|
{
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
asset = m_Cache.Get(id);
|
{
|
||||||
|
if (!m_Cache.Get(id, out asset))
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
return asset.Metadata;
|
return asset.Metadata;
|
||||||
|
@ -210,7 +217,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
asset = m_Cache.Get(id);
|
{
|
||||||
|
if (!m_Cache.Get(id, out asset))
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
return asset.Data;
|
return asset.Data;
|
||||||
|
@ -232,7 +242,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
{
|
{
|
||||||
AssetBase asset = m_Cache.Get(id);
|
AssetBase asset;
|
||||||
|
if (!m_Cache.Get(id, out asset))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
|
@ -287,7 +299,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
{
|
{
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
m_Cache.Get(id);
|
m_Cache.Get(id, out asset);
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
asset.Data = data;
|
asset.Data = data;
|
||||||
|
|
|
@ -149,9 +149,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache
|
parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache
|
||||||
parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0);
|
parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0);
|
||||||
|
|
||||||
|
m_scene.EventManager.OnObjectAddedToScene += EventManagerOnParcelPrimCountAdd;
|
||||||
m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
|
m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
|
||||||
m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
|
|
||||||
m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
|
m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
|
||||||
|
m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
|
||||||
m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
|
m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
|
||||||
|
|
||||||
m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
|
m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
|
||||||
|
@ -287,8 +289,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0,
|
fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0,
|
||||||
(int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY));
|
(int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY));
|
||||||
fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
LandData ldata = fullSimParcel.LandData;
|
||||||
fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
|
ldata.SimwideArea = ldata.Area;
|
||||||
|
ldata.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
||||||
|
ldata.ClaimDate = Util.UnixTimeSinceEpoch();
|
||||||
|
|
||||||
return AddLandObject(fullSimParcel);
|
return AddLandObject(fullSimParcel);
|
||||||
}
|
}
|
||||||
|
@ -813,6 +817,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(m_landList.Count == 0 || m_landIDList == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
lock (m_landIDList)
|
lock (m_landIDList)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -824,8 +831,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_landList[m_landIDList[x / 4, y / 4]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a 'parcel is here' bitmap for the parcel identified by the passed landID
|
// Create a 'parcel is here' bitmap for the parcel identified by the passed landID
|
||||||
|
@ -1576,6 +1581,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FinalizeLandPrimCountUpdate(); // update simarea information
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1640,9 +1646,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
foreach (HashSet<SceneObjectGroup> objs in returns.Values)
|
foreach (HashSet<SceneObjectGroup> objs in returns.Values)
|
||||||
{
|
{
|
||||||
List<SceneObjectGroup> objs2 = new List<SceneObjectGroup>(objs);
|
List<SceneObjectGroup> objs2 = new List<SceneObjectGroup>(objs);
|
||||||
if (m_scene.Permissions.CanReturnObjects(null, remoteClient.AgentId, objs2))
|
if (m_scene.Permissions.CanReturnObjects(null, remoteClient, objs2))
|
||||||
{
|
{
|
||||||
m_scene.returnObjects(objs2.ToArray(), remoteClient.AgentId);
|
m_scene.returnObjects(objs2.ToArray(), remoteClient);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2035,7 +2041,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
SceneObjectGroup[] objs = new SceneObjectGroup[1];
|
SceneObjectGroup[] objs = new SceneObjectGroup[1];
|
||||||
objs[0] = obj;
|
objs[0] = obj;
|
||||||
((Scene)client.Scene).returnObjects(objs, client.AgentId);
|
((Scene)client.Scene).returnObjects(objs, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
|
Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
|
||||||
|
|
|
@ -356,6 +356,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the total prims a parcel owner can have on a region
|
||||||
public int GetSimulatorMaxPrimCount()
|
public int GetSimulatorMaxPrimCount()
|
||||||
{
|
{
|
||||||
if (overrideSimulatorMaxPrimCount != null)
|
if (overrideSimulatorMaxPrimCount != null)
|
||||||
|
@ -370,7 +371,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
* (double)m_scene.RegionInfo.RegionSettings.ObjectBonus
|
* (double)m_scene.RegionInfo.RegionSettings.ObjectBonus
|
||||||
/ (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)
|
/ (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)
|
||||||
+0.5 );
|
+0.5 );
|
||||||
|
// sanity check
|
||||||
if(simMax > m_scene.RegionInfo.ObjectCapacity)
|
if(simMax > m_scene.RegionInfo.ObjectCapacity)
|
||||||
simMax = m_scene.RegionInfo.ObjectCapacity;
|
simMax = m_scene.RegionInfo.ObjectCapacity;
|
||||||
//m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}, SimWidePrims {3}",
|
//m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}, SimWidePrims {3}",
|
||||||
|
@ -1043,7 +1044,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
else
|
else
|
||||||
LandData.AABBMax = new Vector3(tx, ty, (float)m_scene.Heightmap[tx - 1, ty - 1]);
|
LandData.AABBMax = new Vector3(tx, ty, (float)m_scene.Heightmap[tx - 1, ty - 1]);
|
||||||
|
|
||||||
LandData.Area = tempArea * landUnit * landUnit;
|
tempArea *= landUnit * landUnit;
|
||||||
|
LandData.Area = tempArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1647,8 +1649,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
foreach (SceneObjectGroup obj in primsOverMe)
|
foreach (SceneObjectGroup obj in primsOverMe)
|
||||||
{
|
{
|
||||||
if (obj.OwnerID == previousOwner && obj.GroupID == UUID.Zero &&
|
if(m_scene.Permissions.CanSellObject(previousOwner,obj, (byte)SaleType.Original))
|
||||||
(obj.GetEffectivePermissions() & (uint)(OpenSim.Framework.PermissionMask.Transfer)) != 0)
|
|
||||||
m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0);
|
m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1662,7 +1663,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
SceneObjectGroup[] objs = new SceneObjectGroup[1];
|
SceneObjectGroup[] objs = new SceneObjectGroup[1];
|
||||||
objs[0] = obj;
|
objs[0] = obj;
|
||||||
m_scene.returnObjects(objs, obj.OwnerID);
|
m_scene.returnObjects(objs, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
|
public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
|
||||||
|
@ -1693,6 +1694,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
if (obj.GroupID == LandData.GroupID)
|
if (obj.GroupID == LandData.GroupID)
|
||||||
{
|
{
|
||||||
|
if (obj.OwnerID == LandData.OwnerID)
|
||||||
|
continue;
|
||||||
if (!returns.ContainsKey(obj.OwnerID))
|
if (!returns.ContainsKey(obj.OwnerID))
|
||||||
returns[obj.OwnerID] =
|
returns[obj.OwnerID] =
|
||||||
new List<SceneObjectGroup>();
|
new List<SceneObjectGroup>();
|
||||||
|
@ -1734,8 +1737,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
foreach (List<SceneObjectGroup> ol in returns.Values)
|
foreach (List<SceneObjectGroup> ol in returns.Values)
|
||||||
{
|
{
|
||||||
if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol))
|
if (m_scene.Permissions.CanReturnObjects(this, remote_client, ol))
|
||||||
m_scene.returnObjects(ol.ToArray(), remote_client.AgentId);
|
m_scene.returnObjects(ol.ToArray(), remote_client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,10 +92,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
m_Scene.RegisterModuleInterface<IPrimCountModule>(this);
|
m_Scene.RegisterModuleInterface<IPrimCountModule>(this);
|
||||||
|
|
||||||
m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
|
m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
|
||||||
m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
|
m_Scene.EventManager.OnObjectBeingRemovedFromScene += OnObjectBeingRemovedFromScene;
|
||||||
OnObjectBeingRemovedFromScene;
|
m_Scene.EventManager.OnParcelPrimCountTainted += OnParcelPrimCountTainted;
|
||||||
m_Scene.EventManager.OnParcelPrimCountTainted +=
|
|
||||||
OnParcelPrimCountTainted;
|
|
||||||
m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); };
|
m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,29 +213,15 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
else
|
else
|
||||||
parcelCounts.Users[obj.OwnerID] = partCount;
|
parcelCounts.Users[obj.OwnerID] = partCount;
|
||||||
|
|
||||||
if (obj.IsSelected)
|
if (obj.IsSelected || obj.GetSittingAvatarsCount() > 0)
|
||||||
{
|
|
||||||
parcelCounts.Selected += partCount;
|
parcelCounts.Selected += partCount;
|
||||||
}
|
|
||||||
|
if (obj.OwnerID == landData.OwnerID)
|
||||||
|
parcelCounts.Owner += partCount;
|
||||||
|
else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
|
||||||
|
parcelCounts.Group += partCount;
|
||||||
else
|
else
|
||||||
{
|
parcelCounts.Others += partCount;
|
||||||
if (landData.IsGroupOwned)
|
|
||||||
{
|
|
||||||
if (obj.OwnerID == landData.GroupID)
|
|
||||||
parcelCounts.Owner += partCount;
|
|
||||||
else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
|
|
||||||
parcelCounts.Group += partCount;
|
|
||||||
else
|
|
||||||
parcelCounts.Others += partCount;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (obj.OwnerID == landData.OwnerID)
|
|
||||||
parcelCounts.Owner += partCount;
|
|
||||||
else
|
|
||||||
parcelCounts.Others += partCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +377,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
count = counts.Owner;
|
count = counts.Owner;
|
||||||
count += counts.Group;
|
count += counts.Group;
|
||||||
count += counts.Others;
|
count += counts.Others;
|
||||||
count += counts.Selected;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
||||||
|
|
||||||
SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||||
m_scene.AddNewSceneObject(sog, false);
|
m_scene.AddNewSceneObject(sog, false);
|
||||||
m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity);
|
m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, m_userId, UUID.Zero, Quaternion.Identity, false);
|
||||||
|
|
||||||
Assert.That(pc.Owner, Is.EqualTo(6));
|
Assert.That(pc.Owner, Is.EqualTo(6));
|
||||||
Assert.That(pc.Group, Is.EqualTo(0));
|
Assert.That(pc.Group, Is.EqualTo(0));
|
||||||
|
|
|
@ -89,28 +89,23 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
if (part == null)
|
if (part == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (part.ParentGroup.IsDeleted)
|
SceneObjectGroup sog = part.ParentGroup;
|
||||||
|
if (sog == null || sog.IsDeleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (part.OwnerID != part.GroupID && part.OwnerID != client.AgentId && (!m_scene.Permissions.IsGod(client.AgentId)))
|
// Does the user have the power to put the object on sale?
|
||||||
return;
|
if (!m_scene.Permissions.CanSellObject(client, sog, saleType))
|
||||||
|
|
||||||
if (part.OwnerID == part.GroupID) // Group owned
|
|
||||||
{
|
{
|
||||||
// Does the user have the power to put the object on sale?
|
client.SendAgentAlertMessage("You don't have permission to set object on sale", false);
|
||||||
if (!m_scene.Permissions.CanSellGroupObject(client.AgentId, part.GroupID, m_scene))
|
return;
|
||||||
{
|
|
||||||
client.SendAgentAlertMessage("You don't have permission to set group-owned objects on sale", false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
part = part.ParentGroup.RootPart;
|
part = sog.RootPart;
|
||||||
|
|
||||||
part.ObjectSaleType = saleType;
|
part.ObjectSaleType = saleType;
|
||||||
part.SalePrice = salePrice;
|
part.SalePrice = salePrice;
|
||||||
|
|
||||||
part.ParentGroup.HasGroupChanged = true;
|
sog.HasGroupChanged = true;
|
||||||
|
|
||||||
part.SendPropertiesToClient(client);
|
part.SendPropertiesToClient(client);
|
||||||
}
|
}
|
||||||
|
@ -127,7 +122,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
switch (saleType)
|
switch (saleType)
|
||||||
{
|
{
|
||||||
case 1: // Sell as original (in-place sale)
|
case 1: // Sell as original (in-place sale)
|
||||||
uint effectivePerms = group.GetEffectivePermissions();
|
uint effectivePerms = group.EffectiveOwnerPerms;
|
||||||
|
|
||||||
if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
|
if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
|
||||||
{
|
{
|
||||||
|
@ -136,8 +131,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
group.SetOwnerId(remoteClient.AgentId);
|
group.SetOwner(remoteClient.AgentId, remoteClient.ActiveGroupId);
|
||||||
group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId);
|
|
||||||
|
|
||||||
if (m_scene.Permissions.PropagatePermissions())
|
if (m_scene.Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
|
@ -147,6 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
child.TriggerScriptChangedEvent(Changed.OWNER);
|
child.TriggerScriptChangedEvent(Changed.OWNER);
|
||||||
child.ApplyNextOwnerPermissions();
|
child.ApplyNextOwnerPermissions();
|
||||||
}
|
}
|
||||||
|
group.AggregatePerms();
|
||||||
}
|
}
|
||||||
|
|
||||||
part.ObjectSaleType = 0;
|
part.ObjectSaleType = 0;
|
||||||
|
@ -174,7 +169,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
|
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
|
||||||
group.AbsolutePosition = originalPosition;
|
group.AbsolutePosition = originalPosition;
|
||||||
|
|
||||||
uint perms = group.GetEffectivePermissions();
|
uint perms = group.EffectiveOwnerPerms;
|
||||||
|
|
||||||
if ((perms & (uint)PermissionMask.Transfer) == 0)
|
if ((perms & (uint)PermissionMask.Transfer) == 0)
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -61,6 +61,8 @@ namespace OpenSim.Region.CoreModules.World.Region
|
||||||
protected IDialogModule m_DialogModule = null;
|
protected IDialogModule m_DialogModule = null;
|
||||||
protected string m_MarkerPath = String.Empty;
|
protected string m_MarkerPath = String.Empty;
|
||||||
private int[] m_CurrentAlerts = null;
|
private int[] m_CurrentAlerts = null;
|
||||||
|
protected bool m_shortCircuitDelays = false;
|
||||||
|
protected bool m_rebootAll = false;
|
||||||
|
|
||||||
public void Initialise(IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
|
@ -69,6 +71,9 @@ namespace OpenSim.Region.CoreModules.World.Region
|
||||||
{
|
{
|
||||||
m_MarkerPath = restartConfig.GetString("MarkerPath", String.Empty);
|
m_MarkerPath = restartConfig.GetString("MarkerPath", String.Empty);
|
||||||
}
|
}
|
||||||
|
IConfig startupConfig = config.Configs["Startup"];
|
||||||
|
m_shortCircuitDelays = startupConfig.GetBoolean("SkipDelayOnEmptyRegion", false);
|
||||||
|
m_rebootAll = startupConfig.GetBoolean("InworldRestartShutsDown", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
|
@ -250,6 +255,14 @@ namespace OpenSim.Region.CoreModules.World.Region
|
||||||
private void OnTimer(object source, ElapsedEventArgs e)
|
private void OnTimer(object source, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
int nextInterval = DoOneNotice(true);
|
int nextInterval = DoOneNotice(true);
|
||||||
|
if (m_shortCircuitDelays)
|
||||||
|
{
|
||||||
|
if (CountAgents() == 0)
|
||||||
|
{
|
||||||
|
m_Scene.RestartNow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SetTimer(nextInterval);
|
SetTimer(nextInterval);
|
||||||
}
|
}
|
||||||
|
@ -349,5 +362,35 @@ namespace OpenSim.Region.CoreModules.World.Region
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CountAgents()
|
||||||
|
{
|
||||||
|
m_log.Info("[RESTART MODULE]: Counting affected avatars");
|
||||||
|
int agents = 0;
|
||||||
|
|
||||||
|
if (m_rebootAll)
|
||||||
|
{
|
||||||
|
foreach (Scene s in SceneManager.Instance.Scenes)
|
||||||
|
{
|
||||||
|
foreach (ScenePresence sp in s.GetScenePresences())
|
||||||
|
{
|
||||||
|
if (!sp.IsChildAgent && !sp.IsNPC)
|
||||||
|
agents++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (ScenePresence sp in m_Scene.GetScenePresences())
|
||||||
|
{
|
||||||
|
if (!sp.IsChildAgent && !sp.IsNPC)
|
||||||
|
agents++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.InfoFormat("[RESTART MODULE]: Avatars in region: {0}", agents);
|
||||||
|
|
||||||
|
return agents;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,8 +105,9 @@ namespace OpenSim.Region.CoreModules.World.Vegetation
|
||||||
if (rootPart.Shape.PCode != (byte)PCode.Grass)
|
if (rootPart.Shape.PCode != (byte)PCode.Grass)
|
||||||
AdaptTree(ref shape);
|
AdaptTree(ref shape);
|
||||||
|
|
||||||
m_scene.AddNewSceneObject(sceneObject, true);
|
|
||||||
sceneObject.SetGroup(groupID, null);
|
sceneObject.SetGroup(groupID, null);
|
||||||
|
m_scene.AddNewSceneObject(sceneObject, true);
|
||||||
|
sceneObject.AggregatePerms();
|
||||||
|
|
||||||
return sceneObject;
|
return sceneObject;
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,6 +278,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="datastore"></param>
|
/// <param name="datastore"></param>
|
||||||
void ProcessInventoryBackup(ISimulationDataService datastore);
|
void ProcessInventoryBackup(ISimulationDataService datastore);
|
||||||
|
|
||||||
|
void AggregateInnerPerms(ref uint owner, ref uint group, ref uint everyone);
|
||||||
|
|
||||||
uint MaskEffectivePermissions();
|
uint MaskEffectivePermissions();
|
||||||
|
|
||||||
void ApplyNextOwnerPermissions();
|
void ApplyNextOwnerPermissions();
|
||||||
|
|
|
@ -102,6 +102,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
|
|
||||||
ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx);
|
ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx);
|
||||||
|
|
||||||
|
bool CrossAgentCreateFarChild(ScenePresence agent, GridRegion neighbourRegion, Vector3 pos, EntityTransferContext ctx);
|
||||||
|
|
||||||
bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition);
|
bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
public interface IEtcdModule
|
||||||
|
{
|
||||||
|
bool Store(string k, string v);
|
||||||
|
bool Store(string k, string v, int ttl);
|
||||||
|
string Get(string k);
|
||||||
|
void Watch(string k, Action<string> callback);
|
||||||
|
void Delete(string k);
|
||||||
|
}
|
|
@ -3161,7 +3161,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (Action<Scene> d in handler.GetInvocationList())
|
foreach (Action<Scene> d in handler.GetInvocationList())
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[EVENT MANAGER]: TriggerSceneShuttingDown invoque {0}", d.Method.Name.ToString());
|
m_log.InfoFormat("[EVENT MANAGER]: TriggerSceneShuttingDown invoke {0}", d.Method.Name.ToString());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d(s);
|
d(s);
|
||||||
|
|
|
@ -246,17 +246,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
bool newstate = false;
|
bool newstate = false;
|
||||||
if(m_forceGodModeAlwaysOn)
|
if(m_forceGodModeAlwaysOn)
|
||||||
newstate = true;
|
newstate = m_viewergodlevel >= 200;
|
||||||
else
|
if(state != null)
|
||||||
{
|
{
|
||||||
if(state != null)
|
OSDMap s = (OSDMap)state;
|
||||||
{
|
|
||||||
OSDMap s = (OSDMap)state;
|
|
||||||
|
|
||||||
if (s.ContainsKey("ViewerUiIsGod"))
|
if (s.ContainsKey("ViewerUiIsGod"))
|
||||||
newstate = s["ViewerUiIsGod"].AsBoolean();
|
newstate = s["ViewerUiIsGod"].AsBoolean();
|
||||||
m_lastLevelToViewer = m_viewergodlevel; // we are not changing viewer level by default
|
m_lastLevelToViewer = m_viewergodlevel; // we are not changing viewer level by default
|
||||||
}
|
|
||||||
}
|
}
|
||||||
UpdateGodLevels(newstate);
|
UpdateGodLevels(newstate);
|
||||||
}
|
}
|
||||||
|
@ -264,6 +261,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public void HasMovedAway()
|
public void HasMovedAway()
|
||||||
{
|
{
|
||||||
m_lastLevelToViewer = 0;
|
m_lastLevelToViewer = 0;
|
||||||
|
if(m_forceGodModeAlwaysOn)
|
||||||
|
{
|
||||||
|
m_viewergodlevel = m_rightsGodLevel;
|
||||||
|
m_godlevel = m_rightsGodLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int UserLevel
|
public int UserLevel
|
||||||
|
|
|
@ -495,6 +495,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_group.RootPart.Velocity = Vector3.Zero;
|
m_group.RootPart.Velocity = Vector3.Zero;
|
||||||
m_group.RootPart.AngularVelocity = Vector3.Zero;
|
m_group.RootPart.AngularVelocity = Vector3.Zero;
|
||||||
|
m_skippedUpdates = 1000;
|
||||||
m_group.SendGroupRootTerseUpdate();
|
m_group.SendGroupRootTerseUpdate();
|
||||||
// m_group.RootPart.ScheduleTerseUpdate();
|
// m_group.RootPart.ScheduleTerseUpdate();
|
||||||
}
|
}
|
||||||
|
@ -517,6 +518,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
if (m_running && !m_waitingCrossing)
|
if (m_running && !m_waitingCrossing)
|
||||||
StartTimer();
|
StartTimer();
|
||||||
|
m_skippedUpdates = 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,10 +645,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_group.RootPart.Velocity = Vector3.Zero;
|
m_group.RootPart.Velocity = Vector3.Zero;
|
||||||
m_group.RootPart.AngularVelocity = Vector3.Zero;
|
m_group.RootPart.AngularVelocity = Vector3.Zero;
|
||||||
m_group.SendGroupRootTerseUpdate();
|
m_group.SendGroupRootTerseUpdate();
|
||||||
// m_group.RootPart.ScheduleTerseUpdate();
|
|
||||||
m_frames.Clear();
|
m_frames.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector3 m_lastPosUpdate;
|
||||||
|
Quaternion m_lastRotationUpdate;
|
||||||
|
Vector3 m_currentVel;
|
||||||
|
int m_skippedUpdates;
|
||||||
|
|
||||||
private void DoOnTimer(double tickDuration)
|
private void DoOnTimer(double tickDuration)
|
||||||
{
|
{
|
||||||
if (m_skipLoops > 0)
|
if (m_skipLoops > 0)
|
||||||
|
@ -665,6 +672,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_group.RootPart.Velocity != Vector3.Zero)
|
if (m_group.RootPart.Velocity != Vector3.Zero)
|
||||||
{
|
{
|
||||||
m_group.RootPart.Velocity = Vector3.Zero;
|
m_group.RootPart.Velocity = Vector3.Zero;
|
||||||
|
m_skippedUpdates = 1000;
|
||||||
m_group.SendGroupRootTerseUpdate();
|
m_group.SendGroupRootTerseUpdate();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -677,7 +685,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// retry to set the position that evtually caused the outbound
|
// retry to set the position that evtually caused the outbound
|
||||||
// if still outside region this will call startCrossing below
|
// if still outside region this will call startCrossing below
|
||||||
m_isCrossing = false;
|
m_isCrossing = false;
|
||||||
|
m_skippedUpdates = 1000;
|
||||||
m_group.AbsolutePosition = m_nextPosition;
|
m_group.AbsolutePosition = m_nextPosition;
|
||||||
|
|
||||||
if (!m_isCrossing)
|
if (!m_isCrossing)
|
||||||
{
|
{
|
||||||
StopTimer();
|
StopTimer();
|
||||||
|
@ -700,10 +710,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentFrame = m_frames[0];
|
m_currentFrame = m_frames[0];
|
||||||
m_currentFrame.TimeMS += (int)tickDuration;
|
|
||||||
}
|
}
|
||||||
//force a update on a keyframe transition
|
|
||||||
m_nextPosition = m_group.AbsolutePosition;
|
m_nextPosition = m_group.AbsolutePosition;
|
||||||
|
m_currentVel = (Vector3)m_currentFrame.Position - m_nextPosition;
|
||||||
|
m_currentVel /= (m_currentFrame.TimeMS * 0.001f);
|
||||||
|
|
||||||
|
m_currentFrame.TimeMS += (int)tickDuration;
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,7 +724,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Do the frame processing
|
// Do the frame processing
|
||||||
double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration;
|
double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration;
|
||||||
|
|
||||||
if (remainingSteps <= 0.0)
|
if (remainingSteps <= 1.0)
|
||||||
{
|
{
|
||||||
m_group.RootPart.Velocity = Vector3.Zero;
|
m_group.RootPart.Velocity = Vector3.Zero;
|
||||||
m_group.RootPart.AngularVelocity = Vector3.Zero;
|
m_group.RootPart.AngularVelocity = Vector3.Zero;
|
||||||
|
@ -720,92 +732,71 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_nextPosition = (Vector3)m_currentFrame.Position;
|
m_nextPosition = (Vector3)m_currentFrame.Position;
|
||||||
m_group.AbsolutePosition = m_nextPosition;
|
m_group.AbsolutePosition = m_nextPosition;
|
||||||
|
|
||||||
// we are sending imediate updates, no doing force a extra terseUpdate
|
|
||||||
// m_group.UpdateGroupRotationR((Quaternion)m_currentFrame.Rotation);
|
|
||||||
|
|
||||||
m_group.RootPart.RotationOffset = (Quaternion)m_currentFrame.Rotation;
|
m_group.RootPart.RotationOffset = (Quaternion)m_currentFrame.Rotation;
|
||||||
|
|
||||||
lock (m_frames)
|
lock (m_frames)
|
||||||
{
|
{
|
||||||
m_frames.RemoveAt(0);
|
m_frames.RemoveAt(0);
|
||||||
if (m_frames.Count > 0)
|
if (m_frames.Count > 0)
|
||||||
|
{
|
||||||
m_currentFrame = m_frames[0];
|
m_currentFrame = m_frames[0];
|
||||||
|
m_currentVel = (Vector3)m_currentFrame.Position - m_nextPosition;
|
||||||
|
m_currentVel /= (m_currentFrame.TimeMS * 0.001f);
|
||||||
|
m_group.RootPart.Velocity = m_currentVel;
|
||||||
|
m_currentFrame.TimeMS += (int)tickDuration;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_group.RootPart.Velocity = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float completed = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal;
|
bool lastSteps = remainingSteps < 4;
|
||||||
bool lastStep = m_currentFrame.TimeMS <= tickDuration;
|
Vector3 currentPosition = m_group.AbsolutePosition;
|
||||||
|
Vector3 motionThisFrame = (Vector3)m_currentFrame.Position - currentPosition;
|
||||||
|
motionThisFrame /= (float)remainingSteps;
|
||||||
|
|
||||||
|
m_nextPosition = currentPosition + motionThisFrame;
|
||||||
|
|
||||||
Vector3 v = (Vector3)m_currentFrame.Position - m_group.AbsolutePosition;
|
Quaternion currentRotation = m_group.GroupRotation;
|
||||||
Vector3 motionThisFrame = v / (float)remainingSteps;
|
if ((Quaternion)m_currentFrame.Rotation != currentRotation)
|
||||||
v = v * 1000 / m_currentFrame.TimeMS;
|
|
||||||
|
|
||||||
m_nextPosition = m_group.AbsolutePosition + motionThisFrame;
|
|
||||||
|
|
||||||
if (Vector3.Mag(motionThisFrame) >= 0.05f)
|
|
||||||
update = true;
|
|
||||||
|
|
||||||
//int totalSteps = m_currentFrame.TimeTotal / (int)tickDuration;
|
|
||||||
//m_log.DebugFormat("KeyframeMotion.OnTimer: step {0}/{1}, curPosition={2}, finalPosition={3}, motionThisStep={4} (scene {5})",
|
|
||||||
// totalSteps - remainingSteps + 1, totalSteps, m_group.AbsolutePosition, m_currentFrame.Position, motionThisStep, m_scene.RegionInfo.RegionName);
|
|
||||||
|
|
||||||
if ((Quaternion)m_currentFrame.Rotation != m_group.GroupRotation)
|
|
||||||
{
|
{
|
||||||
Quaternion current = m_group.GroupRotation;
|
float completed = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal;
|
||||||
|
|
||||||
Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed);
|
Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed);
|
||||||
step.Normalize();
|
step.Normalize();
|
||||||
/* use simpler change detection
|
m_group.RootPart.RotationOffset = step;
|
||||||
* float angle = 0;
|
if (Math.Abs(step.X - m_lastRotationUpdate.X) > 0.001f
|
||||||
|
|| Math.Abs(step.Y - m_lastRotationUpdate.Y) > 0.001f
|
||||||
float aa = current.X * current.X + current.Y * current.Y + current.Z * current.Z + current.W * current.W;
|
|| Math.Abs(step.Z - m_lastRotationUpdate.Z) > 0.001f)
|
||||||
float bb = step.X * step.X + step.Y * step.Y + step.Z * step.Z + step.W * step.W;
|
|
||||||
float aa_bb = aa * bb;
|
|
||||||
|
|
||||||
if (aa_bb == 0)
|
|
||||||
{
|
|
||||||
angle = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float ab = current.X * step.X +
|
|
||||||
current.Y * step.Y +
|
|
||||||
current.Z * step.Z +
|
|
||||||
current.W * step.W;
|
|
||||||
float q = (ab * ab) / aa_bb;
|
|
||||||
|
|
||||||
if (q > 1.0f)
|
|
||||||
{
|
|
||||||
angle = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
angle = (float)Math.Acos(2 * q - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (angle > 0.01f)
|
|
||||||
*/
|
|
||||||
if (Math.Abs(step.X - current.X) > 0.001f
|
|
||||||
|| Math.Abs(step.Y - current.Y) > 0.001f
|
|
||||||
|| Math.Abs(step.Z - current.Z) > 0.001f)
|
|
||||||
// assuming w is a dependente var
|
|
||||||
{
|
|
||||||
// m_group.UpdateGroupRotationR(step);
|
|
||||||
m_group.RootPart.RotationOffset = step;
|
|
||||||
|
|
||||||
//m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2);
|
|
||||||
update = true;
|
update = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (update)
|
|
||||||
{
|
|
||||||
m_group.AbsolutePosition = m_nextPosition;
|
m_group.AbsolutePosition = m_nextPosition;
|
||||||
|
if(lastSteps)
|
||||||
|
m_group.RootPart.Velocity = Vector3.Zero;
|
||||||
|
else
|
||||||
|
m_group.RootPart.Velocity = m_currentVel;
|
||||||
|
|
||||||
|
if(!update && (
|
||||||
|
lastSteps ||
|
||||||
|
m_skippedUpdates * tickDuration > 0.5 ||
|
||||||
|
Math.Abs(m_nextPosition.X - currentPosition.X) > 5f ||
|
||||||
|
Math.Abs(m_nextPosition.Y - currentPosition.Y) > 5f ||
|
||||||
|
Math.Abs(m_nextPosition.Z - currentPosition.Z) > 5f
|
||||||
|
))
|
||||||
|
{
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_skippedUpdates++;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(update)
|
||||||
|
{
|
||||||
|
m_lastPosUpdate = m_nextPosition;
|
||||||
|
m_lastRotationUpdate = m_group.GroupRotation;
|
||||||
|
m_skippedUpdates = 0;
|
||||||
m_group.SendGroupRootTerseUpdate();
|
m_group.SendGroupRootTerseUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -850,6 +841,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_group.RootPart.Velocity != Vector3.Zero)
|
if (m_group.RootPart.Velocity != Vector3.Zero)
|
||||||
{
|
{
|
||||||
m_group.RootPart.Velocity = Vector3.Zero;
|
m_group.RootPart.Velocity = Vector3.Zero;
|
||||||
|
m_skippedUpdates = 1000;
|
||||||
m_group.SendGroupRootTerseUpdate();
|
m_group.SendGroupRootTerseUpdate();
|
||||||
// m_group.RootPart.ScheduleTerseUpdate();
|
// m_group.RootPart.ScheduleTerseUpdate();
|
||||||
}
|
}
|
||||||
|
@ -862,6 +854,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_group != null)
|
if (m_group != null)
|
||||||
{
|
{
|
||||||
m_group.RootPart.Velocity = Vector3.Zero;
|
m_group.RootPart.Velocity = Vector3.Zero;
|
||||||
|
m_skippedUpdates = 1000;
|
||||||
m_group.SendGroupRootTerseUpdate();
|
m_group.SendGroupRootTerseUpdate();
|
||||||
// m_group.RootPart.ScheduleTerseUpdate();
|
// m_group.RootPart.ScheduleTerseUpdate();
|
||||||
|
|
||||||
|
|
|
@ -172,14 +172,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (entity is SceneObjectPart)
|
if (entity is SceneObjectPart)
|
||||||
{
|
{
|
||||||
|
SceneObjectGroup sog = ((SceneObjectPart)entity).ParentGroup;
|
||||||
// Attachments are high priority,
|
// Attachments are high priority,
|
||||||
if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
|
if (sog.IsAttachment)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
|
|
||||||
|
if(presence.ParentPart != null)
|
||||||
|
{
|
||||||
|
if(presence.ParentPart.ParentGroup == sog)
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
pqueue = ComputeDistancePriority(client, entity, false);
|
pqueue = ComputeDistancePriority(client, entity, false);
|
||||||
|
|
||||||
// Non physical prims are lower priority than physical prims
|
// Non physical prims are lower priority than physical prims
|
||||||
PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
|
PhysicsActor physActor = sog.RootPart.PhysActor;
|
||||||
if (physActor == null || !physActor.IsPhysical)
|
if (physActor == null || !physActor.IsPhysical)
|
||||||
pqueue++;
|
pqueue++;
|
||||||
}
|
}
|
||||||
|
@ -302,6 +310,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup;
|
SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup;
|
||||||
|
if(presence.ParentPart != null)
|
||||||
|
{
|
||||||
|
if(presence.ParentPart.ParentGroup == group)
|
||||||
|
return pqueue;
|
||||||
|
}
|
||||||
|
if(group.IsAttachment)
|
||||||
|
{
|
||||||
|
if(group.RootPart.LocalId == presence.LocalId)
|
||||||
|
return pqueue;
|
||||||
|
}
|
||||||
|
|
||||||
float bradius = group.GetBoundsRadius();
|
float bradius = group.GetBoundsRadius();
|
||||||
Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter();
|
Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter();
|
||||||
distance = Vector3.Distance(presencePos, grppos);
|
distance = Vector3.Distance(presencePos, grppos);
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.StructuredData;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
|
@ -90,6 +91,87 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FaceMaterial
|
||||||
|
{
|
||||||
|
public UUID ID;
|
||||||
|
public UUID NormalMapID = UUID.Zero;
|
||||||
|
public float NormalOffsetX = 0.0f;
|
||||||
|
public float NormalOffsetY = 0.0f;
|
||||||
|
public float NormalRepeatX = 1.0f;
|
||||||
|
public float NormalRepeatY = 1.0f;
|
||||||
|
public float NormalRotation = 0.0f;
|
||||||
|
|
||||||
|
public UUID SpecularMapID = UUID.Zero;
|
||||||
|
public float SpecularOffsetX = 0.0f;
|
||||||
|
public float SpecularOffsetY = 0.0f;
|
||||||
|
public float SpecularRepeatX = 1.0f;
|
||||||
|
public float SpecularRepeatY = 1.0f;
|
||||||
|
public float SpecularRotation = 0.0f;
|
||||||
|
|
||||||
|
public Color4 SpecularLightColor = new Color4(255,255,255,255);
|
||||||
|
public Byte SpecularLightExponent = 51;
|
||||||
|
public Byte EnvironmentIntensity = 0;
|
||||||
|
public Byte DiffuseAlphaMode = 1;
|
||||||
|
public Byte AlphaMaskCutoff = 0;
|
||||||
|
|
||||||
|
public FaceMaterial()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public FaceMaterial(UUID pID, OSDMap mat)
|
||||||
|
{
|
||||||
|
ID = pID;
|
||||||
|
if(mat == null)
|
||||||
|
return;
|
||||||
|
float scale = 0.0001f;
|
||||||
|
NormalMapID = mat["NormMap"].AsUUID();
|
||||||
|
NormalOffsetX = scale * (float)mat["NormOffsetX"].AsReal();
|
||||||
|
NormalOffsetY = scale * (float)mat["NormOffsetY"].AsReal();
|
||||||
|
NormalRepeatX = scale * (float)mat["NormRepeatX"].AsReal();
|
||||||
|
NormalRepeatY = scale * (float)mat["NormRepeatY"].AsReal();
|
||||||
|
NormalRotation = scale * (float)mat["NormRotation"].AsReal();
|
||||||
|
|
||||||
|
SpecularMapID = mat["SpecMap"].AsUUID();
|
||||||
|
SpecularOffsetX = scale * (float)mat["SpecOffsetX"].AsReal();
|
||||||
|
SpecularOffsetY = scale * (float)mat["SpecOffsetY"].AsReal();
|
||||||
|
SpecularRepeatX = scale * (float)mat["SpecRepeatX"].AsReal();
|
||||||
|
SpecularRepeatY = scale * (float)mat["SpecRepeatY"].AsReal();
|
||||||
|
SpecularRotation = scale * (float)mat["SpecRotation"].AsReal();
|
||||||
|
|
||||||
|
SpecularLightColor = mat["SpecColor"].AsColor4();
|
||||||
|
SpecularLightExponent = (Byte)mat["SpecExp"].AsUInteger();
|
||||||
|
EnvironmentIntensity = (Byte)mat["EnvIntensity"].AsUInteger();
|
||||||
|
DiffuseAlphaMode = (Byte)mat["DiffuseAlphaMode"].AsUInteger();
|
||||||
|
AlphaMaskCutoff = (Byte)mat["AlphaMaskCutoff"].AsUInteger();
|
||||||
|
}
|
||||||
|
|
||||||
|
public OSDMap toOSD()
|
||||||
|
{
|
||||||
|
OSDMap mat = new OSDMap();
|
||||||
|
float scale = 10000f;
|
||||||
|
|
||||||
|
mat["NormMap"] = NormalMapID;
|
||||||
|
mat["NormOffsetX"] = (int) (scale * NormalOffsetX);
|
||||||
|
mat["NormOffsetY"] = (int) (scale * NormalOffsetY);
|
||||||
|
mat["NormRepeatX"] = (int) (scale * NormalRepeatX);
|
||||||
|
mat["NormRepeatY"] = (int) (scale * NormalRepeatY);
|
||||||
|
mat["NormRotation"] = (int) (scale * NormalRotation);
|
||||||
|
|
||||||
|
mat["SpecMap"] = SpecularMapID;
|
||||||
|
mat["SpecOffsetX"] = (int) (scale * SpecularOffsetX);
|
||||||
|
mat["SpecOffsetY"] = (int) (scale * SpecularOffsetY);
|
||||||
|
mat["SpecRepeatX"] = (int) (scale * SpecularRepeatX);
|
||||||
|
mat["SpecRepeatY"] = (int) (scale * SpecularRepeatY);
|
||||||
|
mat["SpecRotation"] = (int) (scale * SpecularRotation);
|
||||||
|
|
||||||
|
mat["SpecColor"] = SpecularLightColor;
|
||||||
|
mat["SpecExp"] = SpecularLightExponent;
|
||||||
|
mat["EnvIntensity"] = EnvironmentIntensity;
|
||||||
|
mat["DiffuseAlphaMode"] = DiffuseAlphaMode;
|
||||||
|
mat["AlphaMaskCutoff"] = AlphaMaskCutoff;
|
||||||
|
|
||||||
|
return mat;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -338,6 +338,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Update item with new asset
|
// Update item with new asset
|
||||||
item.AssetID = asset.FullID;
|
item.AssetID = asset.FullID;
|
||||||
group.UpdateInventoryItem(item);
|
group.UpdateInventoryItem(item);
|
||||||
|
group.AggregatePerms();
|
||||||
|
|
||||||
part.SendPropertiesToClient(remoteClient);
|
part.SendPropertiesToClient(remoteClient);
|
||||||
|
|
||||||
|
@ -647,7 +648,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Modify
|
// Modify
|
||||||
uint permsMask = ~ ((uint)PermissionMask.Copy |
|
uint permsMask = ~ ((uint)PermissionMask.Copy |
|
||||||
(uint)PermissionMask.Transfer |
|
(uint)PermissionMask.Transfer |
|
||||||
(uint)PermissionMask.Modify);
|
(uint)PermissionMask.Modify |
|
||||||
|
(uint)PermissionMask.Export);
|
||||||
|
|
||||||
// Now, reduce the next perms to the mask bits
|
// Now, reduce the next perms to the mask bits
|
||||||
// relevant to the operation
|
// relevant to the operation
|
||||||
|
@ -677,6 +679,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
(uint)PermissionMask.Move;
|
(uint)PermissionMask.Move;
|
||||||
uint ownerPerms = item.CurrentPermissions;
|
uint ownerPerms = item.CurrentPermissions;
|
||||||
|
|
||||||
|
// These will be applied to the root prim at next rez.
|
||||||
|
// The legacy slam bit (bit 3) and folded permission (bits 0-2)
|
||||||
|
// are preserved due to the above mangling
|
||||||
|
ownerPerms &= nextPerms;
|
||||||
|
|
||||||
|
// Mask the base permissions. This is a conservative
|
||||||
|
// approach altering only the three main perms
|
||||||
|
basePerms &= nextPerms;
|
||||||
|
|
||||||
|
// Mask out the folded portion of the base mask.
|
||||||
|
// While the owner mask carries the actual folded
|
||||||
|
// permissions, the base mask carries the original
|
||||||
|
// base mask, before masking with the folded perms.
|
||||||
|
// We need this later for rezzing.
|
||||||
|
basePerms &= ~(uint)PermissionMask.FoldedMask;
|
||||||
|
basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0);
|
||||||
|
|
||||||
// If this is an object, root prim perms may be more
|
// If this is an object, root prim perms may be more
|
||||||
// permissive than folded perms. Use folded perms as
|
// permissive than folded perms. Use folded perms as
|
||||||
// a mask
|
// a mask
|
||||||
|
@ -684,6 +703,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
// Create a safe mask for the current perms
|
// Create a safe mask for the current perms
|
||||||
uint foldedPerms = (item.CurrentPermissions & 7) << 13;
|
uint foldedPerms = (item.CurrentPermissions & 7) << 13;
|
||||||
|
if ((item.CurrentPermissions & (uint)PermissionMask.FoldedExport) != 0)
|
||||||
|
foldedPerms |= (uint)PermissionMask.Export;
|
||||||
|
|
||||||
foldedPerms |= permsMask;
|
foldedPerms |= permsMask;
|
||||||
|
|
||||||
bool isRootMod = (item.CurrentPermissions &
|
bool isRootMod = (item.CurrentPermissions &
|
||||||
|
@ -691,6 +713,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
true : false;
|
true : false;
|
||||||
|
|
||||||
// Mask the owner perms to the folded perms
|
// Mask the owner perms to the folded perms
|
||||||
|
// Note that this is only to satisfy the viewer.
|
||||||
|
// The effect of this will be reversed on rez.
|
||||||
ownerPerms &= foldedPerms;
|
ownerPerms &= foldedPerms;
|
||||||
basePerms &= foldedPerms;
|
basePerms &= foldedPerms;
|
||||||
|
|
||||||
|
@ -705,15 +729,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// These will be applied to the root prim at next rez.
|
|
||||||
// The slam bit (bit 3) and folded permission (bits 0-2)
|
|
||||||
// are preserved due to the above mangling
|
|
||||||
ownerPerms &= nextPerms;
|
|
||||||
|
|
||||||
// Mask the base permissions. This is a conservative
|
|
||||||
// approach altering only the three main perms
|
|
||||||
basePerms &= nextPerms;
|
|
||||||
|
|
||||||
// Assign to the actual item. Make sure the slam bit is
|
// Assign to the actual item. Make sure the slam bit is
|
||||||
// set, if it wasn't set before.
|
// set, if it wasn't set before.
|
||||||
itemCopy.BasePermissions = basePerms;
|
itemCopy.BasePermissions = basePerms;
|
||||||
|
@ -1200,6 +1215,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
group.RemoveInventoryItem(localID, itemID);
|
group.RemoveInventoryItem(localID, itemID);
|
||||||
|
group.AggregatePerms();
|
||||||
}
|
}
|
||||||
|
|
||||||
part.SendPropertiesToClient(remoteClient);
|
part.SendPropertiesToClient(remoteClient);
|
||||||
|
@ -1244,6 +1260,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
agentItem.InvType = taskItem.InvType;
|
agentItem.InvType = taskItem.InvType;
|
||||||
agentItem.Flags = taskItem.Flags;
|
agentItem.Flags = taskItem.Flags;
|
||||||
|
|
||||||
|
// The code below isn't OK. It doesn't account for flags being changed
|
||||||
|
// in the object inventory, so it will break when you do it. That
|
||||||
|
// is the previous behaviour, so no matter at this moment. However, there is a lot
|
||||||
|
// TODO: Fix this after the inventory fixer exists and has beenr run
|
||||||
if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
|
if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||||
|
@ -1252,7 +1272,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
|
agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
|
||||||
|
|
||||||
agentItem.CurrentPermissions = agentItem.BasePermissions;
|
agentItem.BasePermissions = agentItem.CurrentPermissions;
|
||||||
|
|
||||||
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||||
agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner);
|
agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner);
|
||||||
|
@ -1360,18 +1380,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
if (!Permissions.CanCopyObjectInventory(itemId, part.UUID, remoteClient.AgentId))
|
||||||
{
|
{
|
||||||
// If the item to be moved is no copy, we need to be able to
|
// check also if we can delete the no copy item
|
||||||
// edit the prim.
|
if(!Permissions.CanEditObject(part.UUID, remoteClient.AgentId))
|
||||||
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If the item is copiable, then we just need to have perms
|
|
||||||
// on it. The delete check is a pure rights check
|
|
||||||
if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId))
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1449,29 +1461,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can't transfer this
|
if(!Permissions.CanDoObjectInvToObjectInv(srcTaskItem, part, destPart))
|
||||||
//
|
|
||||||
if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool overrideNoMod = false;
|
|
||||||
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0)
|
|
||||||
overrideNoMod = true;
|
|
||||||
|
|
||||||
if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
|
|
||||||
{
|
|
||||||
// object cannot copy items to an object owned by a different owner
|
|
||||||
// unless llAllowInventoryDrop has been called
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// must have both move and modify permission to put an item in an object
|
|
||||||
if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskInventoryItem destTaskItem = new TaskInventoryItem();
|
TaskInventoryItem destTaskItem = new TaskInventoryItem();
|
||||||
|
|
||||||
destTaskItem.ItemID = UUID.Random();
|
destTaskItem.ItemID = UUID.Random();
|
||||||
|
@ -1512,9 +1504,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
destTaskItem.Type = srcTaskItem.Type;
|
destTaskItem.Type = srcTaskItem.Type;
|
||||||
|
|
||||||
destPart.Inventory.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID);
|
destPart.Inventory.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID);
|
||||||
|
|
||||||
if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||||
|
{
|
||||||
part.Inventory.RemoveInventoryItem(itemId);
|
part.Inventory.RemoveInventoryItem(itemId);
|
||||||
|
}
|
||||||
|
|
||||||
ScenePresence avatar;
|
ScenePresence avatar;
|
||||||
|
|
||||||
|
@ -1652,76 +1645,79 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
uint primLocalID)
|
uint primLocalID)
|
||||||
{
|
{
|
||||||
UUID itemID = itemInfo.ItemID;
|
UUID itemID = itemInfo.ItemID;
|
||||||
|
if (itemID == UUID.Zero)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero on update for {1}!",
|
||||||
|
remoteClient.Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Find the prim we're dealing with
|
// Find the prim we're dealing with
|
||||||
SceneObjectPart part = GetSceneObjectPart(primLocalID);
|
SceneObjectPart part = GetSceneObjectPart(primLocalID);
|
||||||
|
if(part == null)
|
||||||
if (part != null)
|
|
||||||
{
|
{
|
||||||
TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID);
|
m_log.WarnFormat(
|
||||||
bool allowInventoryDrop = (part.GetEffectiveObjectFlags()
|
"[PRIM INVENTORY]: " +
|
||||||
& (uint)PrimFlags.AllowInventoryDrop) != 0;
|
"Update with item {0} requested of prim {1} for {2} but this prim does not exist",
|
||||||
|
itemID, primLocalID, remoteClient.Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Explicity allow anyone to add to the inventory if the
|
TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID);
|
||||||
// AllowInventoryDrop flag has been set. Don't however let
|
|
||||||
// them update an item unless they pass the external checks
|
if (currentItem == null)
|
||||||
//
|
{
|
||||||
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)
|
InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID);
|
||||||
&& (currentItem != null || !allowInventoryDrop))
|
|
||||||
|
// if not found Try library
|
||||||
|
if (item == null && LibraryService != null && LibraryService.LibraryRootFolder != null)
|
||||||
|
item = LibraryService.LibraryRootFolder.FindItem(itemID);
|
||||||
|
|
||||||
|
if(item == null)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!",
|
||||||
|
itemID, remoteClient.Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Permissions.CanDropInObjectInv(item, remoteClient, part))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (currentItem == null)
|
UUID copyID = UUID.Random();
|
||||||
|
bool modrights = Permissions.CanEditObject(part.ParentGroup, remoteClient);
|
||||||
|
part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID, modrights);
|
||||||
|
m_log.InfoFormat(
|
||||||
|
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
|
||||||
|
item.Name, primLocalID, remoteClient.Name);
|
||||||
|
part.SendPropertiesToClient(remoteClient);
|
||||||
|
if (!Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
UUID copyID = UUID.Random();
|
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||||
if (itemID != UUID.Zero)
|
|
||||||
{
|
{
|
||||||
InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID);
|
List<UUID> uuids = new List<UUID>();
|
||||||
|
uuids.Add(itemID);
|
||||||
// Try library
|
RemoveInventoryItem(remoteClient, uuids);
|
||||||
if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
|
|
||||||
{
|
|
||||||
item = LibraryService.LibraryRootFolder.FindItem(itemID);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we've found the item in the user's inventory or in the library
|
|
||||||
if (item != null)
|
|
||||||
{
|
|
||||||
part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID);
|
|
||||||
m_log.InfoFormat(
|
|
||||||
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
|
|
||||||
item.Name, primLocalID, remoteClient.Name);
|
|
||||||
part.SendPropertiesToClient(remoteClient);
|
|
||||||
if (!Permissions.BypassPermissions())
|
|
||||||
{
|
|
||||||
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
|
||||||
{
|
|
||||||
List<UUID> uuids = new List<UUID>();
|
|
||||||
uuids.Add(itemID);
|
|
||||||
RemoveInventoryItem(remoteClient, uuids);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat(
|
|
||||||
"[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!",
|
|
||||||
itemID, remoteClient.Name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Updating existing item with new perms etc
|
}
|
||||||
{
|
else // Updating existing item with new perms etc
|
||||||
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()",
|
// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()",
|
||||||
// currentItem.Name, part.Name);
|
// currentItem.Name, part.Name);
|
||||||
|
|
||||||
// Only look for an uploaded updated asset if we are passed a transaction ID. This is only the
|
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
|
||||||
// case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update)
|
return;
|
||||||
// will not pass in a transaction ID in the update message.
|
|
||||||
if (transactionID != UUID.Zero && AgentTransactionsModule != null)
|
// Only look for an uploaded updated asset if we are passed a transaction ID. This is only the
|
||||||
{
|
// case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update)
|
||||||
AgentTransactionsModule.HandleTaskItemUpdateFromTransaction(
|
// will not pass in a transaction ID in the update message.
|
||||||
remoteClient, part, transactionID, currentItem);
|
if (transactionID != UUID.Zero && AgentTransactionsModule != null)
|
||||||
|
{
|
||||||
|
AgentTransactionsModule.HandleTaskItemUpdateFromTransaction(
|
||||||
|
remoteClient, part, transactionID, currentItem);
|
||||||
|
|
||||||
// if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
|
// if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
|
||||||
// remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
// remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
||||||
|
@ -1729,49 +1725,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// remoteClient.SendAgentAlertMessage("Script saved", false);
|
// remoteClient.SendAgentAlertMessage("Script saved", false);
|
||||||
// else
|
// else
|
||||||
// remoteClient.SendAgentAlertMessage("Item saved", false);
|
// remoteClient.SendAgentAlertMessage("Item saved", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Base ALWAYS has move
|
// Base ALWAYS has move
|
||||||
currentItem.BasePermissions |= (uint)PermissionMask.Move;
|
currentItem.BasePermissions |= (uint)PermissionMask.Move;
|
||||||
|
|
||||||
itemInfo.Flags = currentItem.Flags;
|
itemInfo.Flags = currentItem.Flags;
|
||||||
|
|
||||||
// Check if we're allowed to mess with permissions
|
// Check if we're allowed to mess with permissions
|
||||||
if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god
|
if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god
|
||||||
|
{
|
||||||
|
if (remoteClient.AgentId != part.OwnerID) // Not owner
|
||||||
{
|
{
|
||||||
if (remoteClient.AgentId != part.OwnerID) // Not owner
|
// Friends and group members can't change any perms
|
||||||
{
|
itemInfo.BasePermissions = currentItem.BasePermissions;
|
||||||
// Friends and group members can't change any perms
|
itemInfo.EveryonePermissions = currentItem.EveryonePermissions;
|
||||||
itemInfo.BasePermissions = currentItem.BasePermissions;
|
itemInfo.GroupPermissions = currentItem.GroupPermissions;
|
||||||
itemInfo.EveryonePermissions = currentItem.EveryonePermissions;
|
itemInfo.NextPermissions = currentItem.NextPermissions;
|
||||||
itemInfo.GroupPermissions = currentItem.GroupPermissions;
|
itemInfo.CurrentPermissions = currentItem.CurrentPermissions;
|
||||||
itemInfo.NextPermissions = currentItem.NextPermissions;
|
|
||||||
itemInfo.CurrentPermissions = currentItem.CurrentPermissions;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Owner can't change base, and can change other
|
|
||||||
// only up to base
|
|
||||||
itemInfo.BasePermissions = currentItem.BasePermissions;
|
|
||||||
if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
|
|
||||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
|
|
||||||
if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
|
|
||||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
|
|
||||||
if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions)
|
|
||||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
|
|
||||||
if (itemInfo.NextPermissions != currentItem.NextPermissions)
|
|
||||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
|
|
||||||
itemInfo.EveryonePermissions &= currentItem.BasePermissions;
|
|
||||||
itemInfo.GroupPermissions &= currentItem.BasePermissions;
|
|
||||||
itemInfo.CurrentPermissions &= currentItem.BasePermissions;
|
|
||||||
itemInfo.NextPermissions &= currentItem.BasePermissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (itemInfo.BasePermissions != currentItem.BasePermissions)
|
// Owner can't change base, and can change other
|
||||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase;
|
// only up to base
|
||||||
|
itemInfo.BasePermissions = currentItem.BasePermissions;
|
||||||
if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
|
if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
|
||||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
|
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
|
||||||
if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
|
if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
|
||||||
|
@ -1780,23 +1757,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
|
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
|
||||||
if (itemInfo.NextPermissions != currentItem.NextPermissions)
|
if (itemInfo.NextPermissions != currentItem.NextPermissions)
|
||||||
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
|
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
|
||||||
|
itemInfo.EveryonePermissions &= currentItem.BasePermissions;
|
||||||
|
itemInfo.GroupPermissions &= currentItem.BasePermissions;
|
||||||
|
itemInfo.CurrentPermissions &= currentItem.BasePermissions;
|
||||||
|
itemInfo.NextPermissions &= currentItem.BasePermissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next ALWAYS has move
|
|
||||||
itemInfo.NextPermissions |= (uint)PermissionMask.Move;
|
|
||||||
|
|
||||||
if (part.Inventory.UpdateInventoryItem(itemInfo))
|
|
||||||
{
|
|
||||||
part.SendPropertiesToClient(remoteClient);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
if (itemInfo.BasePermissions != currentItem.BasePermissions)
|
||||||
m_log.WarnFormat(
|
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase;
|
||||||
"[PRIM INVENTORY]: " +
|
if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
|
||||||
"Update with item {0} requested of prim {1} for {2} but this prim does not exist",
|
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
|
||||||
itemID, primLocalID, remoteClient.Name);
|
if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
|
||||||
|
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
|
||||||
|
if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions)
|
||||||
|
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
|
||||||
|
if (itemInfo.NextPermissions != currentItem.NextPermissions)
|
||||||
|
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Next ALWAYS has move
|
||||||
|
itemInfo.NextPermissions |= (uint)PermissionMask.Move;
|
||||||
|
|
||||||
|
if (part.Inventory.UpdateInventoryItem(itemInfo))
|
||||||
|
{
|
||||||
|
part.SendPropertiesToClient(remoteClient);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1960,6 +1948,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.Inventory.AddInventoryItem(taskItem, false);
|
part.Inventory.AddInventoryItem(taskItem, false);
|
||||||
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
|
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
|
||||||
|
|
||||||
|
part.ParentGroup.AggregatePerms();
|
||||||
|
|
||||||
// tell anyone managing scripts that a new script exists
|
// tell anyone managing scripts that a new script exists
|
||||||
EventManager.TriggerNewScript(agentID, part, taskItem.ItemID);
|
EventManager.TriggerNewScript(agentID, part, taskItem.ItemID);
|
||||||
|
|
||||||
|
@ -2095,13 +2085,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name='action'>DeRezAction</param>
|
/// <param name='action'>DeRezAction</param>
|
||||||
/// <param name='destinationID'>User folder ID to place derezzed object</param>
|
/// <param name='destinationID'>User folder ID to place derezzed object</param>
|
||||||
public virtual void DeRezObjects(
|
public virtual void DeRezObjects(
|
||||||
IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID)
|
IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID, bool AddToReturns = true)
|
||||||
{
|
{
|
||||||
// First, see of we can perform the requested action and
|
// First, see of we can perform the requested action and
|
||||||
// build a list of eligible objects
|
// build a list of eligible objects
|
||||||
List<uint> deleteIDs = new List<uint>();
|
List<uint> deleteIDs = new List<uint>();
|
||||||
List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>();
|
List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>();
|
||||||
List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>();
|
List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>();
|
||||||
|
List<SceneObjectGroup> takeDeleteGroups = new List<SceneObjectGroup>();
|
||||||
|
|
||||||
|
ScenePresence sp = null;
|
||||||
|
if(remoteClient != null)
|
||||||
|
sp = remoteClient.SceneAgent as ScenePresence;
|
||||||
|
else if(action != DeRezAction.Return)
|
||||||
|
return; // only Return can be called without a client
|
||||||
|
|
||||||
// Start with true for both, then remove the flags if objects
|
// Start with true for both, then remove the flags if objects
|
||||||
// that we can't derez are part of the selection
|
// that we can't derez are part of the selection
|
||||||
|
@ -2157,17 +2154,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (action == DeRezAction.TakeCopy)
|
if (action == DeRezAction.TakeCopy)
|
||||||
{
|
{
|
||||||
if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
|
if (!Permissions.CanTakeCopyObject(grp, sp))
|
||||||
permissionToTakeCopy = false;
|
permissionToTakeCopy = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
permissionToTakeCopy = false;
|
permissionToTakeCopy = false;
|
||||||
}
|
}
|
||||||
if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
|
if (!Permissions.CanTakeObject(grp, sp))
|
||||||
permissionToTake = false;
|
permissionToTake = false;
|
||||||
|
|
||||||
if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
|
if (!Permissions.CanDeleteObject(grp, remoteClient))
|
||||||
permissionToDelete = false;
|
permissionToDelete = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2208,13 +2205,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (Permissions.CanReturnObjects(
|
if (Permissions.CanReturnObjects(
|
||||||
null,
|
null,
|
||||||
remoteClient.AgentId,
|
remoteClient,
|
||||||
new List<SceneObjectGroup>() {grp}))
|
new List<SceneObjectGroup>() {grp}))
|
||||||
{
|
{
|
||||||
permissionToTake = true;
|
permissionToTake = true;
|
||||||
permissionToDelete = true;
|
permissionToDelete = true;
|
||||||
|
if(AddToReturns)
|
||||||
AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
|
AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition,
|
||||||
|
"parcel owner return");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Auto return passes through here with null agent
|
else // Auto return passes through here with null agent
|
||||||
|
@ -2224,26 +2222,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permissionToTake && (!permissionToDelete))
|
|
||||||
takeGroups.Add(grp);
|
|
||||||
|
|
||||||
if (permissionToDelete)
|
if (permissionToDelete)
|
||||||
{
|
{
|
||||||
if (permissionToTake)
|
if (permissionToTake)
|
||||||
|
takeDeleteGroups.Add(grp);
|
||||||
|
else
|
||||||
deleteGroups.Add(grp);
|
deleteGroups.Add(grp);
|
||||||
deleteIDs.Add(grp.LocalId);
|
deleteIDs.Add(grp.LocalId);
|
||||||
}
|
}
|
||||||
|
else if(permissionToTake)
|
||||||
|
takeGroups.Add(grp);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendKillObject(deleteIDs);
|
SendKillObject(deleteIDs);
|
||||||
|
|
||||||
if (deleteGroups.Count > 0)
|
if (takeDeleteGroups.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectGroup g in deleteGroups)
|
|
||||||
deleteIDs.Remove(g.LocalId);
|
|
||||||
|
|
||||||
m_asyncSceneObjectDeleter.DeleteToInventory(
|
m_asyncSceneObjectDeleter.DeleteToInventory(
|
||||||
action, destinationID, deleteGroups, remoteClient,
|
action, destinationID, takeDeleteGroups, remoteClient,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
if (takeGroups.Count > 0)
|
if (takeGroups.Count > 0)
|
||||||
|
@ -2252,7 +2248,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
action, destinationID, takeGroups, remoteClient,
|
action, destinationID, takeGroups, remoteClient,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
if (deleteIDs.Count > 0)
|
if (deleteGroups.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectGroup g in deleteGroups)
|
foreach (SceneObjectGroup g in deleteGroups)
|
||||||
DeleteSceneObject(g, true);
|
DeleteSceneObject(g, true);
|
||||||
|
@ -2640,6 +2636,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// We can only call this after adding the scene object, since the scene object references the scene
|
// We can only call this after adding the scene object, since the scene object references the scene
|
||||||
// to find out if scripts should be activated at all.
|
// to find out if scripts should be activated at all.
|
||||||
|
group.AggregatePerms();
|
||||||
group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);
|
group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);
|
||||||
|
|
||||||
group.ScheduleGroupForFullUpdate();
|
group.ScheduleGroupForFullUpdate();
|
||||||
|
@ -2649,7 +2646,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool returnObjects(SceneObjectGroup[] returnobjects,
|
public virtual bool returnObjects(SceneObjectGroup[] returnobjects,
|
||||||
UUID AgentId)
|
IClientAPI client)
|
||||||
{
|
{
|
||||||
List<uint> localIDs = new List<uint>();
|
List<uint> localIDs = new List<uint>();
|
||||||
|
|
||||||
|
@ -2659,8 +2656,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
"parcel owner return");
|
"parcel owner return");
|
||||||
localIDs.Add(grp.RootPart.LocalId);
|
localIDs.Add(grp.RootPart.LocalId);
|
||||||
}
|
}
|
||||||
DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return,
|
DeRezObjects(client, localIDs, UUID.Zero, DeRezAction.Return,
|
||||||
UUID.Zero);
|
UUID.Zero, false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2691,9 +2688,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (ownerID != UUID.Zero)
|
if (ownerID != UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Permissions.CanDeedObject(remoteClient.AgentId, groupID))
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SceneObjectGroup> groups = new List<SceneObjectGroup>();
|
List<SceneObjectGroup> groups = new List<SceneObjectGroup>();
|
||||||
|
@ -2724,21 +2718,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
child.TriggerScriptChangedEvent(Changed.OWNER);
|
child.TriggerScriptChangedEvent(Changed.OWNER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // The object was deeded to the group
|
else // The object deeded to the group
|
||||||
{
|
{
|
||||||
if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId)
|
if (!Permissions.CanDeedObject(remoteClient, sog, groupID))
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!Permissions.CanTransferObject(sog.UUID, groupID))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (sog.GroupID != groupID)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sog.SetOwnerId(groupID);
|
sog.SetOwnerId(groupID);
|
||||||
// Make the group mask be the previous owner mask
|
|
||||||
sog.RootPart.GroupMask = sog.RootPart.OwnerMask;
|
// this is wrong, GroupMask is used for group sharing, still possible to set
|
||||||
|
// this whould give owner rights to users that are member of group but don't have role powers to edit
|
||||||
|
// sog.RootPart.GroupMask = sog.RootPart.OwnerMask;
|
||||||
|
|
||||||
|
// we should keep all permissions on deed to group
|
||||||
|
// and with this comented code, if user does not set next permissions on the object
|
||||||
|
// and on ALL contents of ALL prims, he may loose rights, making the object useless
|
||||||
sog.ApplyNextOwnerPermissions();
|
sog.ApplyNextOwnerPermissions();
|
||||||
|
sog.AggregatePerms();
|
||||||
|
|
||||||
sog.ScheduleGroupForFullUpdate();
|
sog.ScheduleGroupForFullUpdate();
|
||||||
|
|
||||||
|
@ -2748,8 +2743,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
child.Inventory.ChangeInventoryOwner(groupID);
|
child.Inventory.ChangeInventoryOwner(groupID);
|
||||||
child.TriggerScriptChangedEvent(Changed.OWNER);
|
child.TriggerScriptChangedEvent(Changed.OWNER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,11 +183,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.SendFullUpdate(remoteClient);
|
part.SendFullUpdate(remoteClient);
|
||||||
|
|
||||||
// A prim is only tainted if it's allowed to be edited by the person clicking it.
|
// A prim is only tainted if it's allowed to be edited by the person clicking it.
|
||||||
if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
|
if (Permissions.CanChangeSelectedState(part, (ScenePresence)remoteClient.SceneAgent))
|
||||||
|| Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
|
|
||||||
{
|
{
|
||||||
|
bool oldsel = part.IsSelected;
|
||||||
part.IsSelected = true;
|
part.IsSelected = true;
|
||||||
EventManager.TriggerParcelPrimCountTainted();
|
if(!oldsel)
|
||||||
|
EventManager.TriggerParcelPrimCountTainted();
|
||||||
}
|
}
|
||||||
|
|
||||||
part.SendPropertiesToClient(remoteClient);
|
part.SendPropertiesToClient(remoteClient);
|
||||||
|
@ -229,6 +230,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (so.OwnerID == remoteClient.AgentId)
|
if (so.OwnerID == remoteClient.AgentId)
|
||||||
{
|
{
|
||||||
so.SetGroup(groupID, remoteClient);
|
so.SetGroup(groupID, remoteClient);
|
||||||
|
EventManager.TriggerParcelPrimCountTainted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,8 +252,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// handled by group, but by prim. Legacy cruft.
|
// handled by group, but by prim. Legacy cruft.
|
||||||
// TODO: Make selection flagging per prim!
|
// TODO: Make selection flagging per prim!
|
||||||
//
|
//
|
||||||
if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)
|
if (Permissions.CanChangeSelectedState(part, (ScenePresence)remoteClient.SceneAgent))
|
||||||
|| Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId))
|
|
||||||
{
|
{
|
||||||
part.IsSelected = false;
|
part.IsSelected = false;
|
||||||
if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected)
|
if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected)
|
||||||
|
@ -327,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if(group == null || group.IsDeleted)
|
if(group == null || group.IsDeleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
|
if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
|
||||||
{
|
{
|
||||||
group.GrabMovement(objectID, offset, pos, remoteClient);
|
group.GrabMovement(objectID, offset, pos, remoteClient);
|
||||||
}
|
}
|
||||||
|
@ -388,7 +389,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(objectID);
|
SceneObjectGroup group = GetGroupByPrim(objectID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
|
if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
|
||||||
{
|
{
|
||||||
group.SpinStart(remoteClient);
|
group.SpinStart(remoteClient);
|
||||||
}
|
}
|
||||||
|
@ -406,7 +407,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(objectID);
|
SceneObjectGroup group = GetGroupByPrim(objectID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
|
if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
|
||||||
{
|
{
|
||||||
group.SpinMovement(rotation, remoteClient);
|
group.SpinMovement(rotation, remoteClient);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,52 +37,60 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
namespace OpenSim.Region.Framework.Scenes
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
#region Delegates
|
#region Delegates
|
||||||
public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID);
|
public delegate uint GenerateClientFlagsHandler(SceneObjectPart part, ScenePresence sp, uint curEffectivePerms);
|
||||||
public delegate void SetBypassPermissionsHandler(bool value);
|
public delegate void SetBypassPermissionsHandler(bool value);
|
||||||
public delegate bool BypassPermissionsHandler();
|
public delegate bool BypassPermissionsHandler();
|
||||||
public delegate bool PropagatePermissionsHandler();
|
public delegate bool PropagatePermissionsHandler();
|
||||||
public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
|
public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition);
|
||||||
public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
|
public delegate bool DeleteObjectHandlerByIDs(UUID objectID, UUID deleter);
|
||||||
public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene);
|
public delegate bool DeleteObjectHandler(SceneObjectGroup sog, ScenePresence sp);
|
||||||
public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene);
|
public delegate bool TransferObjectHandler(UUID objectID, UUID recipient);
|
||||||
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
|
public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
|
||||||
public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene);
|
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID);
|
||||||
public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
|
public delegate bool SellObjectHandlerByUserID(SceneObjectGroup sog, UUID userID, byte saleType);
|
||||||
public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
|
public delegate bool SellObjectHandler(SceneObjectGroup sog, ScenePresence sp, byte saleType);
|
||||||
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
|
public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
|
||||||
public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene);
|
public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp);
|
||||||
public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
|
public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID);
|
||||||
public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene);
|
public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
|
||||||
public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene);
|
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
|
||||||
public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene);
|
public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
|
||||||
public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
|
public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
|
||||||
public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene);
|
public delegate bool ObjectEnterWithScriptsHandler(SceneObjectGroup sog, ILandObject land);
|
||||||
public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
|
public delegate bool ReturnObjectsHandler(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects);
|
||||||
public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene);
|
public delegate bool InstantMessageHandler(UUID user, UUID target);
|
||||||
public delegate bool RunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
|
public delegate bool InventoryTransferHandler(UUID user, UUID target);
|
||||||
public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene);
|
public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user);
|
||||||
public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene);
|
public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user);
|
||||||
public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene);
|
public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user);
|
||||||
public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene);
|
public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user);
|
||||||
public delegate bool TerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene);
|
public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user);
|
||||||
public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene);
|
public delegate bool RunScriptHandler(TaskInventoryItem item, SceneObjectPart part);
|
||||||
public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand);
|
public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType);
|
||||||
public delegate bool IsGodHandler(UUID user, Scene requestFromScene);
|
public delegate bool StartScriptHandler(UUID script, UUID user);
|
||||||
public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene);
|
public delegate bool StopScriptHandler(UUID script, UUID user);
|
||||||
|
public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user);
|
||||||
|
public delegate bool TerraformLandHandler(UUID user, Vector3 position);
|
||||||
|
public delegate bool RunConsoleCommandHandler(UUID user);
|
||||||
|
public delegate bool IssueEstateCommandHandler(UUID user, bool ownerCommand);
|
||||||
|
public delegate bool IsGodHandler(UUID user);
|
||||||
|
public delegate bool IsGridGodHandler(UUID user);
|
||||||
public delegate bool IsAdministratorHandler(UUID user);
|
public delegate bool IsAdministratorHandler(UUID user);
|
||||||
public delegate bool IsEstateManagerHandler(UUID user);
|
public delegate bool IsEstateManagerHandler(UUID user);
|
||||||
public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
|
public delegate bool EditParcelHandler(UUID user, ILandObject parcel);
|
||||||
public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager);
|
public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, bool allowManager);
|
||||||
public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene);
|
public delegate bool SellParcelHandler(UUID user, ILandObject parcel);
|
||||||
public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
|
public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel);
|
||||||
public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
|
public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel);
|
||||||
public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene);
|
public delegate bool DeedParcelHandler(UUID user, ILandObject parcel);
|
||||||
public delegate bool DeedObjectHandler(UUID user, UUID group, Scene scene);
|
public delegate bool DeedObjectHandler(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID);
|
||||||
public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene);
|
public delegate bool BuyLandHandler(UUID user, ILandObject parcel);
|
||||||
public delegate bool LinkObjectHandler(UUID user, UUID objectID);
|
public delegate bool LinkObjectHandler(UUID user, UUID objectID);
|
||||||
public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
|
public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
|
||||||
public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
|
public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
|
||||||
public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
|
public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
|
||||||
|
public delegate bool DoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart);
|
||||||
|
public delegate bool DoDropInObjectInv(InventoryItemBase item, ScenePresence sp, SceneObjectPart destPart);
|
||||||
public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
|
public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
|
||||||
public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
|
public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
|
||||||
public delegate bool CreateUserInventoryHandler(int invType, UUID userID);
|
public delegate bool CreateUserInventoryHandler(int invType, UUID userID);
|
||||||
|
@ -112,16 +120,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public event BypassPermissionsHandler OnBypassPermissions;
|
public event BypassPermissionsHandler OnBypassPermissions;
|
||||||
public event PropagatePermissionsHandler OnPropagatePermissions;
|
public event PropagatePermissionsHandler OnPropagatePermissions;
|
||||||
public event RezObjectHandler OnRezObject;
|
public event RezObjectHandler OnRezObject;
|
||||||
|
public event DeleteObjectHandlerByIDs OnDeleteObjectByIDs;
|
||||||
public event DeleteObjectHandler OnDeleteObject;
|
public event DeleteObjectHandler OnDeleteObject;
|
||||||
public event TransferObjectHandler OnTransferObject;
|
public event TransferObjectHandler OnTransferObject;
|
||||||
public event TakeObjectHandler OnTakeObject;
|
public event TakeObjectHandler OnTakeObject;
|
||||||
|
|
||||||
public event SellGroupObjectHandler OnSellGroupObject;
|
public event SellGroupObjectHandler OnSellGroupObject;
|
||||||
|
public event SellObjectHandlerByUserID OnSellObjectByUserID;
|
||||||
|
public event SellObjectHandler OnSellObject;
|
||||||
|
|
||||||
public event TakeCopyObjectHandler OnTakeCopyObject;
|
public event TakeCopyObjectHandler OnTakeCopyObject;
|
||||||
public event DuplicateObjectHandler OnDuplicateObject;
|
public event DuplicateObjectHandler OnDuplicateObject;
|
||||||
|
public event EditObjectByIDsHandler OnEditObjectByIDs;
|
||||||
public event EditObjectHandler OnEditObject;
|
public event EditObjectHandler OnEditObject;
|
||||||
public event EditObjectInventoryHandler OnEditObjectInventory;
|
public event EditObjectInventoryHandler OnEditObjectInventory;
|
||||||
public event MoveObjectHandler OnMoveObject;
|
public event MoveObjectHandler OnMoveObject;
|
||||||
public event ObjectEntryHandler OnObjectEntry;
|
public event ObjectEntryHandler OnObjectEntry;
|
||||||
|
public event ObjectEnterWithScriptsHandler OnObjectEnterWithScripts;
|
||||||
public event ReturnObjectsHandler OnReturnObjects;
|
public event ReturnObjectsHandler OnReturnObjects;
|
||||||
public event InstantMessageHandler OnInstantMessage;
|
public event InstantMessageHandler OnInstantMessage;
|
||||||
public event InventoryTransferHandler OnInventoryTransfer;
|
public event InventoryTransferHandler OnInventoryTransfer;
|
||||||
|
@ -129,6 +144,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public event ViewNotecardHandler OnViewNotecard;
|
public event ViewNotecardHandler OnViewNotecard;
|
||||||
public event EditScriptHandler OnEditScript;
|
public event EditScriptHandler OnEditScript;
|
||||||
public event EditNotecardHandler OnEditNotecard;
|
public event EditNotecardHandler OnEditNotecard;
|
||||||
|
public event RunScriptHandlerByIDs OnRunScriptByIDs;
|
||||||
public event RunScriptHandler OnRunScript;
|
public event RunScriptHandler OnRunScript;
|
||||||
public event CompileScriptHandler OnCompileScript;
|
public event CompileScriptHandler OnCompileScript;
|
||||||
public event StartScriptHandler OnStartScript;
|
public event StartScriptHandler OnStartScript;
|
||||||
|
@ -137,7 +153,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public event TerraformLandHandler OnTerraformLand;
|
public event TerraformLandHandler OnTerraformLand;
|
||||||
public event RunConsoleCommandHandler OnRunConsoleCommand;
|
public event RunConsoleCommandHandler OnRunConsoleCommand;
|
||||||
public event IssueEstateCommandHandler OnIssueEstateCommand;
|
public event IssueEstateCommandHandler OnIssueEstateCommand;
|
||||||
public event IsGodHandler OnIsGod;
|
|
||||||
public event IsGridGodHandler OnIsGridGod;
|
public event IsGridGodHandler OnIsGridGod;
|
||||||
public event IsAdministratorHandler OnIsAdministrator;
|
public event IsAdministratorHandler OnIsAdministrator;
|
||||||
public event IsEstateManagerHandler OnIsEstateManager;
|
public event IsEstateManagerHandler OnIsEstateManager;
|
||||||
|
@ -153,6 +168,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public event DelinkObjectHandler OnDelinkObject;
|
public event DelinkObjectHandler OnDelinkObject;
|
||||||
public event CreateObjectInventoryHandler OnCreateObjectInventory;
|
public event CreateObjectInventoryHandler OnCreateObjectInventory;
|
||||||
public event CopyObjectInventoryHandler OnCopyObjectInventory;
|
public event CopyObjectInventoryHandler OnCopyObjectInventory;
|
||||||
|
public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv;
|
||||||
|
public event DoDropInObjectInv OnDropInObjectInv;
|
||||||
public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
|
public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
|
||||||
public event TransferObjectInventoryHandler OnTransferObjectInventory;
|
public event TransferObjectInventoryHandler OnTransferObjectInventory;
|
||||||
public event CreateUserInventoryHandler OnCreateUserInventory;
|
public event CreateUserInventoryHandler OnCreateUserInventory;
|
||||||
|
@ -167,7 +184,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#region Object Permission Checks
|
#region Object Permission Checks
|
||||||
|
|
||||||
public uint GenerateClientFlags(UUID userID, UUID objectID)
|
public uint GenerateClientFlags( SceneObjectPart part, ScenePresence sp)
|
||||||
{
|
{
|
||||||
// libomv will moan about PrimFlags.ObjectYouOfficer being
|
// libomv will moan about PrimFlags.ObjectYouOfficer being
|
||||||
// obsolete...
|
// obsolete...
|
||||||
|
@ -179,12 +196,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
PrimFlags.ObjectTransfer |
|
PrimFlags.ObjectTransfer |
|
||||||
PrimFlags.ObjectYouOwner |
|
PrimFlags.ObjectYouOwner |
|
||||||
PrimFlags.ObjectAnyOwner |
|
PrimFlags.ObjectAnyOwner |
|
||||||
PrimFlags.ObjectOwnerModify |
|
PrimFlags.ObjectOwnerModify;
|
||||||
PrimFlags.ObjectYouOfficer;
|
|
||||||
#pragma warning restore 0612
|
#pragma warning restore 0612
|
||||||
|
|
||||||
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
|
|
||||||
|
|
||||||
if (part == null)
|
if (part == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -196,7 +210,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
|
Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
|
||||||
foreach (GenerateClientFlagsHandler check in list)
|
foreach (GenerateClientFlagsHandler check in list)
|
||||||
{
|
{
|
||||||
perms &= check(userID, objectID);
|
perms &= check(part, sp, perms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return perms;
|
return perms;
|
||||||
|
@ -248,7 +262,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (RezObjectHandler h in list)
|
foreach (RezObjectHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(objectCount, owner,objectPosition, m_scene) == false)
|
if (h(objectCount, owner,objectPosition) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,141 +276,52 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
DeleteObjectHandler handler = OnDeleteObject;
|
DeleteObjectHandlerByIDs handler = OnDeleteObjectByIDs;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (DeleteObjectHandler h in list)
|
foreach (DeleteObjectHandlerByIDs h in list)
|
||||||
{
|
{
|
||||||
if (h(objectID, deleter, m_scene) == false)
|
if (h(objectID, deleter) == false)
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanDeleteObject(SceneObjectGroup sog, IClientAPI client)
|
||||||
|
{
|
||||||
|
DeleteObjectHandler handler = OnDeleteObject;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
if(sog == null || client == null || client.SceneAgent == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ScenePresence sp = client.SceneAgent as ScenePresence;
|
||||||
|
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (DeleteObjectHandler h in list)
|
||||||
|
{
|
||||||
|
if (h(sog, sp) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool CanTransferObject(UUID objectID, UUID recipient)
|
public bool CanTransferObject(UUID objectID, UUID recipient)
|
||||||
{
|
{
|
||||||
bool result = true;
|
|
||||||
|
|
||||||
TransferObjectHandler handler = OnTransferObject;
|
TransferObjectHandler handler = OnTransferObject;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (TransferObjectHandler h in list)
|
foreach (TransferObjectHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(objectID, recipient, m_scene) == false)
|
if (h(objectID, recipient) == false)
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region TAKE OBJECT
|
|
||||||
public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID)
|
|
||||||
{
|
|
||||||
bool result = true;
|
|
||||||
|
|
||||||
TakeObjectHandler handler = OnTakeObject;
|
|
||||||
if (handler != null)
|
|
||||||
{
|
|
||||||
Delegate[] list = handler.GetInvocationList();
|
|
||||||
foreach (TakeObjectHandler h in list)
|
|
||||||
{
|
|
||||||
if (h(objectID, AvatarTakingUUID, m_scene) == false)
|
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}",
|
|
||||||
// objectID, AvatarTakingUUID, result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region SELL GROUP OBJECT
|
|
||||||
public bool CanSellGroupObject(UUID userID, UUID groupID, Scene scene)
|
|
||||||
{
|
|
||||||
bool result = true;
|
|
||||||
|
|
||||||
SellGroupObjectHandler handler = OnSellGroupObject;
|
|
||||||
if (handler != null)
|
|
||||||
{
|
|
||||||
Delegate[] list = handler.GetInvocationList();
|
|
||||||
foreach (SellGroupObjectHandler h in list)
|
|
||||||
{
|
|
||||||
if (h(userID, groupID, scene) == false)
|
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//m_log.DebugFormat(
|
|
||||||
// "[SCENE PERMISSIONS]: CanSellGroupObject() fired for user {0}, group {1}, result {2}",
|
|
||||||
// userID, groupID, result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region TAKE COPY OBJECT
|
|
||||||
public bool CanTakeCopyObject(UUID objectID, UUID userID)
|
|
||||||
{
|
|
||||||
bool result = true;
|
|
||||||
|
|
||||||
TakeCopyObjectHandler handler = OnTakeCopyObject;
|
|
||||||
if (handler != null)
|
|
||||||
{
|
|
||||||
Delegate[] list = handler.GetInvocationList();
|
|
||||||
foreach (TakeCopyObjectHandler h in list)
|
|
||||||
{
|
|
||||||
if (h(objectID, userID, m_scene) == false)
|
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}",
|
|
||||||
// objectID, userID, result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region DUPLICATE OBJECT
|
|
||||||
public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition)
|
|
||||||
{
|
|
||||||
DuplicateObjectHandler handler = OnDuplicateObject;
|
|
||||||
if (handler != null)
|
|
||||||
{
|
|
||||||
Delegate[] list = handler.GetInvocationList();
|
|
||||||
foreach (DuplicateObjectHandler h in list)
|
|
||||||
{
|
|
||||||
if (h(objectCount, objectID, owner, m_scene, objectPosition) == false)
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,16 +330,181 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region TAKE OBJECT
|
||||||
|
public bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
|
||||||
|
{
|
||||||
|
TakeObjectHandler handler = OnTakeObject;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
if(sog == null || sp == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (TakeObjectHandler h in list)
|
||||||
|
{
|
||||||
|
if (h(sog, sp) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}",
|
||||||
|
// objectID, AvatarTakingUUID, result);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SELL GROUP OBJECT
|
||||||
|
public bool CanSellGroupObject(UUID userID, UUID groupID)
|
||||||
|
{
|
||||||
|
SellGroupObjectHandler handler = OnSellGroupObject;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (SellGroupObjectHandler h in list)
|
||||||
|
{
|
||||||
|
if (h(userID, groupID) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//m_log.DebugFormat(
|
||||||
|
// "[SCENE PERMISSIONS]: CanSellGroupObject() fired for user {0}, group {1}, result {2}",
|
||||||
|
// userID, groupID, result);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SELL OBJECT
|
||||||
|
public bool CanSellObject(IClientAPI client, SceneObjectGroup sog, byte saleType)
|
||||||
|
{
|
||||||
|
SellObjectHandler handler = OnSellObject;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
if(sog == null || client == null || client.SceneAgent == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ScenePresence sp = client.SceneAgent as ScenePresence;
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (SellObjectHandler h in list)
|
||||||
|
{
|
||||||
|
if (h(sog, sp, saleType) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanSellObject(UUID userID, SceneObjectGroup sog, byte saleType)
|
||||||
|
{
|
||||||
|
SellObjectHandlerByUserID handler = OnSellObjectByUserID;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
if(sog == null)
|
||||||
|
return false;
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (SellObjectHandlerByUserID h in list)
|
||||||
|
{
|
||||||
|
if (h(sog, userID, saleType) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region TAKE COPY OBJECT
|
||||||
|
public bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
|
||||||
|
{
|
||||||
|
TakeCopyObjectHandler handler = OnTakeCopyObject;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
if(sog == null || sp == null)
|
||||||
|
return false;
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (TakeCopyObjectHandler h in list)
|
||||||
|
{
|
||||||
|
if (h(sog, sp) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}",
|
||||||
|
// objectID, userID, result);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DUPLICATE OBJECT
|
||||||
|
public bool CanDuplicateObject(SceneObjectGroup sog, UUID agentID)
|
||||||
|
{
|
||||||
|
DuplicateObjectHandler handler = OnDuplicateObject;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
if(sog == null || sog.IsDeleted)
|
||||||
|
return false;
|
||||||
|
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
||||||
|
if(sp == null || sp.IsDeleted)
|
||||||
|
return false;
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (DuplicateObjectHandler h in list)
|
||||||
|
{
|
||||||
|
if (h(sog, sp) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region persence EDIT or MOVE OBJECT
|
||||||
|
private const uint CANSELECTMASK = (uint)(
|
||||||
|
PrimFlags.ObjectMove |
|
||||||
|
PrimFlags.ObjectModify |
|
||||||
|
PrimFlags.ObjectOwnerModify
|
||||||
|
);
|
||||||
|
|
||||||
|
public bool CanChangeSelectedState(SceneObjectPart part, ScenePresence sp)
|
||||||
|
{
|
||||||
|
uint perms = GenerateClientFlags(part, sp);
|
||||||
|
return (perms & CANSELECTMASK) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
#region EDIT OBJECT
|
#region EDIT OBJECT
|
||||||
public bool CanEditObject(UUID objectID, UUID editorID)
|
public bool CanEditObject(UUID objectID, UUID editorID)
|
||||||
|
{
|
||||||
|
EditObjectByIDsHandler handler = OnEditObjectByIDs;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (EditObjectByIDsHandler h in list)
|
||||||
|
{
|
||||||
|
if (h(objectID, editorID) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanEditObject(SceneObjectGroup sog, IClientAPI client)
|
||||||
{
|
{
|
||||||
EditObjectHandler handler = OnEditObject;
|
EditObjectHandler handler = OnEditObject;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
if(sog == null || client == null || client.SceneAgent == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ScenePresence sp = client.SceneAgent as ScenePresence;
|
||||||
|
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (EditObjectHandler h in list)
|
foreach (EditObjectHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(objectID, editorID, m_scene) == false)
|
if (h(sog, sp) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,7 +519,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (EditObjectInventoryHandler h in list)
|
foreach (EditObjectInventoryHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(objectID, editorID, m_scene) == false)
|
if (h(objectID, editorID) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -439,15 +529,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region MOVE OBJECT
|
#region MOVE OBJECT
|
||||||
public bool CanMoveObject(UUID objectID, UUID moverID)
|
public bool CanMoveObject(SceneObjectGroup sog, IClientAPI client)
|
||||||
{
|
{
|
||||||
MoveObjectHandler handler = OnMoveObject;
|
MoveObjectHandler handler = OnMoveObject;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
if(sog == null || client == null || client.SceneAgent == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ScenePresence sp = client.SceneAgent as ScenePresence;
|
||||||
|
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (MoveObjectHandler h in list)
|
foreach (MoveObjectHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(objectID, moverID, m_scene) == false)
|
if (h(sog, sp) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,7 +552,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region OBJECT ENTRY
|
#region OBJECT ENTRY
|
||||||
public bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint)
|
public bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
|
||||||
{
|
{
|
||||||
ObjectEntryHandler handler = OnObjectEntry;
|
ObjectEntryHandler handler = OnObjectEntry;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
|
@ -465,7 +560,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (ObjectEntryHandler h in list)
|
foreach (ObjectEntryHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(objectID, enteringRegion, newPoint, m_scene) == false)
|
if (h(sog, enteringRegion, newPoint) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject land)
|
||||||
|
{
|
||||||
|
ObjectEnterWithScriptsHandler handler = OnObjectEnterWithScripts;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (ObjectEnterWithScriptsHandler h in list)
|
||||||
|
{
|
||||||
|
if (h(sog, land) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -475,29 +585,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region RETURN OBJECT
|
#region RETURN OBJECT
|
||||||
public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects)
|
public bool CanReturnObjects(ILandObject land, IClientAPI client, List<SceneObjectGroup> objects)
|
||||||
{
|
{
|
||||||
bool result = true;
|
|
||||||
|
|
||||||
ReturnObjectsHandler handler = OnReturnObjects;
|
ReturnObjectsHandler handler = OnReturnObjects;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
if(objects == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ScenePresence sp = null;
|
||||||
|
if(client != null && client.SceneAgent != null)
|
||||||
|
sp = client.SceneAgent as ScenePresence;
|
||||||
|
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (ReturnObjectsHandler h in list)
|
foreach (ReturnObjectsHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(land, user, objects, m_scene) == false)
|
if (h(land, sp, objects) == false)
|
||||||
{
|
return false;
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}",
|
// "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}",
|
||||||
// user, objects.Count, land.LandData.Name, result);
|
// user, objects.Count, land.LandData.Name, result);
|
||||||
|
|
||||||
return result;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -511,7 +622,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (InstantMessageHandler h in list)
|
foreach (InstantMessageHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, target, m_scene) == false)
|
if (h(user, target) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -529,7 +640,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (InventoryTransferHandler h in list)
|
foreach (InventoryTransferHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, target, m_scene) == false)
|
if (h(user, target) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -547,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (ViewScriptHandler h in list)
|
foreach (ViewScriptHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(script, objectID, user, m_scene) == false)
|
if (h(script, objectID, user) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -562,7 +673,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (ViewNotecardHandler h in list)
|
foreach (ViewNotecardHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(script, objectID, user, m_scene) == false)
|
if (h(script, objectID, user) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -580,7 +691,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (EditScriptHandler h in list)
|
foreach (EditScriptHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(script, objectID, user, m_scene) == false)
|
if (h(script, objectID, user) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -595,7 +706,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (EditNotecardHandler h in list)
|
foreach (EditNotecardHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(script, objectID, user, m_scene) == false)
|
if (h(script, objectID, user) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -607,19 +718,37 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
#region RUN SCRIPT (When Script Placed in Object)
|
#region RUN SCRIPT (When Script Placed in Object)
|
||||||
public bool CanRunScript(UUID script, UUID objectID, UUID user)
|
public bool CanRunScript(UUID script, UUID objectID, UUID user)
|
||||||
{
|
{
|
||||||
RunScriptHandler handler = OnRunScript;
|
RunScriptHandlerByIDs handler = OnRunScriptByIDs;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (RunScriptHandler h in list)
|
foreach (RunScriptHandlerByIDs h in list)
|
||||||
{
|
{
|
||||||
if (h(script, objectID, user, m_scene) == false)
|
if (h(script, objectID, user) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanRunScript(TaskInventoryItem item, SceneObjectPart part)
|
||||||
|
{
|
||||||
|
RunScriptHandler handler = OnRunScript;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
if(item == null || part == null)
|
||||||
|
return false;
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (RunScriptHandler h in list)
|
||||||
|
{
|
||||||
|
if (h(item, part) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region COMPILE SCRIPT (When Script needs to get (re)compiled)
|
#region COMPILE SCRIPT (When Script needs to get (re)compiled)
|
||||||
|
@ -631,7 +760,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (CompileScriptHandler h in list)
|
foreach (CompileScriptHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(ownerUUID, scriptType, m_scene) == false)
|
if (h(ownerUUID, scriptType) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -649,7 +778,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (StartScriptHandler h in list)
|
foreach (StartScriptHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(script, user, m_scene) == false)
|
if (h(script, user) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -667,7 +796,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (StopScriptHandler h in list)
|
foreach (StopScriptHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(script, user, m_scene) == false)
|
if (h(script, user) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -685,7 +814,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (ResetScriptHandler h in list)
|
foreach (ResetScriptHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(prim, script, user, m_scene) == false)
|
if (h(prim, script, user) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -703,7 +832,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (TerraformLandHandler h in list)
|
foreach (TerraformLandHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, pos, m_scene) == false)
|
if (h(user, pos) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -721,7 +850,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (RunConsoleCommandHandler h in list)
|
foreach (RunConsoleCommandHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, m_scene) == false)
|
if (h(user) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -739,7 +868,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (IssueEstateCommandHandler h in list)
|
foreach (IssueEstateCommandHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, m_scene, ownerCommand) == false)
|
if (h(user, ownerCommand) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -750,13 +879,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
#region CAN BE GODLIKE
|
#region CAN BE GODLIKE
|
||||||
public bool IsGod(UUID user)
|
public bool IsGod(UUID user)
|
||||||
{
|
{
|
||||||
IsGodHandler handler = OnIsGod;
|
IsAdministratorHandler handler = OnIsAdministrator;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (IsGodHandler h in list)
|
foreach (IsAdministratorHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, m_scene) == false)
|
if (h(user) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -771,7 +900,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (IsGridGodHandler h in list)
|
foreach (IsGridGodHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, m_scene) == false)
|
if (h(user) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -819,7 +948,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (EditParcelPropertiesHandler h in list)
|
foreach (EditParcelPropertiesHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, parcel, p, m_scene, allowManager) == false)
|
if (h(user, parcel, p, allowManager) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -836,7 +965,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (SellParcelHandler h in list)
|
foreach (SellParcelHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, parcel, m_scene) == false)
|
if (h(user, parcel) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -853,7 +982,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (AbandonParcelHandler h in list)
|
foreach (AbandonParcelHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, parcel, m_scene) == false)
|
if (h(user, parcel) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -869,7 +998,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (ReclaimParcelHandler h in list)
|
foreach (ReclaimParcelHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, parcel, m_scene) == false)
|
if (h(user, parcel) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -884,22 +1013,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (DeedParcelHandler h in list)
|
foreach (DeedParcelHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, parcel, m_scene) == false)
|
if (h(user, parcel) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanDeedObject(UUID user, UUID group)
|
public bool CanDeedObject(IClientAPI client, SceneObjectGroup sog, UUID targetGroupID)
|
||||||
{
|
{
|
||||||
DeedObjectHandler handler = OnDeedObject;
|
DeedObjectHandler handler = OnDeedObject;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
if(sog == null || client == null || client.SceneAgent == null || targetGroupID == UUID.Zero)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ScenePresence sp = client.SceneAgent as ScenePresence;
|
||||||
|
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (DeedObjectHandler h in list)
|
foreach (DeedObjectHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, group, m_scene) == false)
|
if (h(sp, sog, targetGroupID) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -914,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (BuyLandHandler h in list)
|
foreach (BuyLandHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(user, parcel, m_scene) == false)
|
if (h(user, parcel) == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -990,6 +1124,45 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart)
|
||||||
|
{
|
||||||
|
DoObjectInvToObjectInv handler = OnDoObjectInvToObjectInv;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
if (sourcePart == null || destPart == null || item == null)
|
||||||
|
return false;
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (DoObjectInvToObjectInv h in list)
|
||||||
|
{
|
||||||
|
if (h(item, sourcePart, destPart) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanDropInObjectInv(InventoryItemBase item, IClientAPI client, SceneObjectPart destPart)
|
||||||
|
{
|
||||||
|
DoDropInObjectInv handler = OnDropInObjectInv;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
if (client == null || client.SceneAgent == null|| destPart == null || item == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ScenePresence sp = client.SceneAgent as ScenePresence;
|
||||||
|
if(sp == null || sp.IsDeleted)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Delegate[] list = handler.GetInvocationList();
|
||||||
|
foreach (DoDropInObjectInv h in list)
|
||||||
|
{
|
||||||
|
if (h(item, sp, destPart) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
|
public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
|
||||||
{
|
{
|
||||||
DeleteObjectInventoryHandler handler = OnDeleteObjectInventory;
|
DeleteObjectInventoryHandler handler = OnDeleteObjectInventory;
|
||||||
|
|
|
@ -540,6 +540,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private Timer m_mapGenerationTimer = new Timer();
|
private Timer m_mapGenerationTimer = new Timer();
|
||||||
private bool m_generateMaptiles;
|
private bool m_generateMaptiles;
|
||||||
|
|
||||||
|
protected int m_lastHealth = -1;
|
||||||
|
protected int m_lastUsers = -1;
|
||||||
|
|
||||||
#endregion Fields
|
#endregion Fields
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
@ -805,6 +808,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private float m_minReprioritizationDistance = 32f;
|
private float m_minReprioritizationDistance = 32f;
|
||||||
public bool ObjectsCullingByDistance = false;
|
public bool ObjectsCullingByDistance = false;
|
||||||
|
|
||||||
|
private ExpiringCache<UUID, UUID> TeleportTargetsCoolDown = new ExpiringCache<UUID, UUID>();
|
||||||
|
|
||||||
public AgentCircuitManager AuthenticateHandler
|
public AgentCircuitManager AuthenticateHandler
|
||||||
{
|
{
|
||||||
get { return m_authenticateHandler; }
|
get { return m_authenticateHandler; }
|
||||||
|
@ -1212,6 +1217,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
|
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
|
||||||
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
||||||
|
|
||||||
|
IConfig restartConfig = config.Configs["RestartModule"];
|
||||||
|
if (restartConfig != null)
|
||||||
|
{
|
||||||
|
string markerPath = restartConfig.GetString("MarkerPath", String.Empty);
|
||||||
|
|
||||||
|
if (markerPath != String.Empty)
|
||||||
|
{
|
||||||
|
string path = Path.Combine(markerPath, RegionInfo.RegionID.ToString() + ".started");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
|
||||||
|
FileStream fs = File.Create(path);
|
||||||
|
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
||||||
|
Byte[] buf = enc.GetBytes(pidstring);
|
||||||
|
fs.Write(buf, 0, buf.Length);
|
||||||
|
fs.Close();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StartTimerWatchdog();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Scene(RegionInfo regInfo)
|
public Scene(RegionInfo regInfo)
|
||||||
|
@ -1482,6 +1511,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IEtcdModule etcd = RequestModuleInterface<IEtcdModule>();
|
||||||
|
if (etcd != null)
|
||||||
|
{
|
||||||
|
etcd.Delete("Health");
|
||||||
|
etcd.Delete("HealthFlags");
|
||||||
|
etcd.Delete("RootAgents");
|
||||||
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
|
m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1520,6 +1557,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_log.Debug("[SCENE]: Persisting changed objects");
|
m_log.Debug("[SCENE]: Persisting changed objects");
|
||||||
Backup(true);
|
Backup(true);
|
||||||
|
|
||||||
|
m_log.Debug("[SCENE]: Closing scene");
|
||||||
|
|
||||||
m_sceneGraph.Close();
|
m_sceneGraph.Close();
|
||||||
|
|
||||||
base.Close();
|
base.Close();
|
||||||
|
@ -2351,6 +2390,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
EventManager.TriggerOnSceneObjectLoaded(group);
|
EventManager.TriggerOnSceneObjectLoaded(group);
|
||||||
SceneObjectPart rootPart = group.GetPart(group.UUID);
|
SceneObjectPart rootPart = group.GetPart(group.UUID);
|
||||||
rootPart.Flags &= ~PrimFlags.Scripted;
|
rootPart.Flags &= ~PrimFlags.Scripted;
|
||||||
|
group.AggregateDeepPerms();
|
||||||
rootPart.TrimPermissions();
|
rootPart.TrimPermissions();
|
||||||
|
|
||||||
// Don't do this here - it will get done later on when sculpt data is loaded.
|
// Don't do this here - it will get done later on when sculpt data is loaded.
|
||||||
|
@ -2603,8 +2643,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
// Otherwise, use this default creation code;
|
// Otherwise, use this default creation code;
|
||||||
sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
|
sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
|
||||||
AddNewSceneObject(sceneObject, true);
|
|
||||||
sceneObject.SetGroup(groupID, null);
|
sceneObject.SetGroup(groupID, null);
|
||||||
|
AddNewSceneObject(sceneObject, true);
|
||||||
|
|
||||||
if (AgentPreferencesService != null) // This will override the brave new full perm world!
|
if (AgentPreferencesService != null) // This will override the brave new full perm world!
|
||||||
{
|
{
|
||||||
|
@ -2622,6 +2662,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (UserManagementModule != null)
|
if (UserManagementModule != null)
|
||||||
sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID);
|
sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID);
|
||||||
|
|
||||||
|
sceneObject.AggregateDeepPerms();
|
||||||
sceneObject.ScheduleGroupForFullUpdate();
|
sceneObject.ScheduleGroupForFullUpdate();
|
||||||
|
|
||||||
return sceneObject;
|
return sceneObject;
|
||||||
|
@ -2768,7 +2809,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup sog = (SceneObjectGroup)e;
|
SceneObjectGroup sog = (SceneObjectGroup)e;
|
||||||
if (sog != null && !sog.IsAttachment)
|
if (sog != null && !sog.IsAttachment)
|
||||||
{
|
{
|
||||||
if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0))
|
if (!exceptNoCopy || ((sog.EffectiveOwnerPerms & (uint)PermissionMask.Copy) != 0))
|
||||||
{
|
{
|
||||||
DeleteSceneObject((SceneObjectGroup)e, false);
|
DeleteSceneObject((SceneObjectGroup)e, false);
|
||||||
}
|
}
|
||||||
|
@ -2782,7 +2823,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
if (toReturn.Count > 0)
|
if (toReturn.Count > 0)
|
||||||
{
|
{
|
||||||
returnObjects(toReturn.ToArray(), UUID.Zero);
|
returnObjects(toReturn.ToArray(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2944,15 +2985,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Return 'true' if position inside region.
|
// Return 'true' if position inside region.
|
||||||
public bool PositionIsInCurrentRegion(Vector3 pos)
|
public bool PositionIsInCurrentRegion(Vector3 pos)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
float t = pos.X;
|
||||||
int xx = (int)Math.Floor(pos.X);
|
if (t < 0 || t >= RegionInfo.RegionSizeX)
|
||||||
int yy = (int)Math.Floor(pos.Y);
|
|
||||||
if (xx < 0 || yy < 0)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY )
|
t = pos.Y;
|
||||||
ret = true;
|
if (t < 0 || t >= RegionInfo.RegionSizeY)
|
||||||
return ret;
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -3603,7 +3644,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="GroupID">Group of new object</param>
|
/// <param name="GroupID">Group of new object</param>
|
||||||
public void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID)
|
public void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID)
|
||||||
{
|
{
|
||||||
SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity);
|
bool createSelected = (flags & (uint)PrimFlags.CreateSelected) != 0;
|
||||||
|
SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, AgentID,
|
||||||
|
GroupID, Quaternion.Identity, createSelected);
|
||||||
if (copy != null)
|
if (copy != null)
|
||||||
EventManager.TriggerObjectAddedToScene(copy);
|
EventManager.TriggerObjectAddedToScene(copy);
|
||||||
}
|
}
|
||||||
|
@ -3633,6 +3676,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectPart target = GetSceneObjectPart(localID);
|
SceneObjectPart target = GetSceneObjectPart(localID);
|
||||||
SceneObjectPart target2 = GetSceneObjectPart(RayTargetObj);
|
SceneObjectPart target2 = GetSceneObjectPart(RayTargetObj);
|
||||||
|
|
||||||
|
bool createSelected = (dupeFlags & (uint)PrimFlags.CreateSelected) != 0;
|
||||||
|
|
||||||
if (target != null && target2 != null)
|
if (target != null && target2 != null)
|
||||||
{
|
{
|
||||||
Vector3 direction = Vector3.Normalize(RayEnd - RayStart);
|
Vector3 direction = Vector3.Normalize(RayEnd - RayStart);
|
||||||
|
@ -3674,13 +3719,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Quaternion worldRot = target2.GetWorldRotation();
|
Quaternion worldRot = target2.GetWorldRotation();
|
||||||
|
|
||||||
// SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
|
// SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
|
||||||
copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
|
copy = m_sceneGraph.DuplicateObject(localID, pos, AgentID, GroupID, worldRot, createSelected);
|
||||||
//obj.Rotation = worldRot;
|
//obj.Rotation = worldRot;
|
||||||
//obj.UpdateGroupRotationR(worldRot);
|
//obj.UpdateGroupRotationR(worldRot);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity);
|
copy = m_sceneGraph.DuplicateObject(localID, pos, AgentID, GroupID, Quaternion.Identity, createSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copy != null)
|
if (copy != null)
|
||||||
|
@ -3983,7 +4028,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (!LoginsEnabled)
|
if (!LoginsEnabled)
|
||||||
{
|
{
|
||||||
reason = "Logins Disabled";
|
reason = "Logins to this region are disabled";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5077,65 +5122,59 @@ Label_GroupsDone:
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Script Engine
|
#region Script Engine
|
||||||
|
public bool LSLScriptDanger(SceneObjectPart part, Vector3 pos)
|
||||||
|
{
|
||||||
|
|
||||||
|
ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
|
||||||
|
if (parcel == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
LandData ldata = parcel.LandData;
|
||||||
|
if (ldata == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
uint landflags = ldata.Flags;
|
||||||
|
|
||||||
|
uint mask = (uint)(ParcelFlags.CreateObjects | ParcelFlags.AllowAPrimitiveEntry);
|
||||||
|
if((landflags & mask) != mask)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if((landflags & (uint)ParcelFlags.AllowOtherScripts) != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(part == null)
|
||||||
|
return true;
|
||||||
|
if(part.GroupID == ldata.GroupID && (landflags & (uint)ParcelFlags.AllowGroupScripts) != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private bool ScriptDanger(SceneObjectPart part, Vector3 pos)
|
private bool ScriptDanger(SceneObjectPart part, Vector3 pos)
|
||||||
{
|
{
|
||||||
|
if (part == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
|
ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
|
||||||
if (part != null)
|
if (parcel != null)
|
||||||
{
|
{
|
||||||
if (parcel != null)
|
if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0)
|
||||||
{
|
return true;
|
||||||
if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0)
|
|
||||||
&& (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY)
|
if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID))
|
||||||
{
|
return true;
|
||||||
// The only time parcel != null when an object is inside a region is when
|
|
||||||
// there is nothing behind the landchannel. IE, no land plugin loaded.
|
if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0)
|
||||||
return true;
|
&& (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID))
|
||||||
}
|
return true;
|
||||||
else
|
|
||||||
{
|
|
||||||
// The object is outside of this region. Stop piping events to it.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public bool ScriptDanger(uint localID, Vector3 pos)
|
return false;
|
||||||
{
|
|
||||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
|
||||||
if (part != null)
|
|
||||||
{
|
|
||||||
return ScriptDanger(part, pos);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PipeEventsForScript(uint localID)
|
public bool PipeEventsForScript(uint localID)
|
||||||
|
@ -5512,23 +5551,24 @@ Label_GroupsDone:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000)
|
if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 2000)
|
||||||
{
|
{
|
||||||
health+=1;
|
health+=1;
|
||||||
flags |= 1;
|
flags |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000)
|
if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 2000)
|
||||||
{
|
{
|
||||||
health+=1;
|
health+=1;
|
||||||
flags |= 2;
|
flags |= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000)
|
if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 2000)
|
||||||
{
|
{
|
||||||
health+=1;
|
health+=1;
|
||||||
flags |= 4;
|
flags |= 4;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int pid = System.Diagnostics.Process.GetCurrentProcess().Id;
|
int pid = System.Diagnostics.Process.GetCurrentProcess().Id;
|
||||||
|
@ -5541,6 +5581,7 @@ proc.WaitForExit();
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (flags != 7)
|
if (flags != 7)
|
||||||
return health;
|
return health;
|
||||||
|
@ -6305,6 +6346,32 @@ Environment.Exit(1);
|
||||||
public void TimerWatchdog(object sender, ElapsedEventArgs e)
|
public void TimerWatchdog(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
CheckHeartbeat();
|
CheckHeartbeat();
|
||||||
|
|
||||||
|
IEtcdModule etcd = RequestModuleInterface<IEtcdModule>();
|
||||||
|
int flags;
|
||||||
|
string message;
|
||||||
|
if (etcd != null)
|
||||||
|
{
|
||||||
|
int health = GetHealth(out flags, out message);
|
||||||
|
if (health != m_lastHealth)
|
||||||
|
{
|
||||||
|
m_lastHealth = health;
|
||||||
|
|
||||||
|
etcd.Store("Health", health.ToString(), 300000);
|
||||||
|
etcd.Store("HealthFlags", flags.ToString(), 300000);
|
||||||
|
}
|
||||||
|
|
||||||
|
int roots = 0;
|
||||||
|
foreach (ScenePresence sp in GetScenePresences())
|
||||||
|
if (!sp.IsChildAgent && !sp.IsNPC)
|
||||||
|
roots++;
|
||||||
|
|
||||||
|
if (m_lastUsers != roots)
|
||||||
|
{
|
||||||
|
m_lastUsers = roots;
|
||||||
|
etcd.Store("RootAgents", roots.ToString(), 300000);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This method deals with movement when an avatar is automatically moving (but this is distinct from the
|
/// This method deals with movement when an avatar is automatically moving (but this is distinct from the
|
||||||
|
@ -6461,5 +6528,21 @@ Environment.Exit(1);
|
||||||
|
|
||||||
m_eventManager.TriggerExtraSettingChanged(this, name, String.Empty);
|
m_eventManager.TriggerExtraSettingChanged(this, name, String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool InTeleportTargetsCoolDown(UUID sourceID, UUID targetID, double timeout)
|
||||||
|
{
|
||||||
|
lock(TeleportTargetsCoolDown)
|
||||||
|
{
|
||||||
|
UUID lastSource = UUID.Zero;
|
||||||
|
TeleportTargetsCoolDown.TryGetValue(targetID, out lastSource);
|
||||||
|
if(lastSource == UUID.Zero)
|
||||||
|
{
|
||||||
|
TeleportTargetsCoolDown.Add(targetID, sourceID, timeout);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
TeleportTargetsCoolDown.AddOrUpdate(targetID, sourceID, timeout);
|
||||||
|
return lastSource == sourceID;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,7 +343,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
sceneObject.ForceInventoryPersistence();
|
sceneObject.ForceInventoryPersistence();
|
||||||
sceneObject.HasGroupChanged = true;
|
sceneObject.HasGroupChanged = true;
|
||||||
}
|
}
|
||||||
|
sceneObject.AggregateDeepPerms();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,6 +549,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// that are part of the Scene Object being removed
|
// that are part of the Scene Object being removed
|
||||||
m_numTotalPrim -= grp.PrimCount;
|
m_numTotalPrim -= grp.PrimCount;
|
||||||
|
|
||||||
|
bool isPh = (grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics;
|
||||||
|
int nphysparts = 0;
|
||||||
// Go through all parts (primitives and meshes) of this Scene Object
|
// Go through all parts (primitives and meshes) of this Scene Object
|
||||||
foreach (SceneObjectPart part in grp.Parts)
|
foreach (SceneObjectPart part in grp.Parts)
|
||||||
{
|
{
|
||||||
|
@ -559,10 +561,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_numMesh--;
|
m_numMesh--;
|
||||||
else
|
else
|
||||||
m_numPrim--;
|
m_numPrim--;
|
||||||
|
|
||||||
|
if(isPh && part.PhysicsShapeType != (byte)PhysShapeType.none)
|
||||||
|
nphysparts++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
|
if (nphysparts > 0 )
|
||||||
RemovePhysicalPrim(grp.PrimCount);
|
RemovePhysicalPrim(nphysparts);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ret = Entities.Remove(uuid);
|
bool ret = Entities.Remove(uuid);
|
||||||
|
@ -1358,7 +1363,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup grp = part.ParentGroup;
|
SceneObjectGroup grp = part.ParentGroup;
|
||||||
if (grp != null)
|
if (grp != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanEditObject(grp, remoteClient))
|
||||||
{
|
{
|
||||||
// These two are exceptions SL makes in the interpretation
|
// These two are exceptions SL makes in the interpretation
|
||||||
// of the change flags. Must check them here because otherwise
|
// of the change flags. Must check them here because otherwise
|
||||||
|
@ -1379,7 +1384,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0)
|
if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0)
|
||||||
{
|
{
|
||||||
// Are we allowed to move it?
|
// Are we allowed to move it?
|
||||||
if (m_parentScene.Permissions.CanMoveObject(grp.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanMoveObject(grp, remoteClient))
|
||||||
{
|
{
|
||||||
// Strip all but move and rotation from request
|
// Strip all but move and rotation from request
|
||||||
data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation);
|
data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation);
|
||||||
|
@ -1406,7 +1411,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanEditObject(part.ParentGroup, remoteClient))
|
||||||
{
|
{
|
||||||
bool physbuild = false;
|
bool physbuild = false;
|
||||||
if (part.ParentGroup.RootPart.PhysActor != null)
|
if (part.ParentGroup.RootPart.PhysActor != null)
|
||||||
|
@ -1428,7 +1433,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(localID);
|
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
bool physbuild = false;
|
bool physbuild = false;
|
||||||
if (group.RootPart.PhysActor != null)
|
if (group.RootPart.PhysActor != null)
|
||||||
|
@ -1474,7 +1479,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(localID);
|
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
group.UpdateSingleRotation(rot, localID);
|
group.UpdateSingleRotation(rot, localID);
|
||||||
}
|
}
|
||||||
|
@ -1492,7 +1497,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(localID);
|
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
group.UpdateSingleRotation(rot, pos, localID);
|
group.UpdateSingleRotation(rot, pos, localID);
|
||||||
}
|
}
|
||||||
|
@ -1510,7 +1515,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(localID);
|
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
group.UpdateGroupRotationR(rot);
|
group.UpdateGroupRotationR(rot);
|
||||||
}
|
}
|
||||||
|
@ -1529,7 +1534,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(localID);
|
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
group.UpdateGroupRotationPR(pos, rot);
|
group.UpdateGroupRotationPR(pos, rot);
|
||||||
}
|
}
|
||||||
|
@ -1547,7 +1552,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(localID);
|
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) || group.IsAttachment)
|
if (m_parentScene.Permissions.CanMoveObject(group, remoteClient) || group.IsAttachment)
|
||||||
{
|
{
|
||||||
group.UpdateSinglePosition(pos, localID);
|
group.UpdateSinglePosition(pos, localID);
|
||||||
}
|
}
|
||||||
|
@ -1561,17 +1566,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient)
|
public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient)
|
||||||
{
|
|
||||||
UpdatePrimGroupPosition(localId, pos, remoteClient.AgentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Update the position of the given group.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="localId"></param>
|
|
||||||
/// <param name="pos"></param>
|
|
||||||
/// <param name="updatingAgentId"></param>
|
|
||||||
public void UpdatePrimGroupPosition(uint localId, Vector3 pos, UUID updatingAgentId)
|
|
||||||
{
|
{
|
||||||
SceneObjectGroup group = GetGroupByPrim(localId);
|
SceneObjectGroup group = GetGroupByPrim(localId);
|
||||||
|
|
||||||
|
@ -1580,7 +1574,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
|
if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
|
||||||
{
|
{
|
||||||
// Set the new attachment point data in the object
|
// Set the new attachment point data in the object
|
||||||
byte attachmentPoint = group.GetAttachmentPoint();
|
byte attachmentPoint = (byte)group.AttachmentPoint;
|
||||||
group.UpdateGroupPosition(pos);
|
group.UpdateGroupPosition(pos);
|
||||||
group.IsAttachment = false;
|
group.IsAttachment = false;
|
||||||
group.AbsolutePosition = group.RootPart.AttachedPos;
|
group.AbsolutePosition = group.RootPart.AttachedPos;
|
||||||
|
@ -1589,8 +1583,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanMoveObject(group.UUID, updatingAgentId)
|
if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)
|
||||||
&& m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
|
&& m_parentScene.Permissions.CanObjectEntry(group, false, pos))
|
||||||
{
|
{
|
||||||
group.UpdateGroupPosition(pos);
|
group.UpdateGroupPosition(pos);
|
||||||
}
|
}
|
||||||
|
@ -1614,7 +1608,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
group.UpdateTextureEntry(localID, texture);
|
group.UpdateTextureEntry(localID, texture);
|
||||||
}
|
}
|
||||||
|
@ -1638,7 +1632,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(localID);
|
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
// 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
|
||||||
// now only change volume dtc if phantom off
|
// now only change volume dtc if phantom off
|
||||||
|
@ -1685,7 +1679,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
group.SetPartName(Util.CleanString(name), primLocalID);
|
group.SetPartName(Util.CleanString(name), primLocalID);
|
||||||
group.HasGroupChanged = true;
|
group.HasGroupChanged = true;
|
||||||
|
@ -1703,7 +1697,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
group.SetPartDescription(Util.CleanString(description), primLocalID);
|
group.SetPartDescription(Util.CleanString(description), primLocalID);
|
||||||
group.HasGroupChanged = true;
|
group.HasGroupChanged = true;
|
||||||
|
@ -1725,7 +1719,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
|
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
|
@ -1742,7 +1736,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
|
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
|
@ -1996,6 +1990,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
newRoot.TriggerScriptChangedEvent(Changed.LINK);
|
newRoot.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
newRoot.ParentGroup.HasGroupChanged = true;
|
newRoot.ParentGroup.HasGroupChanged = true;
|
||||||
|
newRoot.ParentGroup.InvalidatePartsLinkMaps();
|
||||||
newRoot.ParentGroup.ScheduleGroupForFullUpdate();
|
newRoot.ParentGroup.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2012,6 +2007,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// from the database. They will be rewritten immediately,
|
// from the database. They will be rewritten immediately,
|
||||||
// minus the rows for the unlinked child prims.
|
// minus the rows for the unlinked child prims.
|
||||||
m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID);
|
m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID);
|
||||||
|
g.InvalidatePartsLinkMaps();
|
||||||
g.TriggerScriptChangedEvent(Changed.LINK);
|
g.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
g.HasGroupChanged = true; // Persist
|
g.HasGroupChanged = true; // Persist
|
||||||
g.ScheduleGroupForFullUpdate();
|
g.ScheduleGroupForFullUpdate();
|
||||||
|
@ -2025,27 +2021,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID)
|
protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID)
|
||||||
{
|
{
|
||||||
UUID user = remoteClient.AgentId;
|
SceneObjectGroup sog = GetGroupByPrim(localID);
|
||||||
UUID objid = UUID.Zero;
|
if(sog == null)
|
||||||
SceneObjectPart obj = null;
|
return;
|
||||||
|
|
||||||
EntityBase[] entityList = GetEntities();
|
|
||||||
foreach (EntityBase ent in entityList)
|
|
||||||
{
|
|
||||||
if (ent is SceneObjectGroup)
|
|
||||||
{
|
|
||||||
SceneObjectGroup sog = ent as SceneObjectGroup;
|
|
||||||
|
|
||||||
foreach (SceneObjectPart part in sog.Parts)
|
|
||||||
{
|
|
||||||
if (part.LocalId == localID)
|
|
||||||
{
|
|
||||||
objid = part.UUID;
|
|
||||||
obj = part;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints
|
//Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints
|
||||||
//aka ObjectFlags.JointWheel = IncludeInSearch
|
//aka ObjectFlags.JointWheel = IncludeInSearch
|
||||||
|
@ -2062,15 +2040,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// libomv will complain about PrimFlags.JointWheel being
|
// libomv will complain about PrimFlags.JointWheel being
|
||||||
// deprecated, so we
|
// deprecated, so we
|
||||||
#pragma warning disable 0612
|
#pragma warning disable 0612
|
||||||
if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(objid, user))
|
if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog, remoteClient))
|
||||||
{
|
{
|
||||||
obj.ParentGroup.RootPart.AddFlag(PrimFlags.JointWheel);
|
sog.RootPart.AddFlag(PrimFlags.JointWheel);
|
||||||
obj.ParentGroup.HasGroupChanged = true;
|
sog.HasGroupChanged = true;
|
||||||
}
|
}
|
||||||
else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(objid,user))
|
else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(sog, remoteClient))
|
||||||
{
|
{
|
||||||
obj.ParentGroup.RootPart.RemFlag(PrimFlags.JointWheel);
|
sog.RootPart.RemFlag(PrimFlags.JointWheel);
|
||||||
obj.ParentGroup.HasGroupChanged = true;
|
sog.HasGroupChanged = true;
|
||||||
}
|
}
|
||||||
#pragma warning restore 0612
|
#pragma warning restore 0612
|
||||||
}
|
}
|
||||||
|
@ -2086,7 +2064,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="rot"></param>
|
/// <param name="rot"></param>
|
||||||
/// <returns>null if duplication fails, otherwise the duplicated object</returns>
|
/// <returns>null if duplication fails, otherwise the duplicated object</returns>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
|
public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, UUID AgentID, UUID GroupID, Quaternion rot, bool createSelected)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
|
// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
|
||||||
|
@ -2095,27 +2073,28 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
|
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
|
||||||
if (original != null)
|
if (original != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanDuplicateObject(
|
if (m_parentScene.Permissions.CanDuplicateObject(original, AgentID))
|
||||||
original.PrimCount, original.UUID, AgentID, original.AbsolutePosition))
|
|
||||||
{
|
{
|
||||||
SceneObjectGroup copy = original.Copy(true);
|
SceneObjectGroup copy = original.Copy(true);
|
||||||
copy.AbsolutePosition = copy.AbsolutePosition + offset;
|
copy.AbsolutePosition = copy.AbsolutePosition + offset;
|
||||||
|
|
||||||
|
SceneObjectPart[] parts = copy.Parts;
|
||||||
|
|
||||||
|
m_numTotalPrim += parts.Length;
|
||||||
|
|
||||||
if (original.OwnerID != AgentID)
|
if (original.OwnerID != AgentID)
|
||||||
{
|
{
|
||||||
copy.SetOwnerId(AgentID);
|
copy.SetOwner(AgentID, GroupID);
|
||||||
copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID);
|
|
||||||
|
|
||||||
SceneObjectPart[] partList = copy.Parts;
|
|
||||||
|
|
||||||
if (m_parentScene.Permissions.PropagatePermissions())
|
if (m_parentScene.Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart child in partList)
|
foreach (SceneObjectPart child in parts)
|
||||||
{
|
{
|
||||||
child.Inventory.ChangeInventoryOwner(AgentID);
|
child.Inventory.ChangeInventoryOwner(AgentID);
|
||||||
child.TriggerScriptChangedEvent(Changed.OWNER);
|
child.TriggerScriptChangedEvent(Changed.OWNER);
|
||||||
child.ApplyNextOwnerPermissions();
|
child.ApplyNextOwnerPermissions();
|
||||||
}
|
}
|
||||||
|
copy.AggregatePerms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2125,10 +2104,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
lock (SceneObjectGroupsByFullID)
|
lock (SceneObjectGroupsByFullID)
|
||||||
SceneObjectGroupsByFullID[copy.UUID] = copy;
|
SceneObjectGroupsByFullID[copy.UUID] = copy;
|
||||||
|
|
||||||
SceneObjectPart[] parts = copy.Parts;
|
|
||||||
|
|
||||||
m_numTotalPrim += parts.Length;
|
|
||||||
|
|
||||||
foreach (SceneObjectPart part in parts)
|
foreach (SceneObjectPart part in parts)
|
||||||
{
|
{
|
||||||
if (part.GetPrimType() == PrimType.SCULPT)
|
if (part.GetPrimType() == PrimType.SCULPT)
|
||||||
|
@ -2144,28 +2119,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// PROBABLE END OF FIXME
|
// PROBABLE END OF FIXME
|
||||||
|
|
||||||
// Since we copy from a source group that is in selected
|
copy.IsSelected = createSelected;
|
||||||
// state, but the copy is shown deselected in the viewer,
|
|
||||||
// We need to clear the selection flag here, else that
|
|
||||||
// prim never gets persisted at all. The client doesn't
|
|
||||||
// think it's selected, so it will never send a deselect...
|
|
||||||
copy.IsSelected = false;
|
|
||||||
|
|
||||||
m_numPrim += copy.Parts.Length;
|
|
||||||
|
|
||||||
if (rot != Quaternion.Identity)
|
if (rot != Quaternion.Identity)
|
||||||
{
|
|
||||||
copy.UpdateGroupRotationR(rot);
|
copy.UpdateGroupRotationR(rot);
|
||||||
}
|
|
||||||
|
|
||||||
copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1);
|
|
||||||
copy.HasGroupChanged = true;
|
|
||||||
copy.ScheduleGroupForFullUpdate();
|
|
||||||
copy.ResumeScripts();
|
|
||||||
|
|
||||||
// required for physics to update it's position
|
// required for physics to update it's position
|
||||||
copy.AbsolutePosition = copy.AbsolutePosition;
|
copy.ResetChildPrimPhysicsPositions();
|
||||||
|
|
||||||
|
copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1);
|
||||||
|
copy.ResumeScripts();
|
||||||
|
|
||||||
|
copy.HasGroupChanged = true;
|
||||||
|
copy.ScheduleGroupForFullUpdate();
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="item">The user inventory item being added.</param>
|
/// <param name="item">The user inventory item being added.</param>
|
||||||
/// <param name="copyItemID">The item UUID that should be used by the new item.</param>
|
/// <param name="copyItemID">The item UUID that should be used by the new item.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID)
|
public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID, bool withModRights = true)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}",
|
// "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}",
|
||||||
|
@ -120,69 +120,72 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID;
|
UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID;
|
||||||
|
|
||||||
SceneObjectPart part = GetPart(localID);
|
SceneObjectPart part = GetPart(localID);
|
||||||
if (part != null)
|
if (part == null)
|
||||||
{
|
|
||||||
TaskInventoryItem taskItem = new TaskInventoryItem();
|
|
||||||
|
|
||||||
taskItem.ItemID = newItemId;
|
|
||||||
taskItem.AssetID = item.AssetID;
|
|
||||||
taskItem.Name = item.Name;
|
|
||||||
taskItem.Description = item.Description;
|
|
||||||
taskItem.OwnerID = part.OwnerID; // Transfer ownership
|
|
||||||
taskItem.CreatorID = item.CreatorIdAsUuid;
|
|
||||||
taskItem.Type = item.AssetType;
|
|
||||||
taskItem.InvType = item.InvType;
|
|
||||||
|
|
||||||
if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions())
|
|
||||||
{
|
|
||||||
taskItem.BasePermissions = item.BasePermissions &
|
|
||||||
item.NextPermissions;
|
|
||||||
taskItem.CurrentPermissions = item.CurrentPermissions &
|
|
||||||
item.NextPermissions;
|
|
||||||
taskItem.EveryonePermissions = item.EveryOnePermissions &
|
|
||||||
item.NextPermissions;
|
|
||||||
taskItem.GroupPermissions = item.GroupPermissions &
|
|
||||||
item.NextPermissions;
|
|
||||||
taskItem.NextPermissions = item.NextPermissions;
|
|
||||||
// We're adding this to a prim we don't own. Force
|
|
||||||
// owner change
|
|
||||||
taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
taskItem.BasePermissions = item.BasePermissions;
|
|
||||||
taskItem.CurrentPermissions = item.CurrentPermissions;
|
|
||||||
taskItem.EveryonePermissions = item.EveryOnePermissions;
|
|
||||||
taskItem.GroupPermissions = item.GroupPermissions;
|
|
||||||
taskItem.NextPermissions = item.NextPermissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
taskItem.Flags = item.Flags;
|
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[PRIM INVENTORY]: Flags are 0x{0:X} for item {1} added to part {2} by {3}",
|
|
||||||
// taskItem.Flags, taskItem.Name, localID, remoteClient.Name);
|
|
||||||
|
|
||||||
// TODO: These are pending addition of those fields to TaskInventoryItem
|
|
||||||
// taskItem.SalePrice = item.SalePrice;
|
|
||||||
// taskItem.SaleType = item.SaleType;
|
|
||||||
taskItem.CreationDate = (uint)item.CreationDate;
|
|
||||||
|
|
||||||
bool addFromAllowedDrop = agentID != part.OwnerID;
|
|
||||||
|
|
||||||
part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[PRIM INVENTORY]: " +
|
"[PRIM INVENTORY]: " +
|
||||||
"Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}",
|
"Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}",
|
||||||
localID, Name, UUID, newItemId);
|
localID, Name, UUID, newItemId);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
TaskInventoryItem taskItem = new TaskInventoryItem();
|
||||||
|
|
||||||
|
taskItem.ItemID = newItemId;
|
||||||
|
taskItem.AssetID = item.AssetID;
|
||||||
|
taskItem.Name = item.Name;
|
||||||
|
taskItem.Description = item.Description;
|
||||||
|
taskItem.OwnerID = part.OwnerID; // Transfer ownership
|
||||||
|
taskItem.CreatorID = item.CreatorIdAsUuid;
|
||||||
|
taskItem.Type = item.AssetType;
|
||||||
|
taskItem.InvType = item.InvType;
|
||||||
|
|
||||||
|
if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions())
|
||||||
|
{
|
||||||
|
taskItem.BasePermissions = item.BasePermissions &
|
||||||
|
item.NextPermissions;
|
||||||
|
taskItem.CurrentPermissions = item.CurrentPermissions &
|
||||||
|
item.NextPermissions;
|
||||||
|
taskItem.EveryonePermissions = item.EveryOnePermissions &
|
||||||
|
item.NextPermissions;
|
||||||
|
taskItem.GroupPermissions = item.GroupPermissions &
|
||||||
|
item.NextPermissions;
|
||||||
|
taskItem.NextPermissions = item.NextPermissions;
|
||||||
|
// We're adding this to a prim we don't own. Force
|
||||||
|
// owner change
|
||||||
|
taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
taskItem.BasePermissions = item.BasePermissions;
|
||||||
|
taskItem.CurrentPermissions = item.CurrentPermissions;
|
||||||
|
taskItem.EveryonePermissions = item.EveryOnePermissions;
|
||||||
|
taskItem.GroupPermissions = item.GroupPermissions;
|
||||||
|
taskItem.NextPermissions = item.NextPermissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
taskItem.Flags = item.Flags;
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM INVENTORY]: Flags are 0x{0:X} for item {1} added to part {2} by {3}",
|
||||||
|
// taskItem.Flags, taskItem.Name, localID, remoteClient.Name);
|
||||||
|
|
||||||
|
// TODO: These are pending addition of those fields to TaskInventoryItem
|
||||||
|
// taskItem.SalePrice = item.SalePrice;
|
||||||
|
// taskItem.SaleType = item.SaleType;
|
||||||
|
taskItem.CreationDate = (uint)item.CreationDate;
|
||||||
|
|
||||||
|
bool addFromAllowedDrop;
|
||||||
|
if(withModRights)
|
||||||
|
addFromAllowedDrop = false;
|
||||||
|
else
|
||||||
|
addFromAllowedDrop = (part.ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0;
|
||||||
|
|
||||||
|
part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
|
||||||
|
part.ParentGroup.AggregatePerms();
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -248,6 +251,194 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// new test code, to place in better place later
|
||||||
|
private object PermissionsLock = new object();
|
||||||
|
|
||||||
|
private uint m_EffectiveEveryOnePerms;
|
||||||
|
public uint EffectiveEveryOnePerms
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
||||||
|
// bc this is on heavy duty code paths
|
||||||
|
// but for now we need to test the concept
|
||||||
|
// AggregateDeepPerms();
|
||||||
|
return m_EffectiveEveryOnePerms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private uint m_EffectiveGroupPerms;
|
||||||
|
public uint EffectiveGroupPerms
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
||||||
|
// bc this is on heavy duty code paths
|
||||||
|
// but for now we need to test the concept
|
||||||
|
// AggregateDeepPerms();
|
||||||
|
return m_EffectiveGroupPerms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private uint m_EffectiveGroupOrEveryOnePerms;
|
||||||
|
public uint EffectiveGroupOrEveryOnePerms
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
||||||
|
// bc this is on heavy duty code paths
|
||||||
|
// but for now we need to test the concept
|
||||||
|
// AggregateDeepPerms();
|
||||||
|
return m_EffectiveGroupOrEveryOnePerms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private uint m_EffectiveOwnerPerms;
|
||||||
|
public uint EffectiveOwnerPerms
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
||||||
|
// bc this is on heavy duty code paths
|
||||||
|
// but for now we need to test the concept
|
||||||
|
// AggregateDeepPerms();
|
||||||
|
return m_EffectiveOwnerPerms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// aggregates perms scanning parts and their contents
|
||||||
|
// AggregatePerms does same using cached parts content perms
|
||||||
|
public void AggregateDeepPerms()
|
||||||
|
{
|
||||||
|
lock(PermissionsLock)
|
||||||
|
{
|
||||||
|
// aux
|
||||||
|
const uint allmask = (uint)PermissionMask.AllEffective;
|
||||||
|
const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
|
||||||
|
const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
|
||||||
|
|
||||||
|
uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
|
||||||
|
bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
|
||||||
|
|
||||||
|
uint rootOwnerPerms = RootPart.OwnerMask;
|
||||||
|
uint owner = rootOwnerPerms;
|
||||||
|
uint rootGroupPerms = RootPart.GroupMask;
|
||||||
|
uint group = rootGroupPerms;
|
||||||
|
uint rootEveryonePerms = RootPart.EveryoneMask;
|
||||||
|
uint everyone = rootEveryonePerms;
|
||||||
|
|
||||||
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
|
for (int i = 0; i < parts.Length; i++)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = parts[i];
|
||||||
|
part.AggregateInnerPerms();
|
||||||
|
owner &= part.AggregatedInnerOwnerPerms;
|
||||||
|
group &= part.AggregatedInnerGroupPerms;
|
||||||
|
everyone &= part.AggregatedInnerEveryonePerms;
|
||||||
|
}
|
||||||
|
// recover modify and move
|
||||||
|
rootOwnerPerms &= movemodmask;
|
||||||
|
owner |= rootOwnerPerms;
|
||||||
|
if((owner & copytransfermast) == 0)
|
||||||
|
owner |= (uint)PermissionMask.Transfer;
|
||||||
|
|
||||||
|
owner &= basePerms;
|
||||||
|
m_EffectiveOwnerPerms = owner;
|
||||||
|
uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
|
||||||
|
|
||||||
|
// recover modify and move
|
||||||
|
rootGroupPerms &= movemodmask;
|
||||||
|
group |= rootGroupPerms;
|
||||||
|
if(noBaseTransfer)
|
||||||
|
group &=~(uint)PermissionMask.Copy;
|
||||||
|
else
|
||||||
|
group |= ownertransfermask;
|
||||||
|
|
||||||
|
uint groupOrEveryone = group;
|
||||||
|
m_EffectiveGroupPerms = group & owner;
|
||||||
|
|
||||||
|
// recover move
|
||||||
|
rootEveryonePerms &= (uint)PermissionMask.Move;
|
||||||
|
everyone |= rootEveryonePerms;
|
||||||
|
everyone &= ~(uint)PermissionMask.Modify;
|
||||||
|
if(noBaseTransfer)
|
||||||
|
everyone &=~(uint)PermissionMask.Copy;
|
||||||
|
else
|
||||||
|
everyone |= ownertransfermask;
|
||||||
|
|
||||||
|
groupOrEveryone |= everyone;
|
||||||
|
|
||||||
|
m_EffectiveEveryOnePerms = everyone & owner;
|
||||||
|
m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// aggregates perms scanning parts, assuming their contents was already aggregated and cached
|
||||||
|
// ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop
|
||||||
|
public void AggregatePerms()
|
||||||
|
{
|
||||||
|
lock(PermissionsLock)
|
||||||
|
{
|
||||||
|
// aux
|
||||||
|
const uint allmask = (uint)PermissionMask.AllEffective;
|
||||||
|
const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
|
||||||
|
const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
|
||||||
|
|
||||||
|
uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
|
||||||
|
bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
|
||||||
|
|
||||||
|
uint rootOwnerPerms = RootPart.OwnerMask;
|
||||||
|
uint owner = rootOwnerPerms;
|
||||||
|
uint rootGroupPerms = RootPart.GroupMask;
|
||||||
|
uint group = rootGroupPerms;
|
||||||
|
uint rootEveryonePerms = RootPart.EveryoneMask;
|
||||||
|
uint everyone = rootEveryonePerms;
|
||||||
|
|
||||||
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
|
for (int i = 0; i < parts.Length; i++)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = parts[i];
|
||||||
|
owner &= part.AggregatedInnerOwnerPerms;
|
||||||
|
group &= part.AggregatedInnerGroupPerms;
|
||||||
|
everyone &= part.AggregatedInnerEveryonePerms;
|
||||||
|
}
|
||||||
|
// recover modify and move
|
||||||
|
rootOwnerPerms &= movemodmask;
|
||||||
|
owner |= rootOwnerPerms;
|
||||||
|
if((owner & copytransfermast) == 0)
|
||||||
|
owner |= (uint)PermissionMask.Transfer;
|
||||||
|
|
||||||
|
owner &= basePerms;
|
||||||
|
m_EffectiveOwnerPerms = owner;
|
||||||
|
uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
|
||||||
|
|
||||||
|
// recover modify and move
|
||||||
|
rootGroupPerms &= movemodmask;
|
||||||
|
group |= rootGroupPerms;
|
||||||
|
if(noBaseTransfer)
|
||||||
|
group &=~(uint)PermissionMask.Copy;
|
||||||
|
else
|
||||||
|
group |= ownertransfermask;
|
||||||
|
|
||||||
|
uint groupOrEveryone = group;
|
||||||
|
m_EffectiveGroupPerms = group & owner;
|
||||||
|
|
||||||
|
// recover move
|
||||||
|
rootEveryonePerms &= (uint)PermissionMask.Move;
|
||||||
|
everyone |= rootEveryonePerms;
|
||||||
|
everyone &= ~(uint)PermissionMask.Modify;
|
||||||
|
if(noBaseTransfer)
|
||||||
|
everyone &=~(uint)PermissionMask.Copy;
|
||||||
|
else
|
||||||
|
everyone |= ownertransfermask;
|
||||||
|
|
||||||
|
groupOrEveryone |= everyone;
|
||||||
|
|
||||||
|
m_EffectiveEveryOnePerms = everyone & owner;
|
||||||
|
m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public uint GetEffectivePermissions()
|
public uint GetEffectivePermissions()
|
||||||
{
|
{
|
||||||
return GetEffectivePermissions(false);
|
return GetEffectivePermissions(false);
|
||||||
|
|
|
@ -117,9 +117,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
NOT_STATUS_ROTATE_Z = 0xF7
|
NOT_STATUS_ROTATE_Z = 0xF7
|
||||||
}
|
}
|
||||||
|
|
||||||
// This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm
|
|
||||||
public static readonly uint SLAM = 16;
|
|
||||||
|
|
||||||
// private PrimCountTaintedDelegate handlerPrimCountTainted = null;
|
// private PrimCountTaintedDelegate handlerPrimCountTainted = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -156,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
timeLastChanged = DateTime.UtcNow.Ticks;
|
timeLastChanged = DateTime.UtcNow.Ticks;
|
||||||
if (!m_hasGroupChanged)
|
if (!m_hasGroupChanged)
|
||||||
timeFirstChanged = DateTime.UtcNow.Ticks;
|
timeFirstChanged = DateTime.UtcNow.Ticks;
|
||||||
if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null)
|
if (m_rootPart != null && m_scene != null)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
if (m_rand == null)
|
if (m_rand == null)
|
||||||
|
@ -379,6 +376,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public bool m_dupeInProgress = false;
|
public bool m_dupeInProgress = false;
|
||||||
internal Dictionary<UUID, string> m_savedScriptState;
|
internal Dictionary<UUID, string> m_savedScriptState;
|
||||||
|
|
||||||
|
public UUID MonitoringObject { get; set; }
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -539,7 +538,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
|
|
||||||
public bool inTransit = false;
|
public bool inTransit = false;
|
||||||
public delegate SceneObjectGroup SOGCrossDelegate(SceneObjectGroup sog,Vector3 pos);
|
private delegate SceneObjectGroup SOGCrossDelegate(SceneObjectGroup sog,Vector3 pos, TeleportObjectData tpData);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The absolute position of this scene object in the scene
|
/// The absolute position of this scene object in the scene
|
||||||
|
@ -561,7 +560,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
inTransit = true;
|
inTransit = true;
|
||||||
SOGCrossDelegate d = CrossAsync;
|
SOGCrossDelegate d = CrossAsync;
|
||||||
d.BeginInvoke(this, val, CrossAsyncCompleted, d);
|
d.BeginInvoke(this, val, null, CrossAsyncCompleted, d);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -602,7 +601,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
av.sitSOGmoved();
|
av.sitSOGmoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// now that position is changed tell it to scripts
|
// now that position is changed tell it to scripts
|
||||||
if (triggerScriptEvent)
|
if (triggerScriptEvent)
|
||||||
{
|
{
|
||||||
|
@ -618,64 +616,75 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SceneObjectGroup CrossAsync(SceneObjectGroup sog, Vector3 val)
|
private SceneObjectGroup CrossAsync(SceneObjectGroup sog, Vector3 val, TeleportObjectData tpdata)
|
||||||
{
|
{
|
||||||
Scene sogScene = sog.m_scene;
|
Scene sogScene = sog.m_scene;
|
||||||
|
SceneObjectPart root = sog.RootPart;
|
||||||
|
|
||||||
|
bool isTeleport = tpdata != null;
|
||||||
|
|
||||||
|
if(!isTeleport)
|
||||||
|
{
|
||||||
|
if (root.DIE_AT_EDGE)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sogScene.DeleteSceneObject(sog, false);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
|
||||||
|
}
|
||||||
|
return sog;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root.RETURN_AT_EDGE)
|
||||||
|
{
|
||||||
|
// We remove the object here
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<uint> localIDs = new List<uint>();
|
||||||
|
localIDs.Add(root.LocalId);
|
||||||
|
sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition,
|
||||||
|
"Returned at region cross");
|
||||||
|
sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
|
||||||
|
}
|
||||||
|
return sog;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root.KeyframeMotion != null)
|
||||||
|
root.KeyframeMotion.StartCrossingCheck();
|
||||||
|
|
||||||
|
if(root.PhysActor != null)
|
||||||
|
root.PhysActor.CrossingStart();
|
||||||
|
|
||||||
IEntityTransferModule entityTransfer = sogScene.RequestModuleInterface<IEntityTransferModule>();
|
IEntityTransferModule entityTransfer = sogScene.RequestModuleInterface<IEntityTransferModule>();
|
||||||
|
|
||||||
Vector3 newpos = Vector3.Zero;
|
|
||||||
OpenSim.Services.Interfaces.GridRegion destination = null;
|
|
||||||
|
|
||||||
if (sog.RootPart.DIE_AT_EDGE)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
sogScene.DeleteSceneObject(sog, false);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
|
|
||||||
}
|
|
||||||
return sog;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sog.RootPart.RETURN_AT_EDGE)
|
|
||||||
{
|
|
||||||
// We remove the object here
|
|
||||||
try
|
|
||||||
{
|
|
||||||
List<uint> localIDs = new List<uint>();
|
|
||||||
localIDs.Add(sog.RootPart.LocalId);
|
|
||||||
sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition,
|
|
||||||
"Returned at region cross");
|
|
||||||
sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
|
|
||||||
}
|
|
||||||
return sog;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sog.m_rootPart.KeyframeMotion != null)
|
|
||||||
sog.m_rootPart.KeyframeMotion.StartCrossingCheck();
|
|
||||||
|
|
||||||
if (entityTransfer == null)
|
if (entityTransfer == null)
|
||||||
return sog;
|
return sog;
|
||||||
|
|
||||||
|
Vector3 newpos = Vector3.Zero;
|
||||||
|
OpenSim.Services.Interfaces.GridRegion destination = null;
|
||||||
|
|
||||||
destination = entityTransfer.GetObjectDestination(sog, val, out newpos);
|
destination = entityTransfer.GetObjectDestination(sog, val, out newpos);
|
||||||
if (destination == null)
|
if (destination == null)
|
||||||
return sog;
|
return sog;
|
||||||
|
|
||||||
if (sog.m_sittingAvatars.Count == 0)
|
if (sog.m_sittingAvatars.Count == 0)
|
||||||
{
|
{
|
||||||
entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, true);
|
entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, !isTeleport, true);
|
||||||
return sog;
|
return sog;
|
||||||
}
|
}
|
||||||
|
|
||||||
string reason = String.Empty;
|
string reason = String.Empty;
|
||||||
EntityTransferContext ctx = new EntityTransferContext();
|
EntityTransferContext ctx = new EntityTransferContext();
|
||||||
|
|
||||||
|
Vector3 curPos = root.GroupPosition;
|
||||||
foreach (ScenePresence av in sog.m_sittingAvatars)
|
foreach (ScenePresence av in sog.m_sittingAvatars)
|
||||||
{
|
{
|
||||||
// We need to cross these agents. First, let's find
|
// We need to cross these agents. First, let's find
|
||||||
|
@ -686,10 +695,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// We set the avatar position as being the object
|
// We set the avatar position as being the object
|
||||||
// position to get the region to send to
|
// position to get the region to send to
|
||||||
if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, ctx, out reason))
|
if(av.IsNPC)
|
||||||
{
|
continue;
|
||||||
|
|
||||||
|
if(av.IsInTransit)
|
||||||
return sog;
|
return sog;
|
||||||
}
|
|
||||||
|
if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, ctx, out reason))
|
||||||
|
return sog;
|
||||||
|
|
||||||
m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName);
|
m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,8 +711,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// be made to stand up
|
// be made to stand up
|
||||||
|
|
||||||
List<avtocrossInfo> avsToCross = new List<avtocrossInfo>();
|
List<avtocrossInfo> avsToCross = new List<avtocrossInfo>();
|
||||||
|
List<ScenePresence> avsToCrossFar = new List<ScenePresence>();
|
||||||
foreach (ScenePresence av in sog.m_sittingAvatars)
|
ulong destHandle = destination.RegionHandle;
|
||||||
|
List<ScenePresence> sittingAvatars = GetSittingAvatars();
|
||||||
|
foreach (ScenePresence av in sittingAvatars)
|
||||||
{
|
{
|
||||||
byte cflags = 1;
|
byte cflags = 1;
|
||||||
|
|
||||||
|
@ -712,68 +728,175 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
cflags = 3;
|
cflags = 3;
|
||||||
}
|
}
|
||||||
|
if(!av.knowsNeighbourRegion(destHandle))
|
||||||
|
cflags |= 8;
|
||||||
|
|
||||||
// 1 is crossing
|
// 1 is crossing
|
||||||
// 2 is sitting
|
// 2 is sitting
|
||||||
// 4 is sitting at sittarget
|
// 4 is sitting at sittarget
|
||||||
av.crossingFlags = cflags;
|
// 8 far crossing
|
||||||
|
|
||||||
avinfo.av = av;
|
avinfo.av = av;
|
||||||
avinfo.ParentID = av.ParentID;
|
avinfo.ParentID = av.ParentID;
|
||||||
avsToCross.Add(avinfo);
|
avsToCross.Add(avinfo);
|
||||||
|
|
||||||
|
if(!av.knowsNeighbourRegion(destHandle))
|
||||||
|
{
|
||||||
|
cflags |= 8;
|
||||||
|
avsToCrossFar.Add(av);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(av.IsNPC)
|
||||||
|
av.crossingFlags = 0;
|
||||||
|
else
|
||||||
|
av.crossingFlags = cflags;
|
||||||
|
|
||||||
av.PrevSitOffset = av.OffsetPosition;
|
av.PrevSitOffset = av.OffsetPosition;
|
||||||
av.ParentID = 0;
|
av.ParentID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector3 vel = root.Velocity;
|
||||||
|
Vector3 avel = root.AngularVelocity;
|
||||||
|
Vector3 acc = root.Acceleration;
|
||||||
|
Quaternion ori = root.RotationOffset;
|
||||||
|
|
||||||
|
if(isTeleport)
|
||||||
|
{
|
||||||
|
root.Stop();
|
||||||
|
sogScene.ForEachScenePresence(delegate(ScenePresence av)
|
||||||
|
{
|
||||||
|
av.ControllingClient.SendEntityUpdate(root,PrimUpdateFlags.SendInTransit);
|
||||||
|
av.ControllingClient.SendEntityTerseUpdateImmediate(root);
|
||||||
|
});
|
||||||
|
|
||||||
|
root.Velocity = tpdata.vel;
|
||||||
|
root.AngularVelocity = tpdata.avel;
|
||||||
|
root.Acceleration = tpdata.acc;
|
||||||
|
root.RotationOffset = tpdata.ori;
|
||||||
|
}
|
||||||
|
|
||||||
if (entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, false))
|
if (entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, false))
|
||||||
{
|
{
|
||||||
|
if(isTeleport)
|
||||||
|
{
|
||||||
|
sogScene.ForEachScenePresence(delegate(ScenePresence oav)
|
||||||
|
{
|
||||||
|
if(sittingAvatars.Contains(oav))
|
||||||
|
return;
|
||||||
|
if(oav.knowsNeighbourRegion(destHandle))
|
||||||
|
return;
|
||||||
|
oav.ControllingClient.SendEntityUpdate(root, PrimUpdateFlags.Kill);
|
||||||
|
foreach (ScenePresence sav in sittingAvatars)
|
||||||
|
{
|
||||||
|
sav.SendKillTo(oav);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
bool crossedfar = false;
|
||||||
|
foreach (ScenePresence av in avsToCrossFar)
|
||||||
|
{
|
||||||
|
if(entityTransfer.CrossAgentCreateFarChild(av,destination, newpos, ctx))
|
||||||
|
crossedfar = true;
|
||||||
|
else
|
||||||
|
av.crossingFlags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(crossedfar)
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
foreach (avtocrossInfo avinfo in avsToCross)
|
foreach (avtocrossInfo avinfo in avsToCross)
|
||||||
{
|
{
|
||||||
ScenePresence av = avinfo.av;
|
ScenePresence av = avinfo.av;
|
||||||
if (!av.IsInTransit) // just in case...
|
av.IsInTransit = true;
|
||||||
|
m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);
|
||||||
|
|
||||||
|
if(av.crossingFlags > 0)
|
||||||
|
entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, false, ctx);
|
||||||
|
|
||||||
|
if (av.IsChildAgent)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);
|
// avatar crossed do some extra cleanup
|
||||||
|
if (av.ParentUUID != UUID.Zero)
|
||||||
av.IsInTransit = true;
|
|
||||||
|
|
||||||
// CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync;
|
|
||||||
// d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d);
|
|
||||||
entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, av.Flying, ctx);
|
|
||||||
if (av.IsChildAgent)
|
|
||||||
{
|
{
|
||||||
// avatar crossed do some extra cleanup
|
av.ClearControls();
|
||||||
if (av.ParentUUID != UUID.Zero)
|
av.ParentPart = null;
|
||||||
{
|
|
||||||
av.ClearControls();
|
|
||||||
av.ParentPart = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// avatar cross failed we need do dedicated standUp
|
|
||||||
// part of it was done at CrossAgentToNewRegionAsync
|
|
||||||
// so for now just remove the sog controls
|
|
||||||
// this may need extra care
|
|
||||||
av.UnRegisterSeatControls(sog.UUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
av.ParentUUID = UUID.Zero;
|
av.ParentUUID = UUID.Zero;
|
||||||
|
av.ParentPart = null;
|
||||||
// In any case
|
// In any case
|
||||||
av.IsInTransit = false;
|
av.IsInTransit = false;
|
||||||
av.crossingFlags = 0;
|
av.crossingFlags = 0;
|
||||||
m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname);
|
m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar already in transit {0} to {1}", av.Name, val);
|
{
|
||||||
|
// avatar cross failed we need do dedicated standUp
|
||||||
|
// part of it was done at CrossAgentToNewRegionAsync
|
||||||
|
// so for now just remove the sog controls
|
||||||
|
// this may need extra care
|
||||||
|
av.UnRegisterSeatControls(sog.UUID);
|
||||||
|
av.ParentUUID = UUID.Zero;
|
||||||
|
av.ParentPart = null;
|
||||||
|
Vector3 oldp = curPos;
|
||||||
|
oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f);
|
||||||
|
oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f);
|
||||||
|
av.AbsolutePosition = oldp;
|
||||||
|
av.crossingFlags = 0;
|
||||||
|
av.sitAnimation = "SIT";
|
||||||
|
av.IsInTransit = false;
|
||||||
|
if(av.Animator!= null)
|
||||||
|
av.Animator.SetMovementAnimations("STAND");
|
||||||
|
av.AddToPhysicalScene(false);
|
||||||
|
sogScene.ForEachScenePresence(delegate(ScenePresence oav)
|
||||||
|
{
|
||||||
|
if(sittingAvatars.Contains(oav))
|
||||||
|
return;
|
||||||
|
if(oav.knowsNeighbourRegion(destHandle))
|
||||||
|
av.SendAvatarDataToAgent(oav);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
av.SendAvatarDataToAgent(oav);
|
||||||
|
av.SendAppearanceToAgent(oav);
|
||||||
|
if (av.Animator != null)
|
||||||
|
av.Animator.SendAnimPackToClient(oav.ControllingClient);
|
||||||
|
av.SendAttachmentsToAgentNF(oav); // not ok
|
||||||
|
}
|
||||||
|
});
|
||||||
|
m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} failed.", av.Firstname, av.Lastname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(crossedfar)
|
||||||
|
{
|
||||||
|
Thread.Sleep(10000);
|
||||||
|
foreach (ScenePresence av in avsToCrossFar)
|
||||||
|
{
|
||||||
|
if(av.IsChildAgent)
|
||||||
|
{
|
||||||
|
av.Scene.CloseAgent(av.UUID, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
av.RemoveNeighbourRegion(destHandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
avsToCrossFar.Clear();
|
||||||
avsToCross.Clear();
|
avsToCross.Clear();
|
||||||
sog.RemoveScriptInstances(true);
|
sog.RemoveScriptInstances(true);
|
||||||
sog.Clear();
|
sog.Clear();
|
||||||
return sog;
|
return sog;
|
||||||
}
|
}
|
||||||
else // cross failed, put avas back ??
|
else
|
||||||
{
|
{
|
||||||
|
if(isTeleport)
|
||||||
|
{
|
||||||
|
if((tpdata.flags & OSTPOBJ_STOPONFAIL) == 0)
|
||||||
|
{
|
||||||
|
root.Velocity = vel;
|
||||||
|
root.AngularVelocity = avel;
|
||||||
|
root.Acceleration = acc;
|
||||||
|
}
|
||||||
|
root.RotationOffset = ori;
|
||||||
|
}
|
||||||
foreach (avtocrossInfo avinfo in avsToCross)
|
foreach (avtocrossInfo avinfo in avsToCross)
|
||||||
{
|
{
|
||||||
ScenePresence av = avinfo.av;
|
ScenePresence av = avinfo.av;
|
||||||
|
@ -783,7 +906,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
avsToCross.Clear();
|
avsToCross.Clear();
|
||||||
|
|
||||||
return sog;
|
return sog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -795,11 +917,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (!sog.IsDeleted)
|
if (!sog.IsDeleted)
|
||||||
{
|
{
|
||||||
SceneObjectPart rootp = sog.m_rootPart;
|
SceneObjectPart rootp = sog.m_rootPart;
|
||||||
|
|
||||||
Vector3 oldp = rootp.GroupPosition;
|
Vector3 oldp = rootp.GroupPosition;
|
||||||
oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f);
|
oldp.X = Util.Clamp<float>(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f);
|
||||||
oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f);
|
oldp.Y = Util.Clamp<float>(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f);
|
||||||
rootp.GroupPosition = oldp;
|
rootp.GroupPosition = oldp;
|
||||||
|
|
||||||
|
rootp.Stop();
|
||||||
|
|
||||||
SceneObjectPart[] parts = sog.m_parts.GetArray();
|
SceneObjectPart[] parts = sog.m_parts.GetArray();
|
||||||
|
|
||||||
foreach (SceneObjectPart part in parts)
|
foreach (SceneObjectPart part in parts)
|
||||||
|
@ -813,47 +938,150 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
av.sitSOGmoved();
|
av.sitSOGmoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
sog.Velocity = Vector3.Zero;
|
|
||||||
|
|
||||||
if (sog.m_rootPart.KeyframeMotion != null)
|
if (sog.m_rootPart.KeyframeMotion != null)
|
||||||
sog.m_rootPart.KeyframeMotion.CrossingFailure();
|
sog.m_rootPart.KeyframeMotion.CrossingFailure();
|
||||||
|
|
||||||
if (sog.RootPart.PhysActor != null)
|
if (sog.RootPart.PhysActor != null)
|
||||||
{
|
|
||||||
sog.RootPart.PhysActor.CrossingFailure();
|
sog.RootPart.PhysActor.CrossingFailure();
|
||||||
}
|
|
||||||
|
|
||||||
sog.inTransit = false;
|
sog.inTransit = false;
|
||||||
|
AttachToBackup();
|
||||||
sog.ScheduleGroupForFullUpdate();
|
sog.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* outdated
|
private class TeleportObjectData
|
||||||
private void CrossAgentToNewRegionCompleted(ScenePresence agent)
|
|
||||||
{
|
{
|
||||||
//// If the cross was successful, this agent is a child agent
|
public int flags;
|
||||||
if (agent.IsChildAgent)
|
public Vector3 vel;
|
||||||
|
public Vector3 avel;
|
||||||
|
public Vector3 acc;
|
||||||
|
public Quaternion ori;
|
||||||
|
public UUID sourceID;
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy from LSL_constants.cs
|
||||||
|
const int OSTPOBJ_STOPATTARGET = 0x1; // stops at destination
|
||||||
|
const int OSTPOBJ_STOPONFAIL = 0x2; // stops at start if tp fails
|
||||||
|
const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation
|
||||||
|
|
||||||
|
public int TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags)
|
||||||
|
{
|
||||||
|
if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
inTransit = true;
|
||||||
|
|
||||||
|
PhysicsActor pa = RootPart.PhysActor;
|
||||||
|
if(pa == null || RootPart.KeyframeMotion != null /*|| m_sittingAvatars.Count == 0*/)
|
||||||
{
|
{
|
||||||
if (agent.ParentUUID != UUID.Zero)
|
inTransit = false;
|
||||||
{
|
return -1;
|
||||||
agent.HandleForceReleaseControls(agent.ControllingClient,agent.UUID);
|
|
||||||
agent.ParentPart = null;
|
|
||||||
// agent.ParentPosition = Vector3.Zero;
|
|
||||||
// agent.ParentUUID = UUID.Zero;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
agent.ParentUUID = UUID.Zero;
|
bool stop = (flags & OSTPOBJ_STOPATTARGET) != 0;
|
||||||
// agent.Reset();
|
bool setrot = (flags & OSTPOBJ_SETROT) != 0;
|
||||||
// else // Not successful
|
|
||||||
// agent.RestoreInCurrentScene();
|
|
||||||
|
|
||||||
// In any case
|
rotation.Normalize();
|
||||||
agent.IsInTransit = false;
|
|
||||||
|
Quaternion currentRot = RootPart.RotationOffset;
|
||||||
|
if(setrot)
|
||||||
|
rotation = Quaternion.Conjugate(currentRot) * rotation;
|
||||||
|
|
||||||
m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
|
bool dorot = setrot | (Math.Abs(rotation.W) < 0.99999);
|
||||||
|
|
||||||
|
Vector3 vel = Vector3.Zero;
|
||||||
|
Vector3 avel = Vector3.Zero;
|
||||||
|
Vector3 acc = Vector3.Zero;
|
||||||
|
|
||||||
|
if(!stop)
|
||||||
|
{
|
||||||
|
vel = RootPart.Velocity;
|
||||||
|
avel = RootPart.AngularVelocity;
|
||||||
|
acc = RootPart.Acceleration;
|
||||||
|
}
|
||||||
|
Quaternion ori = RootPart.RotationOffset;
|
||||||
|
|
||||||
|
if(dorot)
|
||||||
|
{
|
||||||
|
if(!stop)
|
||||||
|
{
|
||||||
|
vel *= rotation;
|
||||||
|
avel *= rotation;
|
||||||
|
acc *= rotation;
|
||||||
|
}
|
||||||
|
ori *= rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Scene.PositionIsInCurrentRegion(targetPosition))
|
||||||
|
{
|
||||||
|
if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 1.0))
|
||||||
|
{
|
||||||
|
inTransit = false;
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3 curPos = AbsolutePosition;
|
||||||
|
ILandObject curLand = Scene.LandChannel.GetLandObject(curPos.X, curPos.Y);
|
||||||
|
float posX = targetPosition.X;
|
||||||
|
float posY = targetPosition.Y;
|
||||||
|
ILandObject land = Scene.LandChannel.GetLandObject(posX, posY);
|
||||||
|
if(land != null && land != curLand)
|
||||||
|
{
|
||||||
|
if(!Scene.Permissions.CanObjectEnterWithScripts(this, land))
|
||||||
|
{
|
||||||
|
inTransit = false;
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
UUID agentID;
|
||||||
|
foreach (ScenePresence av in m_sittingAvatars)
|
||||||
|
{
|
||||||
|
agentID = av.UUID;
|
||||||
|
if(land.IsRestrictedFromLand(agentID) || land.IsBannedFromLand(agentID))
|
||||||
|
{
|
||||||
|
inTransit = false;
|
||||||
|
return -4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RootPart.Velocity = vel;
|
||||||
|
RootPart.AngularVelocity = avel;
|
||||||
|
RootPart.Acceleration = acc;
|
||||||
|
RootPart.RotationOffset = ori;
|
||||||
|
|
||||||
|
Vector3 s = RootPart.Scale * RootPart.RotationOffset;
|
||||||
|
float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f;
|
||||||
|
if(targetPosition.Z < h)
|
||||||
|
targetPosition.Z = h;
|
||||||
|
|
||||||
|
inTransit = false;
|
||||||
|
AbsolutePosition = targetPosition;
|
||||||
|
RootPart.ScheduleTerseUpdate();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 20.0))
|
||||||
|
{
|
||||||
|
inTransit = false;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TeleportObjectData tdata = new TeleportObjectData();
|
||||||
|
tdata.flags = flags;
|
||||||
|
tdata.vel = vel;
|
||||||
|
tdata.avel = avel;
|
||||||
|
tdata.acc = acc;
|
||||||
|
tdata.ori = ori;
|
||||||
|
tdata.sourceID = sourceID;
|
||||||
|
|
||||||
|
|
||||||
|
SOGCrossDelegate d = CrossAsync;
|
||||||
|
d.BeginInvoke(this, targetPosition, tdata, CrossAsyncCompleted, d);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
public override Vector3 Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get { return RootPart.Velocity; }
|
get { return RootPart.Velocity; }
|
||||||
|
@ -1786,63 +2014,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attach this scene object to the given avatar.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="agentID"></param>
|
|
||||||
/// <param name="attachmentpoint"></param>
|
|
||||||
/// <param name="AttachOffset"></param>
|
|
||||||
private void AttachToAgent(
|
|
||||||
ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
|
|
||||||
{
|
|
||||||
if (avatar != null)
|
|
||||||
{
|
|
||||||
// don't attach attachments to child agents
|
|
||||||
if (avatar.IsChildAgent) return;
|
|
||||||
|
|
||||||
// Remove from database and parcel prim count
|
|
||||||
m_scene.DeleteFromStorage(so.UUID);
|
|
||||||
m_scene.EventManager.TriggerParcelPrimCountTainted();
|
|
||||||
|
|
||||||
so.AttachedAvatar = avatar.UUID;
|
|
||||||
|
|
||||||
if (so.RootPart.PhysActor != null)
|
|
||||||
{
|
|
||||||
m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
|
|
||||||
so.RootPart.PhysActor = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
so.AbsolutePosition = attachOffset;
|
|
||||||
so.RootPart.AttachedPos = attachOffset;
|
|
||||||
so.IsAttachment = true;
|
|
||||||
so.RootPart.SetParentLocalId(avatar.LocalId);
|
|
||||||
so.AttachmentPoint = attachmentpoint;
|
|
||||||
|
|
||||||
avatar.AddAttachment(this);
|
|
||||||
|
|
||||||
if (!silent)
|
|
||||||
{
|
|
||||||
// Killing it here will cause the client to deselect it
|
|
||||||
// It then reappears on the avatar, deselected
|
|
||||||
// through the full update below
|
|
||||||
//
|
|
||||||
if (IsSelected)
|
|
||||||
{
|
|
||||||
m_scene.SendKillObject(new List<uint> { m_rootPart.LocalId });
|
|
||||||
}
|
|
||||||
|
|
||||||
IsSelected = false; // fudge....
|
|
||||||
ScheduleGroupForFullUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.WarnFormat(
|
|
||||||
"[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present",
|
|
||||||
UUID, avatar.ControllingClient.AgentId, Scene.RegionInfo.RegionName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte GetAttachmentPoint()
|
public byte GetAttachmentPoint()
|
||||||
{
|
{
|
||||||
return m_rootPart.Shape.State;
|
return m_rootPart.Shape.State;
|
||||||
|
@ -1957,6 +2128,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (part.LinkNum == 2)
|
if (part.LinkNum == 2)
|
||||||
RootPart.LinkNum = 1;
|
RootPart.LinkNum = 1;
|
||||||
|
InvalidatePartsLinkMaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2233,7 +2405,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (part.OwnerID != userId)
|
if (part.OwnerID != userId)
|
||||||
{
|
{
|
||||||
part.LastOwnerID = part.OwnerID;
|
if(part.GroupID != part.OwnerID)
|
||||||
|
part.LastOwnerID = part.OwnerID;
|
||||||
part.OwnerID = userId;
|
part.OwnerID = userId;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2313,7 +2486,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
RootPart.UUID);
|
RootPart.UUID);
|
||||||
m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn");
|
m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn");
|
||||||
m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero,
|
m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero,
|
||||||
DeRezAction.Return, UUID.Zero);
|
DeRezAction.Return, UUID.Zero, false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2443,17 +2616,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
|
dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
|
||||||
dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
|
dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
|
||||||
|
|
||||||
|
|
||||||
if (userExposed)
|
if (userExposed)
|
||||||
dupe.m_rootPart.TrimPermissions();
|
dupe.m_rootPart.TrimPermissions();
|
||||||
|
|
||||||
List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.GetArray());
|
List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.GetArray());
|
||||||
|
|
||||||
partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2)
|
partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2)
|
||||||
{
|
{
|
||||||
return p1.LinkNum.CompareTo(p2.LinkNum);
|
return p1.LinkNum.CompareTo(p2.LinkNum);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach (SceneObjectPart part in partList)
|
foreach (SceneObjectPart part in partList)
|
||||||
{
|
{
|
||||||
|
@ -2505,12 +2677,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (dupe.m_rootPart.PhysActor != null)
|
if (dupe.m_rootPart.PhysActor != null)
|
||||||
dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building
|
dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building
|
||||||
|
|
||||||
|
dupe.AggregateDeepPerms();
|
||||||
|
|
||||||
dupe.HasGroupChanged = true;
|
dupe.HasGroupChanged = true;
|
||||||
dupe.AttachToBackup();
|
dupe.AttachToBackup();
|
||||||
|
|
||||||
ScheduleGroupForFullUpdate();
|
dupe.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dupe.InvalidatePartsLinkMaps();
|
||||||
m_dupeInProgress = false;
|
m_dupeInProgress = false;
|
||||||
return dupe;
|
return dupe;
|
||||||
}
|
}
|
||||||
|
@ -2746,25 +2921,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the owner of the root part.
|
/// Set the owner of all linkset.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="part"></param>
|
|
||||||
/// <param name="cAgentID"></param>
|
/// <param name="cAgentID"></param>
|
||||||
/// <param name="cGroupID"></param>
|
/// <param name="cGroupID"></param>
|
||||||
public void SetRootPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID)
|
public void SetOwner(UUID cAgentID, UUID cGroupID)
|
||||||
{
|
{
|
||||||
part.LastOwnerID = part.OwnerID;
|
SceneObjectPart rpart = RootPart;
|
||||||
part.OwnerID = cAgentID;
|
UUID oldowner = rpart.OwnerID;
|
||||||
part.GroupID = cGroupID;
|
ForEachPart(delegate(SceneObjectPart part)
|
||||||
|
{
|
||||||
|
if(part.GroupID != part.OwnerID)
|
||||||
|
part.LastOwnerID = part.OwnerID;
|
||||||
|
part.OwnerID = cAgentID;
|
||||||
|
part.GroupID = cGroupID;
|
||||||
|
});
|
||||||
|
|
||||||
if (part.OwnerID != cAgentID)
|
if (oldowner != cAgentID)
|
||||||
{
|
{
|
||||||
// Apply Next Owner Permissions if we're not bypassing permissions
|
// Apply Next Owner Permissions if we're not bypassing permissions
|
||||||
if (!m_scene.Permissions.BypassPermissions())
|
if (!m_scene.Permissions.BypassPermissions())
|
||||||
|
{
|
||||||
ApplyNextOwnerPermissions();
|
ApplyNextOwnerPermissions();
|
||||||
|
AggregatePerms();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
part.ScheduleFullUpdate();
|
rpart.ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -3264,6 +3447,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ResetChildPrimPhysicsPositions();
|
ResetChildPrimPhysicsPositions();
|
||||||
|
|
||||||
InvalidBoundsRadius();
|
InvalidBoundsRadius();
|
||||||
|
InvalidatePartsLinkMaps();
|
||||||
|
|
||||||
if (m_rootPart.PhysActor != null)
|
if (m_rootPart.PhysActor != null)
|
||||||
m_rootPart.PhysActor.Building = false;
|
m_rootPart.PhysActor.Building = false;
|
||||||
|
@ -3420,6 +3604,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
objectGroup.HasGroupChangedDueToDelink = true;
|
objectGroup.HasGroupChangedDueToDelink = true;
|
||||||
|
|
||||||
InvalidBoundsRadius();
|
InvalidBoundsRadius();
|
||||||
|
InvalidatePartsLinkMaps();
|
||||||
|
objectGroup.AggregatePerms();
|
||||||
|
|
||||||
if (sendEvents)
|
if (sendEvents)
|
||||||
linkPart.TriggerScriptChangedEvent(Changed.LINK);
|
linkPart.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
|
@ -3958,8 +4144,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive)
|
public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive)
|
||||||
{
|
{
|
||||||
uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits
|
uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff0; // Mask folded bits
|
||||||
uint foldedPerms = RootPart.OwnerMask & 3;
|
uint foldedPerms = RootPart.OwnerMask & (uint)PermissionMask.FoldedMask;
|
||||||
|
|
||||||
ForEachPart(part =>
|
ForEachPart(part =>
|
||||||
{
|
{
|
||||||
|
@ -3970,14 +4156,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.Inventory.ApplyGodPermissions(part.BaseMask);
|
part.Inventory.ApplyGodPermissions(part.BaseMask);
|
||||||
});
|
});
|
||||||
|
|
||||||
uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify);
|
uint lockMask = ~(uint)(PermissionMask.Move);
|
||||||
uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify);
|
uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move);
|
||||||
RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
|
RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}",
|
// "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}",
|
||||||
// (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name);
|
// (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name);
|
||||||
|
AggregatePerms();
|
||||||
RootPart.ScheduleFullUpdate();
|
RootPart.ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4002,6 +4188,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in Parts)
|
foreach (SceneObjectPart part in Parts)
|
||||||
part.Inventory.ApplyGodPermissions(RootPart.BaseMask);
|
part.Inventory.ApplyGodPermissions(RootPart.BaseMask);
|
||||||
|
AggregatePerms();
|
||||||
}
|
}
|
||||||
|
|
||||||
HasGroupChanged = true;
|
HasGroupChanged = true;
|
||||||
|
@ -4647,7 +4834,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
if ((change & ObjectChangeType.Position) != 0)
|
if ((change & ObjectChangeType.Position) != 0)
|
||||||
{
|
{
|
||||||
if (IsAttachment || m_scene.Permissions.CanObjectEntry(group.UUID, false, data.position))
|
if (IsAttachment || m_scene.Permissions.CanObjectEntry(group, false, data.position))
|
||||||
UpdateGroupPosition(data.position);
|
UpdateGroupPosition(data.position);
|
||||||
updateType = updatetype.groupterse;
|
updateType = updatetype.groupterse;
|
||||||
}
|
}
|
||||||
|
@ -5056,6 +5243,49 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return Ptot;
|
return Ptot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GetInertiaData(out float TotalMass, out Vector3 CenterOfMass, out Vector3 Inertia, out Vector4 aux )
|
||||||
|
{
|
||||||
|
PhysicsActor pa = RootPart.PhysActor;
|
||||||
|
|
||||||
|
if(((RootPart.Flags & PrimFlags.Physics) !=0) && pa !=null)
|
||||||
|
{
|
||||||
|
PhysicsInertiaData inertia;
|
||||||
|
|
||||||
|
inertia = pa.GetInertiaData();
|
||||||
|
|
||||||
|
TotalMass = inertia.TotalMass;
|
||||||
|
CenterOfMass = inertia.CenterOfMass;
|
||||||
|
Inertia = inertia.Inertia;
|
||||||
|
aux = inertia.InertiaRotation;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TotalMass = GetMass();
|
||||||
|
CenterOfMass = GetCenterOfMass() - AbsolutePosition;
|
||||||
|
CenterOfMass *= Quaternion.Conjugate(RootPart.RotationOffset);
|
||||||
|
Inertia = Vector3.Zero;
|
||||||
|
aux = Vector4.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetInertiaData(float TotalMass, Vector3 CenterOfMass, Vector3 Inertia, Vector4 aux )
|
||||||
|
{
|
||||||
|
PhysicsInertiaData inertia = new PhysicsInertiaData();
|
||||||
|
inertia.TotalMass = TotalMass;
|
||||||
|
inertia.CenterOfMass = CenterOfMass;
|
||||||
|
inertia.Inertia = Inertia;
|
||||||
|
inertia.InertiaRotation = aux;
|
||||||
|
|
||||||
|
if(TotalMass < 0)
|
||||||
|
RootPart.PhysicsInertia = null;
|
||||||
|
else
|
||||||
|
RootPart.PhysicsInertia = new PhysicsInertiaData(inertia);
|
||||||
|
|
||||||
|
PhysicsActor pa = RootPart.PhysActor;
|
||||||
|
if(pa !=null)
|
||||||
|
pa.SetInertiaData(inertia);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the user group to which this scene object belongs.
|
/// Set the user group to which this scene object belongs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -5217,6 +5447,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
part.ResetOwnerChangeFlag();
|
part.ResetOwnerChangeFlag();
|
||||||
});
|
});
|
||||||
|
AggregatePerms();
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear some references to easy cg
|
// clear some references to easy cg
|
||||||
|
@ -5230,6 +5461,84 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_PlaySoundSlavePrims.Clear();
|
m_PlaySoundSlavePrims.Clear();
|
||||||
m_LoopSoundMasterPrim = null;
|
m_LoopSoundMasterPrim = null;
|
||||||
m_targets.Clear();
|
m_targets.Clear();
|
||||||
|
m_partsNameToLinkMap.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Dictionary<string,int> m_partsNameToLinkMap = new Dictionary<string, int>();
|
||||||
|
private string GetLinkNumber_lastname;
|
||||||
|
private int GetLinkNumber_lastnumber;
|
||||||
|
|
||||||
|
// this scales bad but so does GetLinkNumPart
|
||||||
|
public int GetLinkNumber(string name)
|
||||||
|
{
|
||||||
|
if(String.IsNullOrEmpty(name) || name == "Object")
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
lock(m_partsNameToLinkMap)
|
||||||
|
{
|
||||||
|
if(m_partsNameToLinkMap.Count == 0)
|
||||||
|
{
|
||||||
|
GetLinkNumber_lastname = String.Empty;
|
||||||
|
GetLinkNumber_lastnumber = -1;
|
||||||
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
|
for (int i = 0; i < parts.Length; i++)
|
||||||
|
{
|
||||||
|
string s = parts[i].Name;
|
||||||
|
if(String.IsNullOrEmpty(s) || s == "Object" || s == "Primitive")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(m_partsNameToLinkMap.ContainsKey(s))
|
||||||
|
{
|
||||||
|
int ol = parts[i].LinkNum;
|
||||||
|
if(ol < m_partsNameToLinkMap[s])
|
||||||
|
m_partsNameToLinkMap[s] = ol;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_partsNameToLinkMap[s] = parts[i].LinkNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(name == GetLinkNumber_lastname)
|
||||||
|
return GetLinkNumber_lastnumber;
|
||||||
|
|
||||||
|
if(m_partsNameToLinkMap.ContainsKey(name))
|
||||||
|
{
|
||||||
|
lock(m_partsNameToLinkMap)
|
||||||
|
{
|
||||||
|
GetLinkNumber_lastname = name;
|
||||||
|
GetLinkNumber_lastnumber = m_partsNameToLinkMap[name];
|
||||||
|
return GetLinkNumber_lastnumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_sittingAvatars.Count > 0)
|
||||||
|
{
|
||||||
|
int j = m_parts.Count + 1;
|
||||||
|
|
||||||
|
ScenePresence[] avs = m_sittingAvatars.ToArray();
|
||||||
|
for (int i = 0; i < avs.Length; i++, j++)
|
||||||
|
{
|
||||||
|
if (avs[i].Name == name)
|
||||||
|
{
|
||||||
|
GetLinkNumber_lastname = name;
|
||||||
|
GetLinkNumber_lastnumber = j;
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InvalidatePartsLinkMaps()
|
||||||
|
{
|
||||||
|
lock(m_partsNameToLinkMap)
|
||||||
|
{
|
||||||
|
m_partsNameToLinkMap.Clear();
|
||||||
|
GetLinkNumber_lastname = String.Empty;
|
||||||
|
GetLinkNumber_lastnumber = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -244,11 +244,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public uint TimeStampTerse;
|
public uint TimeStampTerse;
|
||||||
|
|
||||||
// The following two are to hold the attachment data
|
|
||||||
// while an object is inworld
|
|
||||||
[XmlIgnore]
|
|
||||||
public byte AttachPoint = 0;
|
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public Quaternion AttachRotation = Quaternion.Identity;
|
public Quaternion AttachRotation = Quaternion.Identity;
|
||||||
|
|
||||||
|
@ -277,7 +272,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public scriptEvents AggregateScriptEvents;
|
public scriptEvents AggregateScriptEvents;
|
||||||
|
|
||||||
public Vector3 AttachedPos;
|
public Vector3 AttachedPos
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
// rotation locks on local X,Y and or Z axis bit flags
|
// rotation locks on local X,Y and or Z axis bit flags
|
||||||
// bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum
|
// bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum
|
||||||
|
@ -407,6 +406,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private SOPVehicle m_vehicleParams = null;
|
private SOPVehicle m_vehicleParams = null;
|
||||||
|
|
||||||
|
private PhysicsInertiaData m_physicsInertia;
|
||||||
|
|
||||||
public KeyframeMotion KeyframeMotion
|
public KeyframeMotion KeyframeMotion
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
|
@ -476,8 +477,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
APIDActive = false;
|
APIDActive = false;
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
CreateSelected = true;
|
CreateSelected = true;
|
||||||
|
|
||||||
TrimPermissions();
|
TrimPermissions();
|
||||||
|
AggregateInnerPerms();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Constructors
|
#endregion Constructors
|
||||||
|
@ -637,6 +638,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_name = value;
|
m_name = value;
|
||||||
|
if(ParentGroup != null)
|
||||||
|
ParentGroup.InvalidatePartsLinkMaps();
|
||||||
|
|
||||||
PhysicsActor pa = PhysActor;
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
|
@ -1063,7 +1066,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_angularVelocity = value;
|
m_angularVelocity = value;
|
||||||
|
|
||||||
PhysicsActor actor = PhysActor;
|
PhysicsActor actor = PhysActor;
|
||||||
if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE)
|
if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this)
|
||||||
{
|
{
|
||||||
actor.RotationalVelocity = m_angularVelocity;
|
actor.RotationalVelocity = m_angularVelocity;
|
||||||
}
|
}
|
||||||
|
@ -1089,6 +1092,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_acceleration = Vector3.Zero;
|
m_acceleration = Vector3.Zero;
|
||||||
else
|
else
|
||||||
m_acceleration = value;
|
m_acceleration = value;
|
||||||
|
|
||||||
|
PhysicsActor actor = PhysActor;
|
||||||
|
if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this)
|
||||||
|
{
|
||||||
|
actor.Acceleration = m_acceleration;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2013,7 +2022,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future
|
// SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future
|
||||||
public void SetVelocity(Vector3 pVel, bool localGlobalTF)
|
public void SetVelocity(Vector3 pVel, bool localGlobalTF)
|
||||||
{
|
{
|
||||||
if (ParentGroup == null || ParentGroup.IsDeleted)
|
if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ParentGroup.IsAttachment)
|
if (ParentGroup.IsAttachment)
|
||||||
|
@ -2040,7 +2049,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future
|
// SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future
|
||||||
public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF)
|
public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF)
|
||||||
{
|
{
|
||||||
if (ParentGroup == null || ParentGroup.IsDeleted)
|
if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ParentGroup.IsAttachment)
|
if (ParentGroup.IsAttachment)
|
||||||
|
@ -2074,6 +2083,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
||||||
public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF)
|
public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF)
|
||||||
{
|
{
|
||||||
|
if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit)
|
||||||
|
return;
|
||||||
|
|
||||||
Vector3 impulse = impulsei;
|
Vector3 impulse = impulsei;
|
||||||
|
|
||||||
if (localGlobalTF)
|
if (localGlobalTF)
|
||||||
|
@ -2228,7 +2240,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
dupe.LocalId = plocalID;
|
dupe.LocalId = plocalID;
|
||||||
|
|
||||||
// This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
|
// This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
|
||||||
dupe.LastOwnerID = OwnerID;
|
if(OwnerID != GroupID)
|
||||||
|
dupe.LastOwnerID = OwnerID;
|
||||||
|
else
|
||||||
|
dupe.LastOwnerID = LastOwnerID; // redundant ?
|
||||||
|
|
||||||
dupe.RezzerID = RezzerID;
|
dupe.RezzerID = RezzerID;
|
||||||
|
|
||||||
byte[] extraP = new byte[Shape.ExtraParams.Length];
|
byte[] extraP = new byte[Shape.ExtraParams.Length];
|
||||||
|
@ -2537,6 +2553,35 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return (uint)Flags | (uint)LocalFlags;
|
return (uint)Flags | (uint)LocalFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// some of this lines need be moved to other place later
|
||||||
|
|
||||||
|
// effective permitions considering only this part inventory contents perms
|
||||||
|
public uint AggregatedInnerOwnerPerms {get; private set; }
|
||||||
|
public uint AggregatedInnerGroupPerms {get; private set; }
|
||||||
|
public uint AggregatedInnerEveryonePerms {get; private set; }
|
||||||
|
private object InnerPermsLock = new object();
|
||||||
|
|
||||||
|
public void AggregateInnerPerms()
|
||||||
|
{
|
||||||
|
// assuming child prims permissions masks are irrelevant on a linkset
|
||||||
|
// root part is handle at SOG since its masks are the sog masks
|
||||||
|
const uint mask = (uint)PermissionMask.AllEffective;
|
||||||
|
|
||||||
|
uint owner = mask;
|
||||||
|
uint group = mask;
|
||||||
|
uint everyone = mask;
|
||||||
|
|
||||||
|
lock(InnerPermsLock) // do we really need this?
|
||||||
|
{
|
||||||
|
if(Inventory != null)
|
||||||
|
Inventory.AggregateInnerPerms(ref owner, ref group, ref everyone);
|
||||||
|
|
||||||
|
AggregatedInnerOwnerPerms = owner & mask;
|
||||||
|
AggregatedInnerGroupPerms = group & mask;
|
||||||
|
AggregatedInnerEveryonePerms = everyone & mask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Vector3 GetGeometricCenter()
|
public Vector3 GetGeometricCenter()
|
||||||
{
|
{
|
||||||
// this is not real geometric center but a average of positions relative to root prim acording to
|
// this is not real geometric center but a average of positions relative to root prim acording to
|
||||||
|
@ -3340,25 +3385,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
public void SendFullUpdateToClient(IClientAPI remoteClient)
|
public void SendFullUpdateToClient(IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
SendFullUpdateToClient(remoteClient, OffsetPosition);
|
if (ParentGroup == null || ParentGroup.IsDeleted)
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sends a full update to the client
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="remoteClient"></param>
|
|
||||||
/// <param name="lPos"></param>
|
|
||||||
public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos)
|
|
||||||
{
|
|
||||||
if (ParentGroup == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Suppress full updates during attachment editing
|
|
||||||
// sl Does send them
|
|
||||||
// if (ParentGroup.IsSelected && ParentGroup.IsAttachment)
|
|
||||||
// return;
|
|
||||||
|
|
||||||
if (ParentGroup.IsDeleted)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ParentGroup.IsAttachment
|
if (ParentGroup.IsAttachment
|
||||||
|
@ -3516,6 +3543,18 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
Force = force;
|
Force = force;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PhysicsInertiaData PhysicsInertia
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_physicsInertia;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
m_physicsInertia = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SOPVehicle VehicleParams
|
public SOPVehicle VehicleParams
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -3689,7 +3728,18 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
bool hasDimple;
|
bool hasDimple;
|
||||||
bool hasProfileCut;
|
bool hasProfileCut;
|
||||||
|
|
||||||
PrimType primType = GetPrimType();
|
if(Shape.SculptEntry)
|
||||||
|
{
|
||||||
|
if (Shape.SculptType != (byte)SculptType.Mesh)
|
||||||
|
return 1; // sculp
|
||||||
|
|
||||||
|
//hack to detect new upload with faces data enconded on pbs
|
||||||
|
if ((Shape.ProfileCurve & 0xf0) != (byte)HollowShape.Triangle)
|
||||||
|
// old broken upload TODO
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
PrimType primType = GetPrimType(true);
|
||||||
HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
|
HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
|
||||||
|
|
||||||
switch (primType)
|
switch (primType)
|
||||||
|
@ -3733,13 +3783,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
if (hasProfileCut) ret += 2;
|
if (hasProfileCut) ret += 2;
|
||||||
if (hasHollow) ret += 1;
|
if (hasHollow) ret += 1;
|
||||||
break;
|
break;
|
||||||
case PrimType.SCULPT:
|
|
||||||
// Special mesh handling
|
|
||||||
if (Shape.SculptType == (byte)SculptType.Mesh)
|
|
||||||
ret = 8; // if it's a mesh then max 8 faces
|
|
||||||
else
|
|
||||||
ret = 1; // if it's a sculpt then max 1 face
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -3750,9 +3793,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="primShape"></param>
|
/// <param name="primShape"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PrimType GetPrimType()
|
public PrimType GetPrimType(bool ignoreSculpt = false)
|
||||||
{
|
{
|
||||||
if (Shape.SculptEntry)
|
if (Shape.SculptEntry && !ignoreSculpt)
|
||||||
return PrimType.SCULPT;
|
return PrimType.SCULPT;
|
||||||
|
|
||||||
if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
|
if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
|
||||||
|
@ -4464,7 +4507,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
AggregateInnerPerms();
|
||||||
SendFullUpdateToAllClients();
|
SendFullUpdateToAllClients();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4481,6 +4524,8 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
EveryoneMask = source.EveryoneMask & BaseMask;
|
EveryoneMask = source.EveryoneMask & BaseMask;
|
||||||
NextOwnerMask = source.NextOwnerMask & BaseMask;
|
NextOwnerMask = source.NextOwnerMask & BaseMask;
|
||||||
|
|
||||||
|
AggregateInnerPerms();
|
||||||
|
|
||||||
if (OwnerMask != prevOwnerMask ||
|
if (OwnerMask != prevOwnerMask ||
|
||||||
GroupMask != prevGroupMask ||
|
GroupMask != prevGroupMask ||
|
||||||
EveryoneMask != prevEveryoneMask ||
|
EveryoneMask != prevEveryoneMask ||
|
||||||
|
@ -4714,8 +4759,13 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
|
|
||||||
if (VolumeDetectActive) // change if not the default only
|
if (VolumeDetectActive) // change if not the default only
|
||||||
pa.SetVolumeDetect(1);
|
pa.SetVolumeDetect(1);
|
||||||
|
|
||||||
|
bool isroot = (m_localId == ParentGroup.RootPart.LocalId);
|
||||||
|
|
||||||
if (m_vehicleParams != null && m_localId == ParentGroup.RootPart.LocalId)
|
if(isroot && m_physicsInertia != null)
|
||||||
|
pa.SetInertiaData(m_physicsInertia);
|
||||||
|
|
||||||
|
if (isroot && m_vehicleParams != null )
|
||||||
{
|
{
|
||||||
m_vehicleParams.SetVehicle(pa);
|
m_vehicleParams.SetVehicle(pa);
|
||||||
if(isPhysical && !isPhantom && m_vehicleParams.CameraDecoupled)
|
if(isPhysical && !isPhantom && m_vehicleParams.CameraDecoupled)
|
||||||
|
@ -5181,7 +5231,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
/// <param name="scene">The scene the prim is being rezzed into</param>
|
/// <param name="scene">The scene the prim is being rezzed into</param>
|
||||||
public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene)
|
public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene)
|
||||||
{
|
{
|
||||||
if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0))
|
if ((OwnerID != item.Owner) || ((item.CurrentPermissions & (uint)PermissionMask.Slam) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0))
|
||||||
{
|
{
|
||||||
if (scene.Permissions.PropagatePermissions())
|
if (scene.Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
|
@ -5212,16 +5262,13 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
|
|
||||||
if (OwnerID != item.Owner)
|
if (OwnerID != item.Owner)
|
||||||
{
|
{
|
||||||
//LogPermissions("Before ApplyNextOwnerPermissions");
|
if(OwnerID != GroupID)
|
||||||
|
LastOwnerID = OwnerID;
|
||||||
|
OwnerID = item.Owner;
|
||||||
|
Inventory.ChangeInventoryOwner(item.Owner);
|
||||||
|
|
||||||
if (scene.Permissions.PropagatePermissions())
|
if (scene.Permissions.PropagatePermissions())
|
||||||
ApplyNextOwnerPermissions();
|
ApplyNextOwnerPermissions();
|
||||||
|
|
||||||
//LogPermissions("After ApplyNextOwnerPermissions");
|
|
||||||
|
|
||||||
LastOwnerID = OwnerID;
|
|
||||||
OwnerID = item.Owner;
|
|
||||||
Inventory.ChangeInventoryOwner(item.Owner);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5245,6 +5292,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
GroupMask = 0; // Giving an object zaps group permissions
|
GroupMask = 0; // Giving an object zaps group permissions
|
||||||
|
|
||||||
Inventory.ApplyNextOwnerPermissions();
|
Inventory.ApplyNextOwnerPermissions();
|
||||||
|
AggregateInnerPerms();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateLookAt()
|
public void UpdateLookAt()
|
||||||
|
@ -5306,6 +5354,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
item.OwnerChanged = false;
|
item.OwnerChanged = false;
|
||||||
Inventory.UpdateInventoryItem(item, false, false);
|
Inventory.UpdateInventoryItem(item, false, false);
|
||||||
}
|
}
|
||||||
|
AggregateInnerPerms();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -360,7 +360,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}",
|
// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}",
|
||||||
// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
|
if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item, m_part))
|
||||||
{
|
{
|
||||||
StoreScriptError(item.ItemID, "no permission");
|
StoreScriptError(item.ItemID, "no permission");
|
||||||
return false;
|
return false;
|
||||||
|
@ -807,6 +807,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
|
|
||||||
|
m_part.AggregateInnerPerms();
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
//m_inventorySerial += 2;
|
//m_inventorySerial += 2;
|
||||||
HasInventoryChanged = true;
|
HasInventoryChanged = true;
|
||||||
|
@ -829,7 +830,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
// m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
}
|
}
|
||||||
m_items.LockItemsForWrite(false);
|
m_items.LockItemsForWrite(false);
|
||||||
|
m_part.AggregateInnerPerms();
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -943,8 +944,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
group.SetGroup(m_part.GroupID, null);
|
group.SetGroup(m_part.GroupID, null);
|
||||||
|
|
||||||
// TODO: Remove magic number badness
|
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
|
||||||
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
|
|
||||||
{
|
{
|
||||||
if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
|
if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
|
@ -964,10 +964,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
foreach (SceneObjectPart part in partList)
|
foreach (SceneObjectPart part in partList)
|
||||||
{
|
{
|
||||||
// TODO: Remove magic number badness
|
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
|
||||||
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
|
|
||||||
{
|
{
|
||||||
part.LastOwnerID = part.OwnerID;
|
if(part.GroupID != part.OwnerID)
|
||||||
|
part.LastOwnerID = part.OwnerID;
|
||||||
part.OwnerID = item.OwnerID;
|
part.OwnerID = item.OwnerID;
|
||||||
part.Inventory.ChangeInventoryOwner(item.OwnerID);
|
part.Inventory.ChangeInventoryOwner(item.OwnerID);
|
||||||
}
|
}
|
||||||
|
@ -981,6 +981,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
// old code end
|
// old code end
|
||||||
rootPart.TrimPermissions();
|
rootPart.TrimPermissions();
|
||||||
|
group.AggregateDeepPerms();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1022,16 +1023,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
item.AssetID = m_items[item.ItemID].AssetID;
|
item.AssetID = m_items[item.ItemID].AssetID;
|
||||||
|
|
||||||
m_items[item.ItemID] = item;
|
m_items[item.ItemID] = item;
|
||||||
|
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
if (fireScriptEvents)
|
if (fireScriptEvents)
|
||||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
|
|
||||||
if (considerChanged)
|
if (considerChanged)
|
||||||
{
|
{
|
||||||
|
m_part.AggregateInnerPerms();
|
||||||
|
m_part.ParentGroup.AggregatePerms();
|
||||||
HasInventoryChanged = true;
|
HasInventoryChanged = true;
|
||||||
m_part.ParentGroup.HasGroupChanged = true;
|
m_part.ParentGroup.HasGroupChanged = true;
|
||||||
}
|
}
|
||||||
m_items.LockItemsForWrite(false);
|
m_items.LockItemsForWrite(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1068,6 +1073,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_items.LockItemsForWrite(true);
|
m_items.LockItemsForWrite(true);
|
||||||
m_items.Remove(itemID);
|
m_items.Remove(itemID);
|
||||||
m_items.LockItemsForWrite(false);
|
m_items.LockItemsForWrite(false);
|
||||||
|
|
||||||
|
m_part.AggregateInnerPerms();
|
||||||
|
m_part.ParentGroup.AggregatePerms();
|
||||||
|
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
|
|
||||||
|
@ -1170,7 +1179,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
{
|
{
|
||||||
UUID ownerID = item.OwnerID;
|
UUID ownerID = item.OwnerID;
|
||||||
uint everyoneMask = 0;
|
uint everyoneMask = item.EveryonePermissions;
|
||||||
uint baseMask = item.BasePermissions;
|
uint baseMask = item.BasePermissions;
|
||||||
uint ownerMask = item.CurrentPermissions;
|
uint ownerMask = item.CurrentPermissions;
|
||||||
uint groupMask = item.GroupPermissions;
|
uint groupMask = item.GroupPermissions;
|
||||||
|
@ -1319,6 +1328,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AggregateInnerPerms(ref uint owner, ref uint group, ref uint everyone)
|
||||||
|
{
|
||||||
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
|
{
|
||||||
|
owner &= item.CurrentPermissions;
|
||||||
|
group &= item.GroupPermissions;
|
||||||
|
everyone &= item.EveryonePermissions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public uint MaskEffectivePermissions()
|
public uint MaskEffectivePermissions()
|
||||||
{
|
{
|
||||||
uint mask=0x7fffffff;
|
uint mask=0x7fffffff;
|
||||||
|
|
|
@ -1778,6 +1778,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private Dictionary<ulong, spRegionSizeInfo> m_knownChildRegionsSizeInfo = new Dictionary<ulong, spRegionSizeInfo>();
|
private Dictionary<ulong, spRegionSizeInfo> m_knownChildRegionsSizeInfo = new Dictionary<ulong, spRegionSizeInfo>();
|
||||||
|
|
||||||
|
public void AddNeighbourRegion(GridRegion region, string capsPath)
|
||||||
|
{
|
||||||
|
lock (m_knownChildRegions)
|
||||||
|
{
|
||||||
|
ulong regionHandle = region.RegionHandle;
|
||||||
|
m_knownChildRegions.Add(regionHandle,capsPath);
|
||||||
|
|
||||||
|
spRegionSizeInfo sizeInfo = new spRegionSizeInfo();
|
||||||
|
sizeInfo.sizeX = region.RegionSizeX;
|
||||||
|
sizeInfo.sizeY = region.RegionSizeY;
|
||||||
|
m_knownChildRegionsSizeInfo[regionHandle] = sizeInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void AddNeighbourRegionSizeInfo(GridRegion region)
|
public void AddNeighbourRegionSizeInfo(GridRegion region)
|
||||||
{
|
{
|
||||||
lock (m_knownChildRegions)
|
lock (m_knownChildRegions)
|
||||||
|
@ -1826,6 +1840,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool knowsNeighbourRegion(ulong regionHandle)
|
||||||
|
{
|
||||||
|
lock (m_knownChildRegions)
|
||||||
|
return m_knownChildRegions.ContainsKey(regionHandle);
|
||||||
|
}
|
||||||
|
|
||||||
public void DropOldNeighbours(List<ulong> oldRegions)
|
public void DropOldNeighbours(List<ulong> oldRegions)
|
||||||
{
|
{
|
||||||
foreach (ulong handle in oldRegions)
|
foreach (ulong handle in oldRegions)
|
||||||
|
@ -2010,6 +2030,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
||||||
|
|
||||||
if(!haveGroupInformation && !IsChildAgent && !IsNPC)
|
if(!haveGroupInformation && !IsChildAgent && !IsNPC)
|
||||||
|
@ -2029,11 +2050,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF);
|
m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell the client that we're totally ready
|
|
||||||
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
|
|
||||||
|
|
||||||
m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(m_callbackURI))
|
if (!string.IsNullOrEmpty(m_callbackURI))
|
||||||
{
|
{
|
||||||
// We cannot sleep here since this would hold up the inbound packet processing thread, as
|
// We cannot sleep here since this would hold up the inbound packet processing thread, as
|
||||||
|
@ -2054,6 +2070,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI);
|
Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI);
|
||||||
m_callbackURI = null;
|
m_callbackURI = null;
|
||||||
|
m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
|
@ -2062,19 +2079,58 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
|
// client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
|
||||||
|
// Tell the client that we're totally ready
|
||||||
|
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
|
||||||
|
m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
||||||
|
|
||||||
|
bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0;
|
||||||
|
|
||||||
|
int delayctnr = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
|
if (!IsChildAgent)
|
||||||
|
{
|
||||||
|
if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
// SceneObjectPart root = ParentPart.ParentGroup.RootPart;
|
||||||
|
// if(root.LocalId != ParentPart.LocalId)
|
||||||
|
// ControllingClient.SendEntityTerseUpdateImmediate(root);
|
||||||
|
// ControllingClient.SendEntityTerseUpdateImmediate(ParentPart);
|
||||||
|
ParentPart.ParentGroup.SendFullUpdateToClient(ControllingClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify baked textures and cache
|
||||||
|
bool cachedbaked = false;
|
||||||
|
|
||||||
|
if (IsNPC)
|
||||||
|
cachedbaked = true;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_scene.AvatarFactory != null && !isHGTP)
|
||||||
|
cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this);
|
||||||
|
|
||||||
|
// not sure we need this
|
||||||
|
if (!cachedbaked)
|
||||||
|
{
|
||||||
|
if (m_scene.AvatarFactory != null)
|
||||||
|
m_scene.AvatarFactory.QueueAppearanceSave(UUID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
||||||
|
}
|
||||||
|
|
||||||
if(m_teleportFlags > 0)
|
if(m_teleportFlags > 0)
|
||||||
{
|
{
|
||||||
gotCrossUpdate = false; // sanity check
|
gotCrossUpdate = false; // sanity check
|
||||||
Thread.Sleep(500); // let viewers catch us
|
if(Util.EnvironmentTickCountSubtract(delayctnr)< 500)
|
||||||
|
Thread.Sleep(500); // let viewers catch us
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!gotCrossUpdate)
|
if(!gotCrossUpdate)
|
||||||
RotateToLookAt(look);
|
RotateToLookAt(look);
|
||||||
|
|
||||||
// HG
|
// HG
|
||||||
bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0;
|
|
||||||
if(isHGTP)
|
if(isHGTP)
|
||||||
{
|
{
|
||||||
// ControllingClient.SendNameReply(m_uuid, Firstname, Lastname);
|
// ControllingClient.SendNameReply(m_uuid, Firstname, Lastname);
|
||||||
|
@ -2101,28 +2157,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (!IsChildAgent)
|
if (!IsChildAgent)
|
||||||
{
|
{
|
||||||
// verify baked textures and cache
|
|
||||||
bool cachedbaked = false;
|
|
||||||
|
|
||||||
if (IsNPC)
|
|
||||||
cachedbaked = true;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_scene.AvatarFactory != null && !isHGTP)
|
|
||||||
cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this);
|
|
||||||
|
|
||||||
// not sure we need this
|
|
||||||
if (!cachedbaked)
|
|
||||||
{
|
|
||||||
if (m_scene.AvatarFactory != null)
|
|
||||||
m_scene.AvatarFactory.QueueAppearanceSave(UUID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ScenePresence> allpresences = m_scene.GetScenePresences();
|
List<ScenePresence> allpresences = m_scene.GetScenePresences();
|
||||||
|
|
||||||
// send avatar object to all presences including us, so they cross it into region
|
// send avatar object to all presences including us, so they cross it into region
|
||||||
// then hide if necessary
|
// then hide if necessary
|
||||||
|
|
||||||
SendInitialAvatarDataToAllAgents(allpresences);
|
SendInitialAvatarDataToAllAgents(allpresences);
|
||||||
|
|
||||||
// send this look
|
// send this look
|
||||||
|
@ -2230,13 +2269,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_lastChildAgentUpdateDrawDistance = DrawDistance;
|
m_lastChildAgentUpdateDrawDistance = DrawDistance;
|
||||||
m_lastChildAgentUpdatePosition = AbsolutePosition;
|
m_lastChildAgentUpdatePosition = AbsolutePosition;
|
||||||
m_childUpdatesBusy = false; // allow them
|
m_childUpdatesBusy = false; // allow them
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// send the rest of the world
|
// send the rest of the world
|
||||||
if (m_teleportFlags > 0 && !IsNPC || m_currentParcelHide)
|
if (m_teleportFlags > 0 && !IsNPC || m_currentParcelHide)
|
||||||
SendInitialDataToMe();
|
SendInitialDataToMe();
|
||||||
|
|
||||||
|
|
||||||
// priority uses avatar position only
|
// priority uses avatar position only
|
||||||
// m_reprioritizationLastPosition = AbsolutePosition;
|
// m_reprioritizationLastPosition = AbsolutePosition;
|
||||||
|
@ -3110,6 +3154,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose;
|
Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose;
|
||||||
m_pos = standPos;
|
m_pos = standPos;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to wait until we have calculated proper stand positions before sitting up the physical
|
// We need to wait until we have calculated proper stand positions before sitting up the physical
|
||||||
|
@ -3124,6 +3169,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
|
|
||||||
SendAvatarDataToAllAgents();
|
SendAvatarDataToAllAgents();
|
||||||
|
m_scene.EventManager.TriggerParcelPrimCountTainted(); // update select/ sat on
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset to default sitAnimation
|
// reset to default sitAnimation
|
||||||
|
@ -3256,6 +3302,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Moved here to avoid a race with default sit anim
|
// Moved here to avoid a race with default sit anim
|
||||||
// The script event needs to be raised after the default sit anim is set.
|
// The script event needs to be raised after the default sit anim is set.
|
||||||
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
|
m_scene.EventManager.TriggerParcelPrimCountTainted(); // update select/ sat on
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3405,6 +3452,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Animator.SetMovementAnimations("SIT");
|
Animator.SetMovementAnimations("SIT");
|
||||||
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
|
m_scene.EventManager.TriggerParcelPrimCountTainted(); // update select/ sat on
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)
|
public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)
|
||||||
|
@ -3968,7 +4016,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
int count = 0;
|
int count = 0;
|
||||||
foreach (ScenePresence p in presences)
|
foreach (ScenePresence p in presences)
|
||||||
{
|
{
|
||||||
p.ControllingClient.SendAvatarDataImmediate(this);
|
p.ControllingClient.SendEntityFullUpdateImmediate(this);
|
||||||
if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod)
|
if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod)
|
||||||
// either just kill the object
|
// either just kill the object
|
||||||
// p.ControllingClient.SendKillObject(new List<uint> {LocalId});
|
// p.ControllingClient.SendKillObject(new List<uint> {LocalId});
|
||||||
|
@ -3981,7 +4029,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void SendInitialAvatarDataToAgent(ScenePresence p)
|
public void SendInitialAvatarDataToAgent(ScenePresence p)
|
||||||
{
|
{
|
||||||
p.ControllingClient.SendAvatarDataImmediate(this);
|
p.ControllingClient.SendEntityFullUpdateImmediate(this);
|
||||||
if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod)
|
if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod)
|
||||||
// either just kill the object
|
// either just kill the object
|
||||||
// p.ControllingClient.SendKillObject(new List<uint> {LocalId});
|
// p.ControllingClient.SendKillObject(new List<uint> {LocalId});
|
||||||
|
@ -3998,12 +4046,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
|
//m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
|
||||||
if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.IsViewerUIGod)
|
if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.IsViewerUIGod)
|
||||||
return;
|
return;
|
||||||
avatar.ControllingClient.SendAvatarDataImmediate(this);
|
avatar.ControllingClient.SendEntityFullUpdateImmediate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAvatarDataToAgentNF(ScenePresence avatar)
|
public void SendAvatarDataToAgentNF(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
avatar.ControllingClient.SendAvatarDataImmediate(this);
|
avatar.ControllingClient.SendEntityFullUpdateImmediate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -6440,7 +6488,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (check)
|
if (check)
|
||||||
{
|
{
|
||||||
// check is relative to current parcel only
|
// check is relative to current parcel only
|
||||||
if (currentParcelUUID == null || oldhide == currentParcelHide)
|
if (oldhide == currentParcelHide)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
allpresences = m_scene.GetScenePresences();
|
allpresences = m_scene.GetScenePresences();
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
// Script state may, or may not, exist. Not having any, is NOT
|
// Script state may, or may not, exist. Not having any, is NOT
|
||||||
// ever a problem.
|
// ever a problem.
|
||||||
sceneObject.LoadScriptState(reader);
|
sceneObject.LoadScriptState(reader);
|
||||||
|
sceneObject.AggregateDeepPerms();
|
||||||
return sceneObject;
|
return sceneObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
// Script state may, or may not, exist. Not having any, is NOT
|
// Script state may, or may not, exist. Not having any, is NOT
|
||||||
// ever a problem.
|
// ever a problem.
|
||||||
sceneObject.LoadScriptState(doc);
|
sceneObject.LoadScriptState(doc);
|
||||||
|
sceneObject.AggregatePerms();
|
||||||
return sceneObject;
|
return sceneObject;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -453,9 +453,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
m_SOPXmlProcessors.Add("Torque", ProcessTorque);
|
m_SOPXmlProcessors.Add("Torque", ProcessTorque);
|
||||||
m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive);
|
m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive);
|
||||||
|
|
||||||
|
|
||||||
m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle);
|
m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle);
|
||||||
|
|
||||||
|
m_SOPXmlProcessors.Add("PhysicsInertia", ProcessPhysicsInertia);
|
||||||
|
|
||||||
m_SOPXmlProcessors.Add("RotationAxisLocks", ProcessRotationAxisLocks);
|
m_SOPXmlProcessors.Add("RotationAxisLocks", ProcessRotationAxisLocks);
|
||||||
m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
|
m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
|
||||||
m_SOPXmlProcessors.Add("Density", ProcessDensity);
|
m_SOPXmlProcessors.Add("Density", ProcessDensity);
|
||||||
|
@ -781,6 +782,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ProcessPhysicsInertia(SceneObjectPart obj, XmlReader reader)
|
||||||
|
{
|
||||||
|
PhysicsInertiaData pdata = PhysicsInertiaData.FromXml2(reader);
|
||||||
|
|
||||||
|
if (pdata == null)
|
||||||
|
{
|
||||||
|
obj.PhysicsInertia = null;
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[SceneObjectSerializer]: Parsing PhysicsInertiaData for object part {0} {1} encountered errors. Please see earlier log entries.",
|
||||||
|
obj.Name, obj.UUID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obj.PhysicsInertia = pdata;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
|
private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
|
||||||
{
|
{
|
||||||
List<string> errorNodeNames;
|
List<string> errorNodeNames;
|
||||||
|
@ -1498,6 +1516,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
if (sop.VehicleParams != null)
|
if (sop.VehicleParams != null)
|
||||||
sop.VehicleParams.ToXml2(writer);
|
sop.VehicleParams.ToXml2(writer);
|
||||||
|
|
||||||
|
if (sop.PhysicsInertia != null)
|
||||||
|
sop.PhysicsInertia.ToXml2(writer);
|
||||||
|
|
||||||
if(sop.RotationAxisLocks != 0)
|
if(sop.RotationAxisLocks != 0)
|
||||||
writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower());
|
writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower());
|
||||||
writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
|
writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
|
||||||
|
@ -1739,6 +1760,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
|
|
||||||
reader.ReadEndElement(); // SceneObjectPart
|
reader.ReadEndElement(); // SceneObjectPart
|
||||||
|
|
||||||
|
obj.AggregateInnerPerms();
|
||||||
// m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID);
|
// m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||||
//obj.RegenerateFullIDs();
|
//obj.RegenerateFullIDs();
|
||||||
|
|
||||||
scene.AddNewSceneObject(obj, true);
|
scene.AddNewSceneObject(obj, true);
|
||||||
|
obj.AggregateDeepPerms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
|
|
||||||
SceneObjectGroup dupeSo
|
SceneObjectGroup dupeSo
|
||||||
= scene.SceneGraph.DuplicateObject(
|
= scene.SceneGraph.DuplicateObject(
|
||||||
part1.LocalId, new Vector3(10, 0, 0), 0, ownerId, UUID.Zero, Quaternion.Identity);
|
part1.LocalId, new Vector3(10, 0, 0), ownerId, UUID.Zero, Quaternion.Identity, false);
|
||||||
Assert.That(dupeSo.Parts.Length, Is.EqualTo(2));
|
Assert.That(dupeSo.Parts.Length, Is.EqualTo(2));
|
||||||
|
|
||||||
SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1);
|
SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1);
|
||||||
|
|
|
@ -157,29 +157,28 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
|
|
||||||
// Cross
|
// Cross
|
||||||
sceneA.SceneGraph.UpdatePrimGroupPosition(
|
sceneA.SceneGraph.UpdatePrimGroupPosition(
|
||||||
so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), userId);
|
so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), sp1SceneA.ControllingClient);
|
||||||
|
|
||||||
// crossing is async
|
// crossing is async
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
|
|
||||||
SceneObjectGroup so1PostCross;
|
SceneObjectGroup so1PostCross;
|
||||||
|
|
||||||
{
|
ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId);
|
||||||
ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId);
|
Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false");
|
||||||
Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false");
|
|
||||||
|
|
||||||
ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId);
|
ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId);
|
||||||
TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient);
|
TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient);
|
||||||
sceneBTc.CompleteMovement();
|
sceneBTc.CompleteMovement();
|
||||||
|
|
||||||
Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true");
|
Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true");
|
||||||
Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject);
|
Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject);
|
||||||
|
|
||||||
|
Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck");
|
||||||
|
so1PostCross = sceneB.GetSceneObjectGroup(so1Id);
|
||||||
|
Assert.NotNull(so1PostCross);
|
||||||
|
Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount());
|
||||||
|
|
||||||
Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck");
|
|
||||||
so1PostCross = sceneB.GetSceneObjectGroup(so1Id);
|
|
||||||
Assert.NotNull(so1PostCross);
|
|
||||||
Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount());
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector3 so1PostCrossPos = so1PostCross.AbsolutePosition;
|
Vector3 so1PostCrossPos = so1PostCross.AbsolutePosition;
|
||||||
|
|
||||||
|
@ -187,7 +186,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
|
|
||||||
// Recross
|
// Recross
|
||||||
sceneB.SceneGraph.UpdatePrimGroupPosition(
|
sceneB.SceneGraph.UpdatePrimGroupPosition(
|
||||||
so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), userId);
|
so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), sp1SceneBPostCross.ControllingClient);
|
||||||
|
|
||||||
// crossing is async
|
// crossing is async
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
|
@ -255,13 +254,19 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
lmmA.EventManagerOnNoLandDataFromStorage();
|
lmmA.EventManagerOnNoLandDataFromStorage();
|
||||||
lmmB.EventManagerOnNoLandDataFromStorage();
|
lmmB.EventManagerOnNoLandDataFromStorage();
|
||||||
|
|
||||||
|
AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
|
||||||
|
TestClient tc = new TestClient(acd, sceneA);
|
||||||
|
List<TestClient> destinationTestClients = new List<TestClient>();
|
||||||
|
EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
|
||||||
|
ScenePresence sp1SceneA = SceneHelpers.AddScenePresence(sceneA, tc, acd);
|
||||||
|
|
||||||
SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail);
|
SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail);
|
||||||
UUID so1Id = so1.UUID;
|
UUID so1Id = so1.UUID;
|
||||||
so1.AbsolutePosition = new Vector3(128, 10, 20);
|
so1.AbsolutePosition = new Vector3(128, 10, 20);
|
||||||
|
|
||||||
// Cross with a negative value. We must make this call rather than setting AbsolutePosition directly
|
// Cross with a negative value. We must make this call rather than setting AbsolutePosition directly
|
||||||
// because only this will execute permission checks in the source region.
|
// because only this will execute permission checks in the source region.
|
||||||
sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), userId);
|
sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), sp1SceneA.ControllingClient);
|
||||||
|
|
||||||
// crossing is async
|
// crossing is async
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
|
|
|
@ -1097,7 +1097,12 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAvatarDataImmediate(ISceneEntity avatar)
|
public void SendEntityFullUpdateImmediate(ISceneEntity ent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,11 +134,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
|
||||||
private int llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint)
|
private int llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint)
|
||||||
{
|
{
|
||||||
SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host);
|
SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host);
|
||||||
|
|
||||||
if (hostPart == null)
|
if (hostPart == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (hostPart.ParentGroup.IsAttachment)
|
SceneObjectGroup hostgroup = hostPart.ParentGroup;
|
||||||
|
|
||||||
|
if (hostgroup== null || hostgroup.IsAttachment)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface<IAttachmentsModule>();
|
IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface<IAttachmentsModule>();
|
||||||
|
@ -156,32 +157,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
|
||||||
if (!m_scene.TryGetScenePresence(item.PermsGranter, out target))
|
if (!m_scene.TryGetScenePresence(item.PermsGranter, out target))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (target.UUID != hostPart.ParentGroup.OwnerID)
|
if (target.UUID != hostgroup.OwnerID)
|
||||||
{
|
{
|
||||||
uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions();
|
uint effectivePerms = hostgroup.EffectiveOwnerPerms;
|
||||||
|
|
||||||
if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
|
if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
hostPart.ParentGroup.SetOwnerId(target.UUID);
|
hostgroup.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId);
|
||||||
hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId);
|
|
||||||
|
|
||||||
if (m_scene.Permissions.PropagatePermissions())
|
if (m_scene.Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart child in hostPart.ParentGroup.Parts)
|
foreach (SceneObjectPart child in hostgroup.Parts)
|
||||||
{
|
{
|
||||||
child.Inventory.ChangeInventoryOwner(target.UUID);
|
child.Inventory.ChangeInventoryOwner(target.UUID);
|
||||||
child.TriggerScriptChangedEvent(Changed.OWNER);
|
child.TriggerScriptChangedEvent(Changed.OWNER);
|
||||||
child.ApplyNextOwnerPermissions();
|
child.ApplyNextOwnerPermissions();
|
||||||
}
|
}
|
||||||
|
hostgroup.AggregatePerms();
|
||||||
}
|
}
|
||||||
|
|
||||||
hostPart.ParentGroup.RootPart.ObjectSaleType = 0;
|
hostgroup.RootPart.ObjectSaleType = 0;
|
||||||
hostPart.ParentGroup.RootPart.SalePrice = 10;
|
hostgroup.RootPart.SalePrice = 10;
|
||||||
|
|
||||||
hostPart.ParentGroup.HasGroupChanged = true;
|
hostgroup.HasGroupChanged = true;
|
||||||
hostPart.ParentGroup.RootPart.SendPropertiesToClient(target.ControllingClient);
|
hostgroup.RootPart.SendPropertiesToClient(target.ControllingClient);
|
||||||
hostPart.ParentGroup.RootPart.ScheduleFullUpdate();
|
hostgroup.RootPart.ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, true) ? 1 : 0;
|
return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, true) ? 1 : 0;
|
||||||
|
|
|
@ -0,0 +1,195 @@
|
||||||
|
/*
|
||||||
|
* 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 System.Text;
|
||||||
|
using log4net;
|
||||||
|
using Mono.Addins;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using netcd;
|
||||||
|
using netcd.Serialization;
|
||||||
|
using netcd.Advanced;
|
||||||
|
using netcd.Advanced.Requests;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.OptionalModules.Framework.Monitoring
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Allows to store monitoring data in etcd, a high availability
|
||||||
|
/// name-value store.
|
||||||
|
/// </summary>
|
||||||
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EtcdMonitoringModule")]
|
||||||
|
public class EtcdMonitoringModule : INonSharedRegionModule, IEtcdModule
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
protected Scene m_scene;
|
||||||
|
protected IEtcdClient m_client;
|
||||||
|
protected bool m_enabled = false;
|
||||||
|
protected string m_etcdBasePath = String.Empty;
|
||||||
|
protected bool m_appendRegionID = true;
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "EtcdMonitoringModule"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type ReplaceableInterface
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialise(IConfigSource source)
|
||||||
|
{
|
||||||
|
if (source.Configs["Etcd"] == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IConfig etcdConfig = source.Configs["Etcd"];
|
||||||
|
|
||||||
|
string etcdUrls = etcdConfig.GetString("EtcdUrls", String.Empty);
|
||||||
|
if (etcdUrls == String.Empty)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_etcdBasePath = etcdConfig.GetString("BasePath", m_etcdBasePath);
|
||||||
|
m_appendRegionID = etcdConfig.GetBoolean("AppendRegionID", m_appendRegionID);
|
||||||
|
|
||||||
|
if (!m_etcdBasePath.EndsWith("/"))
|
||||||
|
m_etcdBasePath += "/";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string[] endpoints = etcdUrls.Split(new char[] {','});
|
||||||
|
List<Uri> uris = new List<Uri>();
|
||||||
|
foreach (string endpoint in endpoints)
|
||||||
|
uris.Add(new Uri(endpoint.Trim()));
|
||||||
|
|
||||||
|
m_client = new EtcdClient(uris.ToArray(), new DefaultSerializer(), new DefaultSerializer());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[ETCD]: Error initializing connection: " + e.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.DebugFormat("[ETCD]: Etcd module configured");
|
||||||
|
m_enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
//m_client = null;
|
||||||
|
m_scene = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
m_scene = scene;
|
||||||
|
|
||||||
|
if (m_enabled)
|
||||||
|
{
|
||||||
|
if (m_appendRegionID)
|
||||||
|
m_etcdBasePath += m_scene.RegionInfo.RegionID.ToString() + "/";
|
||||||
|
|
||||||
|
m_log.DebugFormat("[ETCD]: Using base path {0} for all keys", m_etcdBasePath);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_client.Advanced.CreateDirectory(new CreateDirectoryRequest() {Key = m_etcdBasePath});
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("Exception trying to create base path {0}: " + e.ToString(), m_etcdBasePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
scene.RegisterModuleInterface<IEtcdModule>(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Store(string k, string v)
|
||||||
|
{
|
||||||
|
return Store(k, v, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Store(string k, string v, int ttl)
|
||||||
|
{
|
||||||
|
Response resp = m_client.Advanced.SetKey(new SetKeyRequest() { Key = m_etcdBasePath + k, Value = v, TimeToLive = ttl });
|
||||||
|
|
||||||
|
if (resp == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (resp.ErrorCode.HasValue)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[ETCD]: Error {0} ({1}) storing {2} => {3}", resp.Cause, (int)resp.ErrorCode, m_etcdBasePath + k, v);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Get(string k)
|
||||||
|
{
|
||||||
|
Response resp = m_client.Advanced.GetKey(new GetKeyRequest() { Key = m_etcdBasePath + k });
|
||||||
|
|
||||||
|
if (resp == null)
|
||||||
|
return String.Empty;
|
||||||
|
|
||||||
|
if (resp.ErrorCode.HasValue)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[ETCD]: Error {0} ({1}) getting {2}", resp.Cause, (int)resp.ErrorCode, m_etcdBasePath + k);
|
||||||
|
|
||||||
|
return String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp.Node.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Delete(string k)
|
||||||
|
{
|
||||||
|
m_client.Advanced.DeleteKey(new DeleteKeyRequest() { Key = m_etcdBasePath + k });
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Watch(string k, Action<string> callback)
|
||||||
|
{
|
||||||
|
m_client.Advanced.WatchKey(new WatchKeyRequest() { Key = m_etcdBasePath + k, Callback = (x) => { callback(x.Node.Value); } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -329,7 +329,7 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
AssetBase matAsset = m_scene.AssetService.Get(id.ToString());
|
AssetBase matAsset = m_scene.AssetService.Get(id.ToString());
|
||||||
if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 )
|
if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 )
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
|
//m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ namespace OpenSim.Region.OptionalModules
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private bool m_enabled;
|
private bool m_enabled;
|
||||||
|
|
||||||
|
private Scene m_scene;
|
||||||
public string Name { get { return "PrimLimitsModule"; } }
|
public string Name { get { return "PrimLimitsModule"; } }
|
||||||
|
|
||||||
public Type ReplaceableInterface { get { return null; } }
|
public Type ReplaceableInterface { get { return null; } }
|
||||||
|
@ -77,11 +78,12 @@ namespace OpenSim.Region.OptionalModules
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
m_scene = scene;
|
||||||
scene.Permissions.OnRezObject += CanRezObject;
|
scene.Permissions.OnRezObject += CanRezObject;
|
||||||
scene.Permissions.OnObjectEntry += CanObjectEnter;
|
scene.Permissions.OnObjectEntry += CanObjectEnter;
|
||||||
|
scene.Permissions.OnObjectEnterWithScripts += CanObjectEnterWithScripts;
|
||||||
scene.Permissions.OnDuplicateObject += CanDuplicateObject;
|
scene.Permissions.OnDuplicateObject += CanDuplicateObject;
|
||||||
|
|
||||||
m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName);
|
m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName);
|
||||||
|
@ -89,14 +91,13 @@ namespace OpenSim.Region.OptionalModules
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (m_enabled)
|
if (!m_enabled)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
scene.Permissions.OnRezObject -= CanRezObject;
|
m_scene.Permissions.OnRezObject -= CanRezObject;
|
||||||
scene.Permissions.OnObjectEntry -= CanObjectEnter;
|
m_scene.Permissions.OnObjectEntry -= CanObjectEnter;
|
||||||
scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
|
scene.Permissions.OnObjectEnterWithScripts -= CanObjectEnterWithScripts;
|
||||||
|
m_scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
|
@ -104,11 +105,12 @@ namespace OpenSim.Region.OptionalModules
|
||||||
m_dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
m_dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene)
|
private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition)
|
||||||
{
|
{
|
||||||
ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
|
|
||||||
|
ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
|
||||||
|
|
||||||
string response = DoCommonChecks(objectCount, ownerID, lo, scene);
|
string response = DoCommonChecks(objectCount, ownerID, lo);
|
||||||
|
|
||||||
if (response != null)
|
if (response != null)
|
||||||
{
|
{
|
||||||
|
@ -119,88 +121,99 @@ namespace OpenSim.Region.OptionalModules
|
||||||
}
|
}
|
||||||
|
|
||||||
//OnDuplicateObject
|
//OnDuplicateObject
|
||||||
private bool CanDuplicateObject(int objectCount, UUID objectID, UUID ownerID, Scene scene, Vector3 objectPosition)
|
private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp)
|
||||||
{
|
{
|
||||||
ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
|
Vector3 objectPosition = sog.AbsolutePosition;
|
||||||
|
ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
|
||||||
|
|
||||||
string response = DoCommonChecks(objectCount, ownerID, lo, scene);
|
string response = DoCommonChecks(sog.PrimCount, sp.UUID, lo);
|
||||||
|
|
||||||
if (response != null)
|
if (response != null)
|
||||||
{
|
{
|
||||||
m_dialogModule.SendAlertToUser(ownerID, response);
|
m_dialogModule.SendAlertToUser(sp.UUID, response);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene)
|
private bool CanObjectEnter(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
|
||||||
{
|
{
|
||||||
if (newPoint.X < -1f || newPoint.X > (scene.RegionInfo.RegionSizeX + 1) ||
|
float newX = newPoint.X;
|
||||||
newPoint.Y < -1f || newPoint.Y > (scene.RegionInfo.RegionSizeY) )
|
float newY = newPoint.Y;
|
||||||
|
if (newX < -1.0f || newX > (m_scene.RegionInfo.RegionSizeX + 1.0f) ||
|
||||||
|
newY < -1.0f || newY > (m_scene.RegionInfo.RegionSizeY + 1.0f) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
SceneObjectPart obj = scene.GetSceneObjectPart(objectID);
|
if (sog == null)
|
||||||
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Prim counts are determined by the location of the root prim. if we're
|
ILandObject newParcel = m_scene.LandChannel.GetLandObject(newX, newY);
|
||||||
// moving a child prim, just let it pass
|
|
||||||
if (!obj.IsRoot)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
|
|
||||||
|
|
||||||
if (newParcel == null)
|
if (newParcel == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Vector3 oldPoint = obj.GroupPosition;
|
if(!enteringRegion)
|
||||||
ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
|
|
||||||
|
|
||||||
// The prim hasn't crossed a region boundry so we don't need to worry
|
|
||||||
// about prim counts here
|
|
||||||
if(oldParcel != null && oldParcel.Equals(newParcel))
|
|
||||||
{
|
{
|
||||||
return true;
|
Vector3 oldPoint = sog.AbsolutePosition;
|
||||||
|
ILandObject oldParcel = m_scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
|
||||||
|
if(oldParcel != null && oldParcel.Equals(newParcel))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int objectCount = obj.ParentGroup.PrimCount;
|
int objectCount = sog.PrimCount;
|
||||||
int usedPrims = newParcel.PrimCounts.Total;
|
|
||||||
int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount();
|
|
||||||
|
|
||||||
// TODO: Add Special Case here for temporary prims
|
// TODO: Add Special Case here for temporary prims
|
||||||
|
|
||||||
string response = DoCommonChecks(objectCount, obj.OwnerID, newParcel, scene);
|
string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel);
|
||||||
|
|
||||||
if (response != null)
|
if (response != null)
|
||||||
{
|
{
|
||||||
m_dialogModule.SendAlertToUser(obj.OwnerID, response);
|
if(m_dialogModule != null)
|
||||||
|
m_dialogModule.SendAlertToUser(sog.OwnerID, response);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo, Scene scene)
|
private bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject newParcel)
|
||||||
|
{
|
||||||
|
if (sog == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (newParcel == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
int objectCount = sog.PrimCount;
|
||||||
|
|
||||||
|
// TODO: Add Special Case here for temporary prims
|
||||||
|
|
||||||
|
string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel);
|
||||||
|
|
||||||
|
if (response != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo)
|
||||||
{
|
{
|
||||||
string response = null;
|
string response = null;
|
||||||
|
|
||||||
int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount();
|
int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount();
|
||||||
if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity)
|
if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity)
|
||||||
{
|
{
|
||||||
response = "Unable to rez object because the parcel is too full";
|
response = "Unable to rez object because the parcel is full";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int maxPrimsPerUser = scene.RegionInfo.MaxPrimsPerUser;
|
int maxPrimsPerUser = m_scene.RegionInfo.MaxPrimsPerUser;
|
||||||
if (maxPrimsPerUser >= 0)
|
if (maxPrimsPerUser >= 0)
|
||||||
{
|
{
|
||||||
// per-user prim limit is set
|
// per-user prim limit is set
|
||||||
if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned)
|
if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned)
|
||||||
{
|
{
|
||||||
// caller is not the sole Parcel owner
|
// caller is not the sole Parcel owner
|
||||||
EstateSettings estateSettings = scene.RegionInfo.EstateSettings;
|
EstateSettings estateSettings = m_scene.RegionInfo.EstateSettings;
|
||||||
if (ownerID != estateSettings.EstateOwner)
|
if (ownerID != estateSettings.EstateOwner)
|
||||||
{
|
{
|
||||||
// caller is NOT the Estate owner
|
// caller is NOT the Estate owner
|
||||||
|
|
|
@ -665,7 +665,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||||
taskItem.AssetID = asset.FullID;
|
taskItem.AssetID = asset.FullID;
|
||||||
|
|
||||||
host.Inventory.AddInventoryItem(taskItem, false);
|
host.Inventory.AddInventoryItem(taskItem, false);
|
||||||
|
host.ParentGroup.AggregatePerms();
|
||||||
m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString());
|
m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -813,7 +813,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAvatarDataImmediate(ISceneEntity avatar)
|
public void SendEntityFullUpdateImmediate(ISceneEntity avatar)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -523,9 +523,9 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
|
||||||
|
|
||||||
rootPart.AddFlag(PrimFlags.Phantom);
|
rootPart.AddFlag(PrimFlags.Phantom);
|
||||||
|
|
||||||
m_scene.AddNewSceneObject(sceneObject, true);
|
|
||||||
sceneObject.SetGroup(groupID, null);
|
sceneObject.SetGroup(groupID, null);
|
||||||
|
m_scene.AddNewSceneObject(sceneObject, true);
|
||||||
|
sceneObject.AggregatePerms();
|
||||||
return sceneObject;
|
return sceneObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,6 +256,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SOPName;
|
public string SOPName;
|
||||||
|
|
||||||
|
public virtual void CrossingStart() { }
|
||||||
public abstract void CrossingFailure();
|
public abstract void CrossingFailure();
|
||||||
|
|
||||||
public abstract void link(PhysicsActor obj);
|
public abstract void link(PhysicsActor obj);
|
||||||
|
@ -462,6 +463,23 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
|
||||||
public abstract bool SubscribedEvents();
|
public abstract bool SubscribedEvents();
|
||||||
|
|
||||||
public virtual void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { }
|
public virtual void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { }
|
||||||
|
public virtual void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact) { }
|
||||||
|
|
||||||
|
public virtual PhysicsInertiaData GetInertiaData()
|
||||||
|
{
|
||||||
|
PhysicsInertiaData data = new PhysicsInertiaData();
|
||||||
|
data.TotalMass = this.Mass;
|
||||||
|
data.CenterOfMass = CenterOfMass - Position;
|
||||||
|
data.Inertia = Vector3.Zero;
|
||||||
|
data.InertiaRotation = Vector4.Zero;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void SetInertiaData(PhysicsInertiaData inertia)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual float SimulationSuspended { get; set; }
|
||||||
|
|
||||||
// Warning in a parent part it returns itself, not null
|
// Warning in a parent part it returns itself, not null
|
||||||
public virtual PhysicsActor ParentActor { get { return this; } }
|
public virtual PhysicsActor ParentActor { get { return this; } }
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
private Vector3 m_lastposition;
|
private Vector3 m_lastposition;
|
||||||
private Vector3 m_rotationalVelocity;
|
private Vector3 m_rotationalVelocity;
|
||||||
private Vector3 _size;
|
private Vector3 _size;
|
||||||
private Vector3 _acceleration;
|
private Vector3 m_acceleration;
|
||||||
private IntPtr Amotor;
|
private IntPtr Amotor;
|
||||||
|
|
||||||
internal Vector3 m_force;
|
internal Vector3 m_force;
|
||||||
|
@ -109,8 +109,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
private float m_waterHeight;
|
private float m_waterHeight;
|
||||||
private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
|
private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
|
||||||
|
|
||||||
private int body_autodisable_frames;
|
private int m_body_autodisable_frames;
|
||||||
public int bodydisablecontrol = 0;
|
public int m_bodydisablecontrol = 0;
|
||||||
private float m_gravmod = 1.0f;
|
private float m_gravmod = 1.0f;
|
||||||
|
|
||||||
// Default we're a Geometry
|
// Default we're a Geometry
|
||||||
|
@ -182,18 +182,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
private float m_streamCost;
|
private float m_streamCost;
|
||||||
|
|
||||||
public d.Mass primdMass; // prim inertia information on it's own referencial
|
public d.Mass primdMass; // prim inertia information on it's own referencial
|
||||||
|
private PhysicsInertiaData m_InertiaOverride;
|
||||||
float primMass; // prim own mass
|
float primMass; // prim own mass
|
||||||
float primVolume; // prim own volume;
|
float primVolume; // prim own volume;
|
||||||
float _mass; // object mass acording to case
|
float m_mass; // object mass acording to case
|
||||||
|
|
||||||
public int givefakepos;
|
public int givefakepos;
|
||||||
private Vector3 fakepos;
|
private Vector3 fakepos;
|
||||||
public int givefakeori;
|
public int givefakeori;
|
||||||
private Quaternion fakeori;
|
private Quaternion fakeori;
|
||||||
|
private PhysicsInertiaData m_fakeInertiaOverride;
|
||||||
|
|
||||||
private int m_eventsubscription;
|
private int m_eventsubscription;
|
||||||
private int m_cureventsubscription;
|
private int m_cureventsubscription;
|
||||||
private CollisionEventUpdate CollisionEventsThisFrame = null;
|
private CollisionEventUpdate CollisionEventsThisFrame = null;
|
||||||
|
private CollisionEventUpdate CollisionVDTCEventsThisFrame = null;
|
||||||
private bool SentEmptyCollisionsEvent;
|
private bool SentEmptyCollisionsEvent;
|
||||||
|
|
||||||
public volatile bool childPrim;
|
public volatile bool childPrim;
|
||||||
|
@ -465,6 +468,103 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override PhysicsInertiaData GetInertiaData()
|
||||||
|
{
|
||||||
|
PhysicsInertiaData inertia;
|
||||||
|
if(childPrim)
|
||||||
|
{
|
||||||
|
if(_parent != null)
|
||||||
|
return _parent.GetInertiaData();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inertia = new PhysicsInertiaData();
|
||||||
|
inertia.TotalMass = -1;
|
||||||
|
return inertia;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inertia = new PhysicsInertiaData();
|
||||||
|
|
||||||
|
// double buffering
|
||||||
|
if(m_fakeInertiaOverride != null)
|
||||||
|
{
|
||||||
|
d.Mass objdmass = new d.Mass();
|
||||||
|
objdmass.I.M00 = m_fakeInertiaOverride.Inertia.X;
|
||||||
|
objdmass.I.M11 = m_fakeInertiaOverride.Inertia.Y;
|
||||||
|
objdmass.I.M22 = m_fakeInertiaOverride.Inertia.Z;
|
||||||
|
|
||||||
|
objdmass.mass = m_fakeInertiaOverride.TotalMass;
|
||||||
|
|
||||||
|
if(Math.Abs(m_fakeInertiaOverride.InertiaRotation.W) < 0.999)
|
||||||
|
{
|
||||||
|
d.Matrix3 inertiarotmat = new d.Matrix3();
|
||||||
|
d.Quaternion inertiarot = new d.Quaternion();
|
||||||
|
|
||||||
|
inertiarot.X = m_fakeInertiaOverride.InertiaRotation.X;
|
||||||
|
inertiarot.Y = m_fakeInertiaOverride.InertiaRotation.Y;
|
||||||
|
inertiarot.Z = m_fakeInertiaOverride.InertiaRotation.Z;
|
||||||
|
inertiarot.W = m_fakeInertiaOverride.InertiaRotation.W;
|
||||||
|
d.RfromQ(out inertiarotmat, ref inertiarot);
|
||||||
|
d.MassRotate(ref objdmass, ref inertiarotmat);
|
||||||
|
}
|
||||||
|
|
||||||
|
inertia.TotalMass = m_fakeInertiaOverride.TotalMass;
|
||||||
|
inertia.CenterOfMass = m_fakeInertiaOverride.CenterOfMass;
|
||||||
|
inertia.Inertia.X = objdmass.I.M00;
|
||||||
|
inertia.Inertia.Y = objdmass.I.M11;
|
||||||
|
inertia.Inertia.Z = objdmass.I.M22;
|
||||||
|
inertia.InertiaRotation.X = objdmass.I.M01;
|
||||||
|
inertia.InertiaRotation.Y = objdmass.I.M02;
|
||||||
|
inertia.InertiaRotation.Z = objdmass.I.M12;
|
||||||
|
return inertia;
|
||||||
|
}
|
||||||
|
|
||||||
|
inertia.TotalMass = m_mass;
|
||||||
|
|
||||||
|
if(Body == IntPtr.Zero || prim_geom == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
inertia.CenterOfMass = Vector3.Zero;
|
||||||
|
inertia.Inertia = Vector3.Zero;
|
||||||
|
inertia.InertiaRotation = Vector4.Zero;
|
||||||
|
return inertia;
|
||||||
|
}
|
||||||
|
|
||||||
|
d.Vector3 dtmp;
|
||||||
|
d.Mass m = new d.Mass();
|
||||||
|
lock(_parent_scene.OdeLock)
|
||||||
|
{
|
||||||
|
d.AllocateODEDataForThread(0);
|
||||||
|
dtmp = d.GeomGetOffsetPosition(prim_geom);
|
||||||
|
d.BodyGetMass(Body, out m);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3 cm = new Vector3(-dtmp.X, -dtmp.Y, -dtmp.Z);
|
||||||
|
inertia.CenterOfMass = cm;
|
||||||
|
inertia.Inertia = new Vector3(m.I.M00, m.I.M11, m.I.M22);
|
||||||
|
inertia.InertiaRotation = new Vector4(m.I.M01, m.I.M02 , m.I.M12, 0);
|
||||||
|
|
||||||
|
return inertia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetInertiaData(PhysicsInertiaData inertia)
|
||||||
|
{
|
||||||
|
if(childPrim)
|
||||||
|
{
|
||||||
|
if(_parent != null)
|
||||||
|
_parent.SetInertiaData(inertia);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(inertia.TotalMass > 0)
|
||||||
|
m_fakeInertiaOverride = new PhysicsInertiaData(inertia);
|
||||||
|
else
|
||||||
|
m_fakeInertiaOverride = null;
|
||||||
|
|
||||||
|
if (inertia.TotalMass > _parent_scene.maximumMassObject)
|
||||||
|
inertia.TotalMass = _parent_scene.maximumMassObject;
|
||||||
|
AddChange(changes.SetInertia,(object)m_fakeInertiaOverride);
|
||||||
|
}
|
||||||
|
|
||||||
public override Vector3 CenterOfMass
|
public override Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -569,7 +669,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
if (value.IsFinite())
|
if (value.IsFinite())
|
||||||
{
|
{
|
||||||
AddChange(changes.Velocity, value);
|
if(m_outbounds)
|
||||||
|
_velocity = value;
|
||||||
|
else
|
||||||
|
AddChange(changes.Velocity, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -642,8 +745,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
public override Vector3 Acceleration
|
public override Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return _acceleration; }
|
get { return m_acceleration; }
|
||||||
set { }
|
set
|
||||||
|
{
|
||||||
|
if(m_outbounds)
|
||||||
|
m_acceleration = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Vector3 RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
|
@ -663,7 +770,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
if (value.IsFinite())
|
if (value.IsFinite())
|
||||||
{
|
{
|
||||||
AddChange(changes.AngVelocity, value);
|
if(m_outbounds)
|
||||||
|
m_rotationalVelocity = value;
|
||||||
|
else
|
||||||
|
AddChange(changes.AngVelocity, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -837,7 +947,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
}
|
}
|
||||||
public void SetAcceleration(Vector3 accel)
|
public void SetAcceleration(Vector3 accel)
|
||||||
{
|
{
|
||||||
_acceleration = accel;
|
m_acceleration = accel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddForce(Vector3 force, bool pushforce)
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
|
@ -873,31 +983,68 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
public override void CrossingFailure()
|
public override void CrossingFailure()
|
||||||
{
|
{
|
||||||
if (m_outbounds)
|
lock(_parent_scene.OdeLock)
|
||||||
{
|
{
|
||||||
_position.X = Util.Clip(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f);
|
if (m_outbounds)
|
||||||
_position.Y = Util.Clip(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f);
|
{
|
||||||
_position.Z = Util.Clip(_position.Z + 0.2f, -100f, 50000f);
|
_position.X = Util.Clip(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f);
|
||||||
|
_position.Y = Util.Clip(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f);
|
||||||
|
_position.Z = Util.Clip(_position.Z + 0.2f, -100f, 50000f);
|
||||||
|
|
||||||
|
m_lastposition = _position;
|
||||||
|
_velocity.X = 0;
|
||||||
|
_velocity.Y = 0;
|
||||||
|
_velocity.Z = 0;
|
||||||
|
|
||||||
|
d.AllocateODEDataForThread(0);
|
||||||
|
|
||||||
|
m_lastVelocity = _velocity;
|
||||||
|
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||||
|
m_vehicle.Stop();
|
||||||
|
|
||||||
|
if(Body != IntPtr.Zero)
|
||||||
|
d.BodySetLinearVel(Body, 0, 0, 0); // stop it
|
||||||
|
if (prim_geom != IntPtr.Zero)
|
||||||
|
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||||
|
|
||||||
|
m_outbounds = false;
|
||||||
|
changeDisable(false);
|
||||||
|
base.RequestPhysicsterseUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CrossingStart()
|
||||||
|
{
|
||||||
|
lock(_parent_scene.OdeLock)
|
||||||
|
{
|
||||||
|
if (m_outbounds || childPrim)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_outbounds = true;
|
||||||
|
|
||||||
m_lastposition = _position;
|
m_lastposition = _position;
|
||||||
_velocity.X = 0;
|
m_lastorientation = _orientation;
|
||||||
_velocity.Y = 0;
|
|
||||||
_velocity.Z = 0;
|
|
||||||
|
|
||||||
d.AllocateODEDataForThread(0);
|
d.AllocateODEDataForThread(0);
|
||||||
|
|
||||||
m_lastVelocity = _velocity;
|
|
||||||
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
|
|
||||||
m_vehicle.Stop();
|
|
||||||
|
|
||||||
if(Body != IntPtr.Zero)
|
if(Body != IntPtr.Zero)
|
||||||
d.BodySetLinearVel(Body, 0, 0, 0); // stop it
|
{
|
||||||
if (prim_geom != IntPtr.Zero)
|
d.Vector3 dtmp = d.BodyGetAngularVel(Body);
|
||||||
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
m_rotationalVelocity.X = dtmp.X;
|
||||||
|
m_rotationalVelocity.Y = dtmp.Y;
|
||||||
|
m_rotationalVelocity.Z = dtmp.Z;
|
||||||
|
|
||||||
m_outbounds = false;
|
dtmp = d.BodyGetLinearVel(Body);
|
||||||
changeDisable(false);
|
_velocity.X = dtmp.X;
|
||||||
base.RequestPhysicsterseUpdate();
|
_velocity.Y = dtmp.Y;
|
||||||
|
_velocity.Z = dtmp.Z;
|
||||||
|
|
||||||
|
d.BodySetLinearVel(Body, 0, 0, 0); // stop it
|
||||||
|
d.BodySetAngularVel(Body, 0, 0, 0);
|
||||||
|
}
|
||||||
|
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||||
|
disableBodySoft(); // stop collisions
|
||||||
|
UnSubscribeEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,8 +1067,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
float old = m_density;
|
||||||
m_density = value / 100f;
|
m_density = value / 100f;
|
||||||
// for not prim mass is not updated since this implies full rebuild of body inertia TODO
|
// if(m_density != old)
|
||||||
|
// UpdatePrimBodyData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override float GravModifier
|
public override float GravModifier
|
||||||
|
@ -989,11 +1138,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
m_cureventsubscription = 0;
|
m_cureventsubscription = 0;
|
||||||
if (CollisionEventsThisFrame == null)
|
if (CollisionEventsThisFrame == null)
|
||||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||||
|
if (CollisionVDTCEventsThisFrame == null)
|
||||||
|
CollisionVDTCEventsThisFrame = new CollisionEventUpdate();
|
||||||
SentEmptyCollisionsEvent = false;
|
SentEmptyCollisionsEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UnSubscribeEvents()
|
public override void UnSubscribeEvents()
|
||||||
{
|
{
|
||||||
|
if (CollisionVDTCEventsThisFrame != null)
|
||||||
|
{
|
||||||
|
CollisionVDTCEventsThisFrame.Clear();
|
||||||
|
CollisionVDTCEventsThisFrame = null;
|
||||||
|
}
|
||||||
if (CollisionEventsThisFrame != null)
|
if (CollisionEventsThisFrame != null)
|
||||||
{
|
{
|
||||||
CollisionEventsThisFrame.Clear();
|
CollisionEventsThisFrame.Clear();
|
||||||
|
@ -1012,22 +1168,51 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
_parent_scene.AddCollisionEventReporting(this);
|
_parent_scene.AddCollisionEventReporting(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact)
|
||||||
|
{
|
||||||
|
if (CollisionVDTCEventsThisFrame == null)
|
||||||
|
CollisionVDTCEventsThisFrame = new CollisionEventUpdate();
|
||||||
|
|
||||||
|
CollisionVDTCEventsThisFrame.AddCollider(CollidedWith, contact);
|
||||||
|
_parent_scene.AddCollisionEventReporting(this);
|
||||||
|
}
|
||||||
|
|
||||||
internal void SleeperAddCollisionEvents()
|
internal void SleeperAddCollisionEvents()
|
||||||
{
|
{
|
||||||
if (CollisionEventsThisFrame == null)
|
if(CollisionEventsThisFrame != null && CollisionEventsThisFrame.m_objCollisionList.Count != 0)
|
||||||
return;
|
|
||||||
if(CollisionEventsThisFrame.m_objCollisionList.Count == 0)
|
|
||||||
return;
|
|
||||||
foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionEventsThisFrame.m_objCollisionList)
|
|
||||||
{
|
{
|
||||||
OdePrim other = _parent_scene.getPrim(kvp.Key);
|
foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionEventsThisFrame.m_objCollisionList)
|
||||||
if(other == null)
|
{
|
||||||
continue;
|
if(kvp.Key == 0)
|
||||||
ContactPoint cp = kvp.Value;
|
continue;
|
||||||
cp.SurfaceNormal = - cp.SurfaceNormal;
|
OdePrim other = _parent_scene.getPrim(kvp.Key);
|
||||||
cp.RelativeSpeed = -cp.RelativeSpeed;
|
if(other == null)
|
||||||
other.AddCollisionEvent(ParentActor.LocalID,cp);
|
continue;
|
||||||
|
ContactPoint cp = kvp.Value;
|
||||||
|
cp.SurfaceNormal = - cp.SurfaceNormal;
|
||||||
|
cp.RelativeSpeed = -cp.RelativeSpeed;
|
||||||
|
other.AddCollisionEvent(ParentActor.LocalID,cp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.m_objCollisionList.Count != 0)
|
||||||
|
{
|
||||||
|
foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionVDTCEventsThisFrame.m_objCollisionList)
|
||||||
|
{
|
||||||
|
OdePrim other = _parent_scene.getPrim(kvp.Key);
|
||||||
|
if(other == null)
|
||||||
|
continue;
|
||||||
|
ContactPoint cp = kvp.Value;
|
||||||
|
cp.SurfaceNormal = - cp.SurfaceNormal;
|
||||||
|
cp.RelativeSpeed = -cp.RelativeSpeed;
|
||||||
|
other.AddCollisionEvent(ParentActor.LocalID,cp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void clearSleeperCollisions()
|
||||||
|
{
|
||||||
|
if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.Count >0 )
|
||||||
|
CollisionVDTCEventsThisFrame.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendCollisions(int timestep)
|
public void SendCollisions(int timestep)
|
||||||
|
@ -1035,14 +1220,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
if (m_cureventsubscription < 50000)
|
if (m_cureventsubscription < 50000)
|
||||||
m_cureventsubscription += timestep;
|
m_cureventsubscription += timestep;
|
||||||
|
|
||||||
|
|
||||||
|
if (m_cureventsubscription < m_eventsubscription)
|
||||||
|
return;
|
||||||
|
|
||||||
if (CollisionEventsThisFrame == null)
|
if (CollisionEventsThisFrame == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
|
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
|
||||||
|
|
||||||
if (m_cureventsubscription < m_eventsubscription)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!SentEmptyCollisionsEvent || ncolisions > 0)
|
if (!SentEmptyCollisionsEvent || ncolisions > 0)
|
||||||
{
|
{
|
||||||
base.SendCollisionUpdate(CollisionEventsThisFrame);
|
base.SendCollisionUpdate(CollisionEventsThisFrame);
|
||||||
|
@ -1091,7 +1277,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
m_invTimeStep = 1f / m_timeStep;
|
m_invTimeStep = 1f / m_timeStep;
|
||||||
|
|
||||||
m_density = parent_scene.geomDefaultDensity;
|
m_density = parent_scene.geomDefaultDensity;
|
||||||
body_autodisable_frames = parent_scene.bodyFramesAutoDisable;
|
m_body_autodisable_frames = parent_scene.bodyFramesAutoDisable;
|
||||||
|
|
||||||
prim_geom = IntPtr.Zero;
|
prim_geom = IntPtr.Zero;
|
||||||
collide_geom = IntPtr.Zero;
|
collide_geom = IntPtr.Zero;
|
||||||
|
@ -1714,26 +1900,29 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
m_log.Warn("[PHYSICS]: MakeBody root geom already had a body");
|
m_log.Warn("[PHYSICS]: MakeBody root geom already had a body");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool noInertiaOverride = (m_InertiaOverride == null);
|
||||||
|
|
||||||
|
Body = d.BodyCreate(_parent_scene.world);
|
||||||
|
|
||||||
d.Matrix3 mymat = new d.Matrix3();
|
d.Matrix3 mymat = new d.Matrix3();
|
||||||
d.Quaternion myrot = new d.Quaternion();
|
d.Quaternion myrot = new d.Quaternion();
|
||||||
d.Mass objdmass = new d.Mass { };
|
d.Mass objdmass = new d.Mass { };
|
||||||
|
|
||||||
Body = d.BodyCreate(_parent_scene.world);
|
|
||||||
|
|
||||||
objdmass = primdMass;
|
|
||||||
|
|
||||||
// rotate inertia
|
|
||||||
myrot.X = _orientation.X;
|
myrot.X = _orientation.X;
|
||||||
myrot.Y = _orientation.Y;
|
myrot.Y = _orientation.Y;
|
||||||
myrot.Z = _orientation.Z;
|
myrot.Z = _orientation.Z;
|
||||||
myrot.W = _orientation.W;
|
myrot.W = _orientation.W;
|
||||||
|
|
||||||
d.RfromQ(out mymat, ref myrot);
|
d.RfromQ(out mymat, ref myrot);
|
||||||
d.MassRotate(ref objdmass, ref mymat);
|
|
||||||
|
|
||||||
// set the body rotation
|
// set the body rotation
|
||||||
d.BodySetRotation(Body, ref mymat);
|
d.BodySetRotation(Body, ref mymat);
|
||||||
|
|
||||||
|
if(noInertiaOverride)
|
||||||
|
{
|
||||||
|
objdmass = primdMass;
|
||||||
|
d.MassRotate(ref objdmass, ref mymat);
|
||||||
|
}
|
||||||
|
|
||||||
// recompute full object inertia if needed
|
// recompute full object inertia if needed
|
||||||
if (childrenPrim.Count > 0)
|
if (childrenPrim.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -1756,27 +1945,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpdmass = prm.primdMass;
|
|
||||||
|
|
||||||
// apply prim current rotation to inertia
|
|
||||||
quat.X = prm._orientation.X;
|
quat.X = prm._orientation.X;
|
||||||
quat.Y = prm._orientation.Y;
|
quat.Y = prm._orientation.Y;
|
||||||
quat.Z = prm._orientation.Z;
|
quat.Z = prm._orientation.Z;
|
||||||
quat.W = prm._orientation.W;
|
quat.W = prm._orientation.W;
|
||||||
d.RfromQ(out mat, ref quat);
|
d.RfromQ(out mat, ref quat);
|
||||||
d.MassRotate(ref tmpdmass, ref mat);
|
|
||||||
|
|
||||||
Vector3 ppos = prm._position;
|
|
||||||
ppos.X -= rcm.X;
|
|
||||||
ppos.Y -= rcm.Y;
|
|
||||||
ppos.Z -= rcm.Z;
|
|
||||||
// refer inertia to root prim center of mass position
|
|
||||||
d.MassTranslate(ref tmpdmass,
|
|
||||||
ppos.X,
|
|
||||||
ppos.Y,
|
|
||||||
ppos.Z);
|
|
||||||
|
|
||||||
d.MassAdd(ref objdmass, ref tmpdmass); // add to total object inertia
|
|
||||||
// fix prim colision cats
|
// fix prim colision cats
|
||||||
|
|
||||||
if (d.GeomGetBody(prm.prim_geom) != IntPtr.Zero)
|
if (d.GeomGetBody(prm.prim_geom) != IntPtr.Zero)
|
||||||
|
@ -1789,6 +1963,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
d.GeomSetBody(prm.prim_geom, Body);
|
d.GeomSetBody(prm.prim_geom, Body);
|
||||||
prm.Body = Body;
|
prm.Body = Body;
|
||||||
d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); // set relative rotation
|
d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); // set relative rotation
|
||||||
|
|
||||||
|
if(noInertiaOverride)
|
||||||
|
{
|
||||||
|
tmpdmass = prm.primdMass;
|
||||||
|
|
||||||
|
d.MassRotate(ref tmpdmass, ref mat);
|
||||||
|
Vector3 ppos = prm._position;
|
||||||
|
ppos.X -= rcm.X;
|
||||||
|
ppos.Y -= rcm.Y;
|
||||||
|
ppos.Z -= rcm.Z;
|
||||||
|
// refer inertia to root prim center of mass position
|
||||||
|
d.MassTranslate(ref tmpdmass,
|
||||||
|
ppos.X,
|
||||||
|
ppos.Y,
|
||||||
|
ppos.Z);
|
||||||
|
|
||||||
|
d.MassAdd(ref objdmass, ref tmpdmass); // add to total object inertia
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1797,25 +1989,66 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
// associate root geom with body
|
// associate root geom with body
|
||||||
d.GeomSetBody(prim_geom, Body);
|
d.GeomSetBody(prim_geom, Body);
|
||||||
|
|
||||||
d.BodySetPosition(Body, _position.X + objdmass.c.X, _position.Y + objdmass.c.Y, _position.Z + objdmass.c.Z);
|
if(noInertiaOverride)
|
||||||
|
d.BodySetPosition(Body, _position.X + objdmass.c.X, _position.Y + objdmass.c.Y, _position.Z + objdmass.c.Z);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector3 ncm = m_InertiaOverride.CenterOfMass * _orientation;
|
||||||
|
d.BodySetPosition(Body,
|
||||||
|
_position.X + ncm.X,
|
||||||
|
_position.Y + ncm.Y,
|
||||||
|
_position.Z + ncm.Z);
|
||||||
|
}
|
||||||
|
|
||||||
d.GeomSetOffsetWorldPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
d.GeomSetOffsetWorldPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||||
|
|
||||||
d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
|
if(noInertiaOverride)
|
||||||
myrot.X = -myrot.X;
|
{
|
||||||
myrot.Y = -myrot.Y;
|
d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
|
||||||
myrot.Z = -myrot.Z;
|
myrot.X = -myrot.X;
|
||||||
|
myrot.Y = -myrot.Y;
|
||||||
|
myrot.Z = -myrot.Z;
|
||||||
|
|
||||||
d.RfromQ(out mymat, ref myrot);
|
d.RfromQ(out mymat, ref myrot);
|
||||||
d.MassRotate(ref objdmass, ref mymat);
|
d.MassRotate(ref objdmass, ref mymat);
|
||||||
|
|
||||||
d.BodySetMass(Body, ref objdmass);
|
d.BodySetMass(Body, ref objdmass);
|
||||||
_mass = objdmass.mass;
|
m_mass = objdmass.mass;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
objdmass.c.X = 0;
|
||||||
|
objdmass.c.Y = 0;
|
||||||
|
objdmass.c.Z = 0;
|
||||||
|
|
||||||
|
objdmass.I.M00 = m_InertiaOverride.Inertia.X;
|
||||||
|
objdmass.I.M11 = m_InertiaOverride.Inertia.Y;
|
||||||
|
objdmass.I.M22 = m_InertiaOverride.Inertia.Z;
|
||||||
|
|
||||||
|
objdmass.mass = m_InertiaOverride.TotalMass;
|
||||||
|
|
||||||
|
if(Math.Abs(m_InertiaOverride.InertiaRotation.W) < 0.999)
|
||||||
|
{
|
||||||
|
d.Matrix3 inertiarotmat = new d.Matrix3();
|
||||||
|
d.Quaternion inertiarot = new d.Quaternion();
|
||||||
|
|
||||||
|
inertiarot.X = m_InertiaOverride.InertiaRotation.X;
|
||||||
|
inertiarot.Y = m_InertiaOverride.InertiaRotation.Y;
|
||||||
|
inertiarot.Z = m_InertiaOverride.InertiaRotation.Z;
|
||||||
|
inertiarot.W = m_InertiaOverride.InertiaRotation.W;
|
||||||
|
d.RfromQ(out inertiarotmat, ref inertiarot);
|
||||||
|
d.MassRotate(ref objdmass, ref inertiarotmat);
|
||||||
|
}
|
||||||
|
d.BodySetMass(Body, ref objdmass);
|
||||||
|
|
||||||
|
m_mass = objdmass.mass;
|
||||||
|
}
|
||||||
|
|
||||||
// disconnect from world gravity so we can apply buoyancy
|
// disconnect from world gravity so we can apply buoyancy
|
||||||
d.BodySetGravityMode(Body, false);
|
d.BodySetGravityMode(Body, false);
|
||||||
|
|
||||||
d.BodySetAutoDisableFlag(Body, true);
|
d.BodySetAutoDisableFlag(Body, true);
|
||||||
d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
|
d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
|
||||||
d.BodySetAutoDisableAngularThreshold(Body, 0.05f);
|
d.BodySetAutoDisableAngularThreshold(Body, 0.05f);
|
||||||
d.BodySetAutoDisableLinearThreshold(Body, 0.05f);
|
d.BodySetAutoDisableLinearThreshold(Body, 0.05f);
|
||||||
d.BodySetDamping(Body, .004f, .001f);
|
d.BodySetDamping(Body, .004f, .001f);
|
||||||
|
@ -1909,8 +2142,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z);
|
d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z);
|
||||||
d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
|
d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
|
||||||
|
|
||||||
_zeroFlag = false;
|
_zeroFlag = false;
|
||||||
bodydisablecontrol = 0;
|
m_bodydisablecontrol = 0;
|
||||||
}
|
}
|
||||||
_parent_scene.addActiveGroups(this);
|
_parent_scene.addActiveGroups(this);
|
||||||
}
|
}
|
||||||
|
@ -1988,7 +2222,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
SetInStaticSpace(prm);
|
SetInStaticSpace(prm);
|
||||||
}
|
}
|
||||||
prm.Body = IntPtr.Zero;
|
prm.Body = IntPtr.Zero;
|
||||||
prm._mass = prm.primMass;
|
prm.m_mass = prm.primMass;
|
||||||
prm.m_collisionscore = 0;
|
prm.m_collisionscore = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2002,7 +2236,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
}
|
}
|
||||||
Body = IntPtr.Zero;
|
Body = IntPtr.Zero;
|
||||||
}
|
}
|
||||||
_mass = primMass;
|
m_mass = primMass;
|
||||||
m_collisionscore = 0;
|
m_collisionscore = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2079,7 +2313,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
|
d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
|
||||||
d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
|
d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
|
||||||
d.BodySetMass(Body, ref objdmass);
|
d.BodySetMass(Body, ref objdmass);
|
||||||
_mass = objdmass.mass;
|
m_mass = objdmass.mass;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FixInertia(Vector3 NewPos)
|
private void FixInertia(Vector3 NewPos)
|
||||||
|
@ -2143,7 +2377,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
|
d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
|
||||||
d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
|
d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
|
||||||
d.BodySetMass(Body, ref objdmass);
|
d.BodySetMass(Body, ref objdmass);
|
||||||
_mass = objdmass.mass;
|
m_mass = objdmass.mass;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FixInertia(Quaternion newrot)
|
private void FixInertia(Quaternion newrot)
|
||||||
|
@ -2209,7 +2443,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
|
d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
|
||||||
d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
|
d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
|
||||||
d.BodySetMass(Body, ref objdmass);
|
d.BodySetMass(Body, ref objdmass);
|
||||||
_mass = objdmass.mass;
|
m_mass = objdmass.mass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2224,7 +2458,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
if (primMass > _parent_scene.maximumMassObject)
|
if (primMass > _parent_scene.maximumMassObject)
|
||||||
primMass = _parent_scene.maximumMassObject;
|
primMass = _parent_scene.maximumMassObject;
|
||||||
|
|
||||||
_mass = primMass; // just in case
|
m_mass = primMass; // just in case
|
||||||
|
|
||||||
d.MassSetBoxTotal(out primdMass, primMass, 2.0f * m_OBB.X, 2.0f * m_OBB.Y, 2.0f * m_OBB.Z);
|
d.MassSetBoxTotal(out primdMass, primMass, 2.0f * m_OBB.X, 2.0f * m_OBB.Y, 2.0f * m_OBB.Z);
|
||||||
|
|
||||||
|
@ -2514,7 +2748,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
m_angularForceacc = Vector3.Zero;
|
m_angularForceacc = Vector3.Zero;
|
||||||
// m_torque = Vector3.Zero;
|
// m_torque = Vector3.Zero;
|
||||||
_velocity = Vector3.Zero;
|
_velocity = Vector3.Zero;
|
||||||
_acceleration = Vector3.Zero;
|
m_acceleration = Vector3.Zero;
|
||||||
m_rotationalVelocity = Vector3.Zero;
|
m_rotationalVelocity = Vector3.Zero;
|
||||||
_target_velocity = Vector3.Zero;
|
_target_velocity = Vector3.Zero;
|
||||||
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
|
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||||
|
@ -2767,8 +3001,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
myrot.W = newOri.W;
|
myrot.W = newOri.W;
|
||||||
d.GeomSetQuaternion(prim_geom, ref myrot);
|
d.GeomSetQuaternion(prim_geom, ref myrot);
|
||||||
_orientation = newOri;
|
_orientation = newOri;
|
||||||
if (Body != IntPtr.Zero && m_angularlocks != 0)
|
|
||||||
createAMotor(m_angularlocks);
|
if (Body != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
if(m_angularlocks != 0)
|
||||||
|
createAMotor(m_angularlocks);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
|
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
|
||||||
{
|
{
|
||||||
|
@ -3064,7 +3302,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
private void changeSetTorque(Vector3 newtorque)
|
private void changeSetTorque(Vector3 newtorque)
|
||||||
{
|
{
|
||||||
if (!m_isSelected)
|
if (!m_isSelected && !m_outbounds)
|
||||||
{
|
{
|
||||||
if (m_isphysical && Body != IntPtr.Zero)
|
if (m_isphysical && Body != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
@ -3081,14 +3319,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
private void changeForce(Vector3 force)
|
private void changeForce(Vector3 force)
|
||||||
{
|
{
|
||||||
m_force = force;
|
m_force = force;
|
||||||
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
|
if (!m_isSelected && !m_outbounds && Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
|
||||||
d.BodyEnable(Body);
|
d.BodyEnable(Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeAddForce(Vector3 theforce)
|
private void changeAddForce(Vector3 theforce)
|
||||||
{
|
{
|
||||||
m_forceacc += theforce;
|
m_forceacc += theforce;
|
||||||
if (!m_isSelected)
|
if (!m_isSelected && !m_outbounds)
|
||||||
{
|
{
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
|
@ -3109,7 +3347,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
private void changeAddAngularImpulse(Vector3 aimpulse)
|
private void changeAddAngularImpulse(Vector3 aimpulse)
|
||||||
{
|
{
|
||||||
m_angularForceacc += aimpulse * m_invTimeStep;
|
m_angularForceacc += aimpulse * m_invTimeStep;
|
||||||
if (!m_isSelected)
|
if (!m_isSelected && !m_outbounds)
|
||||||
{
|
{
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
|
@ -3134,7 +3372,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
newVel *= len;
|
newVel *= len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_isSelected)
|
if (!m_isSelected && !m_outbounds)
|
||||||
{
|
{
|
||||||
if (Body != IntPtr.Zero)
|
if (Body != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
@ -3142,7 +3380,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
enableBodySoft();
|
enableBodySoft();
|
||||||
else if (!d.BodyIsEnabled(Body))
|
else if (!d.BodyIsEnabled(Body))
|
||||||
d.BodyEnable(Body);
|
d.BodyEnable(Body);
|
||||||
|
|
||||||
d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
|
d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
|
||||||
}
|
}
|
||||||
//resetCollisionAccounting();
|
//resetCollisionAccounting();
|
||||||
|
@ -3159,7 +3396,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
newAngVel *= len;
|
newAngVel *= len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_isSelected)
|
if (!m_isSelected && !m_outbounds)
|
||||||
{
|
{
|
||||||
if (Body != IntPtr.Zero)
|
if (Body != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
@ -3167,8 +3404,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
enableBodySoft();
|
enableBodySoft();
|
||||||
else if (!d.BodyIsEnabled(Body))
|
else if (!d.BodyIsEnabled(Body))
|
||||||
d.BodyEnable(Body);
|
d.BodyEnable(Body);
|
||||||
|
|
||||||
|
|
||||||
d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z);
|
d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z);
|
||||||
}
|
}
|
||||||
//resetCollisionAccounting();
|
//resetCollisionAccounting();
|
||||||
|
@ -3304,6 +3539,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
m_useHoverPID = active;
|
m_useHoverPID = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void changeInertia(PhysicsInertiaData inertia)
|
||||||
|
{
|
||||||
|
m_InertiaOverride = inertia;
|
||||||
|
|
||||||
|
if (Body != IntPtr.Zero)
|
||||||
|
DestroyBody();
|
||||||
|
MakeBody();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void Move()
|
public void Move()
|
||||||
|
@ -3317,7 +3561,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
|
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (++bodydisablecontrol < 50)
|
if (++m_bodydisablecontrol < 50)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// clear residuals
|
// clear residuals
|
||||||
|
@ -3325,11 +3569,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
d.BodySetLinearVel(Body,0f,0f,0f);
|
d.BodySetLinearVel(Body,0f,0f,0f);
|
||||||
_zeroFlag = true;
|
_zeroFlag = true;
|
||||||
d.BodyEnable(Body);
|
d.BodyEnable(Body);
|
||||||
bodydisablecontrol = -4;
|
m_bodydisablecontrol = -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bodydisablecontrol < 0)
|
if(m_bodydisablecontrol < 0)
|
||||||
bodydisablecontrol ++;
|
m_bodydisablecontrol ++;
|
||||||
|
|
||||||
d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator
|
d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator
|
||||||
|
|
||||||
|
@ -3344,7 +3588,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
float fy = 0;
|
float fy = 0;
|
||||||
float fz = 0;
|
float fz = 0;
|
||||||
|
|
||||||
float m_mass = _mass;
|
float mass = m_mass;
|
||||||
|
|
||||||
if (m_usePID && m_PIDTau > 0)
|
if (m_usePID && m_PIDTau > 0)
|
||||||
{
|
{
|
||||||
|
@ -3451,9 +3695,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
fz = _parent_scene.gravityz * b;
|
fz = _parent_scene.gravityz * b;
|
||||||
}
|
}
|
||||||
|
|
||||||
fx *= m_mass;
|
fx *= mass;
|
||||||
fy *= m_mass;
|
fy *= mass;
|
||||||
fz *= m_mass;
|
fz *= mass;
|
||||||
|
|
||||||
// constant force
|
// constant force
|
||||||
fx += m_force.X;
|
fx += m_force.X;
|
||||||
|
@ -3498,7 +3742,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
bool bodyenabled = d.BodyIsEnabled(Body);
|
bool bodyenabled = d.BodyIsEnabled(Body);
|
||||||
|
|
||||||
if(bodydisablecontrol < 0)
|
if(m_bodydisablecontrol < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (bodyenabled || !_zeroFlag)
|
if (bodyenabled || !_zeroFlag)
|
||||||
|
@ -3513,9 +3757,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
m_outbounds = true;
|
m_outbounds = true;
|
||||||
|
|
||||||
lpos.Z = Util.Clip(lpos.Z, -100f, 100000f);
|
lpos.Z = Util.Clip(lpos.Z, -100f, 100000f);
|
||||||
_acceleration.X = 0;
|
m_acceleration.X = 0;
|
||||||
_acceleration.Y = 0;
|
m_acceleration.Y = 0;
|
||||||
_acceleration.Z = 0;
|
m_acceleration.Z = 0;
|
||||||
|
|
||||||
_velocity.X = 0;
|
_velocity.X = 0;
|
||||||
_velocity.Y = 0;
|
_velocity.Y = 0;
|
||||||
|
@ -3638,19 +3882,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
_orientation.W = ori.W;
|
_orientation.W = ori.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update velocities and aceleration
|
// update velocities and acceleration
|
||||||
if (_zeroFlag || lastZeroFlag)
|
if (_zeroFlag || lastZeroFlag)
|
||||||
{
|
{
|
||||||
// disable interpolators
|
// disable interpolators
|
||||||
_velocity = Vector3.Zero;
|
_velocity = Vector3.Zero;
|
||||||
_acceleration = Vector3.Zero;
|
m_acceleration = Vector3.Zero;
|
||||||
m_rotationalVelocity = Vector3.Zero;
|
m_rotationalVelocity = Vector3.Zero;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d.Vector3 vel = d.BodyGetLinearVel(Body);
|
d.Vector3 vel = d.BodyGetLinearVel(Body);
|
||||||
|
|
||||||
_acceleration = _velocity;
|
m_acceleration = _velocity;
|
||||||
|
|
||||||
if ((Math.Abs(vel.X) < 0.005f) &&
|
if ((Math.Abs(vel.X) < 0.005f) &&
|
||||||
(Math.Abs(vel.Y) < 0.005f) &&
|
(Math.Abs(vel.Y) < 0.005f) &&
|
||||||
|
@ -3658,28 +3902,28 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
_velocity = Vector3.Zero;
|
_velocity = Vector3.Zero;
|
||||||
float t = -m_invTimeStep;
|
float t = -m_invTimeStep;
|
||||||
_acceleration = _acceleration * t;
|
m_acceleration = m_acceleration * t;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_velocity.X = vel.X;
|
_velocity.X = vel.X;
|
||||||
_velocity.Y = vel.Y;
|
_velocity.Y = vel.Y;
|
||||||
_velocity.Z = vel.Z;
|
_velocity.Z = vel.Z;
|
||||||
_acceleration = (_velocity - _acceleration) * m_invTimeStep;
|
m_acceleration = (_velocity - m_acceleration) * m_invTimeStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Math.Abs(_acceleration.X) < 0.01f) &&
|
if ((Math.Abs(m_acceleration.X) < 0.01f) &&
|
||||||
(Math.Abs(_acceleration.Y) < 0.01f) &&
|
(Math.Abs(m_acceleration.Y) < 0.01f) &&
|
||||||
(Math.Abs(_acceleration.Z) < 0.01f))
|
(Math.Abs(m_acceleration.Z) < 0.01f))
|
||||||
{
|
{
|
||||||
_acceleration = Vector3.Zero;
|
m_acceleration = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
vel = d.BodyGetAngularVel(Body);
|
vel = d.BodyGetAngularVel(Body);
|
||||||
if ((Math.Abs(vel.X) < 0.0001) &&
|
if ((Math.Abs(vel.X) < 0.0001) &&
|
||||||
(Math.Abs(vel.Y) < 0.0001) &&
|
(Math.Abs(vel.Y) < 0.0001) &&
|
||||||
(Math.Abs(vel.Z) < 0.0001)
|
(Math.Abs(vel.Z) < 0.0001)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
m_rotationalVelocity = Vector3.Zero;
|
m_rotationalVelocity = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
@ -3939,6 +4183,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
changePIDHoverActive((bool)arg);
|
changePIDHoverActive((bool)arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case changes.SetInertia:
|
||||||
|
changeInertia((PhysicsInertiaData) arg);
|
||||||
|
break;
|
||||||
|
|
||||||
case changes.Null:
|
case changes.Null:
|
||||||
donullchange();
|
donullchange();
|
||||||
break;
|
break;
|
||||||
|
@ -3955,7 +4203,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
_parent_scene.AddChange((PhysicsActor) this, what, arg);
|
_parent_scene.AddChange((PhysicsActor) this, what, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private struct strVehicleBoolParam
|
private struct strVehicleBoolParam
|
||||||
{
|
{
|
||||||
public int param;
|
public int param;
|
||||||
|
|
|
@ -155,6 +155,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
VehicleRotationParam,
|
VehicleRotationParam,
|
||||||
VehicleFlags,
|
VehicleFlags,
|
||||||
SetVehicle,
|
SetVehicle,
|
||||||
|
SetInertia,
|
||||||
|
|
||||||
Null //keep this last used do dim the methods array. does nothing but pulsing the prim
|
Null //keep this last used do dim the methods array. does nothing but pulsing the prim
|
||||||
}
|
}
|
||||||
|
@ -185,7 +186,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
float frictionMovementMult = 0.8f;
|
float frictionMovementMult = 0.8f;
|
||||||
|
|
||||||
float TerrainBounce = 0.1f;
|
float TerrainBounce = 0.001f;
|
||||||
float TerrainFriction = 0.3f;
|
float TerrainFriction = 0.3f;
|
||||||
|
|
||||||
public float AvatarFriction = 0;// 0.9f * 0.5f;
|
public float AvatarFriction = 0;// 0.9f * 0.5f;
|
||||||
|
@ -502,7 +503,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
d.WorldSetGravity(world, gravityx, gravityy, gravityz);
|
d.WorldSetGravity(world, gravityx, gravityy, gravityz);
|
||||||
|
|
||||||
d.WorldSetLinearDamping(world, 0.002f);
|
d.WorldSetLinearDamping(world, 0.001f);
|
||||||
d.WorldSetAngularDamping(world, 0.002f);
|
d.WorldSetAngularDamping(world, 0.002f);
|
||||||
d.WorldSetAngularDampingThreshold(world, 0f);
|
d.WorldSetAngularDampingThreshold(world, 0f);
|
||||||
d.WorldSetLinearDampingThreshold(world, 0f);
|
d.WorldSetLinearDampingThreshold(world, 0f);
|
||||||
|
@ -528,6 +529,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
SharedTmpcontact.surface.mode = comumContactFlags;
|
SharedTmpcontact.surface.mode = comumContactFlags;
|
||||||
SharedTmpcontact.surface.mu = 0;
|
SharedTmpcontact.surface.mu = 0;
|
||||||
SharedTmpcontact.surface.bounce = 0;
|
SharedTmpcontact.surface.bounce = 0;
|
||||||
|
SharedTmpcontact.surface.bounce_vel = 1.5f;
|
||||||
SharedTmpcontact.surface.soft_cfm = comumContactCFM;
|
SharedTmpcontact.surface.soft_cfm = comumContactCFM;
|
||||||
SharedTmpcontact.surface.soft_erp = comumContactERP;
|
SharedTmpcontact.surface.soft_erp = comumContactERP;
|
||||||
SharedTmpcontact.surface.slip1 = comumContactSLIP;
|
SharedTmpcontact.surface.slip1 = comumContactSLIP;
|
||||||
|
@ -726,8 +728,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
if (g1 == g2)
|
if (g1 == g2)
|
||||||
return; // Can't collide with yourself
|
return; // Can't collide with yourself
|
||||||
|
|
||||||
if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
|
// if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
|
||||||
return;
|
// return;
|
||||||
/*
|
/*
|
||||||
// debug
|
// debug
|
||||||
PhysicsActor dp2;
|
PhysicsActor dp2;
|
||||||
|
@ -1082,9 +1084,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
case ActorTypes.Prim:
|
case ActorTypes.Prim:
|
||||||
if (p2events)
|
if (p2events)
|
||||||
{
|
{
|
||||||
AddCollisionEventReporting(p2);
|
//AddCollisionEventReporting(p2);
|
||||||
p2.AddCollisionEvent(p1.ParentActor.LocalID, contact);
|
p2.AddCollisionEvent(p1.ParentActor.LocalID, contact);
|
||||||
}
|
}
|
||||||
|
else if(p1.IsVolumeDtc)
|
||||||
|
p2.AddVDTCCollisionEvent(p1.ParentActor.LocalID, contact);
|
||||||
|
|
||||||
obj2LocalID = p2.ParentActor.LocalID;
|
obj2LocalID = p2.ParentActor.LocalID;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1098,9 +1103,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
contact.SurfaceNormal = -contact.SurfaceNormal;
|
contact.SurfaceNormal = -contact.SurfaceNormal;
|
||||||
contact.RelativeSpeed = -contact.RelativeSpeed;
|
contact.RelativeSpeed = -contact.RelativeSpeed;
|
||||||
AddCollisionEventReporting(p1);
|
//AddCollisionEventReporting(p1);
|
||||||
p1.AddCollisionEvent(obj2LocalID, contact);
|
p1.AddCollisionEvent(obj2LocalID, contact);
|
||||||
}
|
}
|
||||||
|
else if(p2.IsVolumeDtc)
|
||||||
|
{
|
||||||
|
contact.SurfaceNormal = -contact.SurfaceNormal;
|
||||||
|
contact.RelativeSpeed = -contact.RelativeSpeed;
|
||||||
|
//AddCollisionEventReporting(p1);
|
||||||
|
p1.AddVDTCCollisionEvent(obj2LocalID, contact);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ActorTypes.Ground:
|
case ActorTypes.Ground:
|
||||||
|
@ -1109,7 +1121,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
if (p2events && !p2.IsVolumeDtc)
|
if (p2events && !p2.IsVolumeDtc)
|
||||||
{
|
{
|
||||||
AddCollisionEventReporting(p2);
|
//AddCollisionEventReporting(p2);
|
||||||
p2.AddCollisionEvent(0, contact);
|
p2.AddCollisionEvent(0, contact);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1161,8 +1173,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
aprim.CollisionScore = 0;
|
aprim.CollisionScore = 0;
|
||||||
aprim.IsColliding = false;
|
aprim.IsColliding = false;
|
||||||
|
if(!aprim.m_outbounds && d.BodyIsEnabled(aprim.Body))
|
||||||
|
aprim.clearSleeperCollisions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (_activegroups)
|
lock (_activegroups)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1657,11 +1672,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
// d.WorldSetQuickStepNumIterations(world, curphysiteractions);
|
// d.WorldSetQuickStepNumIterations(world, curphysiteractions);
|
||||||
|
|
||||||
int loopstartMS = Util.EnvironmentTickCount();
|
double loopstartMS = Util.GetTimeStampMS();
|
||||||
int looptimeMS = 0;
|
double looptimeMS = 0;
|
||||||
int changestimeMS = 0;
|
double changestimeMS = 0;
|
||||||
int maxChangestime = (int)(reqTimeStep * 500f); // half the time
|
double maxChangestime = (int)(reqTimeStep * 500f); // half the time
|
||||||
int maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time
|
double maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time
|
||||||
|
|
||||||
|
// double collisionTime = 0;
|
||||||
|
// double qstepTIme = 0;
|
||||||
|
// double tmpTime = 0;
|
||||||
|
|
||||||
d.AllocateODEDataForThread(~0U);
|
d.AllocateODEDataForThread(~0U);
|
||||||
|
|
||||||
|
@ -1684,7 +1703,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
item.actor.Name, item.what.ToString());
|
item.actor.Name, item.what.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
changestimeMS = Util.EnvironmentTickCountSubtract(loopstartMS);
|
changestimeMS = Util.GetTimeStampMS() - loopstartMS;
|
||||||
if (changestimeMS > maxChangestime)
|
if (changestimeMS > maxChangestime)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1729,9 +1748,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
m_rayCastManager.ProcessQueuedRequests();
|
m_rayCastManager.ProcessQueuedRequests();
|
||||||
|
|
||||||
|
// tmpTime = Util.GetTimeStampMS();
|
||||||
collision_optimized();
|
collision_optimized();
|
||||||
List<OdePrim> sleepers = new List<OdePrim>();
|
// collisionTime += Util.GetTimeStampMS() - tmpTime;
|
||||||
|
|
||||||
|
lock(_collisionEventPrimRemove)
|
||||||
|
{
|
||||||
|
foreach (PhysicsActor obj in _collisionEventPrimRemove)
|
||||||
|
_collisionEventPrim.Remove(obj);
|
||||||
|
|
||||||
|
_collisionEventPrimRemove.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<OdePrim> sleepers = new List<OdePrim>();
|
||||||
foreach (PhysicsActor obj in _collisionEventPrim)
|
foreach (PhysicsActor obj in _collisionEventPrim)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
|
@ -1761,18 +1790,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
foreach(OdePrim prm in sleepers)
|
foreach(OdePrim prm in sleepers)
|
||||||
prm.SleeperAddCollisionEvents();
|
prm.SleeperAddCollisionEvents();
|
||||||
sleepers.Clear();
|
sleepers.Clear();
|
||||||
|
|
||||||
lock(_collisionEventPrimRemove)
|
|
||||||
{
|
|
||||||
foreach (PhysicsActor obj in _collisionEventPrimRemove)
|
|
||||||
_collisionEventPrim.Remove(obj);
|
|
||||||
|
|
||||||
_collisionEventPrimRemove.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// do a ode simulation step
|
// do a ode simulation step
|
||||||
|
// tmpTime = Util.GetTimeStampMS();
|
||||||
d.WorldQuickStep(world, ODE_STEPSIZE);
|
d.WorldQuickStep(world, ODE_STEPSIZE);
|
||||||
d.JointGroupEmpty(contactgroup);
|
d.JointGroupEmpty(contactgroup);
|
||||||
|
// qstepTIme += Util.GetTimeStampMS() - tmpTime;
|
||||||
|
|
||||||
// update managed ideia of physical data and do updates to core
|
// update managed ideia of physical data and do updates to core
|
||||||
/*
|
/*
|
||||||
|
@ -1813,7 +1836,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
step_time -= ODE_STEPSIZE;
|
step_time -= ODE_STEPSIZE;
|
||||||
nodeframes++;
|
nodeframes++;
|
||||||
|
|
||||||
looptimeMS = Util.EnvironmentTickCountSubtract(loopstartMS);
|
looptimeMS = Util.GetTimeStampMS() - loopstartMS;
|
||||||
if (looptimeMS > maxLoopTime)
|
if (looptimeMS > maxLoopTime)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1881,6 +1904,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
int totgeoms = nstaticgeoms + nactivegeoms + ngroundgeoms + 1; // one ray
|
int totgeoms = nstaticgeoms + nactivegeoms + ngroundgeoms + 1; // one ray
|
||||||
int nbodies = d.NTotalBodies;
|
int nbodies = d.NTotalBodies;
|
||||||
int ngeoms = d.NTotalGeoms;
|
int ngeoms = d.NTotalGeoms;
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
looptimeMS /= nodeframes;
|
||||||
|
if(looptimeMS > 0.080)
|
||||||
|
{
|
||||||
|
collisionTime /= nodeframes;
|
||||||
|
qstepTIme /= nodeframes;
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
// Finished with all sim stepping. If requested, dump world state to file for debugging.
|
// Finished with all sim stepping. If requested, dump world state to file for debugging.
|
||||||
// TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed?
|
// TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed?
|
||||||
|
|
|
@ -454,7 +454,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
|
|
||||||
if (physicsParms == null)
|
if (physicsParms == null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[MESH]: unknown mesh type for prim {0}",primName);
|
//m_log.WarnFormat("[MESH]: unknown mesh type for prim {0}",primName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,7 +712,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if neither mesh or decomposition present, warn and use convex
|
// 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);
|
//m_log.WarnFormat("[MESH]: Data for PRIM shape type ( mesh or decomposition) not found for prim {0}",primName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vs.Clear();
|
vs.Clear();
|
||||||
|
|
|
@ -424,6 +424,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return lease;
|
return lease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected SceneObjectPart MonitoringObject()
|
||||||
|
{
|
||||||
|
UUID m = m_host.ParentGroup.MonitoringObject;
|
||||||
|
if (m == UUID.Zero)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
SceneObjectPart p = m_ScriptEngine.World.GetSceneObjectPart(m);
|
||||||
|
if (p == null)
|
||||||
|
m_host.ParentGroup.MonitoringObject = UUID.Zero;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void ScriptSleep(int delay)
|
protected virtual void ScriptSleep(int delay)
|
||||||
{
|
{
|
||||||
delay = (int)((float)delay * m_ScriptDelayFactor);
|
delay = (int)((float)delay * m_ScriptDelayFactor);
|
||||||
|
@ -481,12 +494,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
UUID item;
|
UUID item;
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
if ((item = GetScriptByName(name)) == UUID.Zero)
|
||||||
|
{
|
||||||
if ((item = GetScriptByName(name)) != UUID.Zero)
|
m_host.AddScriptLPS(1);
|
||||||
m_ScriptEngine.ResetScript(item);
|
|
||||||
else
|
|
||||||
Error("llResetOtherScript", "Can't find script '" + name + "'");
|
Error("llResetOtherScript", "Can't find script '" + name + "'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(item == m_item.ItemID)
|
||||||
|
llResetScript();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
m_ScriptEngine.ResetScript(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llGetScriptState(string name)
|
public LSL_Integer llGetScriptState(string name)
|
||||||
|
@ -2712,9 +2732,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
/// <param name="adjust">if TRUE, will cap the distance to 10m.</param>
|
/// <param name="adjust">if TRUE, will cap the distance to 10m.</param>
|
||||||
protected void SetPos(SceneObjectPart part, LSL_Vector targetPos, bool adjust)
|
protected void SetPos(SceneObjectPart part, LSL_Vector targetPos, bool adjust)
|
||||||
{
|
{
|
||||||
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
|
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted || part.ParentGroup.inTransit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
LSL_Vector currentPos = GetPartLocalPos(part);
|
LSL_Vector currentPos = GetPartLocalPos(part);
|
||||||
LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos, adjust);
|
LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos, adjust);
|
||||||
|
|
||||||
|
@ -2722,7 +2743,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (part.ParentGroup.RootPart == part)
|
if (part.ParentGroup.RootPart == part)
|
||||||
{
|
{
|
||||||
SceneObjectGroup parent = part.ParentGroup;
|
SceneObjectGroup parent = part.ParentGroup;
|
||||||
if (!parent.IsAttachment && !World.Permissions.CanObjectEntry(parent.UUID, false, (Vector3)toPos))
|
if (!parent.IsAttachment && !World.Permissions.CanObjectEntry(parent, false, (Vector3)toPos))
|
||||||
return;
|
return;
|
||||||
parent.UpdateGroupPosition((Vector3)toPos);
|
parent.UpdateGroupPosition((Vector3)toPos);
|
||||||
}
|
}
|
||||||
|
@ -5738,29 +5759,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
|
||||||
index = src.Length + index;
|
index = src.Length + index;
|
||||||
}
|
|
||||||
if (index >= src.Length || index < 0)
|
if (index >= src.Length || index < 0)
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
object item = src.Data[index];
|
||||||
|
|
||||||
// Vectors & Rotations always return zero in SL, but
|
// Vectors & Rotations always return zero in SL, but
|
||||||
// keys don't always return zero, it seems to be a bit complex.
|
// keys don't always return zero, it seems to be a bit complex.
|
||||||
else if (src.Data[index] is LSL_Vector ||
|
if (item is LSL_Vector || item is LSL_Rotation)
|
||||||
src.Data[index] is LSL_Rotation)
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (item is LSL_Integer)
|
||||||
if (src.Data[index] is LSL_Integer)
|
return (LSL_Integer)item;
|
||||||
return (LSL_Integer)src.Data[index];
|
else if (item is LSL_Float)
|
||||||
else if (src.Data[index] is LSL_Float)
|
return Convert.ToInt32(((LSL_Float)item).value);;
|
||||||
return Convert.ToInt32(((LSL_Float)src.Data[index]).value);
|
return new LSL_Integer(item.ToString());
|
||||||
return new LSL_Integer(src.Data[index].ToString());
|
|
||||||
}
|
}
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
|
@ -5772,38 +5789,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
|
||||||
index = src.Length + index;
|
index = src.Length + index;
|
||||||
}
|
|
||||||
if (index >= src.Length || index < 0)
|
if (index >= src.Length || index < 0)
|
||||||
{
|
return 0;
|
||||||
return 0.0;
|
|
||||||
}
|
object item = src.Data[index];
|
||||||
|
|
||||||
// Vectors & Rotations always return zero in SL
|
// Vectors & Rotations always return zero in SL
|
||||||
else if (src.Data[index] is LSL_Vector ||
|
if(item is LSL_Vector || item is LSL_Rotation)
|
||||||
src.Data[index] is LSL_Rotation)
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
// valid keys seem to get parsed as integers then converted to floats
|
// valid keys seem to get parsed as integers then converted to floats
|
||||||
else
|
if (item is LSL_Key)
|
||||||
{
|
{
|
||||||
UUID uuidt;
|
UUID uuidt;
|
||||||
if (src.Data[index] is LSL_Key && UUID.TryParse(src.Data[index].ToString(), out uuidt))
|
string s = item.ToString();
|
||||||
{
|
if(UUID.TryParse(s, out uuidt))
|
||||||
return Convert.ToDouble(new LSL_Integer(src.Data[index].ToString()).value);
|
return Convert.ToDouble(new LSL_Integer(s).value);
|
||||||
}
|
// we can't do this because a string is also a LSL_Key for now :(
|
||||||
|
// else
|
||||||
|
// return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (src.Data[index] is LSL_Integer)
|
if (item is LSL_Integer)
|
||||||
return Convert.ToDouble(((LSL_Integer)src.Data[index]).value);
|
return Convert.ToDouble(((LSL_Integer)item).value);
|
||||||
else if (src.Data[index] is LSL_Float)
|
else if (item is LSL_Float)
|
||||||
return Convert.ToDouble(((LSL_Float)src.Data[index]).value);
|
return Convert.ToDouble(((LSL_Float)item).value);
|
||||||
else if (src.Data[index] is LSL_String)
|
else if (item is LSL_String)
|
||||||
{
|
{
|
||||||
string str = ((LSL_String) src.Data[index]).m_string;
|
string str = ((LSL_String)item).m_string;
|
||||||
Match m = Regex.Match(str, "^\\s*(-?\\+?[,0-9]+\\.?[0-9]*)");
|
Match m = Regex.Match(str, "^\\s*(-?\\+?[,0-9]+\\.?[0-9]*)");
|
||||||
if (m != Match.Empty)
|
if (m != Match.Empty)
|
||||||
{
|
{
|
||||||
|
@ -5811,12 +5828,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
double d = 0.0;
|
double d = 0.0;
|
||||||
if (!Double.TryParse(str, out d))
|
if (!Double.TryParse(str, out d))
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
return Convert.ToDouble(src.Data[index]);
|
return Convert.ToDouble(item);
|
||||||
}
|
}
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
|
@ -5828,13 +5844,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
|
||||||
index = src.Length + index;
|
index = src.Length + index;
|
||||||
}
|
|
||||||
if (index >= src.Length || index < 0)
|
if (index >= src.Length || index < 0)
|
||||||
{
|
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
|
||||||
return src.Data[index].ToString();
|
return src.Data[index].ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5842,14 +5856,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
|
||||||
index = src.Length + index;
|
index = src.Length + index;
|
||||||
}
|
|
||||||
|
|
||||||
if (index >= src.Length || index < 0)
|
if (index >= src.Length || index < 0)
|
||||||
{
|
return String.Empty;
|
||||||
return "";
|
|
||||||
}
|
object item = src.Data[index];
|
||||||
|
|
||||||
// SL spits out an empty string for types other than key & string
|
// SL spits out an empty string for types other than key & string
|
||||||
// At the time of patching, LSL_Key is currently LSL_String,
|
// At the time of patching, LSL_Key is currently LSL_String,
|
||||||
|
@ -5858,31 +5870,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// as it's own struct
|
// as it's own struct
|
||||||
// NOTE: 3rd case is needed because a NULL_KEY comes through as
|
// NOTE: 3rd case is needed because a NULL_KEY comes through as
|
||||||
// type 'obj' and wrongly returns ""
|
// type 'obj' and wrongly returns ""
|
||||||
else if (!(src.Data[index] is LSL_String ||
|
if (!(item is LSL_String ||
|
||||||
src.Data[index] is LSL_Key ||
|
item is LSL_Key ||
|
||||||
src.Data[index].ToString() == "00000000-0000-0000-0000-000000000000"))
|
item.ToString() == "00000000-0000-0000-0000-000000000000"))
|
||||||
{
|
{
|
||||||
return "";
|
return String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
return src.Data[index].ToString();
|
return item.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Vector llList2Vector(LSL_List src, int index)
|
public LSL_Vector llList2Vector(LSL_List src, int index)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
|
||||||
index = src.Length + index;
|
index = src.Length + index;
|
||||||
}
|
|
||||||
if (index >= src.Length || index < 0)
|
if (index >= src.Length || index < 0)
|
||||||
{
|
|
||||||
return new LSL_Vector(0, 0, 0);
|
return new LSL_Vector(0, 0, 0);
|
||||||
}
|
|
||||||
if (src.Data[index].GetType() == typeof(LSL_Vector))
|
object item = src.Data[index];
|
||||||
{
|
|
||||||
return (LSL_Vector)src.Data[index];
|
if (item.GetType() == typeof(LSL_Vector))
|
||||||
}
|
return (LSL_Vector)item;
|
||||||
|
|
||||||
// SL spits always out ZERO_VECTOR for anything other than
|
// SL spits always out ZERO_VECTOR for anything other than
|
||||||
// strings or vectors. Although keys always return ZERO_VECTOR,
|
// strings or vectors. Although keys always return ZERO_VECTOR,
|
||||||
|
@ -5890,28 +5900,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// a string, a key as string and a string that by coincidence
|
// a string, a key as string and a string that by coincidence
|
||||||
// is a string, so we're going to leave that up to the
|
// is a string, so we're going to leave that up to the
|
||||||
// LSL_Vector constructor.
|
// LSL_Vector constructor.
|
||||||
else if (!(src.Data[index] is LSL_String ||
|
if(item is LSL_Vector)
|
||||||
src.Data[index] is LSL_Vector))
|
return (LSL_Vector) item;
|
||||||
{
|
|
||||||
return new LSL_Vector(0, 0, 0);
|
if (item is LSL_String)
|
||||||
}
|
return new LSL_Vector(item.ToString());
|
||||||
else
|
|
||||||
{
|
return new LSL_Vector(0, 0, 0);
|
||||||
return new LSL_Vector(src.Data[index].ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Rotation llList2Rot(LSL_List src, int index)
|
public LSL_Rotation llList2Rot(LSL_List src, int index)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
|
||||||
index = src.Length + index;
|
index = src.Length + index;
|
||||||
}
|
|
||||||
if (index >= src.Length || index < 0)
|
if (index >= src.Length || index < 0)
|
||||||
{
|
|
||||||
return new LSL_Rotation(0, 0, 0, 1);
|
return new LSL_Rotation(0, 0, 0, 1);
|
||||||
}
|
|
||||||
|
object item = src.Data[index];
|
||||||
|
|
||||||
// SL spits always out ZERO_ROTATION for anything other than
|
// SL spits always out ZERO_ROTATION for anything other than
|
||||||
// strings or vectors. Although keys always return ZERO_ROTATION,
|
// strings or vectors. Although keys always return ZERO_ROTATION,
|
||||||
|
@ -5919,19 +5926,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// a string, a key as string and a string that by coincidence
|
// a string, a key as string and a string that by coincidence
|
||||||
// is a string, so we're going to leave that up to the
|
// is a string, so we're going to leave that up to the
|
||||||
// LSL_Rotation constructor.
|
// LSL_Rotation constructor.
|
||||||
else if (!(src.Data[index] is LSL_String ||
|
|
||||||
src.Data[index] is LSL_Rotation))
|
if (item.GetType() == typeof(LSL_Rotation))
|
||||||
{
|
return (LSL_Rotation)item;
|
||||||
return new LSL_Rotation(0, 0, 0, 1);
|
|
||||||
}
|
if (item is LSL_String)
|
||||||
else if (src.Data[index].GetType() == typeof(LSL_Rotation))
|
|
||||||
{
|
|
||||||
return (LSL_Rotation)src.Data[index];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new LSL_Rotation(src.Data[index].ToString());
|
return new LSL_Rotation(src.Data[index].ToString());
|
||||||
}
|
|
||||||
|
return new LSL_Rotation(0, 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_List llList2List(LSL_List src, int start, int end)
|
public LSL_List llList2List(LSL_List src, int start, int end)
|
||||||
|
@ -7963,7 +7965,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Integer llScriptDanger(LSL_Vector pos)
|
public LSL_Integer llScriptDanger(LSL_Vector pos)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
bool result = World.ScriptDanger(m_host.LocalId, pos);
|
bool result = World.LSLScriptDanger(m_host, pos);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -7972,7 +7974,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel)
|
public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel)
|
||||||
|
@ -8849,10 +8850,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSetPhysicsMaterial(int material_bits,
|
public void llSetPhysicsMaterial(int material_bits,
|
||||||
float material_gravity_modifier, float material_restitution,
|
LSL_Float material_gravity_modifier, LSL_Float material_restitution,
|
||||||
float material_friction, float material_density)
|
LSL_Float material_friction, LSL_Float material_density)
|
||||||
{
|
{
|
||||||
SetPhysicsMaterial(m_host, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier);
|
SetPhysicsMaterial(m_host, material_bits, (float)material_density, (float)material_friction, (float)material_restitution, (float)material_gravity_modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vector up using libomv (c&p from sop )
|
// vector up using libomv (c&p from sop )
|
||||||
|
@ -11297,6 +11298,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case (int)ScriptBaseClass.PRIM_NORMAL:
|
||||||
|
case (int)ScriptBaseClass.PRIM_SPECULAR:
|
||||||
|
case (int)ScriptBaseClass.PRIM_ALPHA_MODE:
|
||||||
|
if (remain < 1)
|
||||||
|
return new LSL_List();
|
||||||
|
|
||||||
|
face = (int)rules.GetLSLIntegerItem(idx++);
|
||||||
|
tex = part.Shape.Textures;
|
||||||
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
|
{
|
||||||
|
for (face = 0; face < GetNumberOfSides(part); face++)
|
||||||
|
{
|
||||||
|
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
|
||||||
|
getLSLFaceMaterial(ref res, code, part, texface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
|
{
|
||||||
|
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
|
||||||
|
getLSLFaceMaterial(ref res, code, part, texface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
|
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
|
||||||
|
|
||||||
// TODO: Should be issuing a runtime script warning in this case.
|
// TODO: Should be issuing a runtime script warning in this case.
|
||||||
|
@ -11310,6 +11337,108 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return new LSL_List();
|
return new LSL_List();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
private string filterTextureUUIDbyRights(UUID origID, SceneObjectPart part, bool checkTaskInventory, bool returnInvName)
|
||||||
|
{
|
||||||
|
if(checkTaskInventory)
|
||||||
|
{
|
||||||
|
lock (part.TaskInventory)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in part.TaskInventory)
|
||||||
|
{
|
||||||
|
if (inv.Value.AssetID == origID)
|
||||||
|
{
|
||||||
|
if(inv.Value.InvType == (int)InventoryType.Texture)
|
||||||
|
{
|
||||||
|
if(returnInvName)
|
||||||
|
return inv.Value.Name;
|
||||||
|
else
|
||||||
|
return origID.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return UUID.Zero.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(World.Permissions.CanEditObject(m_host.ParentGroup.UUID, m_host.ParentGroup.RootPart.OwnerID))
|
||||||
|
return origID.ToString();
|
||||||
|
|
||||||
|
return UUID.Zero.ToString();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
private void getLSLFaceMaterial(ref LSL_List res, int code, SceneObjectPart part, Primitive.TextureEntryFace texface)
|
||||||
|
{
|
||||||
|
UUID matID = texface.MaterialID;
|
||||||
|
if(matID != UUID.Zero)
|
||||||
|
{
|
||||||
|
AssetBase MatAsset = World.AssetService.Get(matID.ToString());
|
||||||
|
if(MatAsset != null)
|
||||||
|
{
|
||||||
|
Byte[] data = MatAsset.Data;
|
||||||
|
OSDMap osdmat = (OSDMap)OSDParser.DeserializeLLSDXml(data);
|
||||||
|
if(osdmat != null && osdmat.ContainsKey("NormMap"))
|
||||||
|
{
|
||||||
|
string mapIDstr;
|
||||||
|
FaceMaterial mat = new FaceMaterial(matID, osdmat);
|
||||||
|
if(code == ScriptBaseClass.PRIM_NORMAL)
|
||||||
|
{
|
||||||
|
// mapIDstr = filterTextureUUIDbyRights(mat.NormalMapID, part, true, false);
|
||||||
|
mapIDstr = mat.NormalMapID.ToString();
|
||||||
|
res.Add(new LSL_String(mapIDstr));
|
||||||
|
res.Add(new LSL_Vector(mat.NormalRepeatX, mat.NormalRepeatY, 0));
|
||||||
|
res.Add(new LSL_Vector(mat.NormalOffsetX, mat.NormalOffsetY, 0));
|
||||||
|
res.Add(new LSL_Float(mat.NormalRotation));
|
||||||
|
}
|
||||||
|
else if(code == ScriptBaseClass.PRIM_SPECULAR )
|
||||||
|
{
|
||||||
|
// mapIDstr = filterTextureUUIDbyRights(mat.SpecularMapID, part, true, false);
|
||||||
|
const float colorScale = 1.0f/255f;
|
||||||
|
mapIDstr = mat.SpecularMapID.ToString();
|
||||||
|
res.Add(new LSL_String(mapIDstr));
|
||||||
|
res.Add(new LSL_Vector(mat.SpecularRepeatX, mat.SpecularRepeatY, 0));
|
||||||
|
res.Add(new LSL_Vector(mat.SpecularOffsetX, mat.SpecularOffsetY, 0));
|
||||||
|
res.Add(new LSL_Float(mat.SpecularRotation));
|
||||||
|
res.Add(new LSL_Vector(mat.SpecularLightColor.R * colorScale,
|
||||||
|
mat.SpecularLightColor.G * colorScale,
|
||||||
|
mat.SpecularLightColor.B * colorScale));
|
||||||
|
res.Add(new LSL_Integer(mat.SpecularLightExponent));
|
||||||
|
res.Add(new LSL_Integer(mat.EnvironmentIntensity));
|
||||||
|
}
|
||||||
|
else if(code == ScriptBaseClass.PRIM_ALPHA_MODE)
|
||||||
|
{
|
||||||
|
res.Add(new LSL_Integer(mat.DiffuseAlphaMode));
|
||||||
|
res.Add(new LSL_Integer(mat.AlphaMaskCutoff));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
matID = UUID.Zero;
|
||||||
|
}
|
||||||
|
if(matID == UUID.Zero)
|
||||||
|
{
|
||||||
|
if(code == (int)ScriptBaseClass.PRIM_NORMAL || code == (int)ScriptBaseClass.PRIM_SPECULAR )
|
||||||
|
{
|
||||||
|
res.Add(new LSL_String(UUID.Zero.ToString()));
|
||||||
|
res.Add(new LSL_Vector(1.0, 1.0, 0));
|
||||||
|
res.Add(new LSL_Vector(0, 0, 0));
|
||||||
|
res.Add(new LSL_Float(0));
|
||||||
|
|
||||||
|
if(code == (int)ScriptBaseClass.PRIM_SPECULAR)
|
||||||
|
{
|
||||||
|
res.Add(new LSL_Vector(1.0, 1.0, 1.0));
|
||||||
|
res.Add(new LSL_Integer(51));
|
||||||
|
res.Add(new LSL_Integer(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(code == (int)ScriptBaseClass.PRIM_ALPHA_MODE)
|
||||||
|
{
|
||||||
|
res.Add(new LSL_Integer(1));
|
||||||
|
res.Add(new LSL_Integer(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public LSL_List llGetPrimMediaParams(int face, LSL_List rules)
|
public LSL_List llGetPrimMediaParams(int face, LSL_List rules)
|
||||||
{
|
{
|
||||||
|
@ -15867,7 +15996,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
group.RootPart.AttachPoint = group.RootPart.Shape.State;
|
|
||||||
group.RootPart.AttachedPos = group.AbsolutePosition;
|
group.RootPart.AttachedPos = group.AbsolutePosition;
|
||||||
|
|
||||||
group.ResetIDs();
|
group.ResetIDs();
|
||||||
|
|
|
@ -260,7 +260,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
|
wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns of the function is allowed. Throws a script exception if not allowed.
|
// Returns if OSSL is enabled. Throws a script exception if OSSL is not allowed..
|
||||||
|
// for safe funtions always active
|
||||||
|
public void CheckThreatLevel()
|
||||||
|
{
|
||||||
|
if (!m_OSFunctionsEnabled)
|
||||||
|
OSSLError(String.Format("{0} permission denied. All OS functions are disabled.")); // throws
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns if the function is allowed. Throws a script exception if not allowed.
|
||||||
public void CheckThreatLevel(ThreatLevel level, string function)
|
public void CheckThreatLevel(ThreatLevel level, string function)
|
||||||
{
|
{
|
||||||
if (!m_OSFunctionsEnabled)
|
if (!m_OSFunctionsEnabled)
|
||||||
|
@ -1716,7 +1724,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public LSL_Integer osCheckODE()
|
public LSL_Integer osCheckODE()
|
||||||
{
|
{
|
||||||
|
CheckThreatLevel();
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
LSL_Integer ret = 0; // false
|
LSL_Integer ret = 0; // false
|
||||||
if (m_ScriptEngine.World.PhysicsScene != null)
|
if (m_ScriptEngine.World.PhysicsScene != null)
|
||||||
{
|
{
|
||||||
|
@ -1757,10 +1767,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public string osGetPhysicsEngineName()
|
public string osGetPhysicsEngineName()
|
||||||
{
|
{
|
||||||
// not doing security checks
|
CheckThreatLevel();
|
||||||
// this whould limit the use of this
|
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
string ret = "NoEngine";
|
string ret = "NoEngine";
|
||||||
if (m_ScriptEngine.World.PhysicsScene != null)
|
if (m_ScriptEngine.World.PhysicsScene != null)
|
||||||
{
|
{
|
||||||
|
@ -1771,6 +1780,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string osGetSimulatorVersion()
|
public string osGetSimulatorVersion()
|
||||||
{
|
{
|
||||||
// High because it can be used to target attacks to known weaknesses
|
// High because it can be used to target attacks to known weaknesses
|
||||||
|
@ -2038,6 +2048,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.Inventory.AddInventoryItemExclusive(taskItem, false);
|
m_host.Inventory.AddInventoryItemExclusive(taskItem, false);
|
||||||
else
|
else
|
||||||
m_host.Inventory.AddInventoryItem(taskItem, false);
|
m_host.Inventory.AddInventoryItem(taskItem, false);
|
||||||
|
m_host.ParentGroup.AggregatePerms();
|
||||||
|
|
||||||
return taskItem;
|
return taskItem;
|
||||||
}
|
}
|
||||||
|
@ -3537,7 +3548,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
LSL_Float health = new LSL_Float(-1);
|
LSL_Float health = new LSL_Float(-1);
|
||||||
ScenePresence presence = World.GetScenePresence(new UUID(avatar));
|
ScenePresence presence = World.GetScenePresence(new UUID(avatar));
|
||||||
if (presence != null) health = presence.Health;
|
if (presence != null)
|
||||||
|
health = presence.Health;
|
||||||
return health;
|
return health;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3577,7 +3589,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID avatarId = new UUID(avatar);
|
UUID avatarId = new UUID(avatar);
|
||||||
ScenePresence presence = World.GetScenePresence(avatarId);
|
ScenePresence presence = World.GetScenePresence(avatarId);
|
||||||
|
|
||||||
if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
|
if (presence != null)
|
||||||
{
|
{
|
||||||
float health = presence.Health;
|
float health = presence.Health;
|
||||||
health += (float)healing;
|
health += (float)healing;
|
||||||
|
@ -3597,7 +3609,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID avatarId = new UUID(avatar);
|
UUID avatarId = new UUID(avatar);
|
||||||
ScenePresence presence = World.GetScenePresence(avatarId);
|
ScenePresence presence = World.GetScenePresence(avatarId);
|
||||||
|
|
||||||
if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
|
if (presence != null)
|
||||||
{
|
{
|
||||||
if (health > 100.0)
|
if (health > 100.0)
|
||||||
health = 100.0;
|
health = 100.0;
|
||||||
|
@ -3616,7 +3628,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID avatarId = new UUID(avatar);
|
UUID avatarId = new UUID(avatar);
|
||||||
ScenePresence presence = World.GetScenePresence(avatarId);
|
ScenePresence presence = World.GetScenePresence(avatarId);
|
||||||
|
|
||||||
if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
|
if (presence != null)
|
||||||
presence.HealRate = (float)healrate;
|
presence.HealRate = (float)healrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4362,6 +4374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public void osCollisionSound(string impact_sound, double impact_volume)
|
public void osCollisionSound(string impact_sound, double impact_volume)
|
||||||
{
|
{
|
||||||
|
CheckThreatLevel();
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if(impact_sound == "")
|
if(impact_sound == "")
|
||||||
|
@ -4394,6 +4407,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// still not very usefull, detector is lost on rez, restarts, etc
|
// still not very usefull, detector is lost on rez, restarts, etc
|
||||||
public void osVolumeDetect(int detect)
|
public void osVolumeDetect(int detect)
|
||||||
{
|
{
|
||||||
|
CheckThreatLevel();
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment)
|
if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment)
|
||||||
|
@ -4402,5 +4416,285 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.ScriptSetVolumeDetect(detect != 0);
|
m_host.ScriptSetVolumeDetect(detect != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get inertial data
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>
|
||||||
|
/// a LSL list with contents:
|
||||||
|
/// LSL_Float mass, the total mass of a linkset
|
||||||
|
/// LSL_Vector CenterOfMass, center mass relative to root prim
|
||||||
|
/// LSL_Vector Inertia, elements of diagonal of inertia Ixx,Iyy,Izz divided by total mass
|
||||||
|
/// LSL_Vector aux, elements of upper triagle of inertia Ixy (= Iyx), Ixz (= Izx), Iyz(= Izy) divided by total mass
|
||||||
|
/// </returns>
|
||||||
|
public LSL_List osGetInertiaData()
|
||||||
|
{
|
||||||
|
CheckThreatLevel();
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
LSL_List result = new LSL_List();
|
||||||
|
float TotalMass;
|
||||||
|
Vector3 CenterOfMass;
|
||||||
|
Vector3 Inertia;
|
||||||
|
Vector4 aux;
|
||||||
|
|
||||||
|
SceneObjectGroup sog = m_host.ParentGroup;
|
||||||
|
if(sog== null || sog.IsDeleted)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
sog.GetInertiaData(out TotalMass, out CenterOfMass, out Inertia, out aux );
|
||||||
|
if(TotalMass > 0)
|
||||||
|
{
|
||||||
|
float t = 1.0f/TotalMass;
|
||||||
|
Inertia.X *= t;
|
||||||
|
Inertia.Y *= t;
|
||||||
|
Inertia.Z *= t;
|
||||||
|
|
||||||
|
aux.X *= t;
|
||||||
|
aux.Y *= t;
|
||||||
|
aux.Z *= t;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Add(new LSL_Float(TotalMass));
|
||||||
|
result.Add(new LSL_Vector(CenterOfMass.X, CenterOfMass.Y, CenterOfMass.Z));
|
||||||
|
result.Add(new LSL_Vector(Inertia.X, Inertia.Y, Inertia.Z));
|
||||||
|
result.Add(new LSL_Vector(aux.X, aux.Y, aux.Z));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// set inertial data
|
||||||
|
/// replaces the automatic calculation of mass, center of mass and inertia
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Mass">total mass of linkset</param>
|
||||||
|
/// <param name="centerOfMass">location of center of mass relative to root prim in local coords</param>
|
||||||
|
/// <param name="principalInertiaScaled">moment of inertia relative to principal axis and center of mass,Ixx, Iyy, Izz divided by mass</param>
|
||||||
|
/// <param name="lslrot">rotation of the inertia, relative to local axis</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// the inertia argument is is inertia divided by mass, so corresponds only to the geometric distribution of mass and both can be changed independently.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot)
|
||||||
|
{
|
||||||
|
CheckThreatLevel();
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
SceneObjectGroup sog = m_host.ParentGroup;
|
||||||
|
if(sog== null || sog.IsDeleted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(mass < 0 || principalInertiaScaled.x < 0 || principalInertiaScaled.y < 0 || principalInertiaScaled.z < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// need more checks
|
||||||
|
|
||||||
|
Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
|
||||||
|
Vector3 Inertia;
|
||||||
|
float m = (float)mass;
|
||||||
|
|
||||||
|
Inertia.X = m * (float)principalInertiaScaled.x;
|
||||||
|
Inertia.Y = m * (float)principalInertiaScaled.y;
|
||||||
|
Inertia.Z = m * (float)principalInertiaScaled.z;
|
||||||
|
|
||||||
|
Vector4 rot = new Vector4((float)lslrot.x, (float)lslrot.y, (float)lslrot.y, (float)lslrot.s);
|
||||||
|
rot.Normalize();
|
||||||
|
|
||||||
|
sog.SetInertiaData(m, CenterOfMass, Inertia, rot );
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// set inertial data as a sphere
|
||||||
|
/// replaces the automatic calculation of mass, center of mass and inertia
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Mass">total mass of linkset</param>
|
||||||
|
/// <param name="boxsize">size of the Box</param>
|
||||||
|
/// <param name="centerOfMass">location of center of mass relative to root prim in local coords</param>
|
||||||
|
/// <param name="lslrot">rotation of the box, and so inertia, relative to local axis</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// </remarks>
|
||||||
|
public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot)
|
||||||
|
{
|
||||||
|
CheckThreatLevel();
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
SceneObjectGroup sog = m_host.ParentGroup;
|
||||||
|
if(sog== null || sog.IsDeleted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(mass < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// need more checks
|
||||||
|
|
||||||
|
Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
|
||||||
|
Vector3 Inertia;
|
||||||
|
float lx = (float)boxSize.x;
|
||||||
|
float ly = (float)boxSize.y;
|
||||||
|
float lz = (float)boxSize.z;
|
||||||
|
float m = (float)mass;
|
||||||
|
float t = m / 12.0f;
|
||||||
|
|
||||||
|
Inertia.X = t * (ly*ly + lz*lz);
|
||||||
|
Inertia.Y = t * (lx*lx + lz*lz);
|
||||||
|
Inertia.Z = t * (lx*lx + ly*ly);
|
||||||
|
|
||||||
|
Vector4 rot = new Vector4((float)lslrot.x, (float)lslrot.y, (float)lslrot.z, (float)lslrot.s);
|
||||||
|
rot.Normalize();
|
||||||
|
|
||||||
|
sog.SetInertiaData(m, CenterOfMass, Inertia, rot );
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// set inertial data as a sphere
|
||||||
|
/// replaces the automatic calculation of mass, center of mass and inertia
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Mass">total mass of linkset</param>
|
||||||
|
/// <param name="radius">radius of the sphere</param>
|
||||||
|
/// <param name="centerOfMass">location of center of mass relative to root prim in local coords</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// </remarks>
|
||||||
|
public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass)
|
||||||
|
{
|
||||||
|
CheckThreatLevel();
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
SceneObjectGroup sog = m_host.ParentGroup;
|
||||||
|
if(sog== null || sog.IsDeleted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(mass < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// need more checks
|
||||||
|
|
||||||
|
Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
|
||||||
|
Vector3 Inertia;
|
||||||
|
float r = (float)radius;
|
||||||
|
float m = (float)mass;
|
||||||
|
float t = 0.4f * m * r * r;
|
||||||
|
|
||||||
|
Inertia.X = t;
|
||||||
|
Inertia.Y = t;
|
||||||
|
Inertia.Z = t;
|
||||||
|
|
||||||
|
sog.SetInertiaData(m, CenterOfMass, Inertia, new Vector4(0f, 0f, 0f,1.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// set inertial data as a cylinder
|
||||||
|
/// replaces the automatic calculation of mass, center of mass and inertia
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Mass">total mass of linkset</param>
|
||||||
|
/// <param name="radius">radius of the cylinder</param>
|
||||||
|
/// <param name="lenght">lenght of the cylinder</param>
|
||||||
|
/// <param name="centerOfMass">location of center of mass relative to root prim in local coords</param>
|
||||||
|
/// <param name="lslrot">rotation of the cylinder, and so inertia, relative to local axis</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// cylinder axis aligned with Z axis. For other orientations provide the rotation.
|
||||||
|
/// </remarks>
|
||||||
|
public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot)
|
||||||
|
{
|
||||||
|
CheckThreatLevel();
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
SceneObjectGroup sog = m_host.ParentGroup;
|
||||||
|
if(sog== null || sog.IsDeleted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(mass < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// need more checks
|
||||||
|
|
||||||
|
Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
|
||||||
|
Vector3 Inertia;
|
||||||
|
float m = (float)mass;
|
||||||
|
float r = (float)radius;
|
||||||
|
r *= r;
|
||||||
|
Inertia.Z = 0.5f * m * r;
|
||||||
|
float t = (float)lenght;
|
||||||
|
t *= t;
|
||||||
|
t += 3.0f * r;
|
||||||
|
t *= 8.333333e-2f * m;
|
||||||
|
|
||||||
|
Inertia.X = t;
|
||||||
|
Inertia.Y = t;
|
||||||
|
|
||||||
|
Vector4 rot = new Vector4((float)lslrot.x, (float)lslrot.y, (float)lslrot.z, (float)lslrot.s);
|
||||||
|
rot.Normalize();
|
||||||
|
|
||||||
|
sog.SetInertiaData(m, CenterOfMass, Inertia, rot);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// removes inertial data manual override
|
||||||
|
/// default automatic calculation is used again
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public void osClearInertia()
|
||||||
|
{
|
||||||
|
CheckThreatLevel();
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
SceneObjectGroup sog = m_host.ParentGroup;
|
||||||
|
if(sog== null || sog.IsDeleted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sog.SetInertiaData(-1, Vector3.Zero, Vector3.Zero, Vector4.Zero );
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// teleports a object (full linkset)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objectUUID">the id of the linkset to teleport</param>
|
||||||
|
/// <param name="targetPos">target position</param>
|
||||||
|
/// <param name="rotation"> a rotation to apply</param>
|
||||||
|
/// <param name="flags">several flags/param>
|
||||||
|
/// <remarks>
|
||||||
|
/// only does teleport local to region
|
||||||
|
/// if object has scripts, owner must have rights to run scripts on target location
|
||||||
|
/// object owner must have rights to enter ojects on target location
|
||||||
|
/// target location parcel must have enought free prims capacity for the linkset prims
|
||||||
|
/// all avatars siting on the object must have access to target location
|
||||||
|
/// has a cool down time. retries before expire reset it
|
||||||
|
/// fail conditions are silent ignored
|
||||||
|
/// </remarks>
|
||||||
|
public LSL_Integer osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags)
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.Severe, "osTeleportObject");
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
UUID objUUID;
|
||||||
|
if (!UUID.TryParse(objectUUID, out objUUID))
|
||||||
|
{
|
||||||
|
OSSLShoutError("osTeleportObject() invalid object Key");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SceneObjectGroup sog = World.GetSceneObjectGroup(objUUID);
|
||||||
|
if(sog== null || sog.IsDeleted)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
UUID myid = m_host.ParentGroup.UUID;
|
||||||
|
|
||||||
|
return sog.TeleportObject(myid, targetPos, rotation, flags);
|
||||||
|
// a delay here may break vehicles
|
||||||
|
}
|
||||||
|
|
||||||
|
public LSL_Integer osGetLinkNumber(LSL_String name)
|
||||||
|
{
|
||||||
|
CheckThreatLevel();
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
SceneObjectGroup sog = m_host.ParentGroup;
|
||||||
|
if(sog== null || sog.IsDeleted)
|
||||||
|
return -1;
|
||||||
|
return sog.GetLinkNumber(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,7 +434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
LSL_String llXorBase64Strings(string str1, string str2);
|
LSL_String llXorBase64Strings(string str1, string str2);
|
||||||
LSL_String llXorBase64StringsCorrect(string str1, string str2);
|
LSL_String llXorBase64StringsCorrect(string str1, string str2);
|
||||||
LSL_Integer llGetLinkNumberOfSides(LSL_Integer link);
|
LSL_Integer llGetLinkNumberOfSides(LSL_Integer link);
|
||||||
void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density);
|
void llSetPhysicsMaterial(int material_bits, LSL_Float material_gravity_modifier, LSL_Float material_restitution, LSL_Float material_friction, LSL_Float material_density);
|
||||||
|
|
||||||
void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc);
|
void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc);
|
||||||
void llSetKeyframedMotion(LSL_List frames, LSL_List options);
|
void llSetKeyframedMotion(LSL_List frames, LSL_List options);
|
||||||
|
|
|
@ -38,6 +38,7 @@ using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
|
||||||
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
|
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
|
||||||
using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -50,7 +51,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum ThreatLevel
|
public enum ThreatLevel
|
||||||
{
|
{
|
||||||
// Not documented, presumably means permanently disabled ?
|
|
||||||
NoAccess = -1,
|
NoAccess = -1,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -486,6 +486,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
LSL_String osRequestURL(LSL_List options);
|
LSL_String osRequestURL(LSL_List options);
|
||||||
LSL_String osRequestSecureURL(LSL_List options);
|
LSL_String osRequestSecureURL(LSL_List options);
|
||||||
void osCollisionSound(string impact_sound, double impact_volume);
|
void osCollisionSound(string impact_sound, double impact_volume);
|
||||||
|
|
||||||
void osVolumeDetect(int detect);
|
void osVolumeDetect(int detect);
|
||||||
|
|
||||||
|
LSL_List osGetInertiaData();
|
||||||
|
void osClearInertia();
|
||||||
|
void osSetInertiaAsBox(LSL_Float mass, vector boxSize, vector centerOfMass, rotation rot);
|
||||||
|
void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass);
|
||||||
|
void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot);
|
||||||
|
|
||||||
|
LSL_Integer osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags);
|
||||||
|
LSL_Integer osGetLinkNumber(LSL_String name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -853,5 +853,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
/// process message parameter as regex
|
/// process message parameter as regex
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const int OS_LISTEN_REGEX_MESSAGE = 0x2;
|
public const int OS_LISTEN_REGEX_MESSAGE = 0x2;
|
||||||
|
|
||||||
|
// for osTeleportObject
|
||||||
|
public const int OSTPOBJ_NONE = 0x0;
|
||||||
|
public const int OSTPOBJ_STOPATTARGET = 0x1; // stops at destination
|
||||||
|
public const int OSTPOBJ_STOPONFAIL = 0x2; // stops at jump point if tp fails
|
||||||
|
public const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2036,7 +2036,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
m_LSL_Functions.llSetKeyframedMotion(frames, options);
|
m_LSL_Functions.llSetKeyframedMotion(frames, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density)
|
public void llSetPhysicsMaterial(int material_bits, LSL_Float material_gravity_modifier, LSL_Float material_restitution, LSL_Float material_friction, LSL_Float material_density)
|
||||||
{
|
{
|
||||||
m_LSL_Functions.llSetPhysicsMaterial(material_bits, material_gravity_modifier, material_restitution, material_friction, material_density);
|
m_LSL_Functions.llSetPhysicsMaterial(material_bits, material_gravity_modifier, material_restitution, material_friction, material_density);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1114,5 +1114,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osVolumeDetect(detect);
|
m_OSSL_Functions.osVolumeDetect(detect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LSL_List osGetInertiaData()
|
||||||
|
{
|
||||||
|
return m_OSSL_Functions.osGetInertiaData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void osSetInertiaAsBox(LSL_Float mass, vector boxSize, vector centerOfMass, rotation rot)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osSetInertiaAsBox(mass, boxSize, centerOfMass, rot);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osSetInertiaAsSphere(mass, radius, centerOfMass);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osSetInertiaAsCylinder( mass, radius, lenght, centerOfMass, lslrot);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void osClearInertia()
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osClearInertia();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LSL_Integer osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags)
|
||||||
|
{
|
||||||
|
return m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LSL_Integer osGetLinkNumber(LSL_String name)
|
||||||
|
{
|
||||||
|
return m_OSSL_Functions.osGetLinkNumber(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
|
using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
|
||||||
using OpenSim.Region.OptionalModules.World.NPC;
|
using OpenSim.Region.OptionalModules.World.NPC;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.CoreModules.World.Permissions;
|
||||||
using OpenSim.Region.ScriptEngine.Shared;
|
using OpenSim.Region.ScriptEngine.Shared;
|
||||||
using OpenSim.Region.ScriptEngine.Shared.Api;
|
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||||
using OpenSim.Region.ScriptEngine.Shared.Instance;
|
using OpenSim.Region.ScriptEngine.Shared.Instance;
|
||||||
|
@ -63,12 +64,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
base.SetUp();
|
base.SetUp();
|
||||||
|
|
||||||
IConfigSource initConfigSource = new IniConfigSource();
|
IConfigSource initConfigSource = new IniConfigSource();
|
||||||
IConfig config = initConfigSource.AddConfig("XEngine");
|
IConfig config = initConfigSource.AddConfig("Startup");
|
||||||
|
config.Set("serverside_object_permissions", true);
|
||||||
|
config =initConfigSource.AddConfig("Permissions");
|
||||||
|
config.Set("permissionmodules", "DefaultPermissionsModule");
|
||||||
|
config.Set("serverside_object_permissions", true);
|
||||||
|
config.Set("propagate_permissions", true);
|
||||||
|
|
||||||
|
config = initConfigSource.AddConfig("XEngine");
|
||||||
config.Set("Enabled", "true");
|
config.Set("Enabled", "true");
|
||||||
|
|
||||||
m_scene = new SceneHelpers().SetupScene();
|
m_scene = new SceneHelpers().SetupScene();
|
||||||
SceneHelpers.SetupSceneModules(m_scene, initConfigSource);
|
SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new object[] { new DefaultPermissionsModule() });
|
||||||
|
|
||||||
m_engine = new XEngine.XEngine();
|
m_engine = new XEngine.XEngine();
|
||||||
m_engine.Initialise(initConfigSource);
|
m_engine.Initialise(initConfigSource);
|
||||||
m_engine.AddRegion(m_scene);
|
m_engine.AddRegion(m_scene);
|
||||||
|
|
|
@ -61,6 +61,9 @@ namespace OpenSim.Server.Base
|
||||||
//
|
//
|
||||||
private bool m_Running = true;
|
private bool m_Running = true;
|
||||||
|
|
||||||
|
private static Mono.Unix.UnixSignal[] signals;
|
||||||
|
|
||||||
|
|
||||||
// Handle all the automagical stuff
|
// Handle all the automagical stuff
|
||||||
//
|
//
|
||||||
public ServicesServerBase(string prompt, string[] args) : base()
|
public ServicesServerBase(string prompt, string[] args) : base()
|
||||||
|
@ -183,6 +186,39 @@ namespace OpenSim.Server.Base
|
||||||
RegisterCommonCommands();
|
RegisterCommonCommands();
|
||||||
RegisterCommonComponents(Config);
|
RegisterCommonComponents(Config);
|
||||||
|
|
||||||
|
Thread signal_thread = new Thread (delegate ()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
// Wait for a signal to be delivered
|
||||||
|
int index = Mono.Unix.UnixSignal.WaitAny (signals, -1);
|
||||||
|
|
||||||
|
//Mono.Unix.Native.Signum signal = signals [index].Signum;
|
||||||
|
ShutdownSpecific();
|
||||||
|
m_Running = false;
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(!Util.IsWindows())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// linux mac os specifics
|
||||||
|
signals = new Mono.Unix.UnixSignal[]
|
||||||
|
{
|
||||||
|
new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM)
|
||||||
|
};
|
||||||
|
signal_thread.Start();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Info("Could not set up UNIX signal handlers. SIGTERM will not");
|
||||||
|
m_log.InfoFormat("shut down gracefully: {0}", e.Message);
|
||||||
|
m_log.Debug("Exception was: ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Allow derived classes to perform initialization that
|
// Allow derived classes to perform initialization that
|
||||||
// needs to be done after the console has opened
|
// needs to be done after the console has opened
|
||||||
Initialise();
|
Initialise();
|
||||||
|
|
|
@ -243,8 +243,12 @@ namespace OpenSim.Services.Connectors
|
||||||
string uri = MapServer(id) + "/assets/" + id;
|
string uri = MapServer(id) + "/assets/" + id;
|
||||||
|
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
asset = m_Cache.Get(id);
|
{
|
||||||
|
if (!m_Cache.Get(id, out asset))
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (asset == null || asset.Data == null || asset.Data.Length == 0)
|
if (asset == null || asset.Data == null || asset.Data.Length == 0)
|
||||||
{
|
{
|
||||||
|
@ -275,17 +279,22 @@ namespace OpenSim.Services.Connectors
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id);
|
// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id);
|
||||||
|
|
||||||
|
AssetBase asset = null;
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
return m_Cache.Get(id);
|
{
|
||||||
|
m_Cache.Get(id, out asset);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetMetadata GetMetadata(string id)
|
public AssetMetadata GetMetadata(string id)
|
||||||
{
|
{
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
{
|
{
|
||||||
AssetBase fullAsset = m_Cache.Get(id);
|
AssetBase fullAsset;
|
||||||
|
if (!m_Cache.Get(id, out fullAsset))
|
||||||
|
return null;
|
||||||
|
|
||||||
if (fullAsset != null)
|
if (fullAsset != null)
|
||||||
return fullAsset.Metadata;
|
return fullAsset.Metadata;
|
||||||
|
@ -301,7 +310,9 @@ namespace OpenSim.Services.Connectors
|
||||||
{
|
{
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
{
|
{
|
||||||
AssetBase fullAsset = m_Cache.Get(id);
|
AssetBase fullAsset;
|
||||||
|
if (!m_Cache.Get(id, out fullAsset))
|
||||||
|
return null;
|
||||||
|
|
||||||
if (fullAsset != null)
|
if (fullAsset != null)
|
||||||
return fullAsset.Data;
|
return fullAsset.Data;
|
||||||
|
@ -389,7 +400,10 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
asset = m_Cache.Get(id);
|
{
|
||||||
|
if (!m_Cache.Get(id, out asset))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (asset == null || asset.Data == null || asset.Data.Length == 0)
|
if (asset == null || asset.Data == null || asset.Data.Length == 0)
|
||||||
{
|
{
|
||||||
|
@ -590,7 +604,7 @@ namespace OpenSim.Services.Connectors
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
asset = m_Cache.Get(id);
|
m_Cache.Get(id, out asset);
|
||||||
|
|
||||||
if (asset == null)
|
if (asset == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -136,7 +136,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
// Cache fetch
|
// Cache fetch
|
||||||
if (m_cache != null)
|
if (m_cache != null)
|
||||||
{
|
{
|
||||||
AssetBase asset = m_cache.Get(id);
|
AssetBase asset;
|
||||||
|
if (!m_cache.Get(id, out asset))
|
||||||
|
return null;
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
@ -147,8 +149,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
|
|
||||||
public AssetBase GetCached(string id)
|
public AssetBase GetCached(string id)
|
||||||
{
|
{
|
||||||
|
AssetBase asset;
|
||||||
if (m_cache != null)
|
if (m_cache != null)
|
||||||
return m_cache.Get(id);
|
m_cache.Get(id, out asset);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +172,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
// Cache fetch
|
// Cache fetch
|
||||||
if (m_cache != null)
|
if (m_cache != null)
|
||||||
{
|
{
|
||||||
AssetBase asset = m_cache.Get(id);
|
AssetBase asset;
|
||||||
|
if (!m_cache.Get(id, out asset))
|
||||||
|
return null;
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
return asset.Metadata;
|
return asset.Metadata;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +217,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
// Cache fetch
|
// Cache fetch
|
||||||
if (m_cache != null)
|
if (m_cache != null)
|
||||||
{
|
{
|
||||||
AssetBase asset = m_cache.Get(id);
|
AssetBase asset;
|
||||||
|
if (!m_cache.Get(id, out asset))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
handler(id, sender, asset);
|
handler(id, sender, asset);
|
||||||
|
|
|
@ -129,9 +129,9 @@ namespace OpenSim.Tests.Common
|
||||||
item.AssetType = asset.Type;
|
item.AssetType = asset.Type;
|
||||||
item.InvType = (int)itemType;
|
item.InvType = (int)itemType;
|
||||||
item.BasePermissions = (uint)OpenMetaverse.PermissionMask.All |
|
item.BasePermissions = (uint)OpenMetaverse.PermissionMask.All |
|
||||||
(uint)(Framework.PermissionMask.foldedMask | Framework.PermissionMask.foldedCopy | Framework.PermissionMask.foldedModify | Framework.PermissionMask.foldedTransfer);
|
(uint)(Framework.PermissionMask.FoldedMask | Framework.PermissionMask.FoldedCopy | Framework.PermissionMask.FoldedModify | Framework.PermissionMask.FoldedTransfer);
|
||||||
item.CurrentPermissions = (uint)OpenMetaverse.PermissionMask.All |
|
item.CurrentPermissions = (uint)OpenMetaverse.PermissionMask.All |
|
||||||
(uint)(Framework.PermissionMask.foldedMask | Framework.PermissionMask.foldedCopy | Framework.PermissionMask.foldedModify | Framework.PermissionMask.foldedTransfer);
|
(uint)(Framework.PermissionMask.FoldedMask | Framework.PermissionMask.FoldedCopy | Framework.PermissionMask.FoldedModify | Framework.PermissionMask.FoldedTransfer);
|
||||||
|
|
||||||
InventoryFolderBase folder = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, path)[0];
|
InventoryFolderBase folder = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, path)[0];
|
||||||
|
|
||||||
|
@ -371,4 +371,4 @@ namespace OpenSim.Tests.Common
|
||||||
return InventoryArchiveUtils.FindItemsByPath(inventoryService, userId, path);
|
return InventoryArchiveUtils.FindItemsByPath(inventoryService, userId, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -760,7 +760,11 @@ namespace OpenSim.Tests.Common
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAvatarDataImmediate(ISceneEntity avatar)
|
public void SendEntityFullUpdateImmediate(ISceneEntity ent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue