Resolve merge commits, stage 1
commit
66dec3b874
|
@ -14,6 +14,7 @@ people that make the day to day of OpenSim happen.
|
|||
* Marck
|
||||
* Mic Bowman (Intel)
|
||||
* BlueWall (James Hughes)
|
||||
* Snoopy Pfeffer
|
||||
|
||||
= Core Developers Following the White Rabbit =
|
||||
Core developers who have temporarily (we hope) gone chasing the white rabbit.
|
||||
|
@ -112,6 +113,7 @@ what it is today.
|
|||
* mpallari
|
||||
* MrMonkE
|
||||
* Nebadon Izumi (Michael Cerquoni - http://OSgrid.org)
|
||||
* Neil Canham
|
||||
* nornalbion
|
||||
* Omar Vera Ustariz (IBM)
|
||||
* openlifegrid.com
|
||||
|
@ -128,7 +130,6 @@ what it is today.
|
|||
* Salahzar Stenvaag
|
||||
* sempuki
|
||||
* SignpostMarv
|
||||
* Snoopy
|
||||
* Strawberry Fride
|
||||
* tglion
|
||||
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
|
||||
|
|
|
@ -488,11 +488,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
|||
rdata.userAppearance.AvatarHeight = (float) Convert.ToDouble(xml.Value);
|
||||
indata = true;
|
||||
}
|
||||
if (xml.MoveToAttribute("Owner"))
|
||||
{
|
||||
rdata.userAppearance.Owner = (UUID)xml.Value;
|
||||
indata = true;
|
||||
}
|
||||
// if (xml.MoveToAttribute("Owner"))
|
||||
// {
|
||||
// rdata.userAppearance.Owner = (UUID)xml.Value;
|
||||
// indata = true;
|
||||
// }
|
||||
if (xml.MoveToAttribute("Serial"))
|
||||
{
|
||||
rdata.userAppearance.Serial = Convert.ToInt32(xml.Value);
|
||||
|
@ -747,8 +747,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
|||
rdata.writer.WriteStartElement("Appearance");
|
||||
|
||||
rdata.writer.WriteAttributeString("Height", rdata.userAppearance.AvatarHeight.ToString());
|
||||
if (rdata.userAppearance.Owner != UUID.Zero)
|
||||
rdata.writer.WriteAttributeString("Owner", rdata.userAppearance.Owner.ToString());
|
||||
// if (rdata.userAppearance.Owner != UUID.Zero)
|
||||
// rdata.writer.WriteAttributeString("Owner", rdata.userAppearance.Owner.ToString());
|
||||
rdata.writer.WriteAttributeString("Serial", rdata.userAppearance.Serial.ToString());
|
||||
|
||||
/*
|
||||
|
|
|
@ -168,8 +168,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests
|
|||
float x = Convert.ToSingle(rdata.Parameters[PARM_MOVE_X]);
|
||||
float y = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Y]);
|
||||
float z = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Z]);
|
||||
Vector3 vector = new Vector3(x,y,z);
|
||||
presence.DoAutoPilot(0,vector,presence.ControllingClient);
|
||||
Vector3 vector = new Vector3(x, y, z);
|
||||
presence.MoveToTarget(vector, false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,6 @@ namespace OpenSim.Capabilities.Handlers
|
|||
|
||||
public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
|
||||
{
|
||||
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["int_response_code"] = 400; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
|
@ -69,7 +68,6 @@ namespace OpenSim.Capabilities.Handlers
|
|||
if (request.ContainsKey("mesh_id"))
|
||||
meshStr = request["mesh_id"].ToString();
|
||||
|
||||
|
||||
UUID meshID = UUID.Zero;
|
||||
if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID))
|
||||
{
|
||||
|
@ -82,12 +80,11 @@ namespace OpenSim.Capabilities.Handlers
|
|||
return responsedata;
|
||||
}
|
||||
|
||||
AssetBase mesh;
|
||||
// Only try to fetch locally cached textures. Misses are redirected
|
||||
mesh = m_assetService.GetCached(meshID.ToString());
|
||||
AssetBase mesh = m_assetService.Get(meshID.ToString());
|
||||
|
||||
if (mesh != null)
|
||||
{
|
||||
if (mesh.Type == (SByte)AssetType.Mesh)
|
||||
if (mesh.Type == (SByte)AssetType.Mesh)
|
||||
{
|
||||
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
||||
responsedata["content_type"] = "application/vnd.ll.mesh";
|
||||
|
@ -105,39 +102,15 @@ namespace OpenSim.Capabilities.Handlers
|
|||
}
|
||||
else
|
||||
{
|
||||
mesh = m_assetService.Get(meshID.ToString());
|
||||
if (mesh != null)
|
||||
{
|
||||
if (mesh.Type == (SByte)AssetType.Mesh)
|
||||
{
|
||||
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
||||
responsedata["content_type"] = "application/vnd.ll.mesh";
|
||||
responsedata["int_response_code"] = 200;
|
||||
}
|
||||
// Optionally add additional mesh types here
|
||||
else
|
||||
{
|
||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
|
||||
return responsedata;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
|
||||
return responsedata;
|
||||
}
|
||||
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return responsedata;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -88,7 +88,7 @@ namespace OpenSim.Data.MSSQL
|
|||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
throw new Exception(sql);
|
||||
|
||||
|
|
|
@ -84,21 +84,6 @@ namespace OpenSim.Data.MSSQL
|
|||
//New Migration settings
|
||||
Migration m = new Migration(conn, Assembly, "RegionStore");
|
||||
m.Update();
|
||||
|
||||
// Clean dropped attachments
|
||||
//
|
||||
try
|
||||
{
|
||||
using (SqlCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from prims where prims.UUID in (select UUID from primshapes where PCode = 9 and State <> 0); delete from primshapes where PCode = 9 and State <> 0";
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_Log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ namespace OpenSim.Data.MSSQL
|
|||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -253,12 +253,14 @@ namespace OpenSim.Data.MySQL
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// check if the asset UUID exist in database
|
||||
/// Check if the asset exists in the database
|
||||
/// </summary>
|
||||
/// <param name="uuid">The asset UUID</param>
|
||||
/// <returns>true if exist.</returns>
|
||||
/// <returns>true if it exists, false otherwise.</returns>
|
||||
override public bool ExistsAsset(UUID uuid)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
|
||||
|
||||
bool assetExists = false;
|
||||
|
||||
lock (m_dbLock)
|
||||
|
@ -275,7 +277,10 @@ namespace OpenSim.Data.MySQL
|
|||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if (dbReader.Read())
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
|
||||
assetExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -78,23 +78,6 @@ namespace OpenSim.Data.MySQL
|
|||
//
|
||||
Migration m = new Migration(dbcon, Assembly, "RegionStore");
|
||||
m.Update();
|
||||
|
||||
// Clean dropped attachments
|
||||
//
|
||||
try
|
||||
{
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from prims, primshapes using prims " +
|
||||
"left join primshapes on prims.uuid = primshapes.uuid " +
|
||||
"where PCode = 9 and State <> 0";
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
catch (MySqlException ex)
|
||||
{
|
||||
m_log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace OpenSim.Data.Null
|
|||
{
|
||||
private static NullRegionData Instance = null;
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>();
|
||||
|
||||
|
@ -97,7 +97,7 @@ namespace OpenSim.Data.Null
|
|||
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
|
||||
// m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
|
||||
if (queryMatch(r.RegionName.ToLower()))
|
||||
ret.Add(r);
|
||||
}
|
||||
|
|
|
@ -41,11 +41,9 @@ COMMIT;
|
|||
|
||||
:VERSION 2
|
||||
|
||||
ATTACH 'inventoryStore.db' AS old;
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
INSERT INTO inventoryfolders (folderName, type, version, folderID, agentID, parentFolderID) SELECT `name` AS folderName, `type` AS type, `version` AS version, `UUID` AS folderID, `agentID` AS agentID, `parentID` AS parentFolderID from old.inventoryfolders;
|
||||
INSERT INTO inventoryitems (assetID, assetType, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryID, parentFolderID, avatarID, inventoryGroupPermissions) SELECT `assetID`, `assetType` AS assetType, `inventoryName` AS inventoryName, `inventoryDescription` AS inventoryDescription, `inventoryNextPermissions` AS inventoryNextPermissions, `inventoryCurrentPermissions` AS inventoryCurrentPermissions, `invType` AS invType, `creatorsID` AS creatorID, `inventoryBasePermissions` AS inventoryBasePermissions, `inventoryEveryOnePermissions` AS inventoryEveryOnePermissions, `salePrice` AS salePrice, `saleType` AS saleType, `creationDate` AS creationDate, `groupID` AS groupID, `groupOwned` AS groupOwned, `flags` AS flags, `UUID` AS inventoryID, `parentFolderID` AS parentFolderID, `avatarID` AS avatarID, `inventoryGroupPermissions` AS inventoryGroupPermissions FROM old.inventoryitems;
|
||||
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
|
|
|
@ -57,6 +57,11 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
private SqliteConnection m_conn;
|
||||
|
||||
protected virtual Assembly Assembly
|
||||
{
|
||||
get { return GetType().Assembly; }
|
||||
}
|
||||
|
||||
override public void Dispose()
|
||||
{
|
||||
if (m_conn != null)
|
||||
|
@ -83,8 +88,7 @@ namespace OpenSim.Data.SQLite
|
|||
m_conn = new SqliteConnection(dbconnect);
|
||||
m_conn.Open();
|
||||
|
||||
Assembly assem = GetType().Assembly;
|
||||
Migration m = new Migration(m_conn, assem, "AssetStore");
|
||||
Migration m = new Migration(m_conn, Assembly, "AssetStore");
|
||||
m.Update();
|
||||
|
||||
return;
|
||||
|
|
|
@ -53,6 +53,11 @@ namespace OpenSim.Data.SQLite
|
|||
protected static SqliteConnection m_Connection;
|
||||
private static bool m_initialized = false;
|
||||
|
||||
protected virtual Assembly Assembly
|
||||
{
|
||||
get { return GetType().Assembly; }
|
||||
}
|
||||
|
||||
public SQLiteAuthenticationData(string connectionString, string realm)
|
||||
: base(connectionString)
|
||||
{
|
||||
|
@ -63,7 +68,7 @@ namespace OpenSim.Data.SQLite
|
|||
m_Connection = new SqliteConnection(connectionString);
|
||||
m_Connection.Open();
|
||||
|
||||
Migration m = new Migration(m_Connection, GetType().Assembly, "AuthStore");
|
||||
Migration m = new Migration(m_Connection, Assembly, "AuthStore");
|
||||
m.Update();
|
||||
|
||||
m_initialized = true;
|
||||
|
|
|
@ -53,6 +53,11 @@ namespace OpenSim.Data.SQLite
|
|||
private Dictionary<string, FieldInfo> m_FieldMap =
|
||||
new Dictionary<string, FieldInfo>();
|
||||
|
||||
protected virtual Assembly Assembly
|
||||
{
|
||||
get { return GetType().Assembly; }
|
||||
}
|
||||
|
||||
public SQLiteEstateStore()
|
||||
{
|
||||
}
|
||||
|
@ -71,8 +76,7 @@ namespace OpenSim.Data.SQLite
|
|||
m_connection = new SqliteConnection(m_connectionString);
|
||||
m_connection.Open();
|
||||
|
||||
Assembly assem = GetType().Assembly;
|
||||
Migration m = new Migration(m_connection, assem, "EstateStore");
|
||||
Migration m = new Migration(m_connection, Assembly, "EstateStore");
|
||||
m.Update();
|
||||
|
||||
//m_connection.Close();
|
||||
|
|
|
@ -55,6 +55,11 @@ namespace OpenSim.Data.SQLite
|
|||
protected static SqliteConnection m_Connection;
|
||||
private static bool m_initialized;
|
||||
|
||||
protected virtual Assembly Assembly
|
||||
{
|
||||
get { return GetType().Assembly; }
|
||||
}
|
||||
|
||||
public SQLiteGenericTableHandler(string connectionString,
|
||||
string realm, string storeName) : base(connectionString)
|
||||
{
|
||||
|
@ -68,13 +73,12 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
if (storeName != String.Empty)
|
||||
{
|
||||
Assembly assem = GetType().Assembly;
|
||||
//SqliteConnection newConnection =
|
||||
// (SqliteConnection)((ICloneable)m_Connection).Clone();
|
||||
//newConnection.Open();
|
||||
|
||||
//Migration m = new Migration(newConnection, assem, storeName);
|
||||
Migration m = new Migration(m_Connection, assem, storeName);
|
||||
//Migration m = new Migration(newConnection, Assembly, storeName);
|
||||
Migration m = new Migration(m_Connection, Assembly, storeName);
|
||||
m.Update();
|
||||
//newConnection.Close();
|
||||
//newConnection.Dispose();
|
||||
|
|
|
@ -74,6 +74,11 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
private String m_connectionString;
|
||||
|
||||
protected virtual Assembly Assembly
|
||||
{
|
||||
get { return GetType().Assembly; }
|
||||
}
|
||||
|
||||
public SQLiteSimulationData()
|
||||
{
|
||||
}
|
||||
|
@ -132,8 +137,7 @@ namespace OpenSim.Data.SQLite
|
|||
SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
|
||||
regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
|
||||
// This actually does the roll forward assembly stuff
|
||||
Assembly assem = GetType().Assembly;
|
||||
Migration m = new Migration(m_conn, assem, "RegionStore");
|
||||
Migration m = new Migration(m_conn, Assembly, "RegionStore");
|
||||
m.Update();
|
||||
|
||||
lock (ds)
|
||||
|
|
|
@ -41,7 +41,7 @@ using OpenSim.Framework;
|
|||
namespace OpenSim.Data.SQLite
|
||||
{
|
||||
/// <summary>
|
||||
/// A MySQL Interface for the Asset Server
|
||||
/// A SQLite Interface for the Asset Server
|
||||
/// </summary>
|
||||
public class SQLiteXInventoryData : IXInventoryData
|
||||
{
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T001_LoadEmpty()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Assert.That(m_db.ExistsAsset(uuid1), Is.False);
|
||||
Assert.That(m_db.ExistsAsset(uuid2), Is.False);
|
||||
|
@ -116,7 +116,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T010_StoreReadVerifyAssets()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString());
|
||||
AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString());
|
||||
|
@ -183,7 +183,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T020_CheckForWeirdCreatorID()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// It is expected that eventually the CreatorID might be an arbitrary string (an URI)
|
||||
// rather than a valid UUID (?). This test is to make sure that the database layer does not
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T010_EstateSettingsSimpleStorage_MinimumParameterSet()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
EstateSettingsSimpleStorage(
|
||||
REGION_ID,
|
||||
|
@ -140,7 +140,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T011_EstateSettingsSimpleStorage_MaximumParameterSet()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
EstateSettingsSimpleStorage(
|
||||
REGION_ID,
|
||||
|
@ -173,7 +173,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T012_EstateSettingsSimpleStorage_AccurateParameterSet()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
EstateSettingsSimpleStorage(
|
||||
REGION_ID,
|
||||
|
@ -206,7 +206,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T012_EstateSettingsRandomStorage()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Letting estate store generate rows to database for us
|
||||
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
|
||||
|
@ -227,7 +227,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T020_EstateSettingsManagerList()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Letting estate store generate rows to database for us
|
||||
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
|
||||
|
@ -248,7 +248,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T021_EstateSettingsUserList()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Letting estate store generate rows to database for us
|
||||
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
|
||||
|
@ -269,7 +269,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T022_EstateSettingsGroupList()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Letting estate store generate rows to database for us
|
||||
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
|
||||
|
@ -290,7 +290,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T022_EstateSettingsBanList()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Letting estate store generate rows to database for us
|
||||
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T001_LoadEmpty()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Assert.That(db.getInventoryFolder(zero), Is.Null);
|
||||
Assert.That(db.getInventoryFolder(folder1), Is.Null);
|
||||
|
@ -134,7 +134,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T010_FolderNonParent()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2);
|
||||
// the folder will go in
|
||||
|
@ -146,7 +146,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T011_FolderCreate()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1);
|
||||
// TODO: this is probably wrong behavior, but is what we have
|
||||
|
@ -171,7 +171,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T012_FolderList()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3);
|
||||
db.addInventoryFolder(f2);
|
||||
|
@ -187,7 +187,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T013_FolderHierarchy()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned)
|
||||
Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
|
||||
|
@ -202,7 +202,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T014_MoveFolder()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
InventoryFolderBase f2 = db.getInventoryFolder(folder2);
|
||||
f2.ParentID = folder3;
|
||||
|
@ -218,7 +218,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T015_FolderHierarchy()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
|
||||
Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))");
|
||||
|
@ -231,7 +231,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T100_NoItems()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))");
|
||||
Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))");
|
||||
|
@ -245,7 +245,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T101_CreatItems()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1));
|
||||
db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2));
|
||||
|
@ -256,7 +256,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T102_CompareItems()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
InventoryItemBase i1 = db.getInventoryItem(item1);
|
||||
InventoryItemBase i2 = db.getInventoryItem(item2);
|
||||
|
@ -275,7 +275,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T103_UpdateItem()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// TODO: probably shouldn't have the ability to have an
|
||||
// owner of an item in a folder not owned by the user
|
||||
|
@ -295,7 +295,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T104_RandomUpdateItem()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
PropertyScrambler<InventoryFolderBase> folderScrambler =
|
||||
new PropertyScrambler<InventoryFolderBase>()
|
||||
|
@ -354,7 +354,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T999_StillNull()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// After all tests are run, these should still return no results
|
||||
Assert.That(db.getInventoryFolder(zero), Is.Null);
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T001_LoadEmpty()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
List<SceneObjectGroup> objs = db.LoadObjects(region1);
|
||||
List<SceneObjectGroup> objs3 = db.LoadObjects(region3);
|
||||
|
@ -169,7 +169,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T010_StoreSimpleObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
SceneObjectGroup sog = NewSOG("object1", prim1, region1);
|
||||
SceneObjectGroup sog2 = NewSOG("object2", prim2, region1);
|
||||
|
@ -204,7 +204,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T011_ObjectNames()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
List<SceneObjectGroup> objs = db.LoadObjects(region1);
|
||||
foreach (SceneObjectGroup sog in objs)
|
||||
|
@ -218,7 +218,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T012_SceneParts()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
UUID tmp0 = UUID.Random();
|
||||
UUID tmp1 = UUID.Random();
|
||||
|
@ -253,7 +253,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T013_DatabasePersistency()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data
|
||||
// The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored
|
||||
|
@ -304,9 +304,9 @@ namespace OpenSim.Data.Tests
|
|||
regionInfo.RegionLocX = 0;
|
||||
regionInfo.RegionLocY = 0;
|
||||
|
||||
// Scene scene = new Scene(regionInfo);
|
||||
|
||||
SceneObjectPart sop = new SceneObjectPart();
|
||||
SceneObjectGroup sog = new SceneObjectGroup(sop);
|
||||
|
||||
sop.RegionHandle = regionh;
|
||||
sop.UUID = uuid;
|
||||
sop.LocalId = localid;
|
||||
|
@ -373,8 +373,6 @@ namespace OpenSim.Data.Tests
|
|||
|
||||
// This is necessary or object will not be inserted in DB
|
||||
sop.Flags = PrimFlags.None;
|
||||
|
||||
SceneObjectGroup sog = new SceneObjectGroup(sop);
|
||||
|
||||
// Inserts group in DB
|
||||
db.StoreObject(sog,region3);
|
||||
|
@ -430,7 +428,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T014_UpdateObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string text1 = "object1 text";
|
||||
SceneObjectGroup sog = FindSOG("object1", region1);
|
||||
|
@ -540,7 +538,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T015_LargeSceneObjects()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
UUID id = UUID.Random();
|
||||
Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>();
|
||||
|
@ -587,7 +585,7 @@ namespace OpenSim.Data.Tests
|
|||
//[Test]
|
||||
public void T016_RandomSogWithSceneParts()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
PropertyScrambler<SceneObjectPart> scrambler =
|
||||
new PropertyScrambler<SceneObjectPart>()
|
||||
|
@ -663,7 +661,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T020_PrimInventoryEmpty()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
SceneObjectGroup sog = GetMySOG("object1");
|
||||
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
|
||||
|
@ -687,7 +685,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T021_PrimInventoryBasic()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
SceneObjectGroup sog = GetMySOG("object1");
|
||||
InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero);
|
||||
|
@ -727,7 +725,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T025_PrimInventoryPersistency()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
InventoryItemBase i = new InventoryItemBase();
|
||||
UUID id = UUID.Random();
|
||||
|
@ -800,7 +798,7 @@ namespace OpenSim.Data.Tests
|
|||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void T026_PrimInventoryMany()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
UUID i1,i2,i3,i4;
|
||||
i1 = UUID.Random();
|
||||
|
@ -832,7 +830,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T052_RemoveObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
db.RemoveObject(prim1, region1);
|
||||
SceneObjectGroup sog = FindSOG("object1", region1);
|
||||
|
@ -842,7 +840,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T100_DefaultRegionInfo()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
RegionSettings r1 = db.LoadRegionSettings(region1);
|
||||
Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))");
|
||||
|
@ -854,7 +852,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T101_UpdateRegionInfo()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
int agentlimit = random.Next();
|
||||
double objectbonus = random.Next();
|
||||
|
@ -960,7 +958,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T300_NoTerrain()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Assert.That(db.LoadTerrain(zero), Is.Null);
|
||||
Assert.That(db.LoadTerrain(region1), Is.Null);
|
||||
|
@ -971,7 +969,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T301_CreateTerrain()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
double[,] t1 = GenTerrain(height1);
|
||||
db.StoreTerrain(t1, region1);
|
||||
|
@ -985,7 +983,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T302_FetchTerrain()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
double[,] baseterrain1 = GenTerrain(height1);
|
||||
double[,] baseterrain2 = GenTerrain(height2);
|
||||
|
@ -997,7 +995,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T303_UpdateTerrain()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
double[,] baseterrain1 = GenTerrain(height1);
|
||||
double[,] baseterrain2 = GenTerrain(height2);
|
||||
|
@ -1011,7 +1009,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T400_EmptyLand()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))");
|
||||
Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))");
|
||||
|
|
|
@ -296,11 +296,12 @@ namespace OpenSim.Framework
|
|||
if (args["start_pos"] != null)
|
||||
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
|
||||
|
||||
m_log.InfoFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString());
|
||||
m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos);
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
// Unpack various appearance elements
|
||||
Appearance = new AvatarAppearance(AgentID);
|
||||
Appearance = new AvatarAppearance();
|
||||
|
||||
// Eventually this code should be deprecated, use full appearance
|
||||
// packing in packed_appearance
|
||||
|
@ -313,7 +314,9 @@ namespace OpenSim.Framework
|
|||
m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance");
|
||||
}
|
||||
else
|
||||
m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance");
|
||||
{
|
||||
m_log.Warn("[AGENTCIRCUITDATA]: failed to find a valid packed_appearance");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,6 @@ namespace OpenSim.Framework
|
|||
public readonly static int TEXTURE_COUNT = 21;
|
||||
public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
|
||||
|
||||
protected UUID m_owner;
|
||||
protected int m_serial = 0;
|
||||
protected byte[] m_visualparams;
|
||||
protected Primitive.TextureEntry m_texture;
|
||||
|
@ -56,12 +55,6 @@ namespace OpenSim.Framework
|
|||
protected float m_avatarHeight = 0;
|
||||
protected float m_hipOffset = 0;
|
||||
|
||||
public virtual UUID Owner
|
||||
{
|
||||
get { return m_owner; }
|
||||
set { m_owner = value; }
|
||||
}
|
||||
|
||||
public virtual int Serial
|
||||
{
|
||||
get { return m_serial; }
|
||||
|
@ -77,7 +70,11 @@ namespace OpenSim.Framework
|
|||
public virtual Primitive.TextureEntry Texture
|
||||
{
|
||||
get { return m_texture; }
|
||||
set { m_texture = value; }
|
||||
set
|
||||
{
|
||||
// m_log.DebugFormat("[AVATAR APPEARANCE]: Set TextureEntry to {0}", value);
|
||||
m_texture = value;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual AvatarWearable[] Wearables
|
||||
|
@ -97,38 +94,31 @@ namespace OpenSim.Framework
|
|||
get { return m_hipOffset; }
|
||||
}
|
||||
|
||||
public AvatarAppearance() : this(UUID.Zero) {}
|
||||
|
||||
public AvatarAppearance(UUID owner)
|
||||
public AvatarAppearance()
|
||||
{
|
||||
// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner);
|
||||
// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance");
|
||||
|
||||
m_serial = 0;
|
||||
m_owner = owner;
|
||||
|
||||
SetDefaultWearables();
|
||||
SetDefaultTexture();
|
||||
SetDefaultParams();
|
||||
SetHeight();
|
||||
|
||||
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
|
||||
}
|
||||
|
||||
public AvatarAppearance(UUID avatarID, OSDMap map)
|
||||
public AvatarAppearance(OSDMap map)
|
||||
{
|
||||
// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance for {0} from OSDMap",avatarID);
|
||||
// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap");
|
||||
|
||||
m_owner = avatarID;
|
||||
Unpack(map);
|
||||
SetHeight();
|
||||
}
|
||||
|
||||
public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
|
||||
public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
|
||||
{
|
||||
// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID);
|
||||
// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance");
|
||||
|
||||
m_serial = 0;
|
||||
m_owner = avatarID;
|
||||
|
||||
if (wearables != null)
|
||||
m_wearables = wearables;
|
||||
|
@ -161,24 +151,21 @@ namespace OpenSim.Framework
|
|||
if (appearance == null)
|
||||
{
|
||||
m_serial = 0;
|
||||
m_owner = UUID.Zero;
|
||||
|
||||
SetDefaultWearables();
|
||||
SetDefaultTexture();
|
||||
SetDefaultParams();
|
||||
SetHeight();
|
||||
|
||||
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_serial = appearance.Serial;
|
||||
m_owner = appearance.Owner;
|
||||
|
||||
m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
|
||||
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
|
||||
m_wearables[i] = new AvatarWearable();
|
||||
|
||||
if (copyWearables && (appearance.Wearables != null))
|
||||
{
|
||||
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
|
||||
|
@ -196,6 +183,9 @@ namespace OpenSim.Framework
|
|||
if (appearance.VisualParams != null)
|
||||
m_visualparams = (byte[])appearance.VisualParams.Clone();
|
||||
|
||||
m_avatarHeight = appearance.m_avatarHeight;
|
||||
m_hipOffset = appearance.m_hipOffset;
|
||||
|
||||
// Copy the attachment, force append mode since that ensures consistency
|
||||
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
|
||||
foreach (AvatarAttachment attachment in appearance.GetAttachments())
|
||||
|
@ -237,7 +227,6 @@ namespace OpenSim.Framework
|
|||
{
|
||||
m_serial = 0;
|
||||
|
||||
SetDefaultParams();
|
||||
SetDefaultTexture();
|
||||
|
||||
//for (int i = 0; i < BAKE_INDICES.Length; i++)
|
||||
|
@ -409,9 +398,11 @@ namespace OpenSim.Framework
|
|||
// DEBUG OFF
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of the attachments, note that there may be
|
||||
/// duplicate attachpoints
|
||||
/// Get a list of the attachments.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// There may be duplicate attachpoints
|
||||
/// </remarks>
|
||||
public List<AvatarAttachment> GetAttachments()
|
||||
{
|
||||
lock (m_attachments)
|
||||
|
@ -447,17 +438,29 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an attachment, if the attachpoint has the
|
||||
/// Add an attachment
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the attachpoint has the
|
||||
/// 0x80 bit set then we assume this is an append
|
||||
/// operation otherwise we replace whatever is
|
||||
/// currently attached at the attachpoint
|
||||
/// </remarks>
|
||||
/// <param name="attachpoint"></param>
|
||||
/// <param name="item">If UUID.Zero, then an any attachment at the attachpoint is removed.</param>
|
||||
/// <param name="asset"></param>
|
||||
/// <returns>
|
||||
/// return true if something actually changed
|
||||
/// </summary>
|
||||
/// </returns>
|
||||
public bool SetAttachment(int attachpoint, UUID item, UUID asset)
|
||||
{
|
||||
if (attachpoint == 0)
|
||||
return false;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[AVATAR APPEARANCE]: Setting attachment at {0} with item ID {1}, asset ID {2}",
|
||||
// attachpoint, item, asset);
|
||||
|
||||
if (item == UUID.Zero)
|
||||
{
|
||||
lock (m_attachments)
|
||||
|
@ -487,7 +490,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
else
|
||||
{
|
||||
ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset));
|
||||
ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -589,7 +592,7 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
public void Unpack(OSDMap data)
|
||||
{
|
||||
if ((data != null) && (data["serial"] != null))
|
||||
if ((data != null) && (data["serial"] != null))
|
||||
m_serial = data["serial"].AsInteger();
|
||||
if ((data != null) && (data["height"] != null))
|
||||
m_avatarHeight = (float)data["height"].AsReal();
|
||||
|
@ -647,7 +650,14 @@ namespace OpenSim.Framework
|
|||
{
|
||||
OSDArray attachs = (OSDArray)(data["attachments"]);
|
||||
for (int i = 0; i < attachs.Count; i++)
|
||||
AppendAttachment(new AvatarAttachment((OSDMap)attachs[i]));
|
||||
{
|
||||
AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);
|
||||
AppendAttachment(att);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[AVATAR APPEARANCE]: Unpacked attachment itemID {0}, assetID {1}, point {2}",
|
||||
// att.ItemID, att.AssetID, att.AttachPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -66,11 +66,11 @@ namespace OpenSim.Framework
|
|||
return attachdata;
|
||||
}
|
||||
|
||||
|
||||
public void Unpack(OSDMap args)
|
||||
{
|
||||
if (args["point"] != null)
|
||||
AttachPoint = args["point"].AsInteger();
|
||||
|
||||
ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero;
|
||||
AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero;
|
||||
}
|
||||
|
|
|
@ -593,7 +593,7 @@ namespace OpenSim.Framework
|
|||
// AgentTextures[i++] = o.AsUUID();
|
||||
//}
|
||||
|
||||
Appearance = new AvatarAppearance(AgentID);
|
||||
Appearance = new AvatarAppearance();
|
||||
|
||||
// The code to unpack textures, visuals, wearables and attachments
|
||||
// should be removed; packed appearance contains the full appearance
|
||||
|
@ -635,7 +635,7 @@ namespace OpenSim.Framework
|
|||
// end of code to remove
|
||||
|
||||
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
|
||||
Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]);
|
||||
Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
|
||||
else
|
||||
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace OpenSim.Framework
|
|||
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
|
||||
bool RezSelected, bool RemoveItem, UUID fromTaskID);
|
||||
|
||||
public delegate UUID RezSingleAttachmentFromInv(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
|
||||
public delegate ISceneEntity RezSingleAttachmentFromInv(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
|
||||
|
||||
public delegate void RezMultipleAttachmentsFromInv(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
|
||||
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects);
|
||||
|
@ -790,7 +790,7 @@ namespace OpenSim.Framework
|
|||
event DeRezObject OnDeRezObject;
|
||||
event Action<IClientAPI> OnRegionHandShakeReply;
|
||||
event GenericCall1 OnRequestWearables;
|
||||
event GenericCall1 OnCompleteMovementToRegion;
|
||||
event Action<IClientAPI, bool> OnCompleteMovementToRegion;
|
||||
event UpdateAgent OnPreAgentUpdate;
|
||||
event UpdateAgent OnAgentUpdate;
|
||||
event AgentRequestSit OnAgentRequestSit;
|
||||
|
@ -940,7 +940,7 @@ namespace OpenSim.Framework
|
|||
event ScriptReset OnScriptReset;
|
||||
event GetScriptRunning OnGetScriptRunning;
|
||||
event SetScriptRunning OnSetScriptRunning;
|
||||
event UpdateVector OnAutoPilotGo;
|
||||
event Action<Vector3, bool> OnAutoPilotGo;
|
||||
|
||||
event TerrainUnacked OnUnackedTerrain;
|
||||
event ActivateGesture OnActivateGesture;
|
||||
|
|
|
@ -70,8 +70,20 @@ namespace OpenSim.Framework
|
|||
|
||||
event restart OnRestart;
|
||||
|
||||
void AddNewClient(IClientAPI client);
|
||||
void RemoveClient(UUID agentID);
|
||||
/// <summary>
|
||||
/// Register the new client with the scene. The client starts off as a child agent - the later agent crossing
|
||||
/// will promote it to a root agent.
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="type">The type of agent to add.</param>
|
||||
void AddNewClient(IClientAPI client, PresenceType type);
|
||||
|
||||
/// <summary>
|
||||
/// Remove the given client from the scene.
|
||||
/// </summary>
|
||||
/// <param name="agentID"></param>
|
||||
/// <param name="closeChildAgents">Close the neighbour child agents associated with this client.</param>
|
||||
void RemoveClient(UUID agentID, bool closeChildAgents);
|
||||
|
||||
void Restart();
|
||||
//RegionInfo OtherRegionUp(RegionInfo thisRegion);
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
public interface ISceneEntity
|
||||
{
|
||||
string Name { get; set; }
|
||||
UUID UUID { get; }
|
||||
uint LocalId { get; }
|
||||
Vector3 AbsolutePosition { get; }
|
||||
|
|
|
@ -27,13 +27,15 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class InventoryFolderImpl : InventoryFolderBase
|
||||
{
|
||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public static readonly string PATH_DELIMITER = "/";
|
||||
|
||||
|
@ -402,6 +404,10 @@ namespace OpenSim.Framework
|
|||
{
|
||||
foreach (InventoryItemBase item in Items.Values)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY FOLDER IMPL]: Returning item {0} {1}, OwnerPermissions {2:X}",
|
||||
// item.Name, item.ID, item.CurrentPermissions);
|
||||
|
||||
itemList.Add(item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,6 +144,7 @@ namespace OpenSim.Framework
|
|||
m_log.WarnFormat("[PACKETPOOL]: Failed to get packet of type {0}", type);
|
||||
else
|
||||
packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer);
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
|
@ -160,19 +161,18 @@ namespace OpenSim.Framework
|
|||
case PacketType.ObjectUpdate:
|
||||
ObjectUpdatePacket oup = (ObjectUpdatePacket)packet;
|
||||
|
||||
foreach (ObjectUpdatePacket.ObjectDataBlock oupod in
|
||||
oup.ObjectData)
|
||||
foreach (ObjectUpdatePacket.ObjectDataBlock oupod in oup.ObjectData)
|
||||
ReturnDataBlock<ObjectUpdatePacket.ObjectDataBlock>(oupod);
|
||||
|
||||
oup.ObjectData = null;
|
||||
break;
|
||||
|
||||
case PacketType.ImprovedTerseObjectUpdate:
|
||||
ImprovedTerseObjectUpdatePacket itoup =
|
||||
(ImprovedTerseObjectUpdatePacket)packet;
|
||||
ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet;
|
||||
|
||||
foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock
|
||||
itoupod in itoup.ObjectData)
|
||||
foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock itoupod in itoup.ObjectData)
|
||||
ReturnDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(itoupod);
|
||||
|
||||
itoup.ObjectData = null;
|
||||
break;
|
||||
}
|
||||
|
@ -194,6 +194,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
pool[type] = new Stack<Packet>();
|
||||
}
|
||||
|
||||
if ((pool[type]).Count < 50)
|
||||
{
|
||||
(pool[type]).Push(packet);
|
||||
|
@ -223,6 +224,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
DataBlocks[typeof(T)] = new Stack<Object>();
|
||||
}
|
||||
|
||||
return new T();
|
||||
}
|
||||
}
|
||||
|
@ -234,6 +236,9 @@ namespace OpenSim.Framework
|
|||
|
||||
lock (DataBlocks)
|
||||
{
|
||||
if (!DataBlocks.ContainsKey(typeof(T)))
|
||||
DataBlocks[typeof(T)] = new Stack<Object>();
|
||||
|
||||
if (DataBlocks[typeof(T)].Count < 50)
|
||||
DataBlocks[typeof(T)].Push(block);
|
||||
}
|
||||
|
|
|
@ -24,83 +24,16 @@
|
|||
* (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;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// Undo stack. Deletes entries beyond a certain capacity
|
||||
/// Indicate the type of ScenePresence.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
[Serializable]
|
||||
public class UndoStack<T>
|
||||
public enum PresenceType
|
||||
{
|
||||
private List<T> m_undolist;
|
||||
private int m_max;
|
||||
|
||||
public UndoStack(int capacity)
|
||||
{
|
||||
m_undolist = new List<T>();
|
||||
m_max = capacity;
|
||||
}
|
||||
|
||||
public bool IsFull
|
||||
{
|
||||
get { return m_undolist.Count >= m_max; }
|
||||
}
|
||||
|
||||
public int Capacity
|
||||
{
|
||||
get { return m_max; }
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_undolist.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public void Push(T item)
|
||||
{
|
||||
if (IsFull)
|
||||
{
|
||||
m_undolist.RemoveAt(0);
|
||||
}
|
||||
m_undolist.Add(item);
|
||||
}
|
||||
|
||||
public T Pop()
|
||||
{
|
||||
if (m_undolist.Count > 0)
|
||||
{
|
||||
int ind = m_undolist.Count - 1;
|
||||
T item = m_undolist[ind];
|
||||
m_undolist.RemoveAt(ind);
|
||||
return item;
|
||||
}
|
||||
else
|
||||
throw new InvalidOperationException("Cannot pop from empty stack");
|
||||
}
|
||||
|
||||
public T Peek()
|
||||
{
|
||||
if (m_undolist.Count > 0)
|
||||
{
|
||||
return m_undolist[m_undolist.Count - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
m_undolist.Clear();
|
||||
}
|
||||
User,
|
||||
Npc
|
||||
}
|
||||
}
|
||||
}
|
|
@ -879,6 +879,67 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public ulong GetMeshKey(Vector3 size, float lod)
|
||||
{
|
||||
ulong hash = 5381;
|
||||
|
||||
hash = djb2(hash, this.PathCurve);
|
||||
hash = djb2(hash, (byte)((byte)this.HollowShape | (byte)this.ProfileShape));
|
||||
hash = djb2(hash, this.PathBegin);
|
||||
hash = djb2(hash, this.PathEnd);
|
||||
hash = djb2(hash, this.PathScaleX);
|
||||
hash = djb2(hash, this.PathScaleY);
|
||||
hash = djb2(hash, this.PathShearX);
|
||||
hash = djb2(hash, this.PathShearY);
|
||||
hash = djb2(hash, (byte)this.PathTwist);
|
||||
hash = djb2(hash, (byte)this.PathTwistBegin);
|
||||
hash = djb2(hash, (byte)this.PathRadiusOffset);
|
||||
hash = djb2(hash, (byte)this.PathTaperX);
|
||||
hash = djb2(hash, (byte)this.PathTaperY);
|
||||
hash = djb2(hash, this.PathRevolutions);
|
||||
hash = djb2(hash, (byte)this.PathSkew);
|
||||
hash = djb2(hash, this.ProfileBegin);
|
||||
hash = djb2(hash, this.ProfileEnd);
|
||||
hash = djb2(hash, this.ProfileHollow);
|
||||
|
||||
// TODO: Separate scale out from the primitive shape data (after
|
||||
// scaling is supported at the physics engine level)
|
||||
byte[] scaleBytes = size.GetBytes();
|
||||
for (int i = 0; i < scaleBytes.Length; i++)
|
||||
hash = djb2(hash, scaleBytes[i]);
|
||||
|
||||
// Include LOD in hash, accounting for endianness
|
||||
byte[] lodBytes = new byte[4];
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(lod), 0, lodBytes, 0, 4);
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
{
|
||||
Array.Reverse(lodBytes, 0, 4);
|
||||
}
|
||||
for (int i = 0; i < lodBytes.Length; i++)
|
||||
hash = djb2(hash, lodBytes[i]);
|
||||
|
||||
// include sculpt UUID
|
||||
if (this.SculptEntry)
|
||||
{
|
||||
scaleBytes = this.SculptTexture.GetBytes();
|
||||
for (int i = 0; i < scaleBytes.Length; i++)
|
||||
hash = djb2(hash, scaleBytes[i]);
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
private ulong djb2(ulong hash, byte c)
|
||||
{
|
||||
return ((hash << 5) + hash) + (ulong)c;
|
||||
}
|
||||
|
||||
private ulong djb2(ulong hash, ushort c)
|
||||
{
|
||||
hash = ((hash << 5) + hash) + (ulong)((byte)c);
|
||||
return ((hash << 5) + hash) + (ulong)(c >> 8);
|
||||
}
|
||||
|
||||
public byte[] ExtraParamsToBytes()
|
||||
{
|
||||
// m_log.DebugFormat("[EXTRAPARAMS]: Called ExtraParamsToBytes()");
|
||||
|
|
|
@ -56,7 +56,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
private volatile int NotSocketErrors = 0;
|
||||
public volatile bool HTTPDRunning = false;
|
||||
|
||||
protected Thread m_workerThread;
|
||||
// protected HttpListener m_httpListener;
|
||||
protected CoolHTTPListener m_httpListener2;
|
||||
protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
|
||||
|
@ -66,7 +65,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
|
||||
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
|
||||
protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
|
||||
|
||||
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
|
||||
new Dictionary<string, PollServiceEventArgs>();
|
||||
|
||||
|
@ -155,7 +153,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
public List<string> GetStreamHandlerKeys()
|
||||
{
|
||||
return new List<string>(m_streamHandlers.Keys);
|
||||
lock (m_streamHandlers)
|
||||
return new List<string>(m_streamHandlers.Keys);
|
||||
}
|
||||
|
||||
private static string GetHandlerKey(string httpMethod, string path)
|
||||
|
@ -196,7 +195,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
public List<string> GetXmlRpcHandlerKeys()
|
||||
{
|
||||
return new List<string>(m_rpcHandlers.Keys);
|
||||
lock (m_rpcHandlers)
|
||||
return new List<string>(m_rpcHandlers.Keys);
|
||||
}
|
||||
|
||||
public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
|
||||
|
@ -218,10 +218,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
public List<string> GetHTTPHandlerKeys()
|
||||
{
|
||||
return new List<string>(m_HTTPHandlers.Keys);
|
||||
lock (m_HTTPHandlers)
|
||||
return new List<string>(m_HTTPHandlers.Keys);
|
||||
}
|
||||
|
||||
|
||||
public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args)
|
||||
{
|
||||
bool pollHandlerResult = false;
|
||||
|
@ -242,10 +242,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
public List<string> GetPollServiceHandlerKeys()
|
||||
{
|
||||
return new List<string>(m_pollHandlers.Keys);
|
||||
lock (m_pollHandlers)
|
||||
return new List<string>(m_pollHandlers.Keys);
|
||||
}
|
||||
|
||||
|
||||
// Note that the agent string is provided simply to differentiate
|
||||
// the handlers - it is NOT required to be an actual agent header
|
||||
// value.
|
||||
|
@ -266,7 +266,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
public List<string> GetAgentHandlerKeys()
|
||||
{
|
||||
return new List<string>(m_agentHandlers.Keys);
|
||||
lock (m_agentHandlers)
|
||||
return new List<string>(m_agentHandlers.Keys);
|
||||
}
|
||||
|
||||
public bool AddLLSDHandler(string path, LLSDMethod handler)
|
||||
|
@ -284,7 +285,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
public List<string> GetLLSDHandlerKeys()
|
||||
{
|
||||
return new List<string>(m_llsdHandlers.Keys);
|
||||
lock (m_llsdHandlers)
|
||||
return new List<string>(m_llsdHandlers.Keys);
|
||||
}
|
||||
|
||||
public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler)
|
||||
|
@ -404,14 +406,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
string requestMethod = request.HttpMethod;
|
||||
string uriString = request.RawUrl;
|
||||
|
||||
string reqnum = "unknown";
|
||||
// string reqnum = "unknown";
|
||||
int tickstart = Environment.TickCount;
|
||||
|
||||
try
|
||||
{
|
||||
// OpenSim.Framework.WebUtil.OSHeaderRequestID
|
||||
if (request.Headers["opensim-request-id"] != null)
|
||||
reqnum = String.Format("{0}:{1}",request.RemoteIPEndPoint,request.Headers["opensim-request-id"]);
|
||||
// if (request.Headers["opensim-request-id"] != null)
|
||||
// reqnum = String.Format("{0}:{1}",request.RemoteIPEndPoint,request.Headers["opensim-request-id"]);
|
||||
//m_log.DebugFormat("[BASE HTTP SERVER]: <{0}> handle request for {1}",reqnum,request.RawUrl);
|
||||
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
|
||||
|
@ -746,7 +748,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
|
||||
{
|
||||
agentHandler = null;
|
||||
try
|
||||
|
||||
lock (m_agentHandlers)
|
||||
{
|
||||
foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
|
||||
{
|
||||
|
@ -757,9 +760,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
}
|
||||
}
|
||||
catch(KeyNotFoundException)
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -803,9 +803,12 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
XmlRpcMethod method;
|
||||
bool methodWasFound;
|
||||
bool keepAlive = false;
|
||||
lock (m_rpcHandlers)
|
||||
{
|
||||
methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method);
|
||||
if (methodWasFound)
|
||||
keepAlive = m_rpcHandlersKeepAlive[methodName];
|
||||
}
|
||||
|
||||
if (methodWasFound)
|
||||
|
@ -824,7 +827,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3]
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint);
|
||||
|
@ -846,7 +848,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
|
||||
// if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here
|
||||
response.KeepAlive = m_rpcHandlersKeepAlive[methodName];
|
||||
response.KeepAlive = keepAlive;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1106,7 +1108,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// <returns>true if we have one, false if not</returns>
|
||||
private bool DoWeHaveALLSDHandler(string path)
|
||||
{
|
||||
|
||||
string[] pathbase = path.Split('/');
|
||||
string searchquery = "/";
|
||||
|
||||
|
@ -1122,14 +1123,12 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
string bestMatch = null;
|
||||
|
||||
foreach (string pattern in m_llsdHandlers.Keys)
|
||||
lock (m_llsdHandlers)
|
||||
{
|
||||
|
||||
if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length)
|
||||
foreach (string pattern in m_llsdHandlers.Keys)
|
||||
{
|
||||
|
||||
if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length)
|
||||
bestMatch = pattern;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1142,12 +1141,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
if (String.IsNullOrEmpty(bestMatch))
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1232,29 +1229,32 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
string bestMatch = null;
|
||||
|
||||
foreach (string pattern in m_llsdHandlers.Keys)
|
||||
lock (m_llsdHandlers)
|
||||
{
|
||||
if (searchquery.ToLower().StartsWith(pattern.ToLower()))
|
||||
foreach (string pattern in m_llsdHandlers.Keys)
|
||||
{
|
||||
if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length)
|
||||
if (searchquery.ToLower().StartsWith(pattern.ToLower()))
|
||||
{
|
||||
// You have to specifically register for '/' and to get it, you must specificaly request it
|
||||
//
|
||||
if (pattern == "/" && searchquery == "/" || pattern != "/")
|
||||
bestMatch = pattern;
|
||||
if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length)
|
||||
{
|
||||
// You have to specifically register for '/' and to get it, you must specificaly request it
|
||||
//
|
||||
if (pattern == "/" && searchquery == "/" || pattern != "/")
|
||||
bestMatch = pattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(bestMatch))
|
||||
{
|
||||
llsdHandler = null;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
llsdHandler = m_llsdHandlers[bestMatch];
|
||||
return true;
|
||||
|
||||
if (String.IsNullOrEmpty(bestMatch))
|
||||
{
|
||||
llsdHandler = null;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
llsdHandler = m_llsdHandlers[bestMatch];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1816,7 +1816,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
//m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey);
|
||||
|
||||
lock (m_streamHandlers) m_streamHandlers.Remove(handlerKey);
|
||||
lock (m_streamHandlers)
|
||||
m_streamHandlers.Remove(handlerKey);
|
||||
}
|
||||
|
||||
public void RemoveHTTPHandler(string httpMethod, string path)
|
||||
|
@ -1848,17 +1849,16 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
||||
{
|
||||
try
|
||||
lock (m_agentHandlers)
|
||||
{
|
||||
if (handler == m_agentHandlers[agent])
|
||||
IHttpAgentHandler foundHandler;
|
||||
|
||||
if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
|
||||
{
|
||||
m_agentHandlers.Remove(agent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch(KeyNotFoundException)
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1876,18 +1876,16 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
public bool RemoveLLSDHandler(string path, LLSDMethod handler)
|
||||
{
|
||||
try
|
||||
lock (m_llsdHandlers)
|
||||
{
|
||||
if (handler == m_llsdHandlers[path])
|
||||
LLSDMethod foundHandler;
|
||||
|
||||
if (m_llsdHandlers.TryGetValue(path, out foundHandler) && foundHandler == handler)
|
||||
{
|
||||
m_llsdHandlers.Remove(path);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
// This is an exception to prevent crashing because of invalid code
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Framework.Tests
|
|||
SecureSessionId = UUID.Random();
|
||||
SessionId = UUID.Random();
|
||||
|
||||
AvAppearance = new AvatarAppearance(AgentId);
|
||||
AvAppearance = new AvatarAppearance();
|
||||
VisualParams = new byte[218];
|
||||
|
||||
//body
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace OpenSim.Framework.Tests
|
|||
|
||||
m_agentCircuitData1 = new AgentCircuitData();
|
||||
m_agentCircuitData1.AgentID = AgentId1;
|
||||
m_agentCircuitData1.Appearance = new AvatarAppearance(AgentId1);
|
||||
m_agentCircuitData1.Appearance = new AvatarAppearance();
|
||||
m_agentCircuitData1.BaseFolder = BaseFolder;
|
||||
m_agentCircuitData1.CapsPath = CapsPath;
|
||||
m_agentCircuitData1.child = false;
|
||||
|
@ -83,7 +83,7 @@ namespace OpenSim.Framework.Tests
|
|||
|
||||
m_agentCircuitData2 = new AgentCircuitData();
|
||||
m_agentCircuitData2.AgentID = AgentId2;
|
||||
m_agentCircuitData2.Appearance = new AvatarAppearance(AgentId2);
|
||||
m_agentCircuitData2.Appearance = new AvatarAppearance();
|
||||
m_agentCircuitData2.BaseFolder = BaseFolder;
|
||||
m_agentCircuitData2.CapsPath = CapsPath;
|
||||
m_agentCircuitData2.child = false;
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace OpenSim.Framework.Tests
|
|||
"Magnitude of vector was incorrect.");
|
||||
|
||||
TestDelegate d = delegate() { Util.GetNormalizedVector(v1); };
|
||||
bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d);
|
||||
bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
|
||||
Assert.That(causesArgumentException, Is.True,
|
||||
"Getting magnitude of null vector did not cause argument exception.");
|
||||
|
||||
|
@ -94,12 +94,12 @@ namespace OpenSim.Framework.Tests
|
|||
"Magnitude of vector was incorrect.");
|
||||
|
||||
TestDelegate d = delegate() { Util.GetNormalizedVector(v1); };
|
||||
bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d);
|
||||
bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
|
||||
Assert.That(causesArgumentException, Is.True,
|
||||
"Getting magnitude of null vector did not cause argument exception.");
|
||||
|
||||
d = delegate() { Util.GetNormalizedVector(v2); };
|
||||
causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d);
|
||||
causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
|
||||
Assert.That(causesArgumentException, Is.True,
|
||||
"Getting magnitude of null vector did not cause argument exception.");
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ namespace OpenSim.Framework.Tests
|
|||
"Magnitude of vector was incorrect.");
|
||||
|
||||
TestDelegate d = delegate() { Util.GetNormalizedVector(v1); };
|
||||
bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d);
|
||||
bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
|
||||
Assert.That(causesArgumentException, Is.True,
|
||||
"Getting magnitude of null vector did not cause argument exception.");
|
||||
|
||||
|
|
|
@ -56,8 +56,13 @@ namespace OpenSim.Framework
|
|||
/// <summary>
|
||||
/// The method used by Util.FireAndForget for asynchronously firing events
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// None is used to execute the method in the same thread that made the call. It should only be used by regression
|
||||
/// test code that relies on predictable event ordering.
|
||||
/// </remarks>
|
||||
public enum FireAndForgetMethod
|
||||
{
|
||||
None,
|
||||
UnsafeQueueUserWorkItem,
|
||||
QueueUserWorkItem,
|
||||
BeginInvoke,
|
||||
|
@ -89,7 +94,8 @@ namespace OpenSim.Framework
|
|||
public static readonly Regex UUIDPattern
|
||||
= new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");
|
||||
|
||||
public static FireAndForgetMethod FireAndForgetMethod = FireAndForgetMethod.SmartThreadPool;
|
||||
public static FireAndForgetMethod DefaultFireAndForgetMethod = FireAndForgetMethod.SmartThreadPool;
|
||||
public static FireAndForgetMethod FireAndForgetMethod = DefaultFireAndForgetMethod;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the directory where the current running executable
|
||||
|
@ -1511,25 +1517,47 @@ namespace OpenSim.Framework
|
|||
|
||||
public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
|
||||
{
|
||||
// When OpenSim interacts with a database or sends data over the wire, it must send this in en_US culture
|
||||
// so that we don't encounter problems where, for instance, data is saved with a culture that uses commas
|
||||
// for decimals places but is read by a culture that treats commas as number seperators.
|
||||
WaitCallback realCallback = delegate(object o)
|
||||
{
|
||||
Culture.SetCurrentCulture();
|
||||
|
||||
try
|
||||
{
|
||||
callback(o);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[UTIL]: Continuing after async_call_method thread terminated with exception {0}{1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
};
|
||||
|
||||
switch (FireAndForgetMethod)
|
||||
{
|
||||
case FireAndForgetMethod.None:
|
||||
realCallback.Invoke(obj);
|
||||
break;
|
||||
case FireAndForgetMethod.UnsafeQueueUserWorkItem:
|
||||
ThreadPool.UnsafeQueueUserWorkItem(callback, obj);
|
||||
ThreadPool.UnsafeQueueUserWorkItem(realCallback, obj);
|
||||
break;
|
||||
case FireAndForgetMethod.QueueUserWorkItem:
|
||||
ThreadPool.QueueUserWorkItem(callback, obj);
|
||||
ThreadPool.QueueUserWorkItem(realCallback, obj);
|
||||
break;
|
||||
case FireAndForgetMethod.BeginInvoke:
|
||||
FireAndForgetWrapper wrapper = FireAndForgetWrapper.Instance;
|
||||
wrapper.FireAndForget(callback, obj);
|
||||
wrapper.FireAndForget(realCallback, obj);
|
||||
break;
|
||||
case FireAndForgetMethod.SmartThreadPool:
|
||||
if (m_ThreadPool == null)
|
||||
m_ThreadPool = new SmartThreadPool(2000, 15, 2);
|
||||
m_ThreadPool.QueueWorkItem(SmartThreadPoolCallback, new object[] { callback, obj });
|
||||
m_ThreadPool.QueueWorkItem(SmartThreadPoolCallback, new object[] { realCallback, obj });
|
||||
break;
|
||||
case FireAndForgetMethod.Thread:
|
||||
Thread thread = new Thread(delegate(object o) { callback(o); });
|
||||
Thread thread = new Thread(delegate(object o) { realCallback(o); });
|
||||
thread.Start(obj);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -908,15 +908,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public class SynchronousRestObjectPoster
|
||||
{
|
||||
[Obsolete]
|
||||
public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
|
||||
{
|
||||
return SynchronousRestObjectRequester.MakeRequest<TRequest, TResponse>(verb, requestUrl, obj);
|
||||
}
|
||||
}
|
||||
|
||||
public class SynchronousRestObjectRequester
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
|
@ -989,9 +980,6 @@ namespace OpenSim.Framework
|
|||
{
|
||||
using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse())
|
||||
{
|
||||
if (resp.StatusCode == HttpStatusCode.NotFound)
|
||||
return deserial;
|
||||
|
||||
if (resp.ContentLength != 0)
|
||||
{
|
||||
Stream respStream = resp.GetResponseStream();
|
||||
|
@ -1001,9 +989,19 @@ namespace OpenSim.Framework
|
|||
}
|
||||
else
|
||||
m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb);
|
||||
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
HttpWebResponse hwr = (HttpWebResponse)e.Response;
|
||||
|
||||
if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound)
|
||||
return deserial;
|
||||
else
|
||||
m_log.ErrorFormat(
|
||||
"[SynchronousRestObjectRequester]: WebException {0} {1} {2} {3}",
|
||||
requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace);
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// This is what happens when there is invalid XML
|
||||
|
|
|
@ -73,6 +73,7 @@ namespace OpenSim
|
|||
AppDomain.CurrentDomain.UnhandledException +=
|
||||
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
|
||||
|
||||
// Add the arguments supplied when running the application to the configuration
|
||||
ArgvConfigSource configSource = new ArgvConfigSource(args);
|
||||
|
||||
|
@ -91,6 +92,9 @@ namespace OpenSim
|
|||
m_log.Info("[OPENSIM MAIN]: configured log4net using default OpenSim.exe.config");
|
||||
}
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[OPENSIM MAIN]: System Locale is {0}", System.Threading.Thread.CurrentThread.CurrentCulture);
|
||||
|
||||
// Increase the number of IOCP threads available. Mono defaults to a tragically low number
|
||||
int workerThreads, iocpThreads;
|
||||
System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
|
||||
|
|
|
@ -130,7 +130,9 @@ namespace OpenSim
|
|||
//m_log.InfoFormat("[OPENSIM MAIN]: GC Latency Mode: {0}", GCSettings.LatencyMode.ToString());
|
||||
|
||||
if (m_gui) // Driven by external GUI
|
||||
{
|
||||
m_console = new CommandConsole("Region");
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_consoleType)
|
||||
|
@ -547,6 +549,7 @@ namespace OpenSim
|
|||
{
|
||||
string regionName = string.Empty;
|
||||
string regionFile = string.Empty;
|
||||
|
||||
if (cmd.Length == 3)
|
||||
{
|
||||
regionFile = cmd[2];
|
||||
|
@ -556,14 +559,17 @@ namespace OpenSim
|
|||
regionName = cmd[2];
|
||||
regionFile = cmd[3];
|
||||
}
|
||||
|
||||
string extension = Path.GetExtension(regionFile).ToLower();
|
||||
bool isXml = extension.Equals(".xml");
|
||||
bool isIni = extension.Equals(".ini");
|
||||
|
||||
if (!isXml && !isIni)
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: create region [\"region name\"] <region_file.ini>");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Path.IsPathRooted(regionFile))
|
||||
{
|
||||
string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim();
|
||||
|
@ -580,8 +586,18 @@ namespace OpenSim
|
|||
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
|
||||
}
|
||||
|
||||
IScene scene;
|
||||
Scene existingScene;
|
||||
if (SceneManager.TryGetScene(regInfo.RegionID, out existingScene))
|
||||
{
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"ERROR: Cannot create region {0} with ID {1}, this ID is already assigned to region {2}",
|
||||
regInfo.RegionName, regInfo.RegionID, existingScene.RegionInfo.RegionName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
PopulateRegionEstateInfo(regInfo);
|
||||
IScene scene;
|
||||
CreateRegion(regInfo, true, out scene);
|
||||
regInfo.EstateSettings.Save();
|
||||
}
|
||||
|
|
|
@ -136,7 +136,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset;
|
||||
CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS;
|
||||
GetClient = m_Scene.SceneContents.GetControllingClient;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -232,7 +231,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
public string SeedCapRequest(string request, string path, string param,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
|
||||
// m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
|
||||
|
||||
if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
|
||||
{
|
||||
|
@ -331,14 +330,22 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle a request from the client for a Uri to upload a baked texture.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <param name="httpRequest"></param>
|
||||
/// <param name="httpResponse"></param>
|
||||
/// <returns>The upload response if the request is successful, null otherwise.</returns>
|
||||
public string UploadBakedTexture(string request, string path,
|
||||
string param, OSHttpRequest httpRequest,
|
||||
OSHttpResponse httpResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
// m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " +
|
||||
// m_regionName);
|
||||
// m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + m_regionName);
|
||||
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
|
@ -374,6 +381,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when a baked texture has been successfully uploaded by a client.
|
||||
/// </summary>
|
||||
/// <param name="assetID"></param>
|
||||
/// <param name="data"></param>
|
||||
public void BakedTextureUploaded(UUID assetID, byte[] data)
|
||||
{
|
||||
// m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
|
||||
|
@ -687,7 +699,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
item.CurrentPermissions = (uint)PermissionMask.All;
|
||||
item.BasePermissions = (uint)PermissionMask.All;
|
||||
item.EveryOnePermissions = 0;
|
||||
item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
item.NextPermissions = (uint)PermissionMask.All;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
if (AddNewInventoryItem != null)
|
||||
|
|
|
@ -48,8 +48,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class BunchOfCapsModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_Scene;
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class GetMeshModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private IAssetService m_AssetService;
|
||||
|
@ -113,12 +113,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
UUID capID = UUID.Random();
|
||||
// UUID capID = UUID.Random();
|
||||
|
||||
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
if (m_URL == "localhost")
|
||||
{
|
||||
m_log.InfoFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
|
||||
IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(),
|
||||
delegate(Hashtable m_dhttpMethod)
|
||||
|
@ -130,7 +130,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetMesh", m_URL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class GetTextureModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private IAssetService m_assetService;
|
||||
|
||||
|
@ -128,12 +129,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
if (m_URL == "localhost")
|
||||
{
|
||||
m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler("GetTexture", m_URL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class MeshUploadFlagModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Is this module enabled?
|
||||
|
@ -124,7 +124,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
private Hashtable MeshUploadFlag(Hashtable mDhttpMethod)
|
||||
{
|
||||
m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request");
|
||||
// m_log.DebugFormat("[MESH UPLOAD FLAG MODULE]: MeshUploadFlag request");
|
||||
|
||||
OSDMap data = new OSDMap();
|
||||
ScenePresence sp = m_scene.GetScenePresence(m_agentID);
|
||||
|
|
|
@ -160,8 +160,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
}
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
|
||||
string assetName = llsdRequest.name;
|
||||
string assetDes = llsdRequest.description;
|
||||
|
@ -208,12 +206,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
return uploadResponse;
|
||||
}
|
||||
|
||||
|
||||
public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID,
|
||||
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
|
||||
string assetType,UUID AgentID)
|
||||
{
|
||||
|
||||
sbyte assType = 0;
|
||||
sbyte inType = 0;
|
||||
|
||||
|
@ -266,10 +262,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
item.CurrentPermissions = (uint)PermissionMask.All;
|
||||
item.BasePermissions = (uint)PermissionMask.All;
|
||||
item.EveryOnePermissions = 0;
|
||||
item.NextPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
item.NextPermissions = (uint)PermissionMask.All;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
m_scene.AddInventoryItem(item);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -322,8 +322,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
rootpart.NextOwnerMask = next_owner_mask;
|
||||
rootpart.Material = (byte)material;
|
||||
|
||||
|
||||
|
||||
m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
|
||||
|
||||
responsedata["int_response_code"] = 200; //501; //410; //404;
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// Parses ad request
|
||||
/// Parses add request
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="AgentId"></param>
|
||||
|
@ -312,11 +312,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
primFace.RepeatV = face.ScaleT;
|
||||
primFace.TexMapType = (MappingType) (face.MediaFlags & 6);
|
||||
}
|
||||
|
||||
pbs.TextureEntry = tmp.GetBytes();
|
||||
prim.Shape = pbs;
|
||||
prim.Scale = obj.Scale;
|
||||
|
||||
|
||||
SceneObjectGroup grp = new SceneObjectGroup();
|
||||
|
||||
grp.SetRootPart(prim);
|
||||
|
@ -330,7 +330,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
grp.AbsolutePosition = obj.Position;
|
||||
prim.RotationOffset = obj.Rotation;
|
||||
|
||||
grp.RootPart.IsAttachment = false;
|
||||
grp.IsAttachment = false;
|
||||
// Required for linking
|
||||
grp.RootPart.UpdateFlag = 0;
|
||||
|
||||
|
@ -339,8 +339,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
m_scene.AddSceneObject(grp);
|
||||
grp.AbsolutePosition = obj.Position;
|
||||
}
|
||||
|
||||
allparts[i] = grp;
|
||||
|
||||
}
|
||||
|
||||
for (int j = 1; j < allparts.Length; j++)
|
||||
|
@ -351,7 +351,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
}
|
||||
|
||||
rootGroup.ScheduleGroupForFullUpdate();
|
||||
pos = m_scene.GetNewRezLocation(Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale(), false);
|
||||
pos
|
||||
= m_scene.GetNewRezLocation(
|
||||
Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale, false);
|
||||
|
||||
responsedata["int_response_code"] = 200; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
|
|
|
@ -43,21 +43,29 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
|
|||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
/// <summary>
|
||||
/// SimulatorFeatures capability. This is required for uploading Mesh.
|
||||
/// SimulatorFeatures capability.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is required for uploading Mesh.
|
||||
/// Since is accepts an open-ended response, we also send more information
|
||||
/// for viewers that care to interpret it.
|
||||
///
|
||||
/// NOTE: Part of this code was adapted from the Aurora project, specifically
|
||||
/// the normal part of the response in the capability handler.
|
||||
/// </summary>
|
||||
///
|
||||
/// </remarks>
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class SimulatorFeaturesModule : ISharedRegionModule
|
||||
public class SimulatorFeaturesModule : ISharedRegionModule, ISimulatorFeaturesModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
/// <summary>
|
||||
/// Simulator features
|
||||
/// </summary>
|
||||
private OSDMap m_features = new OSDMap();
|
||||
|
||||
private string m_MapImageServerURL = string.Empty;
|
||||
private string m_SearchURL = string.Empty;
|
||||
|
||||
|
@ -66,18 +74,20 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["SimulatorFeatures"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
|
||||
if (m_MapImageServerURL != string.Empty)
|
||||
if (config != null)
|
||||
{
|
||||
m_MapImageServerURL = m_MapImageServerURL.Trim();
|
||||
if (!m_MapImageServerURL.EndsWith("/"))
|
||||
m_MapImageServerURL = m_MapImageServerURL + "/";
|
||||
m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
|
||||
if (m_MapImageServerURL != string.Empty)
|
||||
{
|
||||
m_MapImageServerURL = m_MapImageServerURL.Trim();
|
||||
if (!m_MapImageServerURL.EndsWith("/"))
|
||||
m_MapImageServerURL = m_MapImageServerURL + "/";
|
||||
}
|
||||
|
||||
m_SearchURL = config.GetString("SearchServerURI", string.Empty);
|
||||
}
|
||||
|
||||
m_SearchURL = config.GetString("SearchServerURI", string.Empty);
|
||||
AddDefaultFeatures();
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
|
@ -110,43 +120,83 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Add default features
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TODO: These should be added from other modules rather than hardcoded.
|
||||
/// </remarks>
|
||||
private void AddDefaultFeatures()
|
||||
{
|
||||
lock (m_features)
|
||||
{
|
||||
m_features["MeshRezEnabled"] = true;
|
||||
m_features["MeshUploadEnabled"] = true;
|
||||
m_features["MeshXferEnabled"] = true;
|
||||
m_features["PhysicsMaterialsEnabled"] = true;
|
||||
|
||||
OSDMap typesMap = new OSDMap();
|
||||
typesMap["convex"] = true;
|
||||
typesMap["none"] = true;
|
||||
typesMap["prim"] = true;
|
||||
m_features["PhysicsShapeTypes"] = typesMap;
|
||||
|
||||
// Extra information for viewers that want to use it
|
||||
OSDMap gridServicesMap = new OSDMap();
|
||||
if (m_MapImageServerURL != string.Empty)
|
||||
gridServicesMap["map-server-url"] = m_MapImageServerURL;
|
||||
if (m_SearchURL != string.Empty)
|
||||
gridServicesMap["search"] = m_SearchURL;
|
||||
m_features["GridServices"] = gridServicesMap;
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), SimulatorFeatures);
|
||||
IRequestHandler reqHandler
|
||||
= new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), HandleSimulatorFeaturesRequest);
|
||||
|
||||
caps.RegisterHandler("SimulatorFeatures", reqHandler);
|
||||
}
|
||||
|
||||
private Hashtable SimulatorFeatures(Hashtable mDhttpMethod)
|
||||
public void AddFeature(string name, OSD value)
|
||||
{
|
||||
m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
|
||||
OSDMap data = new OSDMap();
|
||||
data["MeshRezEnabled"] = true;
|
||||
data["MeshUploadEnabled"] = true;
|
||||
data["MeshXferEnabled"] = true;
|
||||
data["PhysicsMaterialsEnabled"] = true;
|
||||
lock (m_features)
|
||||
m_features[name] = value;
|
||||
}
|
||||
|
||||
OSDMap typesMap = new OSDMap();
|
||||
typesMap["convex"] = true;
|
||||
typesMap["none"] = true;
|
||||
typesMap["prim"] = true;
|
||||
data["PhysicsShapeTypes"] = typesMap;
|
||||
public bool RemoveFeature(string name)
|
||||
{
|
||||
lock (m_features)
|
||||
return m_features.Remove(name);
|
||||
}
|
||||
|
||||
// Extra information for viewers that want to use it
|
||||
OSDMap gridServicesMap = new OSDMap();
|
||||
if (m_MapImageServerURL != string.Empty)
|
||||
gridServicesMap["map-server-url"] = m_MapImageServerURL;
|
||||
if (m_SearchURL != string.Empty)
|
||||
gridServicesMap["search"] = m_SearchURL;
|
||||
data["GridServices"] = gridServicesMap;
|
||||
public bool TryGetFeature(string name, out OSD value)
|
||||
{
|
||||
lock (m_features)
|
||||
return m_features.TryGetValue(name, out value);
|
||||
}
|
||||
|
||||
public OSDMap GetFeatures()
|
||||
{
|
||||
lock (m_features)
|
||||
return new OSDMap(m_features);
|
||||
}
|
||||
|
||||
private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod)
|
||||
{
|
||||
// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
|
||||
|
||||
//Send back data
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["int_response_code"] = 200;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
|
||||
|
||||
lock (m_features)
|
||||
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_features);
|
||||
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public event ObjectAttach OnObjectAttach;
|
||||
public event ObjectDeselect OnObjectDetach;
|
||||
public event ObjectDrop OnObjectDrop;
|
||||
public event GenericCall1 OnCompleteMovementToRegion;
|
||||
public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
|
||||
public event UpdateAgent OnPreAgentUpdate;
|
||||
public event UpdateAgent OnAgentUpdate;
|
||||
public event AgentRequestSit OnAgentRequestSit;
|
||||
|
@ -232,7 +232,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public event ScriptReset OnScriptReset;
|
||||
public event GetScriptRunning OnGetScriptRunning;
|
||||
public event SetScriptRunning OnSetScriptRunning;
|
||||
public event UpdateVector OnAutoPilotGo;
|
||||
public event Action<Vector3, bool> OnAutoPilotGo;
|
||||
public event TerrainUnacked OnUnackedTerrain;
|
||||
public event ActivateGesture OnActivateGesture;
|
||||
public event DeactivateGesture OnDeactivateGesture;
|
||||
|
@ -534,7 +534,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_udpServer.Flush(m_udpClient);
|
||||
|
||||
// Remove ourselves from the scene
|
||||
m_scene.RemoveClient(AgentId);
|
||||
m_scene.RemoveClient(AgentId, true);
|
||||
|
||||
// We can't reach into other scenes and close the connection
|
||||
// We need to do this over grid communications
|
||||
|
@ -596,22 +596,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a handler for the given packet type.
|
||||
/// </summary>
|
||||
/// <remarks>The packet is handled on its own thread. If packets must be handled in the order in which thye
|
||||
/// are received then please us ethe synchronous version of this method.</remarks>
|
||||
/// <param name="packetType"></param>
|
||||
/// <param name="handler"></param>
|
||||
/// <returns>true if the handler was added. This is currently always the case.</returns>
|
||||
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler)
|
||||
{
|
||||
return AddLocalPacketHandler(packetType, handler, true);
|
||||
}
|
||||
|
||||
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool async)
|
||||
/// <summary>
|
||||
/// Add a handler for the given packet type.
|
||||
/// </summary>
|
||||
/// <param name="packetType"></param>
|
||||
/// <param name="handler"></param>
|
||||
/// <param name="doAsync">
|
||||
/// If true, when the packet is received it is handled on its own thread rather than on the main inward bound
|
||||
/// packet handler thread. This vastly increases respnosiveness but some packets need to be handled
|
||||
/// synchronously.
|
||||
/// </param>
|
||||
/// <returns>true if the handler was added. This is currently always the case.</returns>
|
||||
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync)
|
||||
{
|
||||
bool result = false;
|
||||
lock (m_packetHandlers)
|
||||
{
|
||||
if (!m_packetHandlers.ContainsKey(packetType))
|
||||
{
|
||||
m_packetHandlers.Add(packetType, new PacketProcessor() { method = handler, Async = async });
|
||||
m_packetHandlers.Add(packetType, new PacketProcessor() { method = handler, Async = doAsync });
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -694,7 +714,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
public virtual void Start()
|
||||
{
|
||||
m_scene.AddNewClient(this);
|
||||
m_scene.AddNewClient(this, PresenceType.User);
|
||||
|
||||
RefreshGroupMembership();
|
||||
}
|
||||
|
@ -4800,7 +4820,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
SceneObjectPart part = (SceneObjectPart)entity;
|
||||
|
||||
attachPoint = part.AttachmentPoint;
|
||||
attachPoint = part.ParentGroup.AttachmentPoint;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Sending attachPoint {0} for {1} {2} to {3}",
|
||||
// attachPoint, part.Name, part.LocalId, Name);
|
||||
|
||||
collisionPlane = Vector4.Zero;
|
||||
position = part.RelativePosition;
|
||||
velocity = part.Velocity;
|
||||
|
@ -4957,17 +4982,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
//update.JointType = 0;
|
||||
update.Material = data.Material;
|
||||
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
|
||||
if (data.IsAttachment)
|
||||
if (data.ParentGroup.IsAttachment)
|
||||
{
|
||||
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID);
|
||||
update.State = (byte)((data.AttachmentPoint % 16) * 16 + (data.AttachmentPoint / 16));
|
||||
update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));
|
||||
}
|
||||
else
|
||||
{
|
||||
update.NameValue = Utils.EmptyBytes;
|
||||
update.State = data.Shape.State;
|
||||
|
||||
// The root part state is the canonical state for all parts of the object. The other part states in the
|
||||
// case for attachments may contain conflicting values that can end up crashing the viewer.
|
||||
update.State = data.ParentGroup.RootPart.Shape.State;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Sending state {0} for {1} {2} to {3}",
|
||||
// update.State, data.Name, data.LocalId, Name);
|
||||
|
||||
update.ObjectData = objectData;
|
||||
update.ParentID = data.ParentID;
|
||||
update.PathBegin = data.Shape.PathBegin;
|
||||
|
@ -5311,6 +5343,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest);
|
||||
AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes);
|
||||
AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard);
|
||||
|
||||
AddGenericPacketHandler("autopilot", HandleAutopilot);
|
||||
}
|
||||
|
||||
#region Packet Handlers
|
||||
|
@ -5354,7 +5388,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
update = true;
|
||||
}
|
||||
|
||||
// These should be ordered from most-likely to
|
||||
// least likely to change. I've made an initial
|
||||
|
@ -5362,6 +5398,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
if (update)
|
||||
{
|
||||
// m_log.DebugFormat("[LLCLIENTVIEW]: Triggered AgentUpdate for {0}", sener.Name);
|
||||
|
||||
AgentUpdateArgs arg = new AgentUpdateArgs();
|
||||
arg.AgentID = x.AgentID;
|
||||
arg.BodyRotation = x.BodyRotation;
|
||||
|
@ -6235,10 +6273,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack)
|
||||
{
|
||||
GenericCall1 handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
|
||||
Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
|
||||
if (handlerCompleteMovementToRegion != null)
|
||||
{
|
||||
handlerCompleteMovementToRegion(sender);
|
||||
handlerCompleteMovementToRegion(sender, true);
|
||||
}
|
||||
handlerCompleteMovementToRegion = null;
|
||||
|
||||
|
@ -11316,8 +11354,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
protected bool HandleMultipleObjUpdate(IClientAPI simClient, Packet packet)
|
||||
{
|
||||
MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
|
||||
if (multipleupdate.AgentData.SessionID != SessionId) return false;
|
||||
// m_log.Debug("new multi update packet " + multipleupdate.ToString());
|
||||
|
||||
if (multipleupdate.AgentData.SessionID != SessionId)
|
||||
return false;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Incoming MultipleObjectUpdatePacket contained {0} blocks", multipleupdate.ObjectData.Length);
|
||||
|
||||
Scene tScene = (Scene)m_scene;
|
||||
|
||||
for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
|
||||
|
@ -11338,7 +11381,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
else
|
||||
{
|
||||
// UUID partId = part.UUID;
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Processing block {0} type {1} for {2} {3}",
|
||||
// i, block.Type, part.Name, part.LocalId);
|
||||
|
||||
// // Do this once since fetch parts creates a new array.
|
||||
// SceneObjectPart[] parts = part.ParentGroup.Parts;
|
||||
// for (int j = 0; j < parts.Length; j++)
|
||||
// {
|
||||
// part.StoreUndoState();
|
||||
// parts[j].IgnoreUndoUpdate = true;
|
||||
// }
|
||||
|
||||
UpdatePrimGroupRotation handlerUpdatePrimGroupRotation;
|
||||
|
||||
switch (block.Type)
|
||||
|
@ -11353,6 +11407,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
handlerUpdatePrimSinglePosition(localId, pos1, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Quaternion rot1 = new Quaternion(block.Data, 0, true);
|
||||
|
||||
|
@ -11363,6 +11418,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
handlerUpdatePrimSingleRotation(localId, rot1, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Vector3 rotPos = new Vector3(block.Data, 0);
|
||||
Quaternion rot2 = new Quaternion(block.Data, 12, true);
|
||||
|
@ -11375,6 +11431,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case 20:
|
||||
Vector3 scale4 = new Vector3(block.Data, 0);
|
||||
|
@ -11386,8 +11443,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
handlerUpdatePrimScale(localId, scale4, this);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
|
||||
case 5:
|
||||
Vector3 scale1 = new Vector3(block.Data, 12);
|
||||
Vector3 pos11 = new Vector3(block.Data, 0);
|
||||
|
||||
|
@ -11404,6 +11461,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
Vector3 pos2 = new Vector3(block.Data, 0);
|
||||
|
||||
|
@ -11411,10 +11469,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
if (handlerUpdateVector != null)
|
||||
{
|
||||
|
||||
handlerUpdateVector(localId, pos2, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
Quaternion rot3 = new Quaternion(block.Data, 0, true);
|
||||
|
||||
|
@ -11425,6 +11483,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
handlerUpdatePrimRotation(localId, rot3, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 11:
|
||||
Vector3 pos3 = new Vector3(block.Data, 0);
|
||||
Quaternion rot4 = new Quaternion(block.Data, 12, true);
|
||||
|
@ -11448,6 +11507,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
handlerUpdatePrimGroupScale(localId, scale7, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 13:
|
||||
Vector3 scale2 = new Vector3(block.Data, 12);
|
||||
Vector3 pos4 = new Vector3(block.Data, 0);
|
||||
|
@ -11467,6 +11527,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 29:
|
||||
Vector3 scale5 = new Vector3(block.Data, 12);
|
||||
Vector3 pos5 = new Vector3(block.Data, 0);
|
||||
|
@ -11475,6 +11536,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (handlerUpdatePrimGroupScale != null)
|
||||
{
|
||||
// m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
|
||||
part.StoreUndoState(true);
|
||||
part.IgnoreUndoUpdate = true;
|
||||
handlerUpdatePrimGroupScale(localId, scale5, this);
|
||||
handlerUpdateVector = OnUpdatePrimGroupPosition;
|
||||
|
||||
|
@ -11482,8 +11545,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
handlerUpdateVector(localId, pos5, this);
|
||||
}
|
||||
|
||||
part.IgnoreUndoUpdate = false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 21:
|
||||
Vector3 scale6 = new Vector3(block.Data, 12);
|
||||
Vector3 pos6 = new Vector3(block.Data, 0);
|
||||
|
@ -11491,6 +11558,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
handlerUpdatePrimScale = OnUpdatePrimScale;
|
||||
if (handlerUpdatePrimScale != null)
|
||||
{
|
||||
part.StoreUndoState(false);
|
||||
part.IgnoreUndoUpdate = true;
|
||||
|
||||
// m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
|
||||
handlerUpdatePrimScale(localId, scale6, this);
|
||||
handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition;
|
||||
|
@ -11498,15 +11568,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
handlerUpdatePrimSinglePosition(localId, pos6, this);
|
||||
}
|
||||
|
||||
part.IgnoreUndoUpdate = false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
m_log.Debug("[CLIENT] MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
|
||||
m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
|
||||
break;
|
||||
}
|
||||
|
||||
// for (int j = 0; j < parts.Length; j++)
|
||||
// parts[j].IgnoreUndoUpdate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -11666,55 +11743,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Breaks down the genericMessagePacket into specific events
|
||||
/// </summary>
|
||||
/// <param name="gmMethod"></param>
|
||||
/// <param name="gmInvoice"></param>
|
||||
/// <param name="gmParams"></param>
|
||||
public void DecipherGenericMessage(string gmMethod, UUID gmInvoice, GenericMessagePacket.ParamListBlock[] gmParams)
|
||||
protected void HandleAutopilot(Object sender, string method, List<String> args)
|
||||
{
|
||||
switch (gmMethod)
|
||||
{
|
||||
case "autopilot":
|
||||
float locx;
|
||||
float locy;
|
||||
float locz;
|
||||
float locx = 0;
|
||||
float locy = 0;
|
||||
float locz = 0;
|
||||
uint regionX = 0;
|
||||
uint regionY = 0;
|
||||
|
||||
try
|
||||
{
|
||||
uint regionX;
|
||||
uint regionY;
|
||||
Utils.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY);
|
||||
locx = Convert.ToSingle(Utils.BytesToString(gmParams[0].Parameter)) - regionX;
|
||||
locy = Convert.ToSingle(Utils.BytesToString(gmParams[1].Parameter)) - regionY;
|
||||
locz = Convert.ToSingle(Utils.BytesToString(gmParams[2].Parameter));
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
m_log.Error("[CLIENT]: Invalid autopilot request");
|
||||
return;
|
||||
}
|
||||
Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out regionX, out regionY);
|
||||
locx = Convert.ToSingle(args[0]) - (float)regionX;
|
||||
locy = Convert.ToSingle(args[1]) - (float)regionY;
|
||||
locz = Convert.ToSingle(args[2]);
|
||||
|
||||
UpdateVector handlerAutoPilotGo = OnAutoPilotGo;
|
||||
if (handlerAutoPilotGo != null)
|
||||
{
|
||||
handlerAutoPilotGo(0, new Vector3(locx, locy, locz), this);
|
||||
}
|
||||
m_log.InfoFormat("[CLIENT]: Client Requests autopilot to position <{0},{1},{2}>", locx, locy, locz);
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
m_log.Debug("[CLIENT]: Unknown Generic Message, Method: " + gmMethod + ". Invoice: " + gmInvoice + ". Dumping Params:");
|
||||
for (int hi = 0; hi < gmParams.Length; hi++)
|
||||
{
|
||||
Console.WriteLine(gmParams[hi].ToString());
|
||||
}
|
||||
//gmpack.MethodData.
|
||||
break;
|
||||
|
||||
}
|
||||
Action<Vector3, bool> handlerAutoPilotGo = OnAutoPilotGo;
|
||||
if (handlerAutoPilotGo != null)
|
||||
handlerAutoPilotGo(new Vector3(locx, locy, locz), false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static Int32 m_counter = 0;
|
||||
|
||||
private Int32 m_identifier;
|
||||
// private Int32 m_identifier;
|
||||
|
||||
/// <summary>
|
||||
/// Number of ticks (ms) per quantum, drip rate and max burst
|
||||
|
@ -173,7 +173,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// second. If zero, the bucket always remains full</param>
|
||||
public TokenBucket(TokenBucket parent, Int64 dripRate)
|
||||
{
|
||||
m_identifier = m_counter++;
|
||||
// m_identifier = m_counter++;
|
||||
m_counter++;
|
||||
|
||||
Parent = parent;
|
||||
RequestedDripRate = dripRate;
|
||||
|
@ -320,7 +321,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
public class AdaptiveTokenBucket : TokenBucket
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// The minimum rate for flow control. Minimum drip rate is one
|
||||
|
|
|
@ -316,6 +316,12 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
LogException(e);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}",
|
||||
asset.ID, e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
public void Cache(AssetBase asset)
|
||||
|
@ -368,13 +374,13 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
|
||||
asset = (AssetBase)bformatter.Deserialize(stream);
|
||||
|
||||
UpdateMemoryCache(id, asset);
|
||||
|
||||
m_DiskHits++;
|
||||
}
|
||||
catch (System.Runtime.Serialization.SerializationException e)
|
||||
{
|
||||
LogException(e);
|
||||
m_log.ErrorFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Failed to get file {0} for asset {1}. Exception {2} {3}",
|
||||
filename, id, e.Message, e.StackTrace);
|
||||
|
||||
// If there was a problem deserializing the asset, the asset may
|
||||
// either be corrupted OR was serialized under an old format
|
||||
|
@ -384,7 +390,9 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogException(e);
|
||||
m_log.ErrorFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Failed to get file {0} for asset {1}. Exception {2} {3}",
|
||||
filename, id, e.Message, e.StackTrace);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -393,7 +401,6 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#if WAIT_ON_INPROGRESS_REQUESTS
|
||||
// Check if we're already downloading this asset. If so, try to wait for it to
|
||||
// download.
|
||||
|
@ -416,7 +423,6 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
m_RequestsForInprogress++;
|
||||
}
|
||||
#endif
|
||||
|
||||
return asset;
|
||||
}
|
||||
|
||||
|
@ -428,9 +434,15 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
|
||||
if (m_MemoryCacheEnabled)
|
||||
asset = GetFromMemoryCache(id);
|
||||
else if (m_FileCacheEnabled)
|
||||
|
||||
if (asset == null && m_FileCacheEnabled)
|
||||
{
|
||||
asset = GetFromFileCache(id);
|
||||
|
||||
if (m_MemoryCacheEnabled && asset != null)
|
||||
UpdateMemoryCache(id, asset);
|
||||
}
|
||||
|
||||
if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0))
|
||||
{
|
||||
m_HitRateFile = (double)m_DiskHits / m_Requests * 100.0;
|
||||
|
@ -445,7 +457,6 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
}
|
||||
|
||||
m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} unnessesary requests due to requests for assets that are currently downloading.", m_RequestsForInprogress);
|
||||
|
||||
}
|
||||
|
||||
return asset;
|
||||
|
@ -459,7 +470,7 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
public void Expire(string id)
|
||||
{
|
||||
if (m_LogLevel >= 2)
|
||||
m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Expiring Asset {0}.", id);
|
||||
m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Expiring Asset {0}", id);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -477,7 +488,9 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogException(e);
|
||||
m_log.ErrorFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Failed to expire cached file {0}. Exception {1} {2}",
|
||||
id, e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -597,31 +610,59 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(directory))
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
if (!Directory.Exists(directory))
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
}
|
||||
|
||||
stream = File.Open(tempname, FileMode.Create);
|
||||
BinaryFormatter bformatter = new BinaryFormatter();
|
||||
bformatter.Serialize(stream, asset);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Failed to write asset {0} to temporary location {1} (final {2}) on cache in {3}. Exception {4} {5}.",
|
||||
asset.ID, tempname, filename, directory, e.Message, e.StackTrace);
|
||||
|
||||
return;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (stream != null)
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
stream = File.Open(tempname, FileMode.Create);
|
||||
BinaryFormatter bformatter = new BinaryFormatter();
|
||||
bformatter.Serialize(stream, asset);
|
||||
stream.Close();
|
||||
|
||||
// Now that it's written, rename it so that it can be found.
|
||||
File.Move(tempname, filename);
|
||||
|
||||
if (m_LogLevel >= 2)
|
||||
m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogException(e);
|
||||
try
|
||||
{
|
||||
// Now that it's written, rename it so that it can be found.
|
||||
//
|
||||
// File.Copy(tempname, filename, true);
|
||||
// File.Delete(tempname);
|
||||
//
|
||||
// For a brief period, this was done as a separate copy and then temporary file delete operation to
|
||||
// avoid an IOException caused by move if some competing thread had already written the file.
|
||||
// However, this causes exceptions on Windows when other threads attempt to read a file
|
||||
// which is still being copied. So instead, go back to moving the file and swallow any IOException.
|
||||
//
|
||||
// This situation occurs fairly rarely anyway. We assume in this that moves are atomic on the
|
||||
// filesystem.
|
||||
File.Move(tempname, filename);
|
||||
|
||||
if (m_LogLevel >= 2)
|
||||
m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// If we see an IOException here it's likely that some other competing thread has written the
|
||||
// cache file first, so ignore. Other IOException errors (e.g. filesystem full) should be
|
||||
// signally by the earlier temporary file writing code.
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (stream != null)
|
||||
stream.Close();
|
||||
|
||||
// Even if the write fails with an exception, we need to make sure
|
||||
// that we release the lock on that file, otherwise it'll never get
|
||||
// cached
|
||||
|
@ -635,22 +676,9 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
waitEvent.Set();
|
||||
}
|
||||
#else
|
||||
if (m_CurrentlyWriting.Contains(filename))
|
||||
{
|
||||
m_CurrentlyWriting.Remove(filename);
|
||||
}
|
||||
m_CurrentlyWriting.Remove(filename);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void LogException(Exception e)
|
||||
{
|
||||
string[] text = e.ToString().Split(new char[] { '\n' });
|
||||
foreach (string t in text)
|
||||
{
|
||||
m_log.ErrorFormat("[FLOTSAM ASSET CACHE]: {0} ", t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -706,8 +734,7 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
s.ForEachSOG(delegate(SceneObjectGroup e)
|
||||
{
|
||||
gatherer.GatherAssetUuids(e, assets);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
foreach (UUID assetID in assets.Keys)
|
||||
|
@ -740,7 +767,9 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogException(e);
|
||||
m_log.ErrorFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Couldn't clear asset cache directory {0} from {1}. Exception {2} {3}",
|
||||
dir, m_CacheDirectory, e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -752,7 +781,9 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogException(e);
|
||||
m_log.ErrorFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Couldn't clear asset cache file {0} from {1}. Exception {1} {2}",
|
||||
file, m_CacheDirectory, e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -778,7 +809,7 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
|
||||
foreach (string s in Directory.GetFiles(m_CacheDirectory, "*.fac"))
|
||||
{
|
||||
m_log.Info("[FLOTSAM ASSET CACHE]: Deep Scans were performed on the following regions:");
|
||||
m_log.Info("[FLOTSAM ASSET CACHE]: Deep scans have previously been performed on the following regions:");
|
||||
|
||||
string RegionID = s.Remove(0,s.IndexOf("_")).Replace(".fac","");
|
||||
DateTime RegionDeepScanTMStamp = File.GetLastWriteTime(s);
|
||||
|
@ -849,7 +880,6 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
Util.FireAndForget(delegate {
|
||||
int assetsCached = CacheScenes();
|
||||
m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Completed Scene Caching, {0} assets found.", assetsCached);
|
||||
|
||||
});
|
||||
|
||||
break;
|
||||
|
@ -904,7 +934,6 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
|
||||
#region IAssetService Members
|
||||
|
||||
|
||||
public AssetMetadata GetMetadata(string id)
|
||||
{
|
||||
AssetBase asset = Get(id);
|
||||
|
@ -934,7 +963,6 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
Cache(asset);
|
||||
|
||||
return asset.ID;
|
||||
|
||||
}
|
||||
|
||||
public bool UpdateContent(string id, byte[] data)
|
||||
|
|
|
@ -65,18 +65,18 @@ namespace OpenSim.Region.CoreModules.Asset.Tests
|
|||
config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true");
|
||||
|
||||
m_cache = new FlotsamAssetCache();
|
||||
m_scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(m_scene, config, m_cache);
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, config, m_cache);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCacheAsset()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
AssetBase asset = AssetHelpers.CreateAsset();
|
||||
asset.ID = TestHelper.ParseTail(0x1).ToString();
|
||||
asset.ID = TestHelpers.ParseTail(0x1).ToString();
|
||||
|
||||
// Check we don't get anything before the asset is put in the cache
|
||||
AssetBase retrievedAsset = m_cache.Get(asset.ID.ToString());
|
||||
|
@ -93,11 +93,11 @@ namespace OpenSim.Region.CoreModules.Asset.Tests
|
|||
[Test]
|
||||
public void TestExpireAsset()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
AssetBase asset = AssetHelpers.CreateAsset();
|
||||
asset.ID = TestHelper.ParseTail(0x2).ToString();
|
||||
asset.ID = TestHelpers.ParseTail(0x2).ToString();
|
||||
|
||||
m_cache.Store(asset);
|
||||
|
||||
|
@ -110,11 +110,11 @@ namespace OpenSim.Region.CoreModules.Asset.Tests
|
|||
[Test]
|
||||
public void TestClearCache()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
AssetBase asset = AssetHelpers.CreateAsset();
|
||||
asset.ID = TestHelper.ParseTail(0x2).ToString();
|
||||
asset.ID = TestHelpers.ParseTail(0x2).ToString();
|
||||
|
||||
m_cache.Store(asset);
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected Scene m_scene = null;
|
||||
private Scene m_scene;
|
||||
private IDialogModule m_dialogModule;
|
||||
|
||||
public string Name { get { return "Attachments Module"; } }
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
@ -57,6 +58,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
|
||||
m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
|
||||
m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
|
||||
// TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI
|
||||
|
@ -81,7 +83,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
|
||||
client.OnObjectAttach += AttachObject;
|
||||
client.OnObjectDetach += DetachObject;
|
||||
client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
|
||||
client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv;
|
||||
client.OnObjectDrop += DetachSingleAttachmentToGround;
|
||||
}
|
||||
|
||||
public void UnsubscribeFromClientEvents(IClientAPI client)
|
||||
|
@ -90,7 +93,77 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
|
||||
client.OnObjectAttach -= AttachObject;
|
||||
client.OnObjectDetach -= DetachObject;
|
||||
client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
|
||||
client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv;
|
||||
client.OnObjectDrop -= DetachSingleAttachmentToGround;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RezAttachments. This should only be called upon login on the first region.
|
||||
/// Attachment rezzings on crossings and TPs are done in a different way.
|
||||
/// </summary>
|
||||
public void RezAttachments(IScenePresence sp)
|
||||
{
|
||||
if (null == sp.Appearance)
|
||||
{
|
||||
m_log.WarnFormat("[ATTACHMENTS MODULE]: Appearance has not been initialized for agent {0}", sp.UUID);
|
||||
return;
|
||||
}
|
||||
|
||||
List<AvatarAttachment> attachments = sp.Appearance.GetAttachments();
|
||||
foreach (AvatarAttachment attach in attachments)
|
||||
{
|
||||
uint p = (uint)attach.AttachPoint;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Doing initial rez of attachment with itemID {0}, assetID {1}, point {2} for {3} in {4}",
|
||||
// attach.ItemID, attach.AssetID, p, sp.Name, m_scene.RegionInfo.RegionName);
|
||||
|
||||
// For some reason assetIDs are being written as Zero's in the DB -- need to track tat down
|
||||
// But they're not used anyway, the item is being looked up for now, so let's proceed.
|
||||
//if (UUID.Zero == assetID)
|
||||
//{
|
||||
// m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID);
|
||||
// continue;
|
||||
//}
|
||||
|
||||
try
|
||||
{
|
||||
// If we're an NPC then skip all the item checks and manipulations since we don't have an
|
||||
// inventory right now.
|
||||
if (sp.PresenceType == PresenceType.Npc)
|
||||
RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p);
|
||||
else
|
||||
RezSingleAttachmentFromInventory(sp.ControllingClient, attach.ItemID, p);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveChangedAttachments(IScenePresence sp)
|
||||
{
|
||||
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
||||
{
|
||||
if (grp.HasGroupChanged) // Resizer scripts?
|
||||
{
|
||||
grp.IsAttachment = false;
|
||||
grp.AbsolutePosition = grp.RootPart.AttachedPos;
|
||||
UpdateKnownItem(sp.ControllingClient, grp, grp.GetFromItemID(), grp.OwnerID);
|
||||
grp.IsAttachment = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent)
|
||||
{
|
||||
foreach (SceneObjectGroup sop in sp.GetAttachments())
|
||||
{
|
||||
sop.Scene.DeleteSceneObject(sop, silent);
|
||||
}
|
||||
|
||||
sp.ClearAttachments();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -102,10 +175,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
/// <param name="silent"></param>
|
||||
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
|
||||
{
|
||||
m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject");
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})",
|
||||
// objectLocalID, remoteClient.Name, AttachmentPt, silent);
|
||||
|
||||
try
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
|
||||
|
||||
if (sp == null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ATTACHMENTS MODULE]: Could not find presence for client {0} {1}", remoteClient.Name, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we can't take it, we can't attach it!
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID);
|
||||
if (part == null)
|
||||
|
@ -131,7 +215,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
AttachmentPt &= 0x7f;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
if (AttachObject(remoteClient, part.ParentGroup, AttachmentPt, false))
|
||||
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false))
|
||||
{
|
||||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
|
||||
|
@ -144,73 +228,94 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}", e);
|
||||
m_log.ErrorFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}{1}", e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent)
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
|
||||
|
||||
if (sp == null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ATTACHMENTS MODULE]: Could not find presence for client {0} {1}", remoteClient.Name, remoteClient.AgentId);
|
||||
return false;
|
||||
}
|
||||
|
||||
return AttachObject(sp, group, AttachmentPt, silent);
|
||||
}
|
||||
|
||||
private bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
|
||||
// group.Name, group.LocalId, sp.Name, AttachmentPt, silent);
|
||||
|
||||
if (sp.GetAttachments(attachmentPt).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;
|
||||
}
|
||||
|
||||
Vector3 attachPos = group.AbsolutePosition;
|
||||
|
||||
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
|
||||
// be removed when that functionality is implemented in opensim
|
||||
AttachmentPt &= 0x7f;
|
||||
attachmentPt &= 0x7f;
|
||||
|
||||
// If the attachment point isn't the same as the one previously used
|
||||
// set it's offset position = 0 so that it appears on the attachment point
|
||||
// and not in a weird location somewhere unknown.
|
||||
if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
|
||||
if (attachmentPt != 0 && attachmentPt != group.AttachmentPoint)
|
||||
{
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
// AttachmentPt 0 means the client chose to 'wear' the attachment.
|
||||
if (AttachmentPt == 0)
|
||||
if (attachmentPt == 0)
|
||||
{
|
||||
// Check object for stored attachment point
|
||||
AttachmentPt = (uint)group.GetAttachmentPoint();
|
||||
attachmentPt = group.AttachmentPoint;
|
||||
}
|
||||
|
||||
// if we still didn't find a suitable attachment point.......
|
||||
if (AttachmentPt == 0)
|
||||
if (attachmentPt == 0)
|
||||
{
|
||||
// Stick it on left hand with Zero Offset from the attachment point.
|
||||
AttachmentPt = (uint)AttachmentPoint.LeftHand;
|
||||
attachmentPt = (uint)AttachmentPoint.LeftHand;
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
group.SetAttachmentPoint((byte)AttachmentPt);
|
||||
group.AttachmentPoint = attachmentPt;
|
||||
group.AbsolutePosition = attachPos;
|
||||
|
||||
// Remove any previous attachments
|
||||
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
|
||||
UUID itemID = UUID.Zero;
|
||||
if (sp != null)
|
||||
|
||||
List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
|
||||
|
||||
// At the moment we can only deal with a single attachment
|
||||
// We also don't want to do any of the inventory operations for an NPC.
|
||||
if (sp.PresenceType != PresenceType.Npc)
|
||||
{
|
||||
foreach (SceneObjectGroup grp in sp.Attachments)
|
||||
{
|
||||
if (grp.GetAttachmentPoint() == (byte)AttachmentPt)
|
||||
{
|
||||
itemID = grp.GetFromItemID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (attachments.Count != 0)
|
||||
itemID = attachments[0].GetFromItemID();
|
||||
|
||||
if (itemID != UUID.Zero)
|
||||
DetachSingleAttachmentToInv(itemID, remoteClient);
|
||||
}
|
||||
|
||||
if (group.GetFromItemID() == UUID.Zero)
|
||||
{
|
||||
m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID);
|
||||
}
|
||||
else
|
||||
{
|
||||
DetachSingleAttachmentToInv(itemID, sp);
|
||||
|
||||
itemID = group.GetFromItemID();
|
||||
if (itemID == UUID.Zero)
|
||||
itemID = AddSceneObjectAsAttachment(sp.ControllingClient, group).ID;
|
||||
|
||||
ShowAttachInUserInventory(sp, attachmentPt, itemID, group);
|
||||
}
|
||||
|
||||
ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group);
|
||||
|
||||
AttachToAgent(sp, group, AttachmentPt, attachPos, silent);
|
||||
AttachToAgent(sp, group, attachmentPt, attachPos, silent);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -226,12 +331,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
}
|
||||
}
|
||||
|
||||
public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
||||
public ISceneEntity RezSingleAttachmentFromInventory(
|
||||
IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
||||
{
|
||||
return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true);
|
||||
}
|
||||
|
||||
public UUID RezSingleAttachmentFromInventory(
|
||||
public ISceneEntity RezSingleAttachmentFromInventory(
|
||||
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
|
||||
{
|
||||
return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null);
|
||||
|
@ -239,7 +345,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
|
||||
public UUID RezSingleAttachmentFromInventory(
|
||||
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc)
|
||||
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
|
||||
|
||||
{
|
||||
if (sp == null) { m_log.ErrorFormat( "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()", remoteClient.Name, remoteClient.AgentId); return null; }
|
||||
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
|
||||
// be removed when that functionality is implemented in opensim
|
||||
AttachmentPt &= 0x7f;
|
||||
|
@ -249,15 +358,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
if (updateInventoryStatus)
|
||||
{
|
||||
if (att == null)
|
||||
ShowDetachInUserInventory(itemID, remoteClient);
|
||||
DetachSingleAttachmentToInv(itemID, sp.ControllingClient);
|
||||
else
|
||||
ShowAttachInUserInventory(att, remoteClient, itemID, AttachmentPt);
|
||||
ShowAttachInUserInventory(att, sp, itemID, AttachmentPt);
|
||||
}
|
||||
|
||||
if (null == att)
|
||||
return UUID.Zero;
|
||||
else
|
||||
return att.UUID;
|
||||
return att;
|
||||
}
|
||||
|
||||
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
|
||||
|
@ -266,12 +372,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
if (invAccess != null)
|
||||
{
|
||||
SceneObjectGroup objatt = invAccess.RezObject(remoteClient,
|
||||
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
|
||||
false, false, remoteClient.AgentId, true);
|
||||
SceneObjectGroup objatt;
|
||||
|
||||
if (itemID != UUID.Zero)
|
||||
objatt = invAccess.RezObject(sp.ControllingClient,
|
||||
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
|
||||
false, false, sp.UUID, true);
|
||||
else
|
||||
objatt = invAccess.RezObject(sp.ControllingClient,
|
||||
null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
|
||||
false, false, sp.UUID, true);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
|
||||
// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
|
||||
// objatt.Name, remoteClient.Name, AttachmentPt);
|
||||
|
||||
if (objatt != null)
|
||||
|
@ -281,17 +394,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
// since scripts aren't running yet. So, clear it here.
|
||||
objatt.HasGroupChanged = false;
|
||||
bool tainted = false;
|
||||
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
|
||||
if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint)
|
||||
tainted = true;
|
||||
|
||||
// This will throw if the attachment fails
|
||||
try
|
||||
{
|
||||
AttachObject(remoteClient, objatt, AttachmentPt, false);
|
||||
AttachObject(sp, objatt, attachmentPt, false);
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}",
|
||||
objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace);
|
||||
|
||||
// Make sure the object doesn't stick around and bail
|
||||
sp.RemoveAttachment(objatt);
|
||||
m_scene.DeleteSceneObject(objatt, false);
|
||||
return null;
|
||||
}
|
||||
|
@ -311,13 +429,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
objatt.ResumeScripts();
|
||||
|
||||
// Do this last so that event listeners have access to all the effects of the attachment
|
||||
//m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
|
||||
m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
|
||||
itemID, remoteClient.Name, AttachmentPt);
|
||||
itemID, sp.Name, attachmentPt);
|
||||
}
|
||||
|
||||
return objatt;
|
||||
|
@ -330,31 +448,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
/// Update the user inventory to the attachment of an item
|
||||
/// </summary>
|
||||
/// <param name="att"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="itemID"></param>
|
||||
/// <param name="AttachmentPt"></param>
|
||||
/// <param name="attachmentPoint"></param>
|
||||
/// <returns></returns>
|
||||
protected UUID ShowAttachInUserInventory(
|
||||
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
||||
private UUID ShowAttachInUserInventory(
|
||||
SceneObjectGroup att, IScenePresence sp, UUID itemID, uint attachmentPoint)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
|
||||
// remoteClient.Name, att.Name, itemID);
|
||||
// "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} {2} (item ID {3}) at {4}",
|
||||
// sp.Name, att.Name, att.LocalId, itemID, AttachmentPt);
|
||||
|
||||
if (!att.IsDeleted)
|
||||
AttachmentPt = att.RootPart.AttachmentPoint;
|
||||
attachmentPoint = att.AttachmentPoint;
|
||||
|
||||
ScenePresence presence;
|
||||
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||
{
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID);
|
||||
if (m_scene.InventoryService != null)
|
||||
item = m_scene.InventoryService.GetItem(item);
|
||||
|
||||
bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||
}
|
||||
bool changed = sp.Appearance.SetAttachment((int)attachmentPoint, itemID, item.AssetID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
|
||||
|
||||
return att.UUID;
|
||||
}
|
||||
|
@ -362,12 +479,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
/// <summary>
|
||||
/// Update the user inventory to reflect an attachment
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="AttachmentPt"></param>
|
||||
/// <param name="itemID"></param>
|
||||
/// <param name="att"></param>
|
||||
protected void ShowAttachInUserInventory(
|
||||
IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
|
||||
private void ShowAttachInUserInventory(
|
||||
IScenePresence sp, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}",
|
||||
|
@ -390,23 +507,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
m_log.Error("[ATTACHMENTS MODULE]: Unable to save attachment for a prim without the rootpart!");
|
||||
return;
|
||||
}
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID);
|
||||
|
||||
ScenePresence presence;
|
||||
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||
{
|
||||
// XXYY!!
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||
if (item == null)
|
||||
m_log.Error("[ATTACHMENT]: item == null");
|
||||
if (m_scene == null)
|
||||
m_log.Error("[ATTACHMENT]: m_scene == null");
|
||||
if (m_scene.InventoryService == null)
|
||||
m_log.Error("[ATTACHMENT]: m_scene.InventoryService == null");
|
||||
item = m_scene.InventoryService.GetItem(item);
|
||||
bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
item = m_scene.InventoryService.GetItem(item);
|
||||
bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
|
||||
}
|
||||
|
||||
public void DetachObject(uint objectLocalID, IClientAPI remoteClient)
|
||||
|
@ -414,12 +525,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
|
||||
if (group != null)
|
||||
{
|
||||
//group.DetachToGround();
|
||||
ShowDetachInUserInventory(group.GetFromItemID(), remoteClient);
|
||||
DetachSingleAttachmentToInv(group.GetFromItemID(), remoteClient);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient)
|
||||
public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
|
||||
{
|
||||
ScenePresence presence;
|
||||
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||
|
@ -430,34 +540,44 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
bool changed = presence.Appearance.DetachAttachment(itemID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||
}
|
||||
|
||||
DetachSingleAttachmentToInv(itemID, remoteClient);
|
||||
DetachSingleAttachmentToInv(itemID, presence);
|
||||
}
|
||||
}
|
||||
|
||||
public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient)
|
||||
public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient)
|
||||
{
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(itemID);
|
||||
if (part == null || part.ParentGroup == null)
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}",
|
||||
// remoteClient.Name, sceneObjectID);
|
||||
|
||||
SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId);
|
||||
|
||||
if (so == null)
|
||||
return;
|
||||
|
||||
if (part.ParentGroup.RootPart.AttachedAvatar != remoteClient.AgentId)
|
||||
if (so.AttachedAvatar != remoteClient.AgentId)
|
||||
return;
|
||||
|
||||
UUID inventoryID = part.ParentGroup.GetFromItemID();
|
||||
UUID inventoryID = so.GetFromItemID();
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}",
|
||||
// so.Name, so.LocalId, inventoryID);
|
||||
|
||||
ScenePresence presence;
|
||||
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||
{
|
||||
if (!m_scene.Permissions.CanRezObject(
|
||||
part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
|
||||
so.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
|
||||
return;
|
||||
|
||||
bool changed = presence.Appearance.DetachAttachment(itemID);
|
||||
bool changed = presence.Appearance.DetachAttachment(inventoryID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||
|
||||
part.ParentGroup.DetachToGround();
|
||||
presence.RemoveAttachment(so);
|
||||
DetachSceneObjectToGround(so, presence);
|
||||
|
||||
List<UUID> uuids = new List<UUID>();
|
||||
uuids.Add(inventoryID);
|
||||
|
@ -465,12 +585,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
remoteClient.SendRemoveInventoryItem(inventoryID);
|
||||
}
|
||||
|
||||
m_scene.EventManager.TriggerOnAttach(part.ParentGroup.LocalId, itemID, UUID.Zero);
|
||||
m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Detach the given scene object to the ground.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The caller has to take care of all the other work in updating avatar appearance, inventory, etc.
|
||||
/// </remarks>
|
||||
/// <param name="so">The scene object to detach.</param>
|
||||
/// <param name="sp">The scene presence from which the scene object is being detached.</param>
|
||||
private void DetachSceneObjectToGround(SceneObjectGroup so, ScenePresence sp)
|
||||
{
|
||||
SceneObjectPart rootPart = so.RootPart;
|
||||
|
||||
rootPart.FromItemID = UUID.Zero;
|
||||
so.AbsolutePosition = sp.AbsolutePosition;
|
||||
so.AttachedAvatar = UUID.Zero;
|
||||
rootPart.SetParentLocalId(0);
|
||||
so.ClearPartAttachmentData();
|
||||
rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
|
||||
so.HasGroupChanged = true;
|
||||
rootPart.Rezzed = DateTime.Now;
|
||||
rootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
so.AttachToBackup();
|
||||
m_scene.EventManager.TriggerParcelPrimCountTainted();
|
||||
rootPart.ScheduleFullUpdate();
|
||||
rootPart.ClearUndoState();
|
||||
}
|
||||
|
||||
// What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards.
|
||||
// To LocalId or UUID, *THAT* is the question. How now Brown UUID??
|
||||
protected void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
|
||||
private void DetachSingleAttachmentToInv(UUID itemID, IScenePresence sp)
|
||||
{
|
||||
if (itemID == UUID.Zero) // If this happened, someone made a mistake....
|
||||
return;
|
||||
|
@ -493,27 +640,55 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
group.DetachToInventoryPrep();
|
||||
m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
|
||||
|
||||
// If an item contains scripts, it's always changed.
|
||||
// This ensures script state is saved on detach
|
||||
foreach (SceneObjectPart p in group.Parts)
|
||||
if (p.Inventory.ContainsScripts())
|
||||
group.HasGroupChanged = true;
|
||||
// Prepare sog for storage
|
||||
group.AttachedAvatar = UUID.Zero;
|
||||
|
||||
UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
|
||||
group.ForEachPart(
|
||||
delegate(SceneObjectPart part)
|
||||
{
|
||||
// If there are any scripts,
|
||||
// then always trigger a new object and state persistence in UpdateKnownItem()
|
||||
if (part.Inventory.ContainsScripts())
|
||||
group.HasGroupChanged = true;
|
||||
}
|
||||
);
|
||||
|
||||
group.RootPart.SetParentLocalId(0);
|
||||
group.IsAttachment = false;
|
||||
group.AbsolutePosition = group.RootPart.AttachedPos;
|
||||
|
||||
UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID);
|
||||
m_scene.DeleteSceneObject(group, false);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos)
|
||||
{
|
||||
// First we save the
|
||||
// attachment point information, then we update the relative
|
||||
// positioning. Then we have to mark the object as NOT an
|
||||
// attachment. This is necessary in order to correctly save
|
||||
// and retrieve GroupPosition information for the attachment.
|
||||
// Finally, we restore the object's attachment status.
|
||||
uint attachmentPoint = sog.AttachmentPoint;
|
||||
sog.UpdateGroupPosition(pos);
|
||||
sog.IsAttachment = false;
|
||||
sog.AbsolutePosition = sog.RootPart.AttachedPos;
|
||||
sog.AttachmentPoint = attachmentPoint;
|
||||
sog.HasGroupChanged = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the attachment asset for the new sog details if they have changed.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects,
|
||||
/// these details are not stored on the region.
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="grp"></param>
|
||||
/// <param name="itemID"></param>
|
||||
|
@ -524,15 +699,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
{
|
||||
if (!grp.HasGroupChanged)
|
||||
{
|
||||
m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID);
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
|
||||
grp.UUID, grp.AttachmentPoint);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
|
||||
grp.UUID, grp.GetAttachmentPoint());
|
||||
grp.UUID, grp.AttachmentPoint);
|
||||
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||
item = m_scene.InventoryService.GetItem(item);
|
||||
|
||||
|
@ -564,20 +743,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
/// <summary>
|
||||
/// Attach this scene object to the given avatar.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// This isn't publicly available since attachments should always perform the corresponding inventory
|
||||
/// operation (to show the attach in user inventory and update the asset with positional information).
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="so"></param>
|
||||
/// <param name="attachmentpoint"></param>
|
||||
/// <param name="attachOffset"></param>
|
||||
/// <param name="silent"></param>
|
||||
protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
|
||||
private void AttachToAgent(
|
||||
IScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
|
||||
{
|
||||
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name,
|
||||
attachmentpoint, attachOffset, so.RootPart.AttachedPos);
|
||||
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}",
|
||||
// so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos);
|
||||
|
||||
so.DetachFromBackup();
|
||||
|
||||
|
@ -585,12 +764,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
m_scene.DeleteFromStorage(so.UUID);
|
||||
m_scene.EventManager.TriggerParcelPrimCountTainted();
|
||||
|
||||
so.RootPart.AttachedAvatar = avatar.UUID;
|
||||
|
||||
//Anakin Lohner bug #3839
|
||||
SceneObjectPart[] parts = so.Parts;
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
parts[i].AttachedAvatar = avatar.UUID;
|
||||
so.AttachedAvatar = avatar.UUID;
|
||||
|
||||
if (so.RootPart.PhysActor != null)
|
||||
{
|
||||
|
@ -600,10 +774,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
|
||||
so.AbsolutePosition = attachOffset;
|
||||
so.RootPart.AttachedPos = attachOffset;
|
||||
so.RootPart.IsAttachment = true;
|
||||
|
||||
so.IsAttachment = true;
|
||||
so.RootPart.SetParentLocalId(avatar.LocalId);
|
||||
so.SetAttachmentPoint(Convert.ToByte(attachmentpoint));
|
||||
so.AttachmentPoint = attachmentpoint;
|
||||
|
||||
avatar.AddAttachment(so);
|
||||
|
||||
|
@ -617,5 +790,97 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
// it get cleaned up
|
||||
so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a scene object that was previously free in the scene as an attachment to an avatar.
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="grp"></param>
|
||||
/// <returns>The user inventory item created that holds the attachment.</returns>
|
||||
private InventoryItemBase AddSceneObjectAsAttachment(IClientAPI remoteClient, SceneObjectGroup grp)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2} {3} {4}", grp.Name, grp.LocalId, remoteClient.Name, remoteClient.AgentId, AgentId);
|
||||
|
||||
Vector3 inventoryStoredPosition = new Vector3
|
||||
(((grp.AbsolutePosition.X > (int)Constants.RegionSize)
|
||||
? Constants.RegionSize - 6
|
||||
: grp.AbsolutePosition.X)
|
||||
,
|
||||
(grp.AbsolutePosition.Y > (int)Constants.RegionSize)
|
||||
? Constants.RegionSize - 6
|
||||
: grp.AbsolutePosition.Y,
|
||||
grp.AbsolutePosition.Z);
|
||||
|
||||
Vector3 originalPosition = grp.AbsolutePosition;
|
||||
|
||||
grp.AbsolutePosition = inventoryStoredPosition;
|
||||
|
||||
// If we're being called from a script, then trying to serialize that same script's state will not complete
|
||||
// in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if
|
||||
// the client/server crashes rather than logging out normally, the attachment's scripts will resume
|
||||
// without state on relog. Arguably, this is what we want anyway.
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false);
|
||||
|
||||
grp.AbsolutePosition = originalPosition;
|
||||
|
||||
AssetBase asset = m_scene.CreateAsset(
|
||||
grp.GetPartName(grp.LocalId),
|
||||
grp.GetPartDescription(grp.LocalId),
|
||||
(sbyte)AssetType.Object,
|
||||
Utils.StringToBytes(sceneObjectXml),
|
||||
remoteClient.AgentId);
|
||||
|
||||
m_scene.AssetService.Store(asset);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.CreatorId = grp.RootPart.CreatorID.ToString();
|
||||
item.CreatorData = grp.RootPart.CreatorData;
|
||||
item.Owner = remoteClient.AgentId;
|
||||
item.ID = UUID.Random();
|
||||
item.AssetID = asset.FullID;
|
||||
item.Description = asset.Description;
|
||||
item.Name = asset.Name;
|
||||
item.AssetType = asset.Type;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
|
||||
InventoryFolderBase folder = m_scene.InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object);
|
||||
if (folder != null)
|
||||
item.Folder = folder.ID;
|
||||
else // oopsies
|
||||
item.Folder = UUID.Zero;
|
||||
|
||||
if ((remoteClient.AgentId != grp.RootPart.OwnerID) && m_scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
item.BasePermissions = grp.RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions = grp.RootPart.NextOwnerMask;
|
||||
item.NextPermissions = grp.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask;
|
||||
item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BasePermissions = grp.RootPart.BaseMask;
|
||||
item.CurrentPermissions = grp.RootPart.OwnerMask;
|
||||
item.NextPermissions = grp.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = grp.RootPart.EveryoneMask;
|
||||
item.GroupPermissions = grp.RootPart.GroupMask;
|
||||
}
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
// sets itemID so client can show item as 'attached' in inventory
|
||||
grp.SetFromItemID(item.ID);
|
||||
|
||||
if (m_scene.AddInventoryItem(item))
|
||||
{
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_dialogModule != null)
|
||||
m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,274 @@
|
|||
/*
|
||||
* 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 System.Threading;
|
||||
using System.Timers;
|
||||
using Timer=System.Timers.Timer;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.CoreModules.Avatar.Attachments;
|
||||
using OpenSim.Region.CoreModules.Framework.InventoryAccess;
|
||||
using OpenSim.Region.CoreModules.World.Serialiser;
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Attachment tests
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class AttachmentsModuleTests
|
||||
{
|
||||
private Scene scene;
|
||||
private AttachmentsModule m_attMod;
|
||||
private ScenePresence m_presence;
|
||||
|
||||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
// Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
|
||||
Util.FireAndForgetMethod = FireAndForgetMethod.None;
|
||||
|
||||
IConfigSource config = new IniConfigSource();
|
||||
config.AddConfig("Modules");
|
||||
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||
|
||||
scene = SceneHelpers.SetupScene();
|
||||
m_attMod = new AttachmentsModule();
|
||||
SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule());
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
// We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
|
||||
// threads. Possibly, later tests should be rewritten not to worry about such things.
|
||||
Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add the standard presence for a test.
|
||||
/// </summary>
|
||||
private void AddPresence()
|
||||
{
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
UserAccountHelpers.CreateUserWithInventory(scene, userId);
|
||||
m_presence = SceneHelpers.AddScenePresence(scene, userId);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddAttachmentFromGround()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
AddPresence();
|
||||
string attName = "att";
|
||||
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup;
|
||||
|
||||
m_attMod.AttachObject(m_presence.ControllingClient, so, (uint)AttachmentPoint.Chest, false);
|
||||
|
||||
// Check status on scene presence
|
||||
Assert.That(m_presence.HasAttachments(), Is.True);
|
||||
List<SceneObjectGroup> attachments = m_presence.GetAttachments();
|
||||
Assert.That(attachments.Count, Is.EqualTo(1));
|
||||
SceneObjectGroup attSo = attachments[0];
|
||||
Assert.That(attSo.Name, Is.EqualTo(attName));
|
||||
Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
|
||||
Assert.That(attSo.IsAttachment);
|
||||
Assert.That(attSo.UsesPhysics, Is.False);
|
||||
Assert.That(attSo.IsTemporary, Is.False);
|
||||
|
||||
// Check item status
|
||||
Assert.That(m_presence.Appearance.GetAttachpoint(
|
||||
attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddAttachmentFromInventory()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
AddPresence();
|
||||
|
||||
UUID attItemId = TestHelpers.ParseTail(0x2);
|
||||
UUID attAssetId = TestHelpers.ParseTail(0x3);
|
||||
string attName = "att";
|
||||
|
||||
UserInventoryHelpers.CreateInventoryItem(
|
||||
scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
|
||||
|
||||
m_attMod.RezSingleAttachmentFromInventory(
|
||||
m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
|
||||
|
||||
// Check scene presence status
|
||||
Assert.That(m_presence.HasAttachments(), Is.True);
|
||||
List<SceneObjectGroup> attachments = m_presence.GetAttachments();
|
||||
Assert.That(attachments.Count, Is.EqualTo(1));
|
||||
SceneObjectGroup attSo = attachments[0];
|
||||
Assert.That(attSo.Name, Is.EqualTo(attName));
|
||||
Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
|
||||
Assert.That(attSo.IsAttachment);
|
||||
Assert.That(attSo.UsesPhysics, Is.False);
|
||||
Assert.That(attSo.IsTemporary, Is.False);
|
||||
|
||||
// Check appearance status
|
||||
Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDetachAttachmentToGround()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
AddPresence();
|
||||
|
||||
UUID attItemId = TestHelpers.ParseTail(0x2);
|
||||
UUID attAssetId = TestHelpers.ParseTail(0x3);
|
||||
string attName = "att";
|
||||
|
||||
UserInventoryHelpers.CreateInventoryItem(
|
||||
scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
|
||||
|
||||
ISceneEntity so = m_attMod.RezSingleAttachmentFromInventory(
|
||||
m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
|
||||
m_attMod.DetachSingleAttachmentToGround(so.LocalId, m_presence.ControllingClient);
|
||||
|
||||
// Check scene presence status
|
||||
Assert.That(m_presence.HasAttachments(), Is.False);
|
||||
List<SceneObjectGroup> attachments = m_presence.GetAttachments();
|
||||
Assert.That(attachments.Count, Is.EqualTo(0));
|
||||
|
||||
// Check appearance status
|
||||
Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(0));
|
||||
|
||||
// Check item status
|
||||
Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Null);
|
||||
|
||||
// Check object in scene
|
||||
Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDetachAttachmentToInventory()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
AddPresence();
|
||||
|
||||
UUID attItemId = TestHelpers.ParseTail(0x2);
|
||||
UUID attAssetId = TestHelpers.ParseTail(0x3);
|
||||
string attName = "att";
|
||||
|
||||
UserInventoryHelpers.CreateInventoryItem(
|
||||
scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
|
||||
|
||||
m_attMod.RezSingleAttachmentFromInventory(
|
||||
m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
|
||||
m_attMod.DetachSingleAttachmentToInv(attItemId, m_presence.ControllingClient);
|
||||
|
||||
// Check status on scene presence
|
||||
Assert.That(m_presence.HasAttachments(), Is.False);
|
||||
List<SceneObjectGroup> attachments = m_presence.GetAttachments();
|
||||
Assert.That(attachments.Count, Is.EqualTo(0));
|
||||
|
||||
// Check item status
|
||||
Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRezAttachmentsOnAvatarEntrance()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
UUID attItemId = TestHelpers.ParseTail(0x2);
|
||||
UUID attAssetId = TestHelpers.ParseTail(0x3);
|
||||
string attName = "att";
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(scene, userId);
|
||||
InventoryItemBase attItem
|
||||
= UserInventoryHelpers.CreateInventoryItem(
|
||||
scene, attName, attItemId, attAssetId, userId, InventoryType.Object);
|
||||
|
||||
AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
|
||||
acd.Appearance = new AvatarAppearance();
|
||||
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
||||
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
|
||||
|
||||
Assert.That(presence.HasAttachments(), Is.True);
|
||||
List<SceneObjectGroup> attachments = presence.GetAttachments();
|
||||
|
||||
Assert.That(attachments.Count, Is.EqualTo(1));
|
||||
SceneObjectGroup attSo = attachments[0];
|
||||
Assert.That(attSo.Name, Is.EqualTo(attName));
|
||||
Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
|
||||
Assert.That(attSo.IsAttachment);
|
||||
Assert.That(attSo.UsesPhysics, Is.False);
|
||||
Assert.That(attSo.IsTemporary, Is.False);
|
||||
}
|
||||
|
||||
// I'm commenting this test because scene setup NEEDS InventoryService to
|
||||
// be non-null
|
||||
//[Test]
|
||||
// public void T032_CrossAttachments()
|
||||
// {
|
||||
// TestHelpers.InMethod();
|
||||
//
|
||||
// ScenePresence presence = scene.GetScenePresence(agent1);
|
||||
// ScenePresence presence2 = scene2.GetScenePresence(agent1);
|
||||
// presence2.AddAttachment(sog1);
|
||||
// presence2.AddAttachment(sog2);
|
||||
//
|
||||
// ISharedRegionModule serialiser = new SerialiserModule();
|
||||
// SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
|
||||
// SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);
|
||||
//
|
||||
// Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
|
||||
//
|
||||
// //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
|
||||
// Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
|
||||
// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
public void NewClient(IClientAPI client)
|
||||
{
|
||||
client.OnRequestWearables += SendWearables;
|
||||
client.OnSetAppearance += SetAppearance;
|
||||
client.OnSetAppearance += SetAppearanceFromClient;
|
||||
client.OnAvatarNowWearing += AvatarIsWearing;
|
||||
}
|
||||
|
||||
|
@ -115,17 +115,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Check for the existence of the baked texture assets.
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
public bool ValidateBakedTextureCache(IClientAPI client)
|
||||
{
|
||||
return ValidateBakedTextureCache(client, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check for the existence of the baked texture assets. Request a rebake
|
||||
/// unless checkonly is true.
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="checkonly"></param>
|
||||
public bool ValidateBakedTextureCache(IClientAPI client)
|
||||
{
|
||||
return ValidateBakedTextureCache(client, true);
|
||||
}
|
||||
|
||||
private bool ValidateBakedTextureCache(IClientAPI client, bool checkonly)
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
|
||||
|
@ -147,6 +151,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
if (face == null)
|
||||
continue;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
|
||||
// face.TextureID, idx, client.Name, client.AgentId);
|
||||
|
||||
// if the texture is one of the "defaults" then skip it
|
||||
// this should probably be more intelligent (skirt texture doesnt matter
|
||||
// if the avatar isnt wearing a skirt) but if any of the main baked
|
||||
|
@ -156,13 +164,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
|
||||
defonly = false; // found a non-default texture reference
|
||||
|
||||
if (! CheckBakedTextureAsset(client,face.TextureID,idx))
|
||||
if (!CheckBakedTextureAsset(client, face.TextureID, idx))
|
||||
{
|
||||
// the asset didn't exist if we are only checking, then we found a bad
|
||||
// one and we're done otherwise, ask for a rebake
|
||||
if (checkonly) return false;
|
||||
if (checkonly)
|
||||
return false;
|
||||
|
||||
m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake", face.TextureID);
|
||||
|
||||
client.SendRebakeAvatarTextures(face.TextureID);
|
||||
}
|
||||
}
|
||||
|
@ -174,16 +184,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set appearance data (textureentry and slider settings) received from the client
|
||||
/// Set appearance data (texture asset IDs and slider settings) received from the client
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="texture"></param>
|
||||
/// <param name="visualParam"></param>
|
||||
public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams)
|
||||
public void SetAppearanceFromClient(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams)
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
|
||||
if (sp == null)
|
||||
{
|
||||
m_log.WarnFormat("[AVFACTORY]: SetAppearance unable to find presence for {0}",client.AgentId);
|
||||
m_log.WarnFormat("[AVFACTORY]: SetAppearance unable to find presence for {0}", client.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -211,18 +222,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
|
||||
|
||||
m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", client.AgentId);
|
||||
Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client,false); });
|
||||
Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client, false); });
|
||||
|
||||
// This appears to be set only in the final stage of the appearance
|
||||
// update transaction. In theory, we should be able to do an immediate
|
||||
// appearance send and save here.
|
||||
|
||||
// save only if there were changes, send no matter what (doesn't hurt to send twice)
|
||||
if (changed)
|
||||
QueueAppearanceSave(client.AgentId);
|
||||
QueueAppearanceSend(client.AgentId);
|
||||
}
|
||||
// save only if there were changes, send no matter what (doesn't hurt to send twice)
|
||||
if (changed)
|
||||
QueueAppearanceSave(client.AgentId);
|
||||
|
||||
QueueAppearanceSend(client.AgentId);
|
||||
}
|
||||
|
||||
// m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
|
||||
|
@ -246,6 +257,117 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
return true;
|
||||
}
|
||||
|
||||
public Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId)
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentId);
|
||||
|
||||
if (sp == null)
|
||||
return new Dictionary<BakeType, Primitive.TextureEntryFace>();
|
||||
|
||||
return GetBakedTextureFaces(sp);
|
||||
}
|
||||
|
||||
private Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(ScenePresence sp)
|
||||
{
|
||||
if (sp.IsChildAgent)
|
||||
return new Dictionary<BakeType, Primitive.TextureEntryFace>();
|
||||
|
||||
Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures
|
||||
= new Dictionary<BakeType, Primitive.TextureEntryFace>();
|
||||
|
||||
AvatarAppearance appearance = sp.Appearance;
|
||||
Primitive.TextureEntryFace[] faceTextures = appearance.Texture.FaceTextures;
|
||||
|
||||
foreach (int i in Enum.GetValues(typeof(BakeType)))
|
||||
{
|
||||
BakeType bakeType = (BakeType)i;
|
||||
|
||||
if (bakeType == BakeType.Unknown)
|
||||
continue;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}",
|
||||
// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
|
||||
|
||||
int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType);
|
||||
bakedTextures[bakeType] = faceTextures[ftIndex];
|
||||
}
|
||||
|
||||
return bakedTextures;
|
||||
}
|
||||
|
||||
public bool SaveBakedTextures(UUID agentId)
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentId);
|
||||
|
||||
if (sp == null)
|
||||
return false;
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[AV FACTORY]: Permanently saving baked textures for {0} in {1}",
|
||||
sp.Name, m_scene.RegionInfo.RegionName);
|
||||
|
||||
Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = GetBakedTextureFaces(sp);
|
||||
|
||||
if (bakedTextures.Count == 0)
|
||||
return false;
|
||||
|
||||
foreach (BakeType bakeType in bakedTextures.Keys)
|
||||
{
|
||||
Primitive.TextureEntryFace bakedTextureFace = bakedTextures[bakeType];
|
||||
|
||||
if (bakedTextureFace == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently",
|
||||
bakeType, sp.Name, m_scene.RegionInfo.RegionName);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
AssetBase asset = m_scene.AssetService.Get(bakedTextureFace.TextureID.ToString());
|
||||
|
||||
if (asset != null)
|
||||
{
|
||||
asset.Temporary = false;
|
||||
asset.Local = false;
|
||||
m_scene.AssetService.Store(asset);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[AV FACTORY]: Baked texture id {0} not found for bake {1} for avatar {2} in {3} when trying to save permanently",
|
||||
bakedTextureFace.TextureID, bakeType, sp.Name, m_scene.RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
|
||||
// for (int i = 0; i < faceTextures.Length; i++)
|
||||
// {
|
||||
//// m_log.DebugFormat(
|
||||
//// "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}",
|
||||
//// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
|
||||
//
|
||||
// if (faceTextures[i] == null)
|
||||
// continue;
|
||||
//
|
||||
// AssetBase asset = m_scene.AssetService.Get(faceTextures[i].TextureID.ToString());
|
||||
//
|
||||
// if (asset != null)
|
||||
// {
|
||||
// asset.Temporary = false;
|
||||
// m_scene.AssetService.Store(asset);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_log.WarnFormat(
|
||||
// "[AV FACTORY]: Baked texture {0} for {1} in {2} not found when trying to save permanently",
|
||||
// faceTextures[i].TextureID, sp.Name, m_scene.RegionInfo.RegionName);
|
||||
// }
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#region UpdateAppearanceTimer
|
||||
|
||||
/// <summary>
|
||||
|
@ -278,26 +400,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
}
|
||||
|
||||
private void HandleAppearanceSend(UUID agentid)
|
||||
private void SaveAppearance(UUID agentid)
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentid);
|
||||
if (sp == null)
|
||||
{
|
||||
m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid);
|
||||
return;
|
||||
}
|
||||
// We must set appearance parameters in the en_US culture in order to avoid issues where values are saved
|
||||
// in a culture where decimal points are commas and then reloaded in a culture which just treats them as
|
||||
// number seperators.
|
||||
Culture.SetCurrentCulture();
|
||||
|
||||
// m_log.WarnFormat("[AVFACTORY]: Handle appearance send for {0}", agentid);
|
||||
|
||||
// Send the appearance to everyone in the scene
|
||||
sp.SendAppearanceToAllOtherAgents();
|
||||
|
||||
// Send animations back to the avatar as well
|
||||
sp.Animator.SendAnimPack();
|
||||
}
|
||||
|
||||
private void HandleAppearanceSave(UUID agentid)
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentid);
|
||||
if (sp == null)
|
||||
{
|
||||
|
@ -321,7 +430,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
{
|
||||
if (kvp.Value < now)
|
||||
{
|
||||
Util.FireAndForget(delegate(object o) { HandleAppearanceSend(kvp.Key); });
|
||||
Util.FireAndForget(delegate(object o) { SendAppearance(kvp.Key); });
|
||||
m_sendqueue.Remove(kvp.Key);
|
||||
}
|
||||
}
|
||||
|
@ -334,7 +443,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
{
|
||||
if (kvp.Value < now)
|
||||
{
|
||||
Util.FireAndForget(delegate(object o) { HandleAppearanceSave(kvp.Key); });
|
||||
Util.FireAndForget(delegate(object o) { SaveAppearance(kvp.Key); });
|
||||
m_savequeue.Remove(kvp.Key);
|
||||
}
|
||||
}
|
||||
|
@ -380,11 +489,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
// m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}", client.AgentId);
|
||||
|
||||
// we need to clean out the existing textures
|
||||
sp.Appearance.ResetAppearance();
|
||||
sp.Appearance.ResetAppearance();
|
||||
|
||||
// operate on a copy of the appearance so we don't have to lock anything
|
||||
// operate on a copy of the appearance so we don't have to lock anything yet
|
||||
AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
|
||||
|
||||
|
||||
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
||||
{
|
||||
if (wear.Type < AvatarWearable.MAX_WEARABLES)
|
||||
|
@ -396,12 +505,37 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
// This could take awhile since it needs to pull inventory
|
||||
SetAppearanceAssets(sp.UUID, ref avatAppearance);
|
||||
|
||||
// could get fancier with the locks here, but in the spirit of "last write wins"
|
||||
// this should work correctly, also, we don't need to send the appearance here
|
||||
// since the "iswearing" will trigger a new set of visual param and baked texture changes
|
||||
// when those complete, the new appearance will be sent
|
||||
sp.Appearance = avatAppearance;
|
||||
QueueAppearanceSave(client.AgentId);
|
||||
lock (m_setAppearanceLock)
|
||||
{
|
||||
// Update only those fields that we have changed. This is important because the viewer
|
||||
// often sends AvatarIsWearing and SetAppearance packets at once, and AvatarIsWearing
|
||||
// shouldn't overwrite the changes made in SetAppearance.
|
||||
sp.Appearance.Wearables = avatAppearance.Wearables;
|
||||
sp.Appearance.Texture = avatAppearance.Texture;
|
||||
|
||||
// We don't need to send the appearance here since the "iswearing" will trigger a new set
|
||||
// of visual param and baked texture changes. When those complete, the new appearance will be sent
|
||||
|
||||
QueueAppearanceSave(client.AgentId);
|
||||
}
|
||||
}
|
||||
|
||||
public bool SendAppearance(UUID agentId)
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentId);
|
||||
if (sp == null)
|
||||
{
|
||||
m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Send the appearance to everyone in the scene
|
||||
sp.SendAppearanceToAllOtherAgents();
|
||||
|
||||
// Send animations back to the avatar as well
|
||||
sp.Animator.SendAnimPack();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* 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 Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.Asset;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
{
|
||||
[TestFixture]
|
||||
public class AvatarFactoryModuleTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Only partial right now since we don't yet test that it's ended up in the avatar appearance service.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSetAppearance()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
|
||||
AvatarFactoryModule afm = new AvatarFactoryModule();
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, afm);
|
||||
IClientAPI tc = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
|
||||
|
||||
byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT];
|
||||
for (byte i = 0; i < visualParams.Length; i++)
|
||||
visualParams[i] = i;
|
||||
|
||||
afm.SetAppearanceFromClient(tc, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams);
|
||||
|
||||
ScenePresence sp = scene.GetScenePresence(userId);
|
||||
|
||||
// TODO: Check baked texture
|
||||
Assert.AreEqual(visualParams, sp.Appearance.VisualParams);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSaveBakedTextures()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
UUID eyesTextureId = TestHelpers.ParseTail(0x2);
|
||||
|
||||
// We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly
|
||||
// to the AssetService, which will then store temporary and local assets permanently
|
||||
CoreAssetCache assetCache = new CoreAssetCache();
|
||||
|
||||
AvatarFactoryModule afm = new AvatarFactoryModule();
|
||||
TestScene scene = SceneHelpers.SetupScene(assetCache);
|
||||
SceneHelpers.SetupSceneModules(scene, afm);
|
||||
IClientAPI tc = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
|
||||
|
||||
// TODO: Use the actual BunchOfCaps functionality once we slot in the CapabilitiesModules
|
||||
AssetBase uploadedAsset;
|
||||
uploadedAsset = new AssetBase(eyesTextureId, "Baked Texture", (sbyte)AssetType.Texture, userId.ToString());
|
||||
uploadedAsset.Data = new byte[] { 2 };
|
||||
uploadedAsset.Temporary = true;
|
||||
uploadedAsset.Local = true; // Local assets aren't persisted, non-local are
|
||||
scene.AssetService.Store(uploadedAsset);
|
||||
|
||||
byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT];
|
||||
for (byte i = 0; i < visualParams.Length; i++)
|
||||
visualParams[i] = i;
|
||||
|
||||
Primitive.TextureEntry bakedTextureEntry = new Primitive.TextureEntry(TestHelpers.ParseTail(0x10));
|
||||
uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes);
|
||||
Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
|
||||
eyesFace.TextureID = eyesTextureId;
|
||||
|
||||
afm.SetAppearanceFromClient(tc, bakedTextureEntry, visualParams);
|
||||
afm.SaveBakedTextures(userId);
|
||||
// Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = afm.GetBakedTextureFaces(userId);
|
||||
|
||||
// We should also inpsect the asset data store layer directly, but this is difficult to get at right now.
|
||||
assetCache.Clear();
|
||||
|
||||
AssetBase eyesBake = scene.AssetService.Get(eyesTextureId.ToString());
|
||||
Assert.That(eyesBake, Is.Not.Null);
|
||||
Assert.That(eyesBake.Temporary, Is.False);
|
||||
Assert.That(eyesBake.Local, Is.False);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -172,11 +172,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
private void RetrieveInstantMessages(IClientAPI client)
|
||||
{
|
||||
if (m_RestURL == String.Empty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[OFFLINE MESSAGING]: Retrieving stored messages for {0}", client.AgentId);
|
||||
|
||||
m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId);
|
||||
|
||||
List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>(
|
||||
List<GridInstantMessage> msglist
|
||||
= SynchronousRestObjectRequester.MakeRequest<UUID, List<GridInstantMessage>>(
|
||||
"POST", m_RestURL + "/RetrieveMessages/", client.AgentId);
|
||||
|
||||
if (msglist != null)
|
||||
|
@ -209,6 +213,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
im.dialog != (byte)InstantMessageDialog.GroupInvitation &&
|
||||
im.dialog != (byte)InstantMessageDialog.InventoryOffered)
|
||||
{
|
||||
bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
|
||||
"POST", m_RestURL+"/SaveMessage/", im);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,8 +100,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
|
||||
|
||||
|
@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
|
||||
// Create scene object asset
|
||||
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
|
||||
SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50);
|
||||
SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50);
|
||||
|
||||
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
|
||||
|
@ -127,10 +127,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
scene.AddInventoryItem(item1);
|
||||
|
||||
// Create coalesced objects asset
|
||||
SceneObjectGroup cobj1 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120);
|
||||
SceneObjectGroup cobj1 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120);
|
||||
cobj1.AbsolutePosition = new Vector3(15, 30, 45);
|
||||
|
||||
SceneObjectGroup cobj2 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140);
|
||||
SceneObjectGroup cobj2 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140);
|
||||
cobj2.AbsolutePosition = new Vector3(25, 50, 75);
|
||||
|
||||
CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2);
|
||||
|
|
|
@ -61,14 +61,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
m_archiverModule = new InventoryArchiverModule();
|
||||
|
||||
m_scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLoadCoalesecedItem()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password");
|
||||
|
@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestOrder()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes);
|
||||
|
@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestSaveItemToIar()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
// Create user
|
||||
|
@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
|
||||
// Create asset
|
||||
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
|
||||
SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50);
|
||||
SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50);
|
||||
|
||||
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
|
||||
|
@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestSaveItemToIarNoAssets()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
// Create user
|
||||
|
@ -236,7 +236,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
|
||||
// Create asset
|
||||
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
|
||||
SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50);
|
||||
SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50);
|
||||
|
||||
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
|
||||
|
@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestLoadIarCreatorAccountPresent()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood");
|
||||
|
@ -357,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestLoadIarV0_1SameNameCreator()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
|
||||
|
@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestLoadIarV0_1AbsentCreator()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password");
|
||||
|
|
|
@ -57,13 +57,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestSavePathToIarV0_1()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
// Create user
|
||||
string userFirstName = "Jock";
|
||||
|
@ -172,16 +172,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestLoadIarToInventoryPaths()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
|
||||
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
|
||||
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood");
|
||||
UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
|
||||
|
@ -217,13 +217,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestLoadIarPathStartsWithSlash()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password");
|
||||
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream);
|
||||
|
@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestLoadIarPathWithEscapedChars()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
string itemName = "You & you are a mean/man/";
|
||||
|
@ -247,8 +247,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
// Create user
|
||||
string userFirstName = "Jock";
|
||||
|
@ -323,10 +323,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestNewIarPath()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
|
||||
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
||||
|
@ -390,10 +390,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestPartExistingIarPath()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
|
||||
string folder1ExistingName = "a";
|
||||
|
@ -441,10 +441,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
[Test]
|
||||
public void TestMergeIarPath()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
|
||||
string folder1ExistingName = "a";
|
||||
|
|
|
@ -208,9 +208,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
Array.Copy(copyIDBytes, 0, im.binaryBucket, 1, copyIDBytes.Length);
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
user.ControllingClient.SendBulkUpdateInventory(folderCopy);
|
||||
}
|
||||
|
||||
// HACK!!
|
||||
im.imSessionID = folderID.Guid;
|
||||
|
@ -240,9 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16);
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
user.ControllingClient.SendBulkUpdateInventory(itemCopy);
|
||||
}
|
||||
|
||||
// HACK!!
|
||||
im.imSessionID = itemID.Guid;
|
||||
|
@ -280,7 +276,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
else
|
||||
{
|
||||
if (m_TransferModule != null)
|
||||
m_TransferModule.SendInstantMessage(im, delegate(bool success) {});
|
||||
m_TransferModule.SendInstantMessage(im, delegate(bool success) {
|
||||
// Send BulkUpdateInventory
|
||||
IInventoryService invService = scene.InventoryService;
|
||||
UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item /folder, back from it's trip
|
||||
|
||||
InventoryFolderBase folder = new InventoryFolderBase(inventoryEntityID, client.AgentId);
|
||||
folder = invService.GetFolder(folder);
|
||||
|
||||
ScenePresence fromUser = scene.GetScenePresence(new UUID(im.fromAgentID));
|
||||
|
||||
// If the user has left the scene by the time the message comes back then we can't send
|
||||
// them the update.
|
||||
if (fromUser != null)
|
||||
fromUser.ControllingClient.SendBulkUpdateInventory(folder);
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined)
|
||||
|
|
|
@ -196,7 +196,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
|||
if (!(client.Scene is Scene))
|
||||
return;
|
||||
|
||||
Scene scene = (Scene)(client.Scene);
|
||||
// Scene scene = (Scene)(client.Scene);
|
||||
|
||||
GridInstantMessage im = null;
|
||||
if (m_PendingLures.TryGetValue(lureID, out im))
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
|
|||
if (!(s is Scene))
|
||||
return;
|
||||
|
||||
Scene scene = (Scene)s;
|
||||
// Scene scene = (Scene)s;
|
||||
|
||||
string profileUrl = String.Empty;
|
||||
string aboutText = String.Empty;
|
||||
|
|
|
@ -209,7 +209,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
sp.TeleportFlags = (TeleportFlags)teleportFlags;
|
||||
sp.Teleport(position);
|
||||
|
||||
foreach (SceneObjectGroup grp in sp.Attachments)
|
||||
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
||||
sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT);
|
||||
}
|
||||
else // Another region possibly in another simulator
|
||||
|
@ -494,7 +494,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
// Now let's make it officially a child agent
|
||||
sp.MakeChildAgent();
|
||||
|
||||
sp.Scene.CleanDroppedAttachments();
|
||||
// sp.Scene.CleanDroppedAttachments();
|
||||
|
||||
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
|
||||
|
||||
|
@ -560,11 +560,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
|
||||
{
|
||||
foreach (SceneObjectGroup sop in sp.Attachments)
|
||||
{
|
||||
sop.Scene.DeleteSceneObject(sop, true);
|
||||
}
|
||||
sp.Attachments.Clear();
|
||||
sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true);
|
||||
}
|
||||
|
||||
protected void KillEntity(Scene scene, uint localID)
|
||||
|
@ -1088,10 +1084,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
#endregion
|
||||
|
||||
#region Enable Child Agent
|
||||
|
||||
/// <summary>
|
||||
/// This informs a single neighbouring region about agent "avatar".
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// </summary>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="region"></param>
|
||||
public void EnableChildAgent(ScenePresence sp, GridRegion region)
|
||||
{
|
||||
m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName);
|
||||
|
@ -1153,6 +1152,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
/// This informs all neighbouring regions about agent "avatar".
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// </summary>
|
||||
/// <param name="sp"></param>
|
||||
public void EnableChildAgents(ScenePresence sp)
|
||||
{
|
||||
List<GridRegion> neighbours = new List<GridRegion>();
|
||||
|
@ -1340,7 +1340,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
Utils.LongToUInts(reg.RegionHandle, out x, out y);
|
||||
x = x / Constants.RegionSize;
|
||||
y = y / Constants.RegionSize;
|
||||
m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")");
|
||||
m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint + ")");
|
||||
|
||||
string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);
|
||||
|
||||
|
@ -1786,34 +1786,33 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
protected bool CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent)
|
||||
{
|
||||
List<SceneObjectGroup> m_attachments = sp.Attachments;
|
||||
lock (m_attachments)
|
||||
List<SceneObjectGroup> m_attachments = sp.GetAttachments();
|
||||
|
||||
// Validate
|
||||
foreach (SceneObjectGroup gobj in m_attachments)
|
||||
{
|
||||
// Validate
|
||||
foreach (SceneObjectGroup gobj in m_attachments)
|
||||
{
|
||||
if (gobj == null || gobj.IsDeleted)
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (SceneObjectGroup gobj in m_attachments)
|
||||
{
|
||||
// If the prim group is null then something must have happened to it!
|
||||
if (gobj != null && gobj.RootPart != null)
|
||||
{
|
||||
// Set the parent localID to 0 so it transfers over properly.
|
||||
gobj.RootPart.SetParentLocalId(0);
|
||||
gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
|
||||
gobj.RootPart.IsAttachment = false;
|
||||
//gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
|
||||
CrossPrimGroupIntoNewRegion(destination, gobj, silent);
|
||||
}
|
||||
}
|
||||
m_attachments.Clear();
|
||||
|
||||
return true;
|
||||
if (gobj == null || gobj.IsDeleted)
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (SceneObjectGroup gobj in m_attachments)
|
||||
{
|
||||
// If the prim group is null then something must have happened to it!
|
||||
if (gobj != null)
|
||||
{
|
||||
// Set the parent localID to 0 so it transfers over properly.
|
||||
gobj.RootPart.SetParentLocalId(0);
|
||||
gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
|
||||
gobj.IsAttachment = false;
|
||||
//gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
|
||||
CrossPrimGroupIntoNewRegion(destination, gobj, silent);
|
||||
}
|
||||
}
|
||||
|
||||
sp.ClearAttachments();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1862,7 +1861,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
int i = 0;
|
||||
if (sp.InTransitScriptStates.Count > 0)
|
||||
{
|
||||
sp.Attachments.ForEach(delegate(SceneObjectGroup sog)
|
||||
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||
|
||||
foreach (SceneObjectGroup sog in attachments)
|
||||
{
|
||||
if (i < sp.InTransitScriptStates.Count)
|
||||
{
|
||||
|
@ -1871,8 +1872,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
sog.ResumeScripts();
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: InTransitScriptStates.Count={0} smaller than Attachments.Count={1}", sp.InTransitScriptStates.Count, sp.Attachments.Count);
|
||||
});
|
||||
m_log.ErrorFormat(
|
||||
"[ENTITY TRANSFER MODULE]: InTransitScriptStates.Count={0} smaller than Attachments.Count={1}",
|
||||
sp.InTransitScriptStates.Count, attachments.Count);
|
||||
}
|
||||
|
||||
sp.InTransitScriptStates.Clear();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -65,8 +65,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
|
|||
config.AddConfig("Modules");
|
||||
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||
|
||||
m_scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam);
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, config, m_iam);
|
||||
|
||||
// Create user
|
||||
string userFirstName = "Jock";
|
||||
|
@ -82,14 +82,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
|
|||
[Test]
|
||||
public void TestRezCoalescedObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
// Create asset
|
||||
SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20);
|
||||
SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20);
|
||||
object1.AbsolutePosition = new Vector3(15, 30, 45);
|
||||
|
||||
SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40);
|
||||
SceneObjectGroup object2 = SceneHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40);
|
||||
object2.AbsolutePosition = new Vector3(25, 50, 75);
|
||||
|
||||
CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2);
|
||||
|
@ -138,11 +138,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
|
|||
[Test]
|
||||
public void TestRezObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
// Create asset
|
||||
SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40);
|
||||
SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40);
|
||||
|
||||
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
|
||||
|
|
|
@ -185,6 +185,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
|
|||
archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName, false);
|
||||
archread.Execute();
|
||||
}
|
||||
|
||||
foreach (InventoryNodeBase node in nodes)
|
||||
FixPerms(node);
|
||||
}
|
||||
|
@ -197,18 +198,19 @@ namespace OpenSim.Region.CoreModules.Framework.Library
|
|||
archread.Close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void FixPerms(InventoryNodeBase node)
|
||||
{
|
||||
m_log.DebugFormat("[LIBRARY MODULE]: Fixing perms for {0} {1}", node.Name, node.ID);
|
||||
|
||||
if (node is InventoryItemBase)
|
||||
{
|
||||
InventoryItemBase item = (InventoryItemBase)node;
|
||||
item.BasePermissions = 0x7FFFFFFF;
|
||||
item.EveryOnePermissions = 0x7FFFFFFF;
|
||||
item.CurrentPermissions = 0x7FFFFFFF;
|
||||
item.NextPermissions = 0x7FFFFFFF;
|
||||
item.BasePermissions = (uint)PermissionMask.All;
|
||||
item.EveryOnePermissions = (uint)PermissionMask.All - (uint)PermissionMask.Modify;
|
||||
item.CurrentPermissions = (uint)PermissionMask.All;
|
||||
item.NextPermissions = (uint)PermissionMask.All;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,6 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
|
|||
{
|
||||
m_scene = scene;
|
||||
|
||||
|
||||
m_scene.AddCommand(this, "monitor report",
|
||||
"monitor report",
|
||||
"Returns a variety of statistics about the current region and/or simulator",
|
||||
|
|
|
@ -186,7 +186,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private string[] GetUserNames(UUID uuid)
|
||||
{
|
||||
string[] returnstring = new string[2];
|
||||
|
@ -292,6 +291,25 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
return userID.ToString();
|
||||
}
|
||||
|
||||
public void AddUser(UUID uuid, string first, string last)
|
||||
{
|
||||
if (m_UserCache.ContainsKey(uuid))
|
||||
return;
|
||||
|
||||
UserData user = new UserData();
|
||||
user.Id = uuid;
|
||||
user.FirstName = first;
|
||||
user.LastName = last;
|
||||
// user.ProfileURL = we should initialize this to the default
|
||||
|
||||
AddUserInternal(user);
|
||||
}
|
||||
|
||||
public void AddUser(UUID uuid, string first, string last, string profileURL)
|
||||
{
|
||||
AddUser(uuid, profileURL + ";" + first + " " + last);
|
||||
}
|
||||
|
||||
public void AddUser(UUID id, string creatorData)
|
||||
{
|
||||
if (m_UserCache.ContainsKey(id))
|
||||
|
@ -299,18 +317,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
|
||||
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData);
|
||||
|
||||
UserData user = new UserData();
|
||||
user.Id = id;
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
|
||||
|
||||
if (account != null)
|
||||
{
|
||||
user.FirstName = account.FirstName;
|
||||
user.LastName = account.LastName;
|
||||
// user.ProfileURL = we should initialize this to the default
|
||||
AddUser(id, account.FirstName, account.LastName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserData user = new UserData();
|
||||
user.Id = id;
|
||||
|
||||
if (creatorData != null && creatorData != string.Empty)
|
||||
{
|
||||
//creatorData = <endpoint>;<name>
|
||||
|
@ -338,17 +355,19 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
user.FirstName = "Unknown";
|
||||
user.LastName = "User";
|
||||
}
|
||||
|
||||
AddUserInternal(user);
|
||||
}
|
||||
|
||||
lock (m_UserCache)
|
||||
m_UserCache[id] = user;
|
||||
|
||||
//m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.HomeURL);
|
||||
}
|
||||
|
||||
public void AddUser(UUID uuid, string first, string last, string profileURL)
|
||||
void AddUserInternal(UserData user)
|
||||
{
|
||||
AddUser(uuid, profileURL + ";" + first + " " + last);
|
||||
lock (m_UserCache)
|
||||
m_UserCache[user.Id] = user;
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}",
|
||||
user.Id, user.FirstName, user.LastName, user.HomeURL);
|
||||
}
|
||||
|
||||
//public void AddUser(UUID uuid, string userData)
|
||||
|
|
|
@ -282,6 +282,93 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delivers the message to a scene entity.
|
||||
/// </summary>
|
||||
/// <param name='target'>
|
||||
/// Target.
|
||||
/// </param>
|
||||
/// <param name='channel'>
|
||||
/// Channel.
|
||||
/// </param>
|
||||
/// <param name='name'>
|
||||
/// Name.
|
||||
/// </param>
|
||||
/// <param name='id'>
|
||||
/// Identifier.
|
||||
/// </param>
|
||||
/// <param name='msg'>
|
||||
/// Message.
|
||||
/// </param>
|
||||
public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error)
|
||||
{
|
||||
error = null;
|
||||
// Is id an avatar?
|
||||
ScenePresence sp = m_scene.GetScenePresence(target);
|
||||
|
||||
if (sp != null)
|
||||
{
|
||||
// Send message to avatar
|
||||
if (channel == 0)
|
||||
{
|
||||
m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0, pos, name, id, false);
|
||||
}
|
||||
|
||||
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||
|
||||
if (attachments.Count == 0)
|
||||
return true;
|
||||
|
||||
// Get uuid of attachments
|
||||
List<UUID> targets = new List<UUID>();
|
||||
foreach (SceneObjectGroup sog in attachments)
|
||||
{
|
||||
targets.Add(sog.UUID);
|
||||
}
|
||||
|
||||
// Need to check each attachment
|
||||
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
|
||||
{
|
||||
if (li.GetHostID().Equals(id))
|
||||
continue;
|
||||
|
||||
if (m_scene.GetSceneObjectPart(li.GetHostID()) == null)
|
||||
continue;
|
||||
|
||||
if (targets.Contains(li.GetHostID()))
|
||||
QueueMessage(new ListenerInfo(li, name, id, msg));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Need to toss an error here
|
||||
if (channel == 0)
|
||||
{
|
||||
error = "Cannot use llRegionSayTo to message objects on channel 0";
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
|
||||
{
|
||||
// Dont process if this message is from yourself!
|
||||
if (li.GetHostID().Equals(id))
|
||||
continue;
|
||||
|
||||
SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID());
|
||||
if (sPart == null)
|
||||
continue;
|
||||
|
||||
if ( li.GetHostID().Equals(target))
|
||||
{
|
||||
QueueMessage(new ListenerInfo(li, name, id, msg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void QueueMessage(ListenerInfo li)
|
||||
{
|
||||
lock (m_pending.SyncRoot)
|
||||
|
|
|
@ -48,7 +48,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage
|
|||
private static bool m_Enabled = false;
|
||||
|
||||
private IConfigSource m_Config;
|
||||
bool m_Registered = false;
|
||||
|
||||
#region IRegionModule interface
|
||||
|
||||
|
@ -64,9 +63,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage
|
|||
m_log.Info("[MAP SERVICE IN CONNECTOR]: MapImage Service In Connector enabled");
|
||||
new MapGetServiceConnector(m_Config, MainServer.Instance, "MapImageService");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
|
@ -106,6 +103,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,15 +129,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
m_Cache = null;
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName);
|
||||
m_log.DebugFormat(
|
||||
"[LOCAL ASSET SERVICES CONNECTOR]: Enabled connector for region {0}", scene.RegionInfo.RegionName);
|
||||
|
||||
if (m_Cache != null)
|
||||
{
|
||||
m_log.InfoFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName);
|
||||
m_log.DebugFormat(
|
||||
"[LOCAL ASSET SERVICES CONNECTOR]: Enabled asset caching for region {0}",
|
||||
scene.RegionInfo.RegionName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Short-circuit directly to storage layer
|
||||
// Short-circuit directly to storage layer. This ends up storing temporary and local assets.
|
||||
//
|
||||
scene.UnregisterModuleInterface<IAssetService>(this);
|
||||
scene.RegisterModuleInterface<IAssetService>(m_AssetService);
|
||||
|
@ -246,9 +249,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
m_Cache.Cache(asset);
|
||||
|
||||
if (asset.Temporary || asset.Local)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LOCAL ASSET SERVICE CONNECTOR]: Returning asset {0} {1} without querying database since status Temporary = {2}, Local = {3}",
|
||||
// asset.Name, asset.ID, asset.Temporary, asset.Local);
|
||||
|
||||
return asset.ID;
|
||||
|
||||
return m_AssetService.Store(asset);
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LOCAL ASSET SERVICE CONNECTOR]: Passing {0} {1} on to asset service for storage, status Temporary = {2}, Local = {3}",
|
||||
// asset.Name, asset.ID, asset.Temporary, asset.Local);
|
||||
|
||||
return m_AssetService.Store(asset);
|
||||
}
|
||||
}
|
||||
|
||||
public bool UpdateContent(string id, byte[] data)
|
||||
|
|
|
@ -39,8 +39,7 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
||||
{
|
||||
public class LocalAuthorizationServicesConnector :
|
||||
ISharedRegionModule, IAuthorizationService
|
||||
public class LocalAuthorizationServicesConnector : ISharedRegionModule, IAuthorizationService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -127,15 +126,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
|||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_log.InfoFormat("[AUTHORIZATION CONNECTOR]: Enabled local authorization for region {0}", scene.RegionInfo.RegionName);
|
||||
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[AUTHORIZATION CONNECTOR]: Enabled local authorization for region {0}",
|
||||
scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
public bool IsAuthorizedForRegion(string userID, string regionID, out string message)
|
||||
public bool IsAuthorizedForRegion(
|
||||
string userID, string firstName, string lastName, string regionID, out string message)
|
||||
{
|
||||
return m_AuthorizationService.IsAuthorizedForRegion(userID, regionID, out message);
|
||||
return m_AuthorizationService.IsAuthorizedForRegion(userID, firstName, lastName, regionID, out message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -117,9 +117,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
|||
|
||||
}
|
||||
|
||||
public bool IsAuthorizedForRegion(string userID, string regionID, out string message)
|
||||
public bool IsAuthorizedForRegion(
|
||||
string userID, string firstName, string lastName, string regionID, out string message)
|
||||
{
|
||||
m_log.InfoFormat("[REMOTE AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} for region {1}", userID, regionID);
|
||||
m_log.InfoFormat(
|
||||
"[REMOTE AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} for region {1}", userID, regionID);
|
||||
|
||||
bool isAuthorized = true;
|
||||
message = String.Empty;
|
||||
|
@ -140,17 +142,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
|||
if (scene != null)
|
||||
{
|
||||
UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, new UUID(userID));
|
||||
isAuthorized = IsAuthorizedForRegion(userID, account.FirstName, account.LastName,
|
||||
account.Email, scene.RegionInfo.RegionName, regionID, out message);
|
||||
|
||||
isAuthorized
|
||||
= IsAuthorizedForRegion(
|
||||
userID, firstName, lastName, account.Email, scene.RegionInfo.RegionName, regionID, out message);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[REMOTE AUTHORIZATION CONNECTOR] IsAuthorizedForRegion, can't find scene to match region id of {0} ",regionID);
|
||||
m_log.ErrorFormat(
|
||||
"[REMOTE AUTHORIZATION CONNECTOR] IsAuthorizedForRegion, can't find scene to match region id of {0}",
|
||||
regionID);
|
||||
}
|
||||
|
||||
|
||||
return isAuthorized;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,19 +55,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
|
||||
config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
|
||||
config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
|
||||
config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion");
|
||||
config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion");
|
||||
config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion");
|
||||
config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion");
|
||||
config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion");
|
||||
config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion");
|
||||
config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion");
|
||||
|
||||
m_LocalConnector = new LocalGridServicesConnector(config);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test saving a V0.2 OpenSim Region Archive.
|
||||
/// Test region registration.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestRegisterRegionV0_2()
|
||||
public void TestRegisterRegion()
|
||||
{
|
||||
SetUp();
|
||||
|
||||
|
@ -123,11 +123,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
m_LocalConnector.RegisterRegion(UUID.Zero, r1);
|
||||
|
||||
GridRegion result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test");
|
||||
Assert.IsNull(result, "Retrieved GetRegionByName \"Test\" is not null");
|
||||
|
||||
result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test Region 1");
|
||||
Assert.IsNotNull(result, "Retrieved GetRegionByName is null");
|
||||
Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match");
|
||||
|
||||
m_LocalConnector.RegisterRegion(UUID.Zero, r2);
|
||||
m_LocalConnector.RegisterRegion(UUID.Zero, r3);
|
||||
m_LocalConnector.RegisterRegion(UUID.Zero, r2);
|
||||
m_LocalConnector.RegisterRegion(UUID.Zero, r3);
|
||||
m_LocalConnector.RegisterRegion(UUID.Zero, r4);
|
||||
|
||||
result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1));
|
||||
|
@ -152,38 +155,38 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null");
|
||||
Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected");
|
||||
|
||||
results = m_LocalConnector.GetDefaultRegions(UUID.Zero);
|
||||
Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null");
|
||||
Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2");
|
||||
results = m_LocalConnector.GetDefaultRegions(UUID.Zero);
|
||||
Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null");
|
||||
Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2");
|
||||
|
||||
results = m_LocalConnector.GetHyperlinks(UUID.Zero);
|
||||
Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null");
|
||||
|
|
|
@ -66,7 +66,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
|||
public void OnMakeRootAgent(ScenePresence sp)
|
||||
{
|
||||
// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
|
||||
m_GridUserService.SetLastPosition(sp.UUID.ToString(), UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
|
||||
|
||||
if (sp.PresenceType != PresenceType.Npc)
|
||||
m_GridUserService.SetLastPosition(
|
||||
sp.UUID.ToString(), UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
|
||||
}
|
||||
|
||||
public void OnNewClient(IClientAPI client)
|
||||
|
@ -93,7 +96,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
|||
lookat = ((ScenePresence)sp).Lookat;
|
||||
}
|
||||
}
|
||||
m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
|
||||
|
||||
// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
|
||||
m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat);
|
||||
}
|
||||
|
||||
|
|
|
@ -211,11 +211,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID);
|
||||
return;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID);
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
}
|
||||
if (sp == null)
|
||||
|
|
|
@ -280,7 +280,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
{
|
||||
// m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID);
|
||||
|
||||
UUID requestedItemId = item.ID;
|
||||
// UUID requestedItemId = item.ID;
|
||||
|
||||
item = m_InventoryService.GetItem(item);
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
|
|||
private bool m_enabled = false;
|
||||
private IMapImageService m_MapService;
|
||||
|
||||
private string m_serverUrl = String.Empty;
|
||||
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||
|
||||
private int m_refreshtime = 0;
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
{
|
||||
public class PresenceDetector
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IPresenceService m_PresenceService;
|
||||
private Scene m_aScene;
|
||||
|
@ -94,7 +94,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
}
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
|
||||
m_PresenceService.LogoutAgent(client.SessionId);
|
||||
}
|
||||
|
||||
|
|
|
@ -129,14 +129,12 @@ namespace OpenSim.Region.CoreModules.World
|
|||
switch (cmd[1])
|
||||
{
|
||||
case "enable":
|
||||
if (scene.LoginsDisabled)
|
||||
MainConsole.Instance.Output(String.Format("Enabling logins for region {0}", scene.RegionInfo.RegionName));
|
||||
scene.LoginsDisabled = false;
|
||||
MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName));
|
||||
break;
|
||||
case "disable":
|
||||
if (!scene.LoginsDisabled)
|
||||
MainConsole.Instance.Output(String.Format("Disabling logins for region {0}", scene.RegionInfo.RegionName));
|
||||
scene.LoginsDisabled = true;
|
||||
MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName));
|
||||
break;
|
||||
case "status":
|
||||
if (scene.LoginsDisabled)
|
||||
|
|
|
@ -68,8 +68,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
TerrainModule terrainModule = new TerrainModule();
|
||||
|
||||
m_scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
|
||||
}
|
||||
|
||||
private void LoadCompleted(Guid requestId, string errorMessage)
|
||||
|
@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
[Test]
|
||||
public void TestSaveOar()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
SceneObjectPart part1 = CreateSceneObjectPart1();
|
||||
|
@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
[Test]
|
||||
public void TestSaveOarNoAssets()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
SceneObjectPart part1 = CreateSceneObjectPart1();
|
||||
|
@ -300,7 +300,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
[Test]
|
||||
public void TestLoadOar()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
|
@ -409,7 +409,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
[Test]
|
||||
public void TestLoadOarRegionSettings()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
|
@ -505,7 +505,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
//[Test]
|
||||
public void TestMergeOar()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
//XmlConfigurator.Configure();
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
|
@ -524,8 +524,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
TerrainModule terrainModule = new TerrainModule();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
|
||||
|
||||
m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
|
||||
|
||||
|
|
|
@ -875,41 +875,35 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
SceneObjectPart prt = Scene.GetSceneObjectPart(obj);
|
||||
if (prt != null)
|
||||
{
|
||||
if (prt.ParentGroup != null)
|
||||
SceneObjectGroup sog = prt.ParentGroup;
|
||||
LandStatReportItem lsri = new LandStatReportItem();
|
||||
lsri.LocationX = sog.AbsolutePosition.X;
|
||||
lsri.LocationY = sog.AbsolutePosition.Y;
|
||||
lsri.LocationZ = sog.AbsolutePosition.Z;
|
||||
lsri.Score = SceneData[obj];
|
||||
lsri.TaskID = sog.UUID;
|
||||
lsri.TaskLocalID = sog.LocalId;
|
||||
lsri.TaskName = sog.GetPartName(obj);
|
||||
lsri.OwnerName = "waiting";
|
||||
lock (uuidNameLookupList)
|
||||
uuidNameLookupList.Add(sog.OwnerID);
|
||||
|
||||
if (filter.Length != 0)
|
||||
{
|
||||
SceneObjectGroup sog = prt.ParentGroup;
|
||||
if (sog != null)
|
||||
if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
|
||||
{
|
||||
LandStatReportItem lsri = new LandStatReportItem();
|
||||
lsri.LocationX = sog.AbsolutePosition.X;
|
||||
lsri.LocationY = sog.AbsolutePosition.Y;
|
||||
lsri.LocationZ = sog.AbsolutePosition.Z;
|
||||
lsri.Score = SceneData[obj];
|
||||
lsri.TaskID = sog.UUID;
|
||||
lsri.TaskLocalID = sog.LocalId;
|
||||
lsri.TaskName = sog.GetPartName(obj);
|
||||
lsri.OwnerName = "waiting";
|
||||
lock (uuidNameLookupList)
|
||||
uuidNameLookupList.Add(sog.OwnerID);
|
||||
|
||||
if (filter.Length != 0)
|
||||
{
|
||||
if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
SceneReport.Add(lsri);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SceneReport.Add(lsri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
|
||||
|
||||
if (uuidNameLookupList.Count > 0)
|
||||
|
|
|
@ -423,17 +423,49 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
SendLandUpdate(avatar, false);
|
||||
}
|
||||
|
||||
public void EventManagerOnSignificantClientMovement(IClientAPI remote_client)
|
||||
public void EventManagerOnSignificantClientMovement(ScenePresence clientAvatar)
|
||||
{
|
||||
ScenePresence clientAvatar = m_scene.GetScenePresence(remote_client.AgentId);
|
||||
|
||||
if (clientAvatar != null)
|
||||
SendLandUpdate(clientAvatar);
|
||||
SendOutNearestBanLine(clientAvatar.ControllingClient);
|
||||
ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
|
||||
if (parcel != null)
|
||||
{
|
||||
SendLandUpdate(clientAvatar);
|
||||
SendOutNearestBanLine(remote_client);
|
||||
ILandObject parcel = GetLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
|
||||
if (parcel != null)
|
||||
EnforceBans(parcel, clientAvatar);
|
||||
if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
|
||||
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
|
||||
{
|
||||
EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
|
||||
m_scene.RegionInfo.RegionID);
|
||||
//They are going under the safety line!
|
||||
if (!parcel.IsBannedFromLand(clientAvatar.UUID))
|
||||
{
|
||||
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false;
|
||||
}
|
||||
}
|
||||
else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
|
||||
parcel.IsBannedFromLand(clientAvatar.UUID))
|
||||
{
|
||||
//once we've sent the message once, keep going toward the target until we are done
|
||||
if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId))
|
||||
{
|
||||
SendYouAreBannedNotice(clientAvatar);
|
||||
ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
|
||||
}
|
||||
}
|
||||
else if (parcel.IsRestrictedFromLand(clientAvatar.UUID))
|
||||
{
|
||||
//once we've sent the message once, keep going toward the target until we are done
|
||||
if (forcedPosition.ContainsKey(clientAvatar.ControllingClient.AgentId))
|
||||
{
|
||||
SendYouAreRestrictedNotice(clientAvatar);
|
||||
ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//when we are finally in a safe place, lets release the forced position lock
|
||||
forcedPosition.Remove(clientAvatar.ControllingClient.AgentId);
|
||||
}
|
||||
EnforceBans(parcel, clientAvatar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -665,7 +697,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
// Corner case. If an autoreturn happens during sim startup
|
||||
// we will come here with the list uninitialized
|
||||
//
|
||||
int landId = m_landIDList[x, y];
|
||||
// int landId = m_landIDList[x, y];
|
||||
|
||||
// if (landId == 0)
|
||||
// m_log.DebugFormat(
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
|
||||
public class PrimCountModule : IPrimCountModule, INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_Scene;
|
||||
private Dictionary<UUID, PrimCounts> m_PrimCounts =
|
||||
|
|
|
@ -64,8 +64,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
{
|
||||
m_pcm = new PrimCountModule();
|
||||
LandManagementModule lmm = new LandManagementModule();
|
||||
m_scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
|
||||
|
||||
int xParcelDivider = (int)Constants.RegionSize - 1;
|
||||
|
||||
|
@ -106,12 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
[Test]
|
||||
public void TestAddOwnerObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
IPrimCounts pc = m_lo.PrimCounts;
|
||||
|
||||
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||
SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||
m_scene.AddNewSceneObject(sog, false);
|
||||
|
||||
Assert.That(pc.Owner, Is.EqualTo(3));
|
||||
|
@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
Assert.That(pc.Simulator, Is.EqualTo(3));
|
||||
|
||||
// Add a second object and retest
|
||||
SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
|
||||
SceneObjectGroup sog2 = SceneHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
|
||||
m_scene.AddNewSceneObject(sog2, false);
|
||||
|
||||
Assert.That(pc.Owner, Is.EqualTo(5));
|
||||
|
@ -143,12 +143,12 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
[Test]
|
||||
public void TestCopyOwnerObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
IPrimCounts pc = m_lo.PrimCounts;
|
||||
|
||||
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||
SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||
m_scene.AddNewSceneObject(sog, false);
|
||||
m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity);
|
||||
|
||||
|
@ -169,12 +169,12 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
[Test]
|
||||
public void TestMoveOwnerObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||
SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||
m_scene.AddNewSceneObject(sog, false);
|
||||
SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
|
||||
SceneObjectGroup sog2 = SceneHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
|
||||
m_scene.AddNewSceneObject(sog2, false);
|
||||
|
||||
// Move the first scene object to the eastern strip parcel
|
||||
|
@ -230,13 +230,13 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
[Test]
|
||||
public void TestRemoveOwnerObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
IPrimCounts pc = m_lo.PrimCounts;
|
||||
|
||||
m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false);
|
||||
SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
|
||||
m_scene.AddNewSceneObject(SceneHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false);
|
||||
SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
|
||||
m_scene.AddNewSceneObject(sogToDelete, false);
|
||||
m_scene.DeleteSceneObject(sogToDelete, false);
|
||||
|
||||
|
@ -253,14 +253,14 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
[Test]
|
||||
public void TestAddGroupObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
m_lo.DeedToGroup(m_groupId);
|
||||
|
||||
IPrimCounts pc = m_lo.PrimCounts;
|
||||
|
||||
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
|
||||
SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
|
||||
sog.GroupID = m_groupId;
|
||||
m_scene.AddNewSceneObject(sog, false);
|
||||
|
||||
|
@ -284,18 +284,18 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
[Test]
|
||||
public void TestRemoveGroupObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
m_lo.DeedToGroup(m_groupId);
|
||||
|
||||
IPrimCounts pc = m_lo.PrimCounts;
|
||||
|
||||
SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1);
|
||||
SceneObjectGroup sogToKeep = SceneHelpers.CreateSceneObject(1, m_userId, "a", 0x1);
|
||||
sogToKeep.GroupID = m_groupId;
|
||||
m_scene.AddNewSceneObject(sogToKeep, false);
|
||||
|
||||
SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
|
||||
SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
|
||||
m_scene.AddNewSceneObject(sogToDelete, false);
|
||||
m_scene.DeleteSceneObject(sogToDelete, false);
|
||||
|
||||
|
@ -313,12 +313,12 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
[Test]
|
||||
public void TestAddOthersObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
IPrimCounts pc = m_lo.PrimCounts;
|
||||
|
||||
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
|
||||
SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
|
||||
m_scene.AddNewSceneObject(sog, false);
|
||||
|
||||
Assert.That(pc.Owner, Is.EqualTo(0));
|
||||
|
@ -334,13 +334,13 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
[Test]
|
||||
public void TestRemoveOthersObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
IPrimCounts pc = m_lo.PrimCounts;
|
||||
|
||||
m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false);
|
||||
SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10);
|
||||
m_scene.AddNewSceneObject(SceneHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false);
|
||||
SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10);
|
||||
m_scene.AddNewSceneObject(sogToDelete, false);
|
||||
m_scene.DeleteSceneObject(sogToDelete, false);
|
||||
|
||||
|
@ -360,10 +360,10 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
[Test]
|
||||
public void TestTaint()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
IPrimCounts pc = m_lo.PrimCounts;
|
||||
|
||||
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||
SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||
m_scene.AddNewSceneObject(sog, false);
|
||||
|
||||
m_pcm.TaintPrimCount();
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
|||
private Bitmap fetchTexture(UUID id)
|
||||
{
|
||||
AssetBase asset = m_scene.AssetService.Get(id.ToString());
|
||||
m_log.DebugFormat("Fetched texture {0}, found: {1}", id, asset != null);
|
||||
m_log.DebugFormat("[TexturedMapTileRenderer]: Fetched texture {0}, found: {1}", id, asset != null);
|
||||
if (asset == null) return null;
|
||||
|
||||
ManagedImage managedImage;
|
||||
|
|
|
@ -53,17 +53,17 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
|
|||
public void SetUp()
|
||||
{
|
||||
m_module = new MoapModule();
|
||||
m_scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(m_scene, m_module);
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, m_module);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClearMediaUrl()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene);
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
||||
MediaEntry me = new MediaEntry();
|
||||
|
||||
m_module.SetMediaEntry(part, 1, me);
|
||||
|
@ -84,11 +84,11 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
|
|||
[Test]
|
||||
public void TestSetMediaUrl()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string homeUrl = "opensimulator.org";
|
||||
|
||||
SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene);
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
||||
MediaEntry me = new MediaEntry() { HomeURL = homeUrl };
|
||||
|
||||
m_module.SetMediaEntry(part, 1, me);
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
|||
IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice)
|
||||
{
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(localID);
|
||||
if (part == null || part.ParentGroup == null)
|
||||
if (part == null)
|
||||
return;
|
||||
|
||||
if (part.ParentGroup.IsDeleted)
|
||||
|
@ -111,9 +111,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
|||
if (part == null)
|
||||
return false;
|
||||
|
||||
if (part.ParentGroup == null)
|
||||
return false;
|
||||
|
||||
SceneObjectGroup group = part.ParentGroup;
|
||||
|
||||
switch (saleType)
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
= ParseUserSetConfigSetting(myConfig, "allowed_script_editors", m_allowedScriptEditors);
|
||||
|
||||
if (m_bypassPermissions)
|
||||
m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks");
|
||||
m_log.Info("[PERMISSIONS]: serverside_object_permissions = false in ini file so disabling all region service permission checks");
|
||||
else
|
||||
m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks");
|
||||
|
||||
|
@ -1131,7 +1131,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
SceneObjectPart part = scene.GetSceneObjectPart(objectID);
|
||||
if (part.OwnerID != moverID)
|
||||
{
|
||||
if (part.ParentGroup != null && !part.ParentGroup.IsDeleted)
|
||||
if (!part.ParentGroup.IsDeleted)
|
||||
{
|
||||
if (part.ParentGroup.IsAttachment)
|
||||
return false;
|
||||
|
|
|
@ -236,14 +236,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
|
|||
public void Init()
|
||||
{
|
||||
m_serialiserModule = new SerialiserModule();
|
||||
m_scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule);
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, m_serialiserModule);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeserializeXml()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(xml);
|
||||
|
@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
|
|||
[Test]
|
||||
public void TestSerializeXml()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
string rpName = "My Little Donkey";
|
||||
|
@ -334,7 +334,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
|
|||
[Test]
|
||||
public void TestDeserializeXml2()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(xml2);
|
||||
|
@ -350,7 +350,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
|
|||
[Test]
|
||||
public void TestSerializeXml2()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
string rpName = "My Little Pony";
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
|
||||
if (grp.IsAttachment)
|
||||
{
|
||||
if (grp.GetAttachmentPoint() > 30) // HUD
|
||||
if (grp.AttachmentPoint > 30) // HUD
|
||||
{
|
||||
if (sp.ControllingClient.AgentId != grp.OwnerID)
|
||||
return;
|
||||
|
@ -115,7 +115,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
|||
{
|
||||
SceneObjectGroup grp = part.ParentGroup;
|
||||
|
||||
if (grp.IsAttachment && grp.GetAttachmentPoint() > 30)
|
||||
if (grp.IsAttachment && grp.AttachmentPoint > 30)
|
||||
{
|
||||
objectID = ownerID;
|
||||
parentID = ownerID;
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
private ITerrainChannel m_revert;
|
||||
private Scene m_scene;
|
||||
private volatile bool m_tainted;
|
||||
private readonly UndoStack<LandUndoState> m_undo = new UndoStack<LandUndoState>(5);
|
||||
private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
|
||||
|
||||
#region ICommandableModule Members
|
||||
|
||||
|
|
|
@ -100,15 +100,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
|
|||
{
|
||||
case Tree.Cypress1:
|
||||
case Tree.Cypress2:
|
||||
tree.Scale = new Vector3(4, 4, 10);
|
||||
tree.Scale *= new Vector3(8, 8, 20);
|
||||
break;
|
||||
|
||||
// case... other tree types
|
||||
// tree.Scale = new Vector3(?, ?, ?);
|
||||
// tree.Scale *= new Vector3(?, ?, ?);
|
||||
// break;
|
||||
|
||||
default:
|
||||
tree.Scale = new Vector3(4, 4, 4);
|
||||
tree.Scale *= new Vector3(8, 8, 8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,16 +96,7 @@ m_log.DebugFormat("MAP NAME=({0})", mapName);
|
|||
|
||||
// try to fetch from GridServer
|
||||
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
|
||||
if (regionInfos == null)
|
||||
{
|
||||
m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?");
|
||||
// service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region
|
||||
regionInfos = new List<GridRegion>();
|
||||
GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName);
|
||||
if (info != null)
|
||||
regionInfos.Add(info);
|
||||
}
|
||||
else if (regionInfos.Count == 0)
|
||||
if (regionInfos.Count == 0)
|
||||
remoteClient.SendAlertMessage("Hyperlink could not be established.");
|
||||
|
||||
//m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count);
|
||||
|
|
|
@ -46,6 +46,7 @@ using OpenSim.Framework.Servers;
|
|||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.CoreModules.World.Land;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
using OSDArray=OpenMetaverse.StructuredData.OSDArray;
|
||||
using OSDMap=OpenMetaverse.StructuredData.OSDMap;
|
||||
|
@ -68,6 +69,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
protected Scene m_scene;
|
||||
private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>();
|
||||
private int cachedTime = 0;
|
||||
private int blacklistTimeout = 10*60*1000; // 10 minutes
|
||||
private byte[] myMapImageJPEG;
|
||||
protected volatile bool m_Enabled = false;
|
||||
private Dictionary<UUID, MapRequestState> m_openRequests = new Dictionary<UUID, MapRequestState>();
|
||||
|
@ -85,6 +87,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
IConfig startupConfig = config.Configs["Startup"];
|
||||
if (startupConfig.GetString("WorldMapModule", "WorldMap") == "WorldMap")
|
||||
m_Enabled = true;
|
||||
|
||||
blacklistTimeout = startupConfig.GetInt("BlacklistTimeout", 10*60) * 1000;
|
||||
}
|
||||
|
||||
public virtual void AddRegion (Scene scene)
|
||||
|
@ -159,11 +163,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
m_scene.EventManager.OnClientClosed += ClientLoggedOut;
|
||||
m_scene.EventManager.OnMakeChildAgent += MakeChildAgent;
|
||||
m_scene.EventManager.OnMakeRootAgent += MakeRootAgent;
|
||||
m_scene.EventManager.OnRegionUp += OnRegionUp;
|
||||
|
||||
StartThread(new object());
|
||||
}
|
||||
|
||||
// this has to be called with a lock on m_scene
|
||||
protected virtual void RemoveHandlers()
|
||||
{
|
||||
StopThread();
|
||||
|
||||
m_scene.EventManager.OnRegionUp -= OnRegionUp;
|
||||
m_scene.EventManager.OnMakeRootAgent -= MakeRootAgent;
|
||||
m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent;
|
||||
m_scene.EventManager.OnClientClosed -= ClientLoggedOut;
|
||||
|
@ -279,7 +289,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
/// <returns></returns>
|
||||
public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
|
||||
{
|
||||
m_log.Debug("[WORLD MAP]: MapLayer Request in region: " + m_scene.RegionInfo.RegionName);
|
||||
m_log.DebugFormat("[WORLD MAP]: MapLayer Request in region: {0}", m_scene.RegionInfo.RegionName);
|
||||
LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
|
||||
mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse());
|
||||
return mapResponse;
|
||||
|
@ -321,8 +331,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
lock (m_rootAgents)
|
||||
{
|
||||
m_rootAgents.Remove(AgentId);
|
||||
if (m_rootAgents.Count == 0)
|
||||
StopThread();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -362,6 +370,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags,
|
||||
uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
|
||||
{
|
||||
// m_log.DebugFormat("[WORLD MAP]: Handle MapItem request {0} {1}", regionhandle, itemtype);
|
||||
|
||||
lock (m_rootAgents)
|
||||
{
|
||||
if (!m_rootAgents.Contains(remoteClient.AgentId))
|
||||
|
@ -370,7 +380,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
uint xstart = 0;
|
||||
uint ystart = 0;
|
||||
Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
|
||||
if (itemtype == 6) // we only sevice 6 right now (avatar green dots)
|
||||
if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots)
|
||||
{
|
||||
if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
|
@ -414,14 +424,57 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
// Remote Map Item Request
|
||||
|
||||
// ensures that the blockingqueue doesn't get borked if the GetAgents() timing changes.
|
||||
// Note that we only start up a remote mapItem Request thread if there's users who could
|
||||
// be making requests
|
||||
if (!threadrunning)
|
||||
{
|
||||
m_log.Warn("[WORLD MAP]: Starting new remote request thread manually. This means that AvatarEnteringParcel never fired! This needs to be fixed! Don't Mantis this, as the developers can see it in this message");
|
||||
StartThread(new object());
|
||||
}
|
||||
RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle);
|
||||
}
|
||||
} else if (itemtype == 7) // Service 7 (MAP_ITEM_LAND_FOR_SALE)
|
||||
{
|
||||
if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
// Parcels
|
||||
ILandChannel landChannel = m_scene.LandChannel;
|
||||
List<ILandObject> parcels = landChannel.AllParcels();
|
||||
|
||||
// Local Map Item Request
|
||||
List<mapItemReply> mapitems = new List<mapItemReply>();
|
||||
mapItemReply mapitem = new mapItemReply();
|
||||
if ((parcels != null) && (parcels.Count >= 1))
|
||||
{
|
||||
foreach (ILandObject parcel_interface in parcels)
|
||||
{
|
||||
// Play it safe
|
||||
if (!(parcel_interface is LandObject))
|
||||
continue;
|
||||
|
||||
LandObject land = (LandObject)parcel_interface;
|
||||
LandData parcel = land.LandData;
|
||||
|
||||
// Show land for sale
|
||||
if ((parcel.Flags & (uint)ParcelFlags.ForSale) == (uint)ParcelFlags.ForSale)
|
||||
{
|
||||
Vector3 min = parcel.AABBMin;
|
||||
Vector3 max = parcel.AABBMax;
|
||||
float x = (min.X+max.X)/2;
|
||||
float y = (min.Y+max.Y)/2;
|
||||
|
||||
mapitem = new mapItemReply();
|
||||
mapitem.x = (uint)(xstart + x);
|
||||
mapitem.y = (uint)(ystart + y);
|
||||
// mapitem.z = (uint)m_scene.GetGroundHeight(x,y);
|
||||
mapitem.id = UUID.Zero;
|
||||
mapitem.name = parcel.Name;
|
||||
mapitem.Extra = parcel.Area;
|
||||
mapitem.Extra2 = parcel.SalePrice;
|
||||
mapitems.Add(mapitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remote Map Item Request
|
||||
|
||||
// ensures that the blockingqueue doesn't get borked if the GetAgents() timing changes.
|
||||
RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle);
|
||||
}
|
||||
}
|
||||
|
@ -542,6 +595,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
}
|
||||
av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags);
|
||||
}
|
||||
|
||||
// Service 7 (MAP_ITEM_LAND_FOR_SALE)
|
||||
uint itemtype = 7;
|
||||
|
||||
if (response.ContainsKey(itemtype.ToString()))
|
||||
{
|
||||
List<mapItemReply> returnitems = new List<mapItemReply>();
|
||||
OSDArray itemarray = (OSDArray)response[itemtype.ToString()];
|
||||
for (int i = 0; i < itemarray.Count; i++)
|
||||
{
|
||||
OSDMap mapitem = (OSDMap)itemarray[i];
|
||||
mapItemReply mi = new mapItemReply();
|
||||
mi.x = (uint)mapitem["X"].AsInteger();
|
||||
mi.y = (uint)mapitem["Y"].AsInteger();
|
||||
mi.id = mapitem["ID"].AsUUID();
|
||||
mi.Extra = mapitem["Extra"].AsInteger();
|
||||
mi.Extra2 = mapitem["Extra2"].AsInteger();
|
||||
mi.name = mapitem["Name"].AsString();
|
||||
returnitems.Add(mi);
|
||||
}
|
||||
av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -589,12 +664,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
private OSDMap RequestMapItemsAsync(UUID id, uint flags,
|
||||
uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
|
||||
{
|
||||
// m_log.DebugFormat("[WORLDMAP]: RequestMapItemsAsync; region handle: {0} {1}", regionhandle, itemtype);
|
||||
|
||||
string httpserver = "";
|
||||
bool blacklisted = false;
|
||||
lock (m_blacklistedregions)
|
||||
{
|
||||
if (m_blacklistedregions.ContainsKey(regionhandle))
|
||||
blacklisted = true;
|
||||
{
|
||||
if (Environment.TickCount > (m_blacklistedregions[regionhandle] + blacklistTimeout))
|
||||
{
|
||||
m_log.DebugFormat("[WORLDMAP]: Unblock blacklisted region {0}", regionhandle);
|
||||
|
||||
m_blacklistedregions.Remove(regionhandle);
|
||||
}
|
||||
else
|
||||
blacklisted = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (blacklisted)
|
||||
|
@ -636,7 +722,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
lock (m_blacklistedurls)
|
||||
{
|
||||
if (m_blacklistedurls.ContainsKey(httpserver))
|
||||
blacklisted = true;
|
||||
{
|
||||
if (Environment.TickCount > (m_blacklistedurls[httpserver] + blacklistTimeout))
|
||||
{
|
||||
m_log.DebugFormat("[WORLDMAP]: Unblock blacklisted URL {0}", httpserver);
|
||||
|
||||
m_blacklistedurls.Remove(httpserver);
|
||||
}
|
||||
else
|
||||
blacklisted = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Can't find the http server
|
||||
|
@ -682,7 +777,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
mapitemsrequest.ContentLength = buffer.Length; //Count bytes to send
|
||||
os = mapitemsrequest.GetRequestStream();
|
||||
os.Write(buffer, 0, buffer.Length); //Send it
|
||||
os.Close();
|
||||
//m_log.DebugFormat("[WORLD MAP]: Getting MapItems from {0}", httpserver);
|
||||
}
|
||||
catch (WebException ex)
|
||||
|
@ -705,6 +799,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
responseMap["connect"] = OSD.FromBoolean(false);
|
||||
return responseMap;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (os != null)
|
||||
os.Close();
|
||||
}
|
||||
|
||||
string response_mapItems_reply = null;
|
||||
{ // get the response
|
||||
|
@ -1060,6 +1159,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart);
|
||||
|
||||
// Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots)
|
||||
|
||||
OSDMap responsemap = new OSDMap();
|
||||
int tc = Environment.TickCount;
|
||||
if (m_scene.GetRootAgentCount() == 0)
|
||||
|
@ -1092,6 +1193,60 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
});
|
||||
responsemap["6"] = responsearr;
|
||||
}
|
||||
|
||||
// Service 7 (MAP_ITEM_LAND_FOR_SALE)
|
||||
|
||||
ILandChannel landChannel = m_scene.LandChannel;
|
||||
List<ILandObject> parcels = landChannel.AllParcels();
|
||||
|
||||
if ((parcels == null) || (parcels.Count == 0))
|
||||
{
|
||||
OSDMap responsemapdata = new OSDMap();
|
||||
responsemapdata["X"] = OSD.FromInteger((int)(xstart + 1));
|
||||
responsemapdata["Y"] = OSD.FromInteger((int)(ystart + 1));
|
||||
responsemapdata["ID"] = OSD.FromUUID(UUID.Zero);
|
||||
responsemapdata["Name"] = OSD.FromString("");
|
||||
responsemapdata["Extra"] = OSD.FromInteger(0);
|
||||
responsemapdata["Extra2"] = OSD.FromInteger(0);
|
||||
OSDArray responsearr = new OSDArray();
|
||||
responsearr.Add(responsemapdata);
|
||||
|
||||
responsemap["7"] = responsearr;
|
||||
}
|
||||
else
|
||||
{
|
||||
OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount());
|
||||
foreach (ILandObject parcel_interface in parcels)
|
||||
{
|
||||
// Play it safe
|
||||
if (!(parcel_interface is LandObject))
|
||||
continue;
|
||||
|
||||
LandObject land = (LandObject)parcel_interface;
|
||||
LandData parcel = land.LandData;
|
||||
|
||||
// Show land for sale
|
||||
if ((parcel.Flags & (uint)ParcelFlags.ForSale) == (uint)ParcelFlags.ForSale)
|
||||
{
|
||||
Vector3 min = parcel.AABBMin;
|
||||
Vector3 max = parcel.AABBMax;
|
||||
float x = (min.X+max.X)/2;
|
||||
float y = (min.Y+max.Y)/2;
|
||||
|
||||
OSDMap responsemapdata = new OSDMap();
|
||||
responsemapdata["X"] = OSD.FromInteger((int)(xstart + x));
|
||||
responsemapdata["Y"] = OSD.FromInteger((int)(ystart + y));
|
||||
// responsemapdata["Z"] = OSD.FromInteger((int)m_scene.GetGroundHeight(x,y));
|
||||
responsemapdata["ID"] = OSD.FromUUID(UUID.Zero);
|
||||
responsemapdata["Name"] = OSD.FromString(parcel.Name);
|
||||
responsemapdata["Extra"] = OSD.FromInteger(parcel.Area);
|
||||
responsemapdata["Extra2"] = OSD.FromInteger(parcel.SalePrice);
|
||||
responsearr.Add(responsemapdata);
|
||||
}
|
||||
}
|
||||
responsemap["7"] = responsearr;
|
||||
}
|
||||
|
||||
return responsemap;
|
||||
}
|
||||
|
||||
|
@ -1110,14 +1265,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
if (data == null)
|
||||
return;
|
||||
|
||||
UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
|
||||
|
||||
m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE");
|
||||
|
||||
m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random();
|
||||
UUID terrainImageID = UUID.Random();
|
||||
|
||||
AssetBase asset = new AssetBase(
|
||||
m_scene.RegionInfo.RegionSettings.TerrainImageID,
|
||||
terrainImageID,
|
||||
"terrainImage_" + m_scene.RegionInfo.RegionID.ToString(),
|
||||
(sbyte)AssetType.Texture,
|
||||
m_scene.RegionInfo.RegionID.ToString());
|
||||
|
@ -1129,6 +1282,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
// Store the new one
|
||||
m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID);
|
||||
m_scene.AssetService.Store(asset);
|
||||
|
||||
// Switch to the new one
|
||||
UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
|
||||
m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID;
|
||||
m_scene.RegionInfo.RegionSettings.Save();
|
||||
|
||||
// Delete the old one
|
||||
|
@ -1138,12 +1295,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
private void MakeRootAgent(ScenePresence avatar)
|
||||
{
|
||||
// You may ask, why this is in a threadpool to start with..
|
||||
// The reason is so we don't cause the thread to freeze waiting
|
||||
// for the 1 second it costs to start a thread manually.
|
||||
if (!threadrunning)
|
||||
Util.FireAndForget(this.StartThread);
|
||||
|
||||
lock (m_rootAgents)
|
||||
{
|
||||
if (!m_rootAgents.Contains(avatar.UUID))
|
||||
|
@ -1158,8 +1309,30 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
lock (m_rootAgents)
|
||||
{
|
||||
m_rootAgents.Remove(avatar.UUID);
|
||||
if (m_rootAgents.Count == 0)
|
||||
StopThread();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnRegionUp(GridRegion otherRegion)
|
||||
{
|
||||
ulong regionhandle = otherRegion.RegionHandle;
|
||||
string httpserver = otherRegion.ServerURI + "MAP/MapItems/" + regionhandle.ToString();
|
||||
|
||||
lock (m_blacklistedregions)
|
||||
{
|
||||
if (!m_blacklistedregions.ContainsKey(regionhandle))
|
||||
m_blacklistedregions.Remove(regionhandle);
|
||||
}
|
||||
|
||||
lock (m_blacklistedurls)
|
||||
{
|
||||
if (m_blacklistedurls.ContainsKey(httpserver))
|
||||
m_blacklistedurls.Remove(httpserver);
|
||||
}
|
||||
|
||||
lock (m_cachedRegionMapItemsAddress)
|
||||
{
|
||||
if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))
|
||||
m_cachedRegionMapItemsAddress.Remove(regionhandle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,59 +118,56 @@ namespace OpenSim.Region.DataSnapshot.Providers
|
|||
{
|
||||
SceneObjectPart m_rootPart = obj.RootPart;
|
||||
|
||||
if (m_rootPart != null)
|
||||
ILandObject land = m_scene.LandChannel.GetLandObject(m_rootPart.AbsolutePosition.X, m_rootPart.AbsolutePosition.Y);
|
||||
|
||||
XmlNode xmlobject = nodeFactory.CreateNode(XmlNodeType.Element, "object", "");
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
|
||||
node.InnerText = obj.UUID.ToString();
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "title", "");
|
||||
node.InnerText = m_rootPart.Name;
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "description", "");
|
||||
node.InnerText = m_rootPart.Description;
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "flags", "");
|
||||
node.InnerText = String.Format("{0:x}", (uint)m_rootPart.Flags);
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "regionuuid", "");
|
||||
node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString();
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
if (land != null && land.LandData != null)
|
||||
{
|
||||
ILandObject land = m_scene.LandChannel.GetLandObject(m_rootPart.AbsolutePosition.X, m_rootPart.AbsolutePosition.Y);
|
||||
|
||||
XmlNode xmlobject = nodeFactory.CreateNode(XmlNodeType.Element, "object", "");
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
|
||||
node.InnerText = obj.UUID.ToString();
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", "");
|
||||
node.InnerText = land.LandData.GlobalID.ToString();
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "title", "");
|
||||
node.InnerText = m_rootPart.Name;
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "description", "");
|
||||
node.InnerText = m_rootPart.Description;
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "flags", "");
|
||||
node.InnerText = String.Format("{0:x}", (uint)m_rootPart.Flags);
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "regionuuid", "");
|
||||
node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString();
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
if (land != null && land.LandData != null)
|
||||
{
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", "");
|
||||
node.InnerText = land.LandData.GlobalID.ToString();
|
||||
xmlobject.AppendChild(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something is wrong with this object. Let's not list it.
|
||||
m_log.WarnFormat("[DATASNAPSHOT]: Bad data for object {0} ({1}) in region {2}", obj.Name, obj.UUID, m_scene.RegionInfo.RegionName);
|
||||
continue;
|
||||
}
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "location", "");
|
||||
Vector3 loc = obj.AbsolutePosition;
|
||||
node.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString();
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
string bestImage = GuessImage(obj);
|
||||
if (bestImage != string.Empty)
|
||||
{
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "image", "");
|
||||
node.InnerText = bestImage;
|
||||
xmlobject.AppendChild(node);
|
||||
}
|
||||
|
||||
parent.AppendChild(xmlobject);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something is wrong with this object. Let's not list it.
|
||||
m_log.WarnFormat("[DATASNAPSHOT]: Bad data for object {0} ({1}) in region {2}", obj.Name, obj.UUID, m_scene.RegionInfo.RegionName);
|
||||
continue;
|
||||
}
|
||||
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "location", "");
|
||||
Vector3 loc = obj.AbsolutePosition;
|
||||
node.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString();
|
||||
xmlobject.AppendChild(node);
|
||||
|
||||
string bestImage = GuessImage(obj);
|
||||
if (bestImage != string.Empty)
|
||||
{
|
||||
node = nodeFactory.CreateNode(XmlNodeType.Element, "image", "");
|
||||
node.InnerText = bestImage;
|
||||
xmlobject.AppendChild(node);
|
||||
}
|
||||
|
||||
parent.AppendChild(xmlobject);
|
||||
}
|
||||
#pragma warning disable 0612
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
public event DeRezObject OnDeRezObject;
|
||||
public event Action<IClientAPI> OnRegionHandShakeReply;
|
||||
public event GenericCall1 OnRequestWearables;
|
||||
public event GenericCall1 OnCompleteMovementToRegion;
|
||||
public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
|
||||
public event UpdateAgent OnPreAgentUpdate;
|
||||
public event UpdateAgent OnAgentUpdate;
|
||||
public event AgentRequestSit OnAgentRequestSit;
|
||||
|
@ -222,7 +222,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
public event ScriptReset OnScriptReset;
|
||||
public event GetScriptRunning OnGetScriptRunning;
|
||||
public event SetScriptRunning OnSetScriptRunning;
|
||||
public event UpdateVector OnAutoPilotGo;
|
||||
public event Action<Vector3, bool> OnAutoPilotGo;
|
||||
|
||||
public event TerrainUnacked OnUnackedTerrain;
|
||||
|
||||
|
@ -663,7 +663,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
|
||||
if (OnCompleteMovementToRegion != null)
|
||||
{
|
||||
OnCompleteMovementToRegion(this);
|
||||
OnCompleteMovementToRegion(this, true);
|
||||
}
|
||||
}
|
||||
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
MyNpcCharacter m_character = new MyNpcCharacter(m_scene);
|
||||
m_scene.AddNewClient(m_character);
|
||||
m_scene.AddNewClient(m_character, PresenceType.Npc);
|
||||
m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false);
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue