Merge branch 'master' into httptests
commit
9aec227767
|
@ -486,7 +486,7 @@ namespace OpenSim.Groups
|
||||||
// check permissions
|
// check permissions
|
||||||
bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
|
bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
|
||||||
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) | IsOwner(RequestingAgentID, GroupID);
|
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) | IsOwner(RequestingAgentID, GroupID);
|
||||||
if (!limited || !unlimited)
|
if (!limited && !unlimited)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
|
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -354,9 +354,9 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
byte[] data = new byte[0];
|
byte[] data = new byte[0];
|
||||||
|
|
||||||
MemoryStream imgstream = new MemoryStream();
|
MemoryStream imgstream = new MemoryStream();
|
||||||
Bitmap mTexture = new Bitmap(1, 1);
|
Bitmap mTexture = null;
|
||||||
ManagedImage managedImage;
|
ManagedImage managedImage = null;
|
||||||
Image image = (Image)mTexture;
|
Image image = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -365,25 +365,26 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
imgstream = new MemoryStream();
|
imgstream = new MemoryStream();
|
||||||
|
|
||||||
// Decode image to System.Drawing.Image
|
// Decode image to System.Drawing.Image
|
||||||
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image))
|
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
|
||||||
{
|
{
|
||||||
// Save to bitmap
|
// Save to bitmap
|
||||||
mTexture = new Bitmap(image);
|
mTexture = new Bitmap(image);
|
||||||
|
|
||||||
EncoderParameters myEncoderParameters = new EncoderParameters();
|
using(EncoderParameters myEncoderParameters = new EncoderParameters())
|
||||||
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 95L);
|
|
||||||
|
|
||||||
// Save bitmap to stream
|
|
||||||
ImageCodecInfo codec = GetEncoderInfo("image/" + format);
|
|
||||||
if (codec != null)
|
|
||||||
{
|
{
|
||||||
mTexture.Save(imgstream, codec, myEncoderParameters);
|
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality,95L);
|
||||||
// Write the stream to a byte array for output
|
|
||||||
data = imgstream.ToArray();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_log.WarnFormat("[GETTEXTURE]: No such codec {0}", format);
|
|
||||||
|
|
||||||
|
// Save bitmap to stream
|
||||||
|
ImageCodecInfo codec = GetEncoderInfo("image/" + format);
|
||||||
|
if (codec != null)
|
||||||
|
{
|
||||||
|
mTexture.Save(imgstream, codec, myEncoderParameters);
|
||||||
|
// Write the stream to a byte array for output
|
||||||
|
data = imgstream.ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_log.WarnFormat("[GETTEXTURE]: No such codec {0}", format);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -399,7 +400,9 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
|
|
||||||
if (image != null)
|
if (image != null)
|
||||||
image.Dispose();
|
image.Dispose();
|
||||||
|
|
||||||
|
if(managedImage != null)
|
||||||
|
managedImage.Clear();
|
||||||
if (imgstream != null)
|
if (imgstream != null)
|
||||||
{
|
{
|
||||||
imgstream.Close();
|
imgstream.Close();
|
||||||
|
|
|
@ -359,9 +359,9 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
byte[] data = new byte[0];
|
byte[] data = new byte[0];
|
||||||
|
|
||||||
MemoryStream imgstream = new MemoryStream();
|
MemoryStream imgstream = new MemoryStream();
|
||||||
Bitmap mTexture = new Bitmap(1, 1);
|
Bitmap mTexture = null;
|
||||||
ManagedImage managedImage;
|
ManagedImage managedImage = null;
|
||||||
Image image = (Image)mTexture;
|
Image image = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -370,25 +370,26 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
imgstream = new MemoryStream();
|
imgstream = new MemoryStream();
|
||||||
|
|
||||||
// Decode image to System.Drawing.Image
|
// Decode image to System.Drawing.Image
|
||||||
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image))
|
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
|
||||||
{
|
{
|
||||||
// Save to bitmap
|
// Save to bitmap
|
||||||
mTexture = new Bitmap(image);
|
mTexture = new Bitmap(image);
|
||||||
|
|
||||||
EncoderParameters myEncoderParameters = new EncoderParameters();
|
using(EncoderParameters myEncoderParameters = new EncoderParameters())
|
||||||
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 95L);
|
|
||||||
|
|
||||||
// Save bitmap to stream
|
|
||||||
ImageCodecInfo codec = GetEncoderInfo("image/" + format);
|
|
||||||
if (codec != null)
|
|
||||||
{
|
{
|
||||||
mTexture.Save(imgstream, codec, myEncoderParameters);
|
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality,95L);
|
||||||
// Write the stream to a byte array for output
|
|
||||||
data = imgstream.ToArray();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_log.WarnFormat("[GETTEXTURE]: No such codec {0}", format);
|
|
||||||
|
|
||||||
|
// Save bitmap to stream
|
||||||
|
ImageCodecInfo codec = GetEncoderInfo("image/" + format);
|
||||||
|
if (codec != null)
|
||||||
|
{
|
||||||
|
mTexture.Save(imgstream, codec, myEncoderParameters);
|
||||||
|
// Write the stream to a byte array for output
|
||||||
|
data = imgstream.ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_log.WarnFormat("[GETTEXTURE]: No such codec {0}", format);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -405,6 +406,9 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
if (image != null)
|
if (image != null)
|
||||||
image.Dispose();
|
image.Dispose();
|
||||||
|
|
||||||
|
if(managedImage != null)
|
||||||
|
managedImage.Clear();
|
||||||
|
|
||||||
if (imgstream != null)
|
if (imgstream != null)
|
||||||
{
|
{
|
||||||
imgstream.Close();
|
imgstream.Close();
|
||||||
|
|
|
@ -61,6 +61,9 @@ namespace OpenSim.Framework.Capabilities
|
||||||
// OpenMetaverse.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
|
// OpenMetaverse.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
|
||||||
|
|
||||||
Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
|
Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
|
||||||
|
if(hash == null)
|
||||||
|
return new byte[0];
|
||||||
|
|
||||||
TRequest llsdRequest = new TRequest();
|
TRequest llsdRequest = new TRequest();
|
||||||
LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest);
|
LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest);
|
||||||
|
|
||||||
|
|
|
@ -316,15 +316,16 @@ namespace OpenSim.Data.MySQL
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MySqlCommand cmd = conn.CreateCommand();
|
using(MySqlCommand cmd = conn.CreateCommand())
|
||||||
|
|
||||||
cmd.CommandText = String.Format("select count(*) as count from {0}", m_Table);
|
|
||||||
|
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
|
||||||
{
|
{
|
||||||
reader.Read();
|
cmd.CommandText = String.Format("select count(*) as count from {0}",m_Table);
|
||||||
|
|
||||||
count = Convert.ToInt32(reader["count"]);
|
using (IDataReader reader = cmd.ExecuteReader())
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
|
|
||||||
|
count = Convert.ToInt32(reader["count"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,15 +334,15 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public bool Delete(string id)
|
public bool Delete(string id)
|
||||||
{
|
{
|
||||||
MySqlCommand cmd = new MySqlCommand();
|
using(MySqlCommand cmd = new MySqlCommand())
|
||||||
|
{
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where id = ?id", m_Table);
|
cmd.CommandText = String.Format("delete from {0} where id = ?id",m_Table);
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?id", id);
|
cmd.Parameters.AddWithValue("?id", id);
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
cmd.Dispose();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -440,37 +440,39 @@ namespace OpenSim.Data.MySQL
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count", dbcon);
|
using(MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count",dbcon))
|
||||||
cmd.Parameters.AddWithValue("?start", start);
|
|
||||||
cmd.Parameters.AddWithValue("?count", count);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
cmd.Parameters.AddWithValue("?start",start);
|
||||||
|
cmd.Parameters.AddWithValue("?count", count);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
while (dbReader.Read())
|
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
AssetMetadata metadata = new AssetMetadata();
|
while (dbReader.Read())
|
||||||
metadata.Name = (string)dbReader["Name"];
|
{
|
||||||
metadata.Description = (string)dbReader["Description"];
|
AssetMetadata metadata = new AssetMetadata();
|
||||||
metadata.Type = (sbyte)dbReader["AssetType"];
|
metadata.Name = (string)dbReader["Name"];
|
||||||
metadata.Temporary = Convert.ToBoolean(dbReader["Temporary"]); // Not sure if this is correct.
|
metadata.Description = (string)dbReader["Description"];
|
||||||
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
|
metadata.Type = (sbyte)dbReader["AssetType"];
|
||||||
metadata.FullID = DBGuid.FromDB(dbReader["ID"]);
|
metadata.Temporary = Convert.ToBoolean(dbReader["Temporary"]); // Not sure if this is correct.
|
||||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
|
||||||
|
metadata.FullID = DBGuid.FromDB(dbReader["ID"]);
|
||||||
|
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||||
|
|
||||||
// We'll ignore this for now - it appears unused!
|
// We'll ignore this for now - it appears unused!
|
||||||
// metadata.SHA1 = dbReader["hash"]);
|
// metadata.SHA1 = dbReader["hash"]);
|
||||||
|
|
||||||
UpdateAccessTime(metadata, (int)dbReader["AccessTime"]);
|
UpdateAccessTime(metadata, (int)dbReader["AccessTime"]);
|
||||||
|
|
||||||
retList.Add(metadata);
|
retList.Add(metadata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||||
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -518,40 +518,42 @@ namespace OpenSim.Data.PGSQL
|
||||||
using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
|
using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
NpgsqlCommand cmd = new NpgsqlCommand( @"SELECT name, description, access_time, ""AssetType"", temporary, id, asset_flags, creatorid
|
using(NpgsqlCommand cmd = new NpgsqlCommand(@"SELECT name, description, access_time, ""AssetType"", temporary, id, asset_flags, creatorid
|
||||||
FROM XAssetsMeta
|
FROM XAssetsMeta
|
||||||
LIMIT :start, :count", dbcon);
|
LIMIT :start, :count",dbcon))
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("start", start));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("count", count));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
using (NpgsqlDataReader dbReader = cmd.ExecuteReader())
|
cmd.Parameters.Add(m_database.CreateParameter("start",start));
|
||||||
|
cmd.Parameters.Add(m_database.CreateParameter("count", count));
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
while (dbReader.Read())
|
using (NpgsqlDataReader dbReader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
AssetMetadata metadata = new AssetMetadata();
|
while (dbReader.Read())
|
||||||
metadata.Name = (string)dbReader["name"];
|
{
|
||||||
metadata.Description = (string)dbReader["description"];
|
AssetMetadata metadata = new AssetMetadata();
|
||||||
metadata.Type = Convert.ToSByte(dbReader["AssetType"]);
|
metadata.Name = (string)dbReader["name"];
|
||||||
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]);
|
metadata.Description = (string)dbReader["description"];
|
||||||
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
metadata.Type = Convert.ToSByte(dbReader["AssetType"]);
|
||||||
metadata.FullID = DBGuid.FromDB(dbReader["id"]);
|
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]);
|
||||||
metadata.CreatorID = dbReader["creatorid"].ToString();
|
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||||
|
metadata.FullID = DBGuid.FromDB(dbReader["id"]);
|
||||||
|
metadata.CreatorID = dbReader["creatorid"].ToString();
|
||||||
|
|
||||||
// We'll ignore this for now - it appears unused!
|
// We'll ignore this for now - it appears unused!
|
||||||
// metadata.SHA1 = dbReader["hash"]);
|
// metadata.SHA1 = dbReader["hash"]);
|
||||||
|
|
||||||
UpdateAccessTime(metadata, (int)dbReader["access_time"]);
|
UpdateAccessTime(metadata, (int)dbReader["access_time"]);
|
||||||
|
|
||||||
retList.Add(metadata);
|
retList.Add(metadata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
m_log.Error("[XASSETS DB]: PGSql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||||
m_log.Error("[XASSETS DB]: PGSql failure fetching asset set" + Environment.NewLine + e.ToString());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public delegate void ObjectExtraParams(UUID agentID, uint localID, ushort type, bool inUse, byte[] data);
|
public delegate void ObjectExtraParams(UUID agentID, uint localID, ushort type, bool inUse, byte[] data);
|
||||||
|
|
||||||
public delegate void ObjectSelect(uint localID, IClientAPI remoteClient);
|
public delegate void ObjectSelect(List<uint> localID, IClientAPI remoteClient);
|
||||||
|
|
||||||
public delegate void ObjectRequest(uint localID, IClientAPI remoteClient);
|
public delegate void ObjectRequest(uint localID, IClientAPI remoteClient);
|
||||||
|
|
||||||
|
@ -1382,6 +1382,8 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
void SendObjectPropertiesReply(ISceneEntity Entity);
|
void SendObjectPropertiesReply(ISceneEntity Entity);
|
||||||
|
|
||||||
|
void SendSelectedPartsProprieties(List<ISceneEntity> parts);
|
||||||
|
|
||||||
void SendPartPhysicsProprieties(ISceneEntity Entity);
|
void SendPartPhysicsProprieties(ISceneEntity Entity);
|
||||||
|
|
||||||
void SendAgentOffline(UUID[] agentIDs);
|
void SendAgentOffline(UUID[] agentIDs);
|
||||||
|
|
|
@ -132,8 +132,8 @@ namespace OpenSim.Framework.Monitoring
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool RegisterCheck(Check check)
|
public static bool RegisterCheck(Check check)
|
||||||
{
|
{
|
||||||
SortedDictionary<string, SortedDictionary<string, Check>> category = null, newCategory;
|
SortedDictionary<string, SortedDictionary<string, Check>> category = null;
|
||||||
SortedDictionary<string, Check> container = null, newContainer;
|
SortedDictionary<string, Check> container = null;
|
||||||
|
|
||||||
lock (RegisteredChecks)
|
lock (RegisteredChecks)
|
||||||
{
|
{
|
||||||
|
@ -146,19 +146,15 @@ namespace OpenSim.Framework.Monitoring
|
||||||
// We take a copy-on-write approach here of replacing dictionaries when keys are added or removed.
|
// We take a copy-on-write approach here of replacing dictionaries when keys are added or removed.
|
||||||
// This means that we don't need to lock or copy them on iteration, which will be a much more
|
// This means that we don't need to lock or copy them on iteration, which will be a much more
|
||||||
// common operation after startup.
|
// common operation after startup.
|
||||||
if (container != null)
|
if (container == null)
|
||||||
newContainer = new SortedDictionary<string, Check>(container);
|
container = new SortedDictionary<string, Check>();
|
||||||
else
|
|
||||||
newContainer = new SortedDictionary<string, Check>();
|
|
||||||
|
|
||||||
if (category != null)
|
if (category == null)
|
||||||
newCategory = new SortedDictionary<string, SortedDictionary<string, Check>>(category);
|
category = new SortedDictionary<string, SortedDictionary<string, Check>>();
|
||||||
else
|
|
||||||
newCategory = new SortedDictionary<string, SortedDictionary<string, Check>>();
|
|
||||||
|
|
||||||
newContainer[check.ShortName] = check;
|
container[check.ShortName] = check;
|
||||||
newCategory[check.Container] = newContainer;
|
category[check.Container] = container;
|
||||||
RegisteredChecks[check.Category] = newCategory;
|
RegisteredChecks[check.Category] = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -171,23 +167,24 @@ namespace OpenSim.Framework.Monitoring
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool DeregisterCheck(Check check)
|
public static bool DeregisterCheck(Check check)
|
||||||
{
|
{
|
||||||
SortedDictionary<string, SortedDictionary<string, Check>> category = null, newCategory;
|
SortedDictionary<string, SortedDictionary<string, Check>> category = null;
|
||||||
SortedDictionary<string, Check> container = null, newContainer;
|
SortedDictionary<string, Check> container = null;
|
||||||
|
|
||||||
lock (RegisteredChecks)
|
lock (RegisteredChecks)
|
||||||
{
|
{
|
||||||
if (!TryGetCheckParents(check, out category, out container))
|
if (!TryGetCheckParents(check, out category, out container))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
newContainer = new SortedDictionary<string, Check>(container);
|
if(container != null)
|
||||||
newContainer.Remove(check.ShortName);
|
{
|
||||||
|
container.Remove(check.ShortName);
|
||||||
newCategory = new SortedDictionary<string, SortedDictionary<string, Check>>(category);
|
if(category != null && container.Count == 0)
|
||||||
newCategory.Remove(check.Container);
|
{
|
||||||
|
category.Remove(check.Container);
|
||||||
newCategory[check.Container] = newContainer;
|
if(category.Count == 0)
|
||||||
RegisteredChecks[check.Category] = newCategory;
|
RegisteredChecks.Remove(check.Category);
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,8 +80,7 @@ namespace OpenSim.Framework.Monitoring
|
||||||
+ "'all' will show all statistics.\n"
|
+ "'all' will show all statistics.\n"
|
||||||
+ "A <category> name will show statistics from that category.\n"
|
+ "A <category> name will show statistics from that category.\n"
|
||||||
+ "A <category>.<container> name will show statistics from that category in that container.\n"
|
+ "A <category>.<container> name will show statistics from that category in that container.\n"
|
||||||
+ "More than one name can be given separated by spaces.\n"
|
+ "More than one name can be given separated by spaces.\n",
|
||||||
+ "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
|
|
||||||
HandleShowStatsCommand);
|
HandleShowStatsCommand);
|
||||||
|
|
||||||
console.Commands.AddCommand(
|
console.Commands.AddCommand(
|
||||||
|
@ -91,7 +90,6 @@ namespace OpenSim.Framework.Monitoring
|
||||||
"show stats [list|all|(<category>[.<container>])+",
|
"show stats [list|all|(<category>[.<container>])+",
|
||||||
"Alias for 'stats show' command",
|
"Alias for 'stats show' command",
|
||||||
HandleShowStatsCommand);
|
HandleShowStatsCommand);
|
||||||
|
|
||||||
StatsLogger.RegisterConsoleCommands(console);
|
StatsLogger.RegisterConsoleCommands(console);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,8 +359,8 @@ namespace OpenSim.Framework.Monitoring
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool RegisterStat(Stat stat)
|
public static bool RegisterStat(Stat stat)
|
||||||
{
|
{
|
||||||
SortedDictionary<string, SortedDictionary<string, Stat>> category = null, newCategory;
|
SortedDictionary<string, SortedDictionary<string, Stat>> category = null;
|
||||||
SortedDictionary<string, Stat> container = null, newContainer;
|
SortedDictionary<string, Stat> container = null;
|
||||||
|
|
||||||
lock (RegisteredStats)
|
lock (RegisteredStats)
|
||||||
{
|
{
|
||||||
|
@ -372,22 +370,15 @@ namespace OpenSim.Framework.Monitoring
|
||||||
if (TryGetStatParents(stat, out category, out container))
|
if (TryGetStatParents(stat, out category, out container))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// We take a copy-on-write approach here of replacing dictionaries when keys are added or removed.
|
if (container == null)
|
||||||
// This means that we don't need to lock or copy them on iteration, which will be a much more
|
container = new SortedDictionary<string, Stat>();
|
||||||
// common operation after startup.
|
|
||||||
if (container != null)
|
|
||||||
newContainer = new SortedDictionary<string, Stat>(container);
|
|
||||||
else
|
|
||||||
newContainer = new SortedDictionary<string, Stat>();
|
|
||||||
|
|
||||||
if (category != null)
|
if (category == null)
|
||||||
newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>(category);
|
category = new SortedDictionary<string, SortedDictionary<string, Stat>>();
|
||||||
else
|
|
||||||
newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>();
|
|
||||||
|
|
||||||
newContainer[stat.ShortName] = stat;
|
container[stat.ShortName] = stat;
|
||||||
newCategory[stat.Container] = newContainer;
|
category[stat.Container] = container;
|
||||||
RegisteredStats[stat.Category] = newCategory;
|
RegisteredStats[stat.Category] = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -400,23 +391,24 @@ namespace OpenSim.Framework.Monitoring
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool DeregisterStat(Stat stat)
|
public static bool DeregisterStat(Stat stat)
|
||||||
{
|
{
|
||||||
SortedDictionary<string, SortedDictionary<string, Stat>> category = null, newCategory;
|
SortedDictionary<string, SortedDictionary<string, Stat>> category = null;
|
||||||
SortedDictionary<string, Stat> container = null, newContainer;
|
SortedDictionary<string, Stat> container = null;
|
||||||
|
|
||||||
lock (RegisteredStats)
|
lock (RegisteredStats)
|
||||||
{
|
{
|
||||||
if (!TryGetStatParents(stat, out category, out container))
|
if (!TryGetStatParents(stat, out category, out container))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
newContainer = new SortedDictionary<string, Stat>(container);
|
if(container != null)
|
||||||
newContainer.Remove(stat.ShortName);
|
{
|
||||||
|
container.Remove(stat.ShortName);
|
||||||
newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>(category);
|
if(category != null && container.Count == 0)
|
||||||
newCategory.Remove(stat.Container);
|
{
|
||||||
|
category.Remove(stat.Container);
|
||||||
newCategory[stat.Container] = newContainer;
|
if(category.Count == 0)
|
||||||
RegisteredStats[stat.Category] = newCategory;
|
RegisteredStats.Remove(stat.Category);
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,18 +332,18 @@ namespace OpenSim.Framework.Monitoring
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
{
|
{
|
||||||
List<ThreadWatchdogInfo> callbackInfos = null;
|
List<ThreadWatchdogInfo> callbackInfos = null;
|
||||||
List<ThreadWatchdogInfo> threadsInfo;
|
List<ThreadWatchdogInfo> threadsToRemove = null;
|
||||||
|
|
||||||
lock (m_threads)
|
lock (m_threads)
|
||||||
{
|
{
|
||||||
// get a copy since we may change m_threads
|
foreach(ThreadWatchdogInfo threadInfo in m_threads.Values)
|
||||||
threadsInfo = m_threads.Values.ToList();
|
|
||||||
|
|
||||||
foreach(ThreadWatchdogInfo threadInfo in threadsInfo)
|
|
||||||
{
|
{
|
||||||
if(threadInfo.Thread.ThreadState == ThreadState.Stopped)
|
if(threadInfo.Thread.ThreadState == ThreadState.Stopped)
|
||||||
{
|
{
|
||||||
RemoveThread(threadInfo.Thread.ManagedThreadId);
|
if(threadsToRemove == null)
|
||||||
|
threadsToRemove = new List<ThreadWatchdogInfo>();
|
||||||
|
|
||||||
|
threadsToRemove.Add(threadInfo);
|
||||||
|
|
||||||
if(callbackInfos == null)
|
if(callbackInfos == null)
|
||||||
callbackInfos = new List<ThreadWatchdogInfo>();
|
callbackInfos = new List<ThreadWatchdogInfo>();
|
||||||
|
@ -365,6 +365,10 @@ namespace OpenSim.Framework.Monitoring
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(threadsToRemove != null)
|
||||||
|
foreach(ThreadWatchdogInfo twi in threadsToRemove)
|
||||||
|
RemoveThread(twi.Thread.ManagedThreadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(callbackInfos != null)
|
if(callbackInfos != null)
|
||||||
|
|
|
@ -461,8 +461,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
|
|
||||||
OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
|
OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
|
||||||
// resp.ReuseContext = true;
|
resp.ReuseContext = true;
|
||||||
resp.ReuseContext = false;
|
// resp.ReuseContext = false;
|
||||||
HandleRequest(req, resp);
|
HandleRequest(req, resp);
|
||||||
|
|
||||||
// !!!HACK ALERT!!!
|
// !!!HACK ALERT!!!
|
||||||
|
|
|
@ -842,7 +842,7 @@ namespace OpenSim.Framework.Servers
|
||||||
{
|
{
|
||||||
StreamReader RevisionFile = File.OpenText(svnRevisionFileName);
|
StreamReader RevisionFile = File.OpenText(svnRevisionFileName);
|
||||||
buildVersion = RevisionFile.ReadLine();
|
buildVersion = RevisionFile.ReadLine();
|
||||||
buildVersion.Trim();
|
buildVersion = buildVersion.Trim();
|
||||||
RevisionFile.Close();
|
RevisionFile.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -705,8 +705,10 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
private static byte[] ComputeSHA1Hash(byte[] src)
|
private static byte[] ComputeSHA1Hash(byte[] src)
|
||||||
{
|
{
|
||||||
SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();
|
byte[] ret;
|
||||||
return SHA1.ComputeHash(src);
|
using(SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider())
|
||||||
|
ret = SHA1.ComputeHash(src);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int fast_distance2d(int x, int y)
|
public static int fast_distance2d(int x, int y)
|
||||||
|
|
|
@ -2801,6 +2801,48 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
SendAgentGroupDataUpdate(AgentId,GroupMembership);
|
SendAgentGroupDataUpdate(AgentId,GroupMembership);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendSelectedPartsProprieties(List<ISceneEntity> parts)
|
||||||
|
{
|
||||||
|
// udp part
|
||||||
|
ObjectPropertiesPacket packet =
|
||||||
|
(ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
|
||||||
|
ObjectPropertiesPacket.ObjectDataBlock[] ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[parts.Count];
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
foreach(SceneObjectPart sop in parts)
|
||||||
|
ObjectData[i++] = CreateObjectPropertiesBlock(sop);
|
||||||
|
|
||||||
|
packet.ObjectData = ObjectData;
|
||||||
|
packet.Header.Zerocoded = true;
|
||||||
|
// udp send splits this mega packets correctly
|
||||||
|
// mb later will avoid that to reduce gc stress
|
||||||
|
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
||||||
|
|
||||||
|
// caps physics part
|
||||||
|
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
|
||||||
|
if(eq == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
OSDArray array = new OSDArray();
|
||||||
|
foreach(SceneObjectPart sop in parts)
|
||||||
|
{
|
||||||
|
OSDMap physinfo = new OSDMap(6);
|
||||||
|
physinfo["LocalID"] = sop.LocalId;
|
||||||
|
physinfo["Density"] = sop.Density;
|
||||||
|
physinfo["Friction"] = sop.Friction;
|
||||||
|
physinfo["GravityMultiplier"] = sop.GravityModifier;
|
||||||
|
physinfo["Restitution"] = sop.Restitution;
|
||||||
|
physinfo["PhysicsShapeType"] = (int)sop.PhysicsShapeType;
|
||||||
|
array.Add(physinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
OSDMap llsdBody = new OSDMap(1);
|
||||||
|
llsdBody.Add("ObjectData", array);
|
||||||
|
|
||||||
|
eq.Enqueue(BuildEvent("ObjectPhysicsProperties", llsdBody),AgentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = (SceneObjectPart)entity;
|
SceneObjectPart part = (SceneObjectPart)entity;
|
||||||
|
@ -2882,18 +2924,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
public void SendAsset(AssetRequestToClient req)
|
public void SendAsset(AssetRequestToClient req)
|
||||||
{
|
{
|
||||||
|
if (req.AssetInf == null)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset is null",
|
||||||
|
LogHeader);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (req.AssetInf.Data == null)
|
if (req.AssetInf.Data == null)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null",
|
m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null",
|
||||||
LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType);
|
LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WearableOut = 0;
|
int WearableOut = 0;
|
||||||
bool isWearable = false;
|
bool isWearable = false;
|
||||||
|
|
||||||
if (req.AssetInf != null)
|
isWearable = ((AssetType) req.AssetInf.Type ==
|
||||||
isWearable =
|
|
||||||
((AssetType) req.AssetInf.Type ==
|
|
||||||
AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing);
|
AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing);
|
||||||
|
|
||||||
|
|
||||||
|
@ -3013,7 +3061,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
reply.Data.ParcelID = parcelID;
|
reply.Data.ParcelID = parcelID;
|
||||||
reply.Data.OwnerID = land.OwnerID;
|
reply.Data.OwnerID = land.OwnerID;
|
||||||
reply.Data.Name = Utils.StringToBytes(land.Name);
|
reply.Data.Name = Utils.StringToBytes(land.Name);
|
||||||
if (land != null && land.Description != null && land.Description != String.Empty)
|
if (land.Description != null && land.Description != String.Empty)
|
||||||
reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length));
|
reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length));
|
||||||
else
|
else
|
||||||
reply.Data.Desc = new Byte[0];
|
reply.Data.Desc = new Byte[0];
|
||||||
|
@ -4221,46 +4269,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
if (!canUseImproved && !canUseCompressed)
|
if (!canUseImproved && !canUseCompressed)
|
||||||
{
|
{
|
||||||
|
ObjectUpdatePacket.ObjectDataBlock ablock;
|
||||||
if (update.Entity is ScenePresence)
|
if (update.Entity is ScenePresence)
|
||||||
{
|
ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
|
||||||
ObjectUpdatePacket.ObjectDataBlock ablock =
|
|
||||||
CreateAvatarUpdateBlock((ScenePresence)update.Entity);
|
|
||||||
objectUpdateBlocks.Value.Add(ablock);
|
|
||||||
maxUpdatesBytes -= ablock.Length;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId);
|
||||||
ObjectUpdatePacket.ObjectDataBlock ablock =
|
objectUpdateBlocks.Value.Add(ablock);
|
||||||
CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId);
|
objectUpdates.Value.Add(update);
|
||||||
objectUpdateBlocks.Value.Add(ablock);
|
maxUpdatesBytes -= ablock.Length;
|
||||||
maxUpdatesBytes -= ablock.Length;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (!canUseImproved)
|
else if (!canUseImproved)
|
||||||
{
|
{
|
||||||
ObjectUpdateCompressedPacket.ObjectDataBlock ablock =
|
ObjectUpdateCompressedPacket.ObjectDataBlock ablock =
|
||||||
CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags);
|
CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags);
|
||||||
compressedUpdateBlocks.Value.Add(ablock);
|
compressedUpdateBlocks.Value.Add(ablock);
|
||||||
|
compressedUpdates.Value.Add(update);
|
||||||
maxUpdatesBytes -= ablock.Length;
|
maxUpdatesBytes -= ablock.Length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock;
|
||||||
if (update.Entity is ScenePresence)
|
if (update.Entity is ScenePresence)
|
||||||
{
|
{
|
||||||
// ALL presence updates go into a special list
|
// ALL presence updates go into a special list
|
||||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock =
|
ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
|
||||||
CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
|
|
||||||
terseAgentUpdateBlocks.Value.Add(ablock);
|
terseAgentUpdateBlocks.Value.Add(ablock);
|
||||||
maxUpdatesBytes -= ablock.Length;
|
terseAgentUpdates.Value.Add(update);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Everything else goes here
|
// Everything else goes here
|
||||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock =
|
ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
|
||||||
CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
|
|
||||||
terseUpdateBlocks.Value.Add(ablock);
|
terseUpdateBlocks.Value.Add(ablock);
|
||||||
maxUpdatesBytes -= ablock.Length;
|
terseUpdates.Value.Add(update);
|
||||||
}
|
}
|
||||||
|
maxUpdatesBytes -= ablock.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Block Construction
|
#endregion Block Construction
|
||||||
|
@ -4290,7 +4334,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
for (int i = 0; i < blocks.Count; i++)
|
for (int i = 0; i < blocks.Count; i++)
|
||||||
packet.ObjectData[i] = blocks[i];
|
packet.ObjectData[i] = blocks[i];
|
||||||
|
|
||||||
OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
|
OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objectUpdateBlocks.IsValueCreated)
|
if (objectUpdateBlocks.IsValueCreated)
|
||||||
|
@ -4305,7 +4349,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
for (int i = 0; i < blocks.Count; i++)
|
for (int i = 0; i < blocks.Count; i++)
|
||||||
packet.ObjectData[i] = blocks[i];
|
packet.ObjectData[i] = blocks[i];
|
||||||
|
|
||||||
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compressedUpdateBlocks.IsValueCreated)
|
if (compressedUpdateBlocks.IsValueCreated)
|
||||||
|
@ -4320,7 +4364,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
for (int i = 0; i < blocks.Count; i++)
|
for (int i = 0; i < blocks.Count; i++)
|
||||||
packet.ObjectData[i] = blocks[i];
|
packet.ObjectData[i] = blocks[i];
|
||||||
|
|
||||||
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (terseUpdateBlocks.IsValueCreated)
|
if (terseUpdateBlocks.IsValueCreated)
|
||||||
|
@ -5444,22 +5488,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
Quaternion rotation;
|
Quaternion rotation;
|
||||||
byte[] textureEntry;
|
byte[] textureEntry;
|
||||||
|
|
||||||
if (entity is ScenePresence)
|
if (avatar)
|
||||||
{
|
{
|
||||||
ScenePresence presence = (ScenePresence)entity;
|
ScenePresence presence = (ScenePresence)entity;
|
||||||
|
|
||||||
position = presence.OffsetPosition;
|
position = presence.OffsetPosition;
|
||||||
|
velocity = presence.Velocity;
|
||||||
|
acceleration = Vector3.Zero;
|
||||||
rotation = presence.Rotation;
|
rotation = presence.Rotation;
|
||||||
angularVelocity = presence.AngularVelocity;
|
angularVelocity = presence.AngularVelocity;
|
||||||
rotation = presence.Rotation;
|
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name);
|
// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name);
|
||||||
|
|
||||||
attachPoint = presence.State;
|
attachPoint = presence.State;
|
||||||
collisionPlane = presence.CollisionPlane;
|
collisionPlane = presence.CollisionPlane;
|
||||||
velocity = presence.Velocity;
|
|
||||||
acceleration = Vector3.Zero;
|
|
||||||
|
|
||||||
if (sendTexture)
|
if (sendTexture)
|
||||||
{
|
{
|
||||||
|
@ -7710,20 +7753,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
List<uint> thisSelection = new List<uint>();
|
||||||
ObjectSelect handlerObjectSelect = null;
|
ObjectSelect handlerObjectSelect = null;
|
||||||
uint objID;
|
uint objID;
|
||||||
for (int i = 0; i < incomingselect.ObjectData.Length; i++)
|
handlerObjectSelect = OnObjectSelect;
|
||||||
|
if (handlerObjectSelect != null)
|
||||||
{
|
{
|
||||||
objID = incomingselect.ObjectData[i].ObjectLocalID;
|
for (int i = 0; i < incomingselect.ObjectData.Length; i++)
|
||||||
if (!SelectedObjects.Contains(objID))
|
|
||||||
SelectedObjects.Add(objID);
|
|
||||||
|
|
||||||
handlerObjectSelect = OnObjectSelect;
|
|
||||||
if (handlerObjectSelect != null)
|
|
||||||
{
|
{
|
||||||
handlerObjectSelect(objID, this);
|
objID = incomingselect.ObjectData[i].ObjectLocalID;
|
||||||
|
thisSelection.Add(objID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlerObjectSelect(thisSelection, this);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -7746,8 +7788,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
|
for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
|
||||||
{
|
{
|
||||||
objID = incomingdeselect.ObjectData[i].ObjectLocalID;
|
objID = incomingdeselect.ObjectData[i].ObjectLocalID;
|
||||||
if (SelectedObjects.Contains(objID))
|
|
||||||
SelectedObjects.Remove(objID);
|
|
||||||
|
|
||||||
handlerObjectDeselect = OnObjectDeselect;
|
handlerObjectDeselect = OnObjectDeselect;
|
||||||
if (handlerObjectDeselect != null)
|
if (handlerObjectDeselect != null)
|
||||||
|
@ -7969,6 +8009,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
touchArgs.Add(arg);
|
touchArgs.Add(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
|
handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
|
||||||
grabUpdate.ObjectData.GrabPosition, this, touchArgs);
|
grabUpdate.ObjectData.GrabPosition, this, touchArgs);
|
||||||
}
|
}
|
||||||
|
@ -12409,72 +12450,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <param name="simclient"></param>
|
/// <param name="simclient"></param>
|
||||||
/// <param name="packet"></param>
|
/// <param name="packet"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
// TODO: Convert old handler to use new method
|
|
||||||
/*
|
|
||||||
protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
|
|
||||||
{
|
|
||||||
AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
|
|
||||||
AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
|
|
||||||
|
|
||||||
if (cachedtex.AgentData.SessionID != SessionId)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: don't create new blocks if recycling an old packet
|
|
||||||
cachedresp.AgentData.AgentID = AgentId;
|
|
||||||
cachedresp.AgentData.SessionID = m_sessionId;
|
|
||||||
cachedresp.AgentData.SerialNum = m_cachedTextureSerial;
|
|
||||||
m_cachedTextureSerial++;
|
|
||||||
cachedresp.WearableData =
|
|
||||||
new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
|
|
||||||
|
|
||||||
int maxWearablesLoop = cachedtex.WearableData.Length;
|
|
||||||
if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
|
|
||||||
maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
|
|
||||||
|
|
||||||
// Find the cached baked textures for this user, if they're available
|
|
||||||
|
|
||||||
IAssetService cache = m_scene.AssetService;
|
|
||||||
IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
|
||||||
|
|
||||||
WearableCacheItem[] cacheItems = null;
|
|
||||||
|
|
||||||
if (bakedTextureModule != null && cache != null)
|
|
||||||
{
|
|
||||||
ScenePresence p = m_scene.GetScenePresence(AgentId);
|
|
||||||
if (p.Appearance != null)
|
|
||||||
{
|
|
||||||
if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
cacheItems = bakedTextureModule.Get(AgentId);
|
|
||||||
p.Appearance.WearableCacheItems = cacheItems;
|
|
||||||
p.Appearance.WearableCacheItemsDirty = false;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
cacheItems = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (p.Appearance.WearableCacheItems != null)
|
|
||||||
{
|
|
||||||
cacheItems = p.Appearance.WearableCacheItems;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest;
|
|
||||||
if (handlerCachedTextureRequest != null)
|
|
||||||
{
|
|
||||||
handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
|
protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
|
||||||
{
|
{
|
||||||
|
|
|
@ -124,20 +124,26 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
double now = Util.GetTimeStampMS();
|
double now = Util.GetTimeStampMS();
|
||||||
if(now - lastTimeTick > 1750.0)
|
if(now - lastTimeTick > 1750.0)
|
||||||
{
|
{
|
||||||
inTimeTick = true;
|
|
||||||
|
|
||||||
//don't overload busy heartbeat
|
|
||||||
WorkManager.RunInThread(
|
|
||||||
delegate
|
|
||||||
{
|
|
||||||
transfersTimeTick(now);
|
|
||||||
expireFiles(now);
|
|
||||||
|
|
||||||
|
if(Transfers.Count == 0 && NewFiles.Count == 0)
|
||||||
lastTimeTick = now;
|
lastTimeTick = now;
|
||||||
inTimeTick = false;
|
else
|
||||||
},
|
{
|
||||||
null,
|
inTimeTick = true;
|
||||||
"XferTimeTick");
|
|
||||||
|
//don't overload busy heartbeat
|
||||||
|
WorkManager.RunInThreadPool(
|
||||||
|
delegate
|
||||||
|
{
|
||||||
|
transfersTimeTick(now);
|
||||||
|
expireFiles(now);
|
||||||
|
|
||||||
|
lastTimeTick = now;
|
||||||
|
inTimeTick = false;
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
"XferTimeTick");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Monitor.Exit(timeTickLock);
|
Monitor.Exit(timeTickLock);
|
||||||
|
|
|
@ -594,8 +594,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
group.ResumeScripts();
|
group.ResumeScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
// Do this last so that event listeners have access to all the effects of the attachment
|
// Do this last so that event listeners have access to all the effects of the attachment
|
||||||
m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID);
|
// this can't be done when creating scripts:
|
||||||
|
// scripts do internal enqueue of attach event
|
||||||
|
// and not all scripts are loaded at this point
|
||||||
|
m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1053,7 +1057,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (fireDetachEvent)
|
if (fireDetachEvent)
|
||||||
{
|
{
|
||||||
m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero);
|
m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero);
|
||||||
|
|
||||||
// Allow detach event time to do some work before stopping the script
|
// Allow detach event time to do some work before stopping the script
|
||||||
Thread.Sleep(2);
|
Thread.Sleep(2);
|
||||||
}
|
}
|
||||||
|
@ -1115,13 +1118,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
|
|
||||||
SceneObjectGroup objatt;
|
SceneObjectGroup objatt;
|
||||||
|
|
||||||
|
UUID rezGroupID = sp.ControllingClient.ActiveGroupId;
|
||||||
|
|
||||||
if (itemID != UUID.Zero)
|
if (itemID != UUID.Zero)
|
||||||
objatt = m_invAccessModule.RezObject(sp.ControllingClient,
|
objatt = m_invAccessModule.RezObject(sp.ControllingClient,
|
||||||
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
|
itemID, rezGroupID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
|
||||||
false, false, sp.UUID, true);
|
false, false, sp.UUID, true);
|
||||||
else
|
else
|
||||||
objatt = m_invAccessModule.RezObject(sp.ControllingClient,
|
objatt = m_invAccessModule.RezObject(sp.ControllingClient,
|
||||||
null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
|
null, rezGroupID, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
|
||||||
false, false, sp.UUID, true);
|
false, false, sp.UUID, true);
|
||||||
|
|
||||||
if (objatt == null)
|
if (objatt == null)
|
||||||
|
@ -1318,7 +1323,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
AttachmentPt &= 0x7f;
|
AttachmentPt &= 0x7f;
|
||||||
|
|
||||||
// Calls attach with a Zero position
|
// Calls attach with a Zero position
|
||||||
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true, append))
|
SceneObjectGroup group = part.ParentGroup;
|
||||||
|
if (AttachObject(sp, group , AttachmentPt, false, true, append))
|
||||||
{
|
{
|
||||||
if (DebugLevel > 0)
|
if (DebugLevel > 0)
|
||||||
m_log.Debug(
|
m_log.Debug(
|
||||||
|
@ -1377,7 +1383,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
DetachSingleAttachmentToGround(sp, soLocalId);
|
DetachSingleAttachmentToGround(sp, soLocalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ using OpenSim.Tests.Common;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attachment tests
|
/// Attachment tests
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -804,7 +805,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSameSimulatorNeighbouringRegionsTeleportV1()
|
public void TestSameSimulatorNeighbouringRegionsTeleportV1()
|
||||||
{
|
{
|
||||||
|
@ -844,7 +845,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule());
|
sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule());
|
||||||
|
|
||||||
// FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour
|
// FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour
|
||||||
lscm.ServiceVersion = 0.1f;
|
//lscm.ServiceVersion = 0.1f;
|
||||||
|
|
||||||
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1);
|
||||||
|
|
||||||
|
@ -912,7 +913,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
// Check events
|
// Check events
|
||||||
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSameSimulatorNeighbouringRegionsTeleportV2()
|
public void TestSameSimulatorNeighbouringRegionsTeleportV2()
|
||||||
|
@ -1025,4 +1026,5 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,15 +324,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||||
if (destinationFolderID != UUID.Zero)
|
if (destinationFolderID != UUID.Zero)
|
||||||
{
|
{
|
||||||
InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId);
|
InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId);
|
||||||
if (destinationFolder == null)
|
|
||||||
{
|
|
||||||
m_log.WarnFormat(
|
|
||||||
"[INVENTORY TRANSFER]: TaskInventoryAccepted message from {0} in {1} specified folder {2} which does not exist",
|
|
||||||
client.Name, scene.Name, destinationFolderID);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IInventoryService invService = scene.InventoryService;
|
IInventoryService invService = scene.InventoryService;
|
||||||
|
|
||||||
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
|
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
|
||||||
|
|
|
@ -31,6 +31,7 @@ using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -458,36 +459,43 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
||||||
int queryclassifiedPrice, IClientAPI remoteClient)
|
int queryclassifiedPrice, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
Scene s = (Scene)remoteClient.Scene;
|
Scene s = (Scene)remoteClient.Scene;
|
||||||
IMoneyModule money = s.RequestModuleInterface<IMoneyModule>();
|
Vector3 pos = remoteClient.SceneAgent.AbsolutePosition;
|
||||||
|
ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||||
|
UUID creatorId = remoteClient.AgentId;
|
||||||
|
ScenePresence p = FindPresence(creatorId);
|
||||||
|
|
||||||
if (money != null)
|
string serverURI = string.Empty;
|
||||||
|
GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
|
||||||
|
|
||||||
|
OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}};
|
||||||
|
OSD Params = (OSD)parameters;
|
||||||
|
if (!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString()))
|
||||||
{
|
{
|
||||||
if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice))
|
remoteClient.SendAgentAlertMessage("Error fetching classifieds", false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
parameters = (OSDMap)Params;
|
||||||
|
OSDArray list = (OSDArray)parameters["result"];
|
||||||
|
bool exists = list.Cast<OSDMap>().Where(map => map.ContainsKey("classifieduuid"))
|
||||||
|
.Any(map => map["classifieduuid"].AsUUID().Equals(queryclassifiedID));
|
||||||
|
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
IMoneyModule money = s.RequestModuleInterface<IMoneyModule>();
|
||||||
|
if (money != null)
|
||||||
{
|
{
|
||||||
remoteClient.SendAgentAlertMessage("You do not have enough money to create requested classified.", false);
|
if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice))
|
||||||
return;
|
{
|
||||||
|
remoteClient.SendAgentAlertMessage("You do not have enough money to create this classified.", false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge);
|
||||||
}
|
}
|
||||||
money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UserClassifiedAdd ad = new UserClassifiedAdd();
|
UserClassifiedAdd ad = new UserClassifiedAdd();
|
||||||
|
|
||||||
Vector3 pos = remoteClient.SceneAgent.AbsolutePosition;
|
ad.ParcelName = land == null ? string.Empty : land.LandData.Name;
|
||||||
ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y);
|
|
||||||
ScenePresence p = FindPresence(remoteClient.AgentId);
|
|
||||||
|
|
||||||
string serverURI = string.Empty;
|
|
||||||
GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
|
|
||||||
|
|
||||||
if (land == null)
|
|
||||||
{
|
|
||||||
ad.ParcelName = string.Empty;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ad.ParcelName = land.LandData.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
ad.CreatorId = remoteClient.AgentId;
|
ad.CreatorId = remoteClient.AgentId;
|
||||||
ad.ClassifiedId = queryclassifiedID;
|
ad.ClassifiedId = queryclassifiedID;
|
||||||
ad.Category = Convert.ToInt32(queryCategory);
|
ad.Category = Convert.ToInt32(queryCategory);
|
||||||
|
@ -507,9 +515,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
||||||
|
|
||||||
if(!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString()))
|
if(!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString()))
|
||||||
{
|
{
|
||||||
remoteClient.SendAgentAlertMessage(
|
remoteClient.SendAgentAlertMessage("Error updating classified", false);
|
||||||
"Error updating classified", false);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -478,9 +478,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
|
m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
|
||||||
|
|
||||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||||
|
lookAt.Z = 0f;
|
||||||
|
|
||||||
|
if(Math.Abs(lookAt.X) < 0.01f && Math.Abs(lookAt.Y) < 0.01f)
|
||||||
|
{
|
||||||
|
lookAt.X = 1.0f;
|
||||||
|
lookAt.Y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
||||||
sp.TeleportFlags = (Constants.TeleportFlags)teleportFlags;
|
sp.TeleportFlags = (Constants.TeleportFlags)teleportFlags;
|
||||||
|
sp.RotateToLookAt(lookAt);
|
||||||
sp.Velocity = Vector3.Zero;
|
sp.Velocity = Vector3.Zero;
|
||||||
sp.Teleport(position);
|
sp.Teleport(position);
|
||||||
|
|
||||||
|
|
|
@ -261,64 +261,60 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
{
|
{
|
||||||
InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID);
|
InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID);
|
||||||
|
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[INVENTORY ACCESS MODULE]: Could not find item {0} for caps inventory update", itemID);
|
||||||
|
return UUID.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
if (item.Owner != remoteClient.AgentId)
|
if (item.Owner != remoteClient.AgentId)
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
|
|
||||||
if (item != null)
|
if ((InventoryType)item.InvType == InventoryType.Notecard)
|
||||||
{
|
{
|
||||||
if ((InventoryType)item.InvType == InventoryType.Notecard)
|
if (!m_Scene.Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId))
|
||||||
{
|
{
|
||||||
if (!m_Scene.Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId))
|
remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false);
|
||||||
{
|
return UUID.Zero;
|
||||||
remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false);
|
|
||||||
return UUID.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
remoteClient.SendAlertMessage("Notecard saved");
|
|
||||||
}
|
}
|
||||||
else if ((InventoryType)item.InvType == InventoryType.LSL)
|
|
||||||
{
|
|
||||||
if (!m_Scene.Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId))
|
|
||||||
{
|
|
||||||
remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false);
|
|
||||||
return UUID.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
remoteClient.SendAlertMessage("Script saved");
|
remoteClient.SendAlertMessage("Notecard saved");
|
||||||
}
|
}
|
||||||
else if ((CustomInventoryType)item.InvType == CustomInventoryType.AnimationSet)
|
else if ((InventoryType)item.InvType == InventoryType.LSL)
|
||||||
|
{
|
||||||
|
if (!m_Scene.Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId))
|
||||||
{
|
{
|
||||||
AnimationSet animSet = new AnimationSet(data);
|
remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false);
|
||||||
if (!animSet.Validate(x => {
|
return UUID.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
remoteClient.SendAlertMessage("Script saved");
|
||||||
|
}
|
||||||
|
else if ((CustomInventoryType)item.InvType == CustomInventoryType.AnimationSet)
|
||||||
|
{
|
||||||
|
AnimationSet animSet = new AnimationSet(data);
|
||||||
|
if (!animSet.Validate(x => {
|
||||||
int perms = m_Scene.InventoryService.GetAssetPermissions(remoteClient.AgentId, x);
|
int perms = m_Scene.InventoryService.GetAssetPermissions(remoteClient.AgentId, x);
|
||||||
int required = (int)(PermissionMask.Transfer | PermissionMask.Copy);
|
int required = (int)(PermissionMask.Transfer | PermissionMask.Copy);
|
||||||
if ((perms & required) != required)
|
if ((perms & required) != required)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
data = animSet.ToBytes();
|
data = animSet.ToBytes();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetBase asset =
|
|
||||||
CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString());
|
|
||||||
item.AssetID = asset.FullID;
|
|
||||||
m_Scene.AssetService.Store(asset);
|
|
||||||
|
|
||||||
m_Scene.InventoryService.UpdateItem(item);
|
|
||||||
|
|
||||||
// remoteClient.SendInventoryItemCreateUpdate(item);
|
|
||||||
return (asset.FullID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat(
|
|
||||||
"[INVENTORY ACCESS MODULE]: Could not find item {0} for caps inventory update",
|
|
||||||
itemID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return UUID.Zero;
|
AssetBase asset =
|
||||||
|
CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString());
|
||||||
|
item.AssetID = asset.FullID;
|
||||||
|
m_Scene.AssetService.Store(asset);
|
||||||
|
|
||||||
|
m_Scene.InventoryService.UpdateItem(item);
|
||||||
|
|
||||||
|
// remoteClient.SendInventoryItemCreateUpdate(item);
|
||||||
|
return (asset.FullID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset)
|
public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset)
|
||||||
|
|
|
@ -553,37 +553,44 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||||
ManagedImage managedImage;
|
ManagedImage managedImage;
|
||||||
Image image;
|
Image image;
|
||||||
|
|
||||||
if (OpenJPEG.DecodeToImage(frontImage, out managedImage, out image))
|
if (!OpenJPEG.DecodeToImage(frontImage, out managedImage, out image) || image == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
Bitmap image1 = new Bitmap(image);
|
||||||
|
image.Dispose();
|
||||||
|
|
||||||
|
if (!OpenJPEG.DecodeToImage(backImage, out managedImage, out image) || image == null)
|
||||||
{
|
{
|
||||||
Bitmap image1 = new Bitmap(image);
|
image1.Dispose();
|
||||||
|
return null;
|
||||||
if (OpenJPEG.DecodeToImage(backImage, out managedImage, out image))
|
|
||||||
{
|
|
||||||
Bitmap image2 = new Bitmap(image);
|
|
||||||
|
|
||||||
if (setNewAlpha)
|
|
||||||
SetAlpha(ref image1, newAlpha);
|
|
||||||
|
|
||||||
Bitmap joint = MergeBitMaps(image1, image2);
|
|
||||||
|
|
||||||
byte[] result = new byte[0];
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
result = OpenJPEG.EncodeFromImage(joint, true);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat(
|
|
||||||
"[DYNAMICTEXTUREMODULE]: OpenJpeg Encode Failed. Exception {0}{1}",
|
|
||||||
e.Message, e.StackTrace);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
Bitmap image2 = new Bitmap(image);
|
||||||
|
image.Dispose();
|
||||||
|
|
||||||
|
if (setNewAlpha)
|
||||||
|
SetAlpha(ref image1, newAlpha);
|
||||||
|
|
||||||
|
using(Bitmap joint = MergeBitMaps(image1, image2))
|
||||||
|
{
|
||||||
|
image1.Dispose();
|
||||||
|
image2.Dispose();
|
||||||
|
|
||||||
|
byte[] result = new byte[0];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result = OpenJPEG.EncodeFromImage(joint, true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[DYNAMICTEXTUREMODULE]: OpenJpeg Encode Failed. Exception {0}{1}",
|
||||||
|
e.Message, e.StackTrace);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bitmap MergeBitMaps(Bitmap front, Bitmap back)
|
public Bitmap MergeBitMaps(Bitmap front, Bitmap back)
|
||||||
|
@ -592,12 +599,12 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||||
Graphics jG;
|
Graphics jG;
|
||||||
|
|
||||||
joint = new Bitmap(back.Width, back.Height, PixelFormat.Format32bppArgb);
|
joint = new Bitmap(back.Width, back.Height, PixelFormat.Format32bppArgb);
|
||||||
jG = Graphics.FromImage(joint);
|
using(jG = Graphics.FromImage(joint))
|
||||||
|
{
|
||||||
jG.DrawImage(back, 0, 0, back.Width, back.Height);
|
jG.DrawImage(back, 0, 0, back.Width, back.Height);
|
||||||
jG.DrawImage(front, 0, 0, back.Width, back.Height);
|
jG.DrawImage(front, 0, 0, back.Width, back.Height);
|
||||||
|
return joint;
|
||||||
return joint;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAlpha(ref Bitmap b, byte alpha)
|
private void SetAlpha(ref Bitmap b, byte alpha)
|
||||||
|
|
|
@ -559,9 +559,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||||
return coll[0].GetHandle();
|
return coll[0].GetHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_curlisteners < m_maxlisteners)
|
lock (m_listeners)
|
||||||
{
|
{
|
||||||
lock (m_listeners)
|
if (m_curlisteners < m_maxlisteners)
|
||||||
{
|
{
|
||||||
int newHandle = GetNewHandle(itemID);
|
int newHandle = GetNewHandle(itemID);
|
||||||
|
|
||||||
|
|
|
@ -126,13 +126,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
|
||||||
|
|
||||||
public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess)
|
public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}",
|
// m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}",
|
||||||
regionHandle, m_Scenes.Count);
|
// regionHandle, m_Scenes.Count);
|
||||||
|
|
||||||
|
uint rx = 0, ry = 0;
|
||||||
|
Util.RegionHandleToWorldLoc(regionHandle, out rx, out ry);
|
||||||
|
|
||||||
foreach (Scene s in m_Scenes)
|
foreach (Scene s in m_Scenes)
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == regionHandle)
|
uint t = s.RegionInfo.WorldLocX;
|
||||||
|
if( rx < t)
|
||||||
|
continue;
|
||||||
|
t += s.RegionInfo.RegionSizeX;
|
||||||
|
if( rx >= t)
|
||||||
|
continue;
|
||||||
|
t = s.RegionInfo.WorldLocY;
|
||||||
|
if( ry < t)
|
||||||
|
continue;
|
||||||
|
t += s.RegionInfo.RegionSizeY;
|
||||||
|
if( ry < t)
|
||||||
{
|
{
|
||||||
m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from");
|
// m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from");
|
||||||
regionAccess = s.RegionInfo.AccessLevel;
|
regionAccess = s.RegionInfo.AccessLevel;
|
||||||
return s.GetLandData(x, y);
|
return s.GetLandData(x, y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,12 +367,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
if (String.IsNullOrEmpty(id))
|
if (String.IsNullOrEmpty(id))
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|
||||||
asset.ID = id;
|
if(asset.ID != id)
|
||||||
|
{
|
||||||
|
asset.ID = id;
|
||||||
|
if (m_Cache != null)
|
||||||
|
m_Cache.Cache(asset);
|
||||||
|
}
|
||||||
|
|
||||||
if (isHG && m_Cache != null)
|
return id;
|
||||||
m_Cache.Cache(asset);
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateContent(string id, byte[] data)
|
public bool UpdateContent(string id, byte[] data)
|
||||||
|
|
|
@ -121,12 +121,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
||||||
public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess)
|
public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||||
{
|
{
|
||||||
regionAccess = 2;
|
regionAccess = 2;
|
||||||
m_log.DebugFormat("[LAND CONNECTOR]: request for land data in {0} at {1}, {2}",
|
// m_log.DebugFormat("[LAND CONNECTOR]: request for land data in {0} at {1}, {2}",
|
||||||
regionHandle, x, y);
|
// regionHandle, x, y);
|
||||||
|
|
||||||
|
uint rx = 0, ry = 0;
|
||||||
|
Util.RegionHandleToWorldLoc(regionHandle, out rx, out ry);
|
||||||
|
|
||||||
foreach (Scene s in m_Scenes)
|
foreach (Scene s in m_Scenes)
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == regionHandle)
|
uint t = s.RegionInfo.WorldLocX;
|
||||||
|
if( rx < t)
|
||||||
|
continue;
|
||||||
|
t += s.RegionInfo.RegionSizeX;
|
||||||
|
if( rx >= t)
|
||||||
|
continue;
|
||||||
|
t = s.RegionInfo.WorldLocY;
|
||||||
|
if( ry < t)
|
||||||
|
continue;
|
||||||
|
t += s.RegionInfo.RegionSizeY;
|
||||||
|
if( ry < t)
|
||||||
{
|
{
|
||||||
LandData land = s.GetLandData(x, y);
|
LandData land = s.GetLandData(x, y);
|
||||||
regionAccess = s.RegionInfo.AccessLevel;
|
regionAccess = s.RegionInfo.AccessLevel;
|
||||||
|
|
|
@ -1193,6 +1193,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlFileLoaded = true;
|
ControlFileLoaded = true;
|
||||||
|
if(xtr != null)
|
||||||
|
xtr.Close();
|
||||||
|
|
||||||
return dearchivedScenes;
|
return dearchivedScenes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1229,15 +1229,24 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
}
|
}
|
||||||
terr.SaveToFile(Util.dataDir() + "/terrain.raw");
|
terr.SaveToFile(Util.dataDir() + "/terrain.raw");
|
||||||
|
|
||||||
FileStream input = new FileStream(Util.dataDir() + "/terrain.raw", FileMode.Open);
|
byte[] bdata;
|
||||||
byte[] bdata = new byte[input.Length];
|
using(FileStream input = new FileStream(Util.dataDir() + "/terrain.raw",FileMode.Open))
|
||||||
input.Read(bdata, 0, (int)input.Length);
|
{
|
||||||
|
bdata = new byte[input.Length];
|
||||||
|
input.Read(bdata, 0, (int)input.Length);
|
||||||
|
}
|
||||||
|
if(bdata == null || bdata.Length == 0)
|
||||||
|
{
|
||||||
|
remote_client.SendAlertMessage("Terrain error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
remote_client.SendAlertMessage("Terrain file written, starting download...");
|
remote_client.SendAlertMessage("Terrain file written, starting download...");
|
||||||
Scene.XferManager.AddNewFile("terrain.raw", bdata);
|
string xfername = (UUID.Random()).ToString();
|
||||||
|
Scene.XferManager.AddNewFile(xfername, bdata);
|
||||||
|
|
||||||
m_log.DebugFormat("[CLIENT]: Sending terrain for region {0} to {1}", Scene.Name, remote_client.Name);
|
m_log.DebugFormat("[CLIENT]: Sending terrain for region {0} to {1}", Scene.Name, remote_client.Name);
|
||||||
|
remote_client.SendInitiateDownload(xfername, clientFileName);
|
||||||
remote_client.SendInitiateDownload("terrain.raw", clientFileName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
|
|
||||||
Vector3 pos = part.GetWorldPosition();
|
Vector3 pos = part.GetWorldPosition();
|
||||||
|
|
||||||
// skip prim outside of retion
|
// skip prim outside of region
|
||||||
if (!m_scene.PositionIsInCurrentRegion(pos))
|
if (!m_scene.PositionIsInCurrentRegion(pos))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -406,12 +406,13 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
{
|
{
|
||||||
// Translate scale by rotation so scale is represented properly when object is rotated
|
// Translate scale by rotation so scale is represented properly when object is rotated
|
||||||
Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z);
|
Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z);
|
||||||
|
lscale *= 0.5f;
|
||||||
|
|
||||||
Vector3 scale = new Vector3();
|
Vector3 scale = new Vector3();
|
||||||
Vector3 tScale = new Vector3();
|
Vector3 tScale = new Vector3();
|
||||||
Vector3 axPos = new Vector3(pos.X, pos.Y, pos.Z);
|
Vector3 axPos = new Vector3(pos.X, pos.Y, pos.Z);
|
||||||
|
|
||||||
Quaternion llrot = part.GetWorldRotation();
|
Quaternion rot = part.GetWorldRotation();
|
||||||
Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
|
|
||||||
scale = lscale * rot;
|
scale = lscale * rot;
|
||||||
|
|
||||||
// negative scales don't work in this situation
|
// negative scales don't work in this situation
|
||||||
|
@ -470,7 +471,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
|
|
||||||
tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z);
|
tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z);
|
||||||
scale = ((tScale * rot));
|
scale = ((tScale * rot));
|
||||||
|
|
||||||
vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
|
vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
|
||||||
|
|
||||||
//vertexes[2].x = pos.X + vertexes[2].x;
|
//vertexes[2].x = pos.X + vertexes[2].x;
|
||||||
|
|
|
@ -47,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <param name="map">The terrain channel being saved</param>
|
/// <param name="map">The terrain channel being saved</param>
|
||||||
public override void SaveFile(string filename, ITerrainChannel map)
|
public override void SaveFile(string filename, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
|
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
|
||||||
|
colours.Save(filename,ImageFormat.Bmp);
|
||||||
colours.Save(filename, ImageFormat.Bmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -59,9 +58,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <param name="map">The terrain channel being saved</param>
|
/// <param name="map">The terrain channel being saved</param>
|
||||||
public override void SaveStream(Stream stream, ITerrainChannel map)
|
public override void SaveStream(Stream stream, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
|
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
|
||||||
|
colours.Save(stream,ImageFormat.Bmp);
|
||||||
colours.Save(stream, ImageFormat.Png);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
{
|
{
|
||||||
public override void SaveFile(string filename, ITerrainChannel map)
|
public override void SaveFile(string filename, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
|
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
|
||||||
|
colours.Save(filename,ImageFormat.Gif);
|
||||||
colours.Save(filename, ImageFormat.Gif);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <param name="map">The terrain channel being saved</param>
|
/// <param name="map">The terrain channel being saved</param>
|
||||||
public override void SaveStream(Stream stream, ITerrainChannel map)
|
public override void SaveStream(Stream stream, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
|
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
|
||||||
|
colours.Save(stream,ImageFormat.Gif);
|
||||||
colours.Save(stream, ImageFormat.Gif);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <returns>A terrain channel generated from the image.</returns>
|
/// <returns>A terrain channel generated from the image.</returns>
|
||||||
public virtual ITerrainChannel LoadFile(string filename)
|
public virtual ITerrainChannel LoadFile(string filename)
|
||||||
{
|
{
|
||||||
using (Bitmap b = new Bitmap(filename))
|
using(Bitmap b = new Bitmap(filename))
|
||||||
return LoadBitmap(b);
|
return LoadBitmap(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,9 +111,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <param name="map">The terrain channel being saved</param>
|
/// <param name="map">The terrain channel being saved</param>
|
||||||
public virtual void SaveFile(string filename, ITerrainChannel map)
|
public virtual void SaveFile(string filename, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
|
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
|
||||||
|
colours.Save(filename,ImageFormat.Png);
|
||||||
colours.Save(filename, ImageFormat.Png);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -123,9 +122,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <param name="map">The terrain channel being saved</param>
|
/// <param name="map">The terrain channel being saved</param>
|
||||||
public virtual void SaveStream(Stream stream, ITerrainChannel map)
|
public virtual void SaveStream(Stream stream, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
|
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
|
||||||
|
colours.Save(stream,ImageFormat.Png);
|
||||||
colours.Save(stream, ImageFormat.Png);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SaveFile(ITerrainChannel m_channel, string filename,
|
public virtual void SaveFile(ITerrainChannel m_channel, string filename,
|
||||||
|
|
|
@ -59,9 +59,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
|
|
||||||
public void SaveFile(string filename, ITerrainChannel map)
|
public void SaveFile(string filename, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateBitmapFromMap(map);
|
using(Bitmap colours = CreateBitmapFromMap(map))
|
||||||
|
colours.Save(filename,ImageFormat.Jpeg);
|
||||||
colours.Save(filename, ImageFormat.Jpeg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -71,9 +70,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <param name="map">The terrain channel being saved</param>
|
/// <param name="map">The terrain channel being saved</param>
|
||||||
public void SaveStream(Stream stream, ITerrainChannel map)
|
public void SaveStream(Stream stream, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateBitmapFromMap(map);
|
using(Bitmap colours = CreateBitmapFromMap(map))
|
||||||
|
colours.Save(stream,ImageFormat.Jpeg);
|
||||||
colours.Save(stream, ImageFormat.Jpeg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SaveFile(ITerrainChannel m_channel, string filename,
|
public virtual void SaveFile(ITerrainChannel m_channel, string filename,
|
||||||
|
|
|
@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
{
|
{
|
||||||
public override void SaveFile(string filename, ITerrainChannel map)
|
public override void SaveFile(string filename, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
|
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
|
||||||
|
colours.Save(filename,ImageFormat.Png);
|
||||||
colours.Save(filename, ImageFormat.Png);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <param name="map">The terrain channel being saved</param>
|
/// <param name="map">The terrain channel being saved</param>
|
||||||
public override void SaveStream(Stream stream, ITerrainChannel map)
|
public override void SaveStream(Stream stream, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
|
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
|
||||||
|
colours.Save(stream,ImageFormat.Png);
|
||||||
colours.Save(stream, ImageFormat.Png);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|
|
@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
{
|
{
|
||||||
public override void SaveFile(string filename, ITerrainChannel map)
|
public override void SaveFile(string filename, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
|
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
|
||||||
|
colours.Save(filename,ImageFormat.Tiff);
|
||||||
colours.Save(filename, ImageFormat.Tiff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <param name="map">The terrain channel being saved</param>
|
/// <param name="map">The terrain channel being saved</param>
|
||||||
public override void SaveStream(Stream stream, ITerrainChannel map)
|
public override void SaveStream(Stream stream, ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
|
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
|
||||||
|
colours.Save(stream,ImageFormat.Tiff);
|
||||||
colours.Save(stream, ImageFormat.Tiff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|
|
@ -963,6 +963,27 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||||
return wasLimited;
|
return wasLimited;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool EnforceEstateLimits(int startX, int startY, int endX, int endY)
|
||||||
|
{
|
||||||
|
TerrainData terrData = m_channel.GetTerrainData();
|
||||||
|
|
||||||
|
bool wasLimited = false;
|
||||||
|
for (int x = startX; x <= endX; x += Constants.TerrainPatchSize)
|
||||||
|
{
|
||||||
|
for (int y = startX; y <= endY; y += Constants.TerrainPatchSize)
|
||||||
|
{
|
||||||
|
if (terrData.IsTaintedAt(x, y, false /* clearOnTest */))
|
||||||
|
{
|
||||||
|
// If we should respect the estate settings then
|
||||||
|
// fixup and height deltas that don't respect them.
|
||||||
|
// Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values.
|
||||||
|
wasLimited |= LimitChannelChanges(terrData, x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return wasLimited;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks to see height deltas in the tainted terrain patch at xStart ,yStart
|
/// Checks to see height deltas in the tainted terrain patch at xStart ,yStart
|
||||||
/// are all within the current estate limits
|
/// are all within the current estate limits
|
||||||
|
@ -1341,7 +1362,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||||
|
|
||||||
//block changes outside estate limits
|
//block changes outside estate limits
|
||||||
if (!god)
|
if (!god)
|
||||||
EnforceEstateLimits();
|
EnforceEstateLimits(startX, endX, startY, endY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1404,7 +1425,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||||
|
|
||||||
//block changes outside estate limits
|
//block changes outside estate limits
|
||||||
if (!god)
|
if (!god)
|
||||||
EnforceEstateLimits();
|
EnforceEstateLimits(startX, endX, startY, endY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -35,7 +35,7 @@ using System.Reflection;
|
||||||
using CSJ2K;
|
using CSJ2K;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Rednettle.Warp3D;
|
using Warp3D;
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -76,11 +76,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
private bool m_texturePrims = true; // true if should texture the rendered prims
|
private bool m_texturePrims = true; // true if should texture the rendered prims
|
||||||
private float m_texturePrimSize = 48f; // size of prim before we consider texturing it
|
private float m_texturePrimSize = 48f; // size of prim before we consider texturing it
|
||||||
private bool m_renderMeshes = false; // true if to render meshes rather than just bounding boxes
|
private bool m_renderMeshes = false; // true if to render meshes rather than just bounding boxes
|
||||||
private bool m_useAntiAliasing = false; // true if to anti-alias the rendered image
|
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
private Bitmap lastImage = null;
|
// private Bitmap lastImage = null;
|
||||||
private DateTime lastImageTime = DateTime.MinValue;
|
private DateTime lastImageTime = DateTime.MinValue;
|
||||||
|
|
||||||
#region Region Module interface
|
#region Region Module interface
|
||||||
|
@ -107,10 +106,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
= Util.GetConfigVarFromSections<float>(m_config, "TexturePrimSize", configSections, m_texturePrimSize);
|
= Util.GetConfigVarFromSections<float>(m_config, "TexturePrimSize", configSections, m_texturePrimSize);
|
||||||
m_renderMeshes
|
m_renderMeshes
|
||||||
= Util.GetConfigVarFromSections<bool>(m_config, "RenderMeshes", configSections, m_renderMeshes);
|
= Util.GetConfigVarFromSections<bool>(m_config, "RenderMeshes", configSections, m_renderMeshes);
|
||||||
m_useAntiAliasing
|
}
|
||||||
= Util.GetConfigVarFromSections<bool>(m_config, "UseAntiAliasing", configSections, m_useAntiAliasing);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
|
@ -201,21 +197,14 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
int width = viewport.Width;
|
int width = viewport.Width;
|
||||||
int height = viewport.Height;
|
int height = viewport.Height;
|
||||||
|
|
||||||
if (m_useAntiAliasing)
|
|
||||||
{
|
|
||||||
width *= 2;
|
|
||||||
height *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
WarpRenderer renderer = new WarpRenderer();
|
WarpRenderer renderer = new WarpRenderer();
|
||||||
|
|
||||||
renderer.CreateScene(width, height);
|
if(!renderer.CreateScene(width, height))
|
||||||
renderer.Scene.autoCalcNormals = false;
|
return new Bitmap(width,height);
|
||||||
|
|
||||||
#region Camera
|
#region Camera
|
||||||
|
|
||||||
warp_Vector pos = ConvertVector(viewport.Position);
|
warp_Vector pos = ConvertVector(viewport.Position);
|
||||||
pos.z -= 0.001f; // Works around an issue with the Warp3D camera
|
|
||||||
warp_Vector lookat = warp_Vector.add(ConvertVector(viewport.Position), ConvertVector(viewport.LookDirection));
|
warp_Vector lookat = warp_Vector.add(ConvertVector(viewport.Position), ConvertVector(viewport.LookDirection));
|
||||||
|
|
||||||
renderer.Scene.defaultCamera.setPos(pos);
|
renderer.Scene.defaultCamera.setPos(pos);
|
||||||
|
@ -223,9 +212,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
|
|
||||||
if (viewport.Orthographic)
|
if (viewport.Orthographic)
|
||||||
{
|
{
|
||||||
renderer.Scene.defaultCamera.isOrthographic = true;
|
renderer.Scene.defaultCamera.setOrthographic(true,viewport.OrthoWindowWidth, viewport.OrthoWindowHeight);
|
||||||
renderer.Scene.defaultCamera.orthoViewWidth = viewport.OrthoWindowWidth;
|
|
||||||
renderer.Scene.defaultCamera.orthoViewHeight = viewport.OrthoWindowHeight;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -247,24 +234,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
renderer.Render();
|
renderer.Render();
|
||||||
Bitmap bitmap = renderer.Scene.getImage();
|
Bitmap bitmap = renderer.Scene.getImage();
|
||||||
|
|
||||||
if (m_useAntiAliasing)
|
renderer.Scene.destroy();
|
||||||
{
|
renderer.Reset();
|
||||||
using (Bitmap origBitmap = bitmap)
|
|
||||||
bitmap = ImageUtils.ResizeImage(origBitmap, viewport.Width, viewport.Height);
|
|
||||||
}
|
|
||||||
|
|
||||||
// XXX: It shouldn't really be necesary to force a GC here as one should occur anyway pretty shortly
|
|
||||||
// afterwards. It's generally regarded as a bad idea to manually GC. If Warp3D is using lots of memory
|
|
||||||
// then this may be some issue with the Warp3D code itself, though it's also quite possible that generating
|
|
||||||
// this map tile simply takes a lot of memory.
|
|
||||||
foreach (var o in renderer.Scene.objectData.Values)
|
|
||||||
{
|
|
||||||
warp_Object obj = (warp_Object)o;
|
|
||||||
obj.vertexData = null;
|
|
||||||
obj.triangleData = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderer.Scene.removeAllObjects();
|
|
||||||
renderer = null;
|
renderer = null;
|
||||||
viewport = null;
|
viewport = null;
|
||||||
|
|
||||||
|
@ -301,9 +272,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
|
float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
|
||||||
|
|
||||||
renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f);
|
renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f);
|
||||||
renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX / 2 - 0.5f,
|
renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX * 0.5f - 0.5f,
|
||||||
waterHeight,
|
waterHeight,
|
||||||
m_scene.RegionInfo.RegionSizeY / 2 - 0.5f);
|
m_scene.RegionInfo.RegionSizeY * 0.5f - 0.5f);
|
||||||
|
|
||||||
warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR));
|
warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR));
|
||||||
waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif
|
waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif
|
||||||
|
@ -319,53 +290,53 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
{
|
{
|
||||||
ITerrainChannel terrain = m_scene.Heightmap;
|
ITerrainChannel terrain = m_scene.Heightmap;
|
||||||
|
|
||||||
|
float regionsx = m_scene.RegionInfo.RegionSizeX;
|
||||||
|
float regionsy = m_scene.RegionInfo.RegionSizeY;
|
||||||
|
|
||||||
// 'diff' is the difference in scale between the real region size and the size of terrain we're buiding
|
// 'diff' is the difference in scale between the real region size and the size of terrain we're buiding
|
||||||
float diff = (float)m_scene.RegionInfo.RegionSizeX / 256f;
|
float diff = regionsx / 256f;
|
||||||
|
|
||||||
warp_Object obj = new warp_Object(256 * 256, 255 * 255 * 2);
|
int npointsx =(int)(regionsx / diff);
|
||||||
|
int npointsy =(int)(regionsy / diff);
|
||||||
|
|
||||||
|
float invsx = 1.0f / regionsx;
|
||||||
|
float invsy = 1.0f / (float)m_scene.RegionInfo.RegionSizeY;
|
||||||
|
|
||||||
// Create all the vertices for the terrain
|
// Create all the vertices for the terrain
|
||||||
for (float y = 0; y < m_scene.RegionInfo.RegionSizeY; y += diff)
|
warp_Object obj = new warp_Object();
|
||||||
|
for (float y = 0; y < regionsy; y += diff)
|
||||||
{
|
{
|
||||||
for (float x = 0; x < m_scene.RegionInfo.RegionSizeX; x += diff)
|
for (float x = 0; x < regionsx; x += diff)
|
||||||
{
|
{
|
||||||
warp_Vector pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]);
|
warp_Vector pos = ConvertVector(x , y , (float)terrain[(int)x, (int)y]);
|
||||||
obj.addVertex(new warp_Vertex(pos,
|
obj.addVertex(new warp_Vertex(pos, x * invsx, 1.0f - y * invsy));
|
||||||
x / (float)m_scene.RegionInfo.RegionSizeX,
|
|
||||||
(((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that we have all the vertices, make another pass and create
|
// Now that we have all the vertices, make another pass and
|
||||||
// the normals for each of the surface triangles and
|
// create the list of triangle indices.
|
||||||
// create the list of triangle indices.
|
float invdiff = 1.0f / diff;
|
||||||
for (float y = 0; y < m_scene.RegionInfo.RegionSizeY; y += diff)
|
int limx = npointsx - 1;
|
||||||
|
int limy = npointsy - 1;
|
||||||
|
for (float y = 0; y < regionsy; y += diff)
|
||||||
{
|
{
|
||||||
for (float x = 0; x < m_scene.RegionInfo.RegionSizeX; x += diff)
|
for (float x = 0; x < regionsx; x += diff)
|
||||||
{
|
{
|
||||||
float newX = x / diff;
|
float newX = x * invdiff;
|
||||||
float newY = y / diff;
|
float newY = y * invdiff;
|
||||||
if (newX < 255 && newY < 255)
|
if (newX < limx && newY < limy)
|
||||||
{
|
{
|
||||||
int v = (int)newY * 256 + (int)newX;
|
int v = (int)newY * npointsx + (int)newX;
|
||||||
|
|
||||||
// Normal for a triangle made up of three adjacent vertices
|
|
||||||
Vector3 v1 = new Vector3(newX, newY, (float)terrain[(int)x, (int)y]);
|
|
||||||
Vector3 v2 = new Vector3(newX + 1, newY, (float)terrain[(int)(x + 1), (int)y]);
|
|
||||||
Vector3 v3 = new Vector3(newX, newY + 1, (float)terrain[(int)x, ((int)(y + 1))]);
|
|
||||||
warp_Vector norm = ConvertVector(SurfaceNormal(v1, v2, v3));
|
|
||||||
norm = norm.reverse();
|
|
||||||
obj.vertex(v).n = norm;
|
|
||||||
|
|
||||||
// Make two triangles for each of the squares in the grid of vertices
|
// Make two triangles for each of the squares in the grid of vertices
|
||||||
obj.addTriangle(
|
obj.addTriangle(
|
||||||
v,
|
v,
|
||||||
v + 1,
|
v + 1,
|
||||||
v + 256);
|
v + npointsx);
|
||||||
|
|
||||||
obj.addTriangle(
|
obj.addTriangle(
|
||||||
v + 256 + 1,
|
v + npointsx + 1,
|
||||||
v + 256,
|
v + npointsx,
|
||||||
v + 1);
|
v + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -398,14 +369,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out globalX, out globalY);
|
Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out globalX, out globalY);
|
||||||
|
|
||||||
warp_Texture texture;
|
warp_Texture texture;
|
||||||
using (
|
using (Bitmap image = TerrainSplat.Splat(
|
||||||
Bitmap image
|
|
||||||
= TerrainSplat.Splat(
|
|
||||||
terrain, textureIDs, startHeights, heightRanges,
|
terrain, textureIDs, startHeights, heightRanges,
|
||||||
new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain))
|
new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain))
|
||||||
{
|
|
||||||
texture = new warp_Texture(image);
|
texture = new warp_Texture(image);
|
||||||
}
|
|
||||||
|
|
||||||
warp_Material material = new warp_Material(texture);
|
warp_Material material = new warp_Material(texture);
|
||||||
material.setReflectivity(50);
|
material.setReflectivity(50);
|
||||||
|
@ -431,11 +398,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim,
|
private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim,
|
||||||
bool useTextures)
|
bool useTextures)
|
||||||
{
|
{
|
||||||
const float MIN_SIZE = 2f;
|
const float MIN_SIZE_SQUARE = 4f;
|
||||||
|
|
||||||
if ((PCode)prim.Shape.PCode != PCode.Prim)
|
if ((PCode)prim.Shape.PCode != PCode.Prim)
|
||||||
return;
|
return;
|
||||||
if (prim.Scale.LengthSquared() < MIN_SIZE * MIN_SIZE)
|
float primScaleLenSquared = prim.Scale.LengthSquared();
|
||||||
|
|
||||||
|
if (primScaleLenSquared < MIN_SIZE_SQUARE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FacetedMesh renderMesh = null;
|
FacetedMesh renderMesh = null;
|
||||||
|
@ -459,13 +428,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
else // It's sculptie
|
else // It's sculptie
|
||||||
{
|
{
|
||||||
IJ2KDecoder imgDecoder = m_scene.RequestModuleInterface<IJ2KDecoder>();
|
IJ2KDecoder imgDecoder = m_scene.RequestModuleInterface<IJ2KDecoder>();
|
||||||
if (imgDecoder != null)
|
if(imgDecoder != null)
|
||||||
{
|
{
|
||||||
Image sculpt = imgDecoder.DecodeToImage(sculptAsset);
|
Image sculpt = imgDecoder.DecodeToImage(sculptAsset);
|
||||||
if (sculpt != null)
|
if(sculpt != null)
|
||||||
{
|
{
|
||||||
renderMesh = m_primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt,
|
renderMesh = m_primMesher.GenerateFacetedSculptMesh(omvPrim,(Bitmap)sculpt,
|
||||||
DetailLevel.Medium);
|
DetailLevel.Medium);
|
||||||
sculpt.Dispose();
|
sculpt.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -483,20 +452,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
if (renderMesh == null)
|
if (renderMesh == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
warp_Vector primPos = ConvertVector(prim.GetWorldPosition());
|
|
||||||
warp_Quaternion primRot = ConvertQuaternion(prim.RotationOffset);
|
|
||||||
|
|
||||||
warp_Matrix m = warp_Matrix.quaternionMatrix(primRot);
|
|
||||||
|
|
||||||
if (prim.ParentID != 0)
|
|
||||||
{
|
|
||||||
SceneObjectGroup group = m_scene.SceneGraph.GetGroupByPrim(prim.LocalId);
|
|
||||||
if (group != null)
|
|
||||||
m.transform(warp_Matrix.quaternionMatrix(ConvertQuaternion(group.RootPart.RotationOffset)));
|
|
||||||
}
|
|
||||||
|
|
||||||
warp_Vector primScale = ConvertVector(prim.Scale);
|
|
||||||
|
|
||||||
string primID = prim.UUID.ToString();
|
string primID = prim.UUID.ToString();
|
||||||
|
|
||||||
// Create the prim faces
|
// Create the prim faces
|
||||||
|
@ -504,27 +459,18 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
for (int i = 0; i < renderMesh.Faces.Count; i++)
|
for (int i = 0; i < renderMesh.Faces.Count; i++)
|
||||||
{
|
{
|
||||||
Face face = renderMesh.Faces[i];
|
Face face = renderMesh.Faces[i];
|
||||||
string meshName = primID + "-Face-" + i.ToString();
|
string meshName = primID + i.ToString();
|
||||||
|
|
||||||
// Avoid adding duplicate meshes to the scene
|
// Avoid adding duplicate meshes to the scene
|
||||||
if (renderer.Scene.objectData.ContainsKey(meshName))
|
if (renderer.Scene.objectData.ContainsKey(meshName))
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
warp_Object faceObj = new warp_Object(face.Vertices.Count, face.Indices.Count / 3);
|
|
||||||
|
|
||||||
|
warp_Object faceObj = new warp_Object();
|
||||||
for (int j = 0; j < face.Vertices.Count; j++)
|
for (int j = 0; j < face.Vertices.Count; j++)
|
||||||
{
|
{
|
||||||
Vertex v = face.Vertices[j];
|
Vertex v = face.Vertices[j];
|
||||||
|
|
||||||
warp_Vector pos = ConvertVector(v.Position);
|
warp_Vector pos = ConvertVector(v.Position);
|
||||||
warp_Vector norm = ConvertVector(v.Normal);
|
warp_Vertex vert = new warp_Vertex(pos, v.TexCoord.X, v.TexCoord.Y);
|
||||||
|
|
||||||
if (prim.Shape.SculptTexture == UUID.Zero)
|
|
||||||
norm = norm.reverse();
|
|
||||||
warp_Vertex vert = new warp_Vertex(pos, norm, v.TexCoord.X, v.TexCoord.Y);
|
|
||||||
|
|
||||||
faceObj.addVertex(vert);
|
faceObj.addVertex(vert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,17 +485,19 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
Primitive.TextureEntryFace teFace = prim.Shape.Textures.GetFace((uint)i);
|
Primitive.TextureEntryFace teFace = prim.Shape.Textures.GetFace((uint)i);
|
||||||
Color4 faceColor = GetFaceColor(teFace);
|
Color4 faceColor = GetFaceColor(teFace);
|
||||||
string materialName = String.Empty;
|
string materialName = String.Empty;
|
||||||
if (m_texturePrims && prim.Scale.LengthSquared() > m_texturePrimSize*m_texturePrimSize)
|
if (m_texturePrims && primScaleLenSquared > m_texturePrimSize*m_texturePrimSize)
|
||||||
materialName = GetOrCreateMaterial(renderer, faceColor, teFace.TextureID);
|
materialName = GetOrCreateMaterial(renderer, faceColor, teFace.TextureID);
|
||||||
else
|
else
|
||||||
materialName = GetOrCreateMaterial(renderer, faceColor);
|
materialName = GetOrCreateMaterial(renderer, faceColor);
|
||||||
|
|
||||||
|
warp_Vector primPos = ConvertVector(prim.GetWorldPosition());
|
||||||
|
warp_Quaternion primRot = ConvertQuaternion(prim.GetWorldRotation());
|
||||||
|
warp_Matrix m = warp_Matrix.quaternionMatrix(primRot);
|
||||||
faceObj.transform(m);
|
faceObj.transform(m);
|
||||||
faceObj.setPos(primPos);
|
faceObj.setPos(primPos);
|
||||||
faceObj.scaleSelf(primScale.x, primScale.y, primScale.z);
|
faceObj.scaleSelf(prim.Scale.X, prim.Scale.Z, prim.Scale.Y);
|
||||||
|
|
||||||
renderer.Scene.addObject(meshName, faceObj);
|
renderer.Scene.addObject(meshName, faceObj);
|
||||||
|
|
||||||
renderer.SetObjectMaterial(meshName, materialName);
|
renderer.SetObjectMaterial(meshName, materialName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1428,6 +1428,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
|
|
||||||
mapTexture.Save(exportPath, ImageFormat.Jpeg);
|
mapTexture.Save(exportPath, ImageFormat.Jpeg);
|
||||||
|
|
||||||
|
g.Dispose();
|
||||||
|
mapTexture.Dispose();
|
||||||
|
sea.Dispose();
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[WORLD MAP]: Successfully exported world map for {0} to {1}",
|
"[WORLD MAP]: Successfully exported world map for {0} to {1}",
|
||||||
m_scene.RegionInfo.RegionName, exportPath);
|
m_scene.RegionInfo.RegionName, exportPath);
|
||||||
|
@ -1613,9 +1617,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
int mb = bx;
|
int mb = bx;
|
||||||
if(mb < by)
|
if(mb < by)
|
||||||
mb = by;
|
mb = by;
|
||||||
if(mb > 2 * Constants.RegionSize && mb > 0)
|
if(mb > Constants.RegionSize && mb > 0)
|
||||||
{
|
{
|
||||||
float scale = 2.0f * (float)Constants.RegionSize/(float)mb;
|
float scale = (float)Constants.RegionSize/(float)mb;
|
||||||
Size newsize = new Size();
|
Size newsize = new Size();
|
||||||
newsize.Width = (int)(bx * scale);
|
newsize.Width = (int)(bx * scale);
|
||||||
newsize.Height = (int)(by * scale);
|
newsize.Height = (int)(by * scale);
|
||||||
|
|
|
@ -52,6 +52,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private object MAOLock = new object();
|
||||||
private Dictionary<string, UUID> m_overrides = new Dictionary<string, UUID>();
|
private Dictionary<string, UUID> m_overrides = new Dictionary<string, UUID>();
|
||||||
public void SetOverride(string state, UUID animID)
|
public void SetOverride(string state, UUID animID)
|
||||||
{
|
{
|
||||||
|
@ -66,13 +67,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_log.DebugFormat("Setting override for {0} to {1}", state, animID);
|
m_log.DebugFormat("Setting override for {0} to {1}", state, animID);
|
||||||
|
|
||||||
lock (m_overrides)
|
lock (MAOLock)
|
||||||
m_overrides[state] = animID;
|
m_overrides[state] = animID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID GetOverriddenAnimation(string state)
|
public UUID GetOverriddenAnimation(string state)
|
||||||
{
|
{
|
||||||
lock (m_overrides)
|
lock (MAOLock)
|
||||||
{
|
{
|
||||||
if (m_overrides.ContainsKey(state))
|
if (m_overrides.ContainsKey(state))
|
||||||
return m_overrides[state];
|
return m_overrides[state];
|
||||||
|
@ -83,7 +84,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public Dictionary<string, UUID> CloneAOPairs()
|
public Dictionary<string, UUID> CloneAOPairs()
|
||||||
{
|
{
|
||||||
lock (m_overrides)
|
lock (MAOLock)
|
||||||
{
|
{
|
||||||
return new Dictionary<string, UUID>(m_overrides);
|
return new Dictionary<string, UUID>(m_overrides);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +92,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void CopyAOPairsFrom(Dictionary<string, UUID> src)
|
public void CopyAOPairsFrom(Dictionary<string, UUID> src)
|
||||||
{
|
{
|
||||||
lock (m_overrides)
|
lock (MAOLock)
|
||||||
{
|
{
|
||||||
m_overrides.Clear();
|
m_overrides.Clear();
|
||||||
m_overrides = new Dictionary<string, UUID>(src);
|
m_overrides = new Dictionary<string, UUID>(src);
|
||||||
|
|
|
@ -128,20 +128,29 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (part.CollisionSoundType < 0)
|
if (part.CollisionSoundType < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float volume = 0.0f;
|
float volume = part.CollisionSoundVolume;
|
||||||
bool HaveSound = false;
|
|
||||||
|
|
||||||
UUID soundID = part.CollisionSound;
|
UUID soundID = part.CollisionSound;
|
||||||
|
|
||||||
if (part.CollisionSoundType > 0)
|
bool HaveSound = false;
|
||||||
|
switch (part.CollisionSoundType)
|
||||||
{
|
{
|
||||||
// soundID = part.CollisionSound;
|
case 0: // default sounds
|
||||||
volume = part.CollisionSoundVolume;
|
volume = 1.0f;
|
||||||
if (volume == 0.0f)
|
break;
|
||||||
return;
|
case 1: // selected sound
|
||||||
HaveSound = true;
|
if(soundID == part.invalidCollisionSoundUUID)
|
||||||
|
return;
|
||||||
|
HaveSound = true;
|
||||||
|
break;
|
||||||
|
case 2: // default sounds with volume set by script
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (volume == 0.0f)
|
||||||
|
return;
|
||||||
|
|
||||||
bool doneownsound = false;
|
bool doneownsound = false;
|
||||||
|
|
||||||
int thisMaterial = (int)part.Material;
|
int thisMaterial = (int)part.Material;
|
||||||
|
@ -152,7 +161,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
CollisionForSoundInfo colInfo;
|
CollisionForSoundInfo colInfo;
|
||||||
uint id;
|
uint id;
|
||||||
|
|
||||||
for(int i = 0; i< collidersinfolist.Count; i++)
|
for(int i = 0; i < collidersinfolist.Count; i++)
|
||||||
{
|
{
|
||||||
colInfo = collidersinfolist[i];
|
colInfo = collidersinfolist[i];
|
||||||
|
|
||||||
|
@ -163,15 +172,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (!HaveSound)
|
if (!HaveSound)
|
||||||
{
|
{
|
||||||
volume = Math.Abs(colInfo.relativeVel);
|
float vol = Math.Abs(colInfo.relativeVel);
|
||||||
if (volume < 0.2f)
|
if (vol < 0.2f)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
volume *= volume * .0625f; // 4m/s == full volume
|
vol *= vol * .0625f; // 4m/s == full volume
|
||||||
if (volume > 1.0f)
|
if (vol > 1.0f)
|
||||||
volume = 1.0f;
|
vol = 1.0f;
|
||||||
|
|
||||||
soundID = m_TerrainPart[thisMaterial];
|
soundID = m_TerrainPart[thisMaterial];
|
||||||
|
volume *= vol;
|
||||||
}
|
}
|
||||||
part.SendCollisionSound(soundID, volume, colInfo.position);
|
part.SendCollisionSound(soundID, volume, colInfo.position);
|
||||||
doneownsound = true;
|
doneownsound = true;
|
||||||
|
@ -187,7 +197,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (!HaveSound)
|
if (!HaveSound)
|
||||||
{
|
{
|
||||||
if (otherPart.CollisionSoundType > 0)
|
if (otherPart.CollisionSoundType == 1)
|
||||||
{
|
{
|
||||||
soundID = otherPart.CollisionSound;
|
soundID = otherPart.CollisionSound;
|
||||||
volume = otherPart.CollisionSoundVolume;
|
volume = otherPart.CollisionSoundVolume;
|
||||||
|
@ -196,19 +206,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
volume = Math.Abs(colInfo.relativeVel);
|
if (otherPart.CollisionSoundType == 2)
|
||||||
if (volume < 0.2f)
|
{
|
||||||
|
volume = otherPart.CollisionSoundVolume;
|
||||||
|
if (volume == 0.0f)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
float vol = Math.Abs(colInfo.relativeVel);
|
||||||
|
if (vol < 0.2f)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
volume *= volume * .0625f; // 4m/s == full volume
|
vol *= vol * .0625f; // 4m/s == full volume
|
||||||
if (volume > 1.0f)
|
if (vol > 1.0f)
|
||||||
volume = 1.0f;
|
vol = 1.0f;
|
||||||
|
|
||||||
int otherMaterial = (int)otherPart.Material;
|
int otherMaterial = (int)otherPart.Material;
|
||||||
if (otherMaterial >= MaxMaterials)
|
if (otherMaterial >= MaxMaterials)
|
||||||
otherMaterial = 3;
|
otherMaterial = 3;
|
||||||
|
|
||||||
soundID = m_PartPart[thisMatScaled + otherMaterial];
|
soundID = m_PartPart[thisMatScaled + otherMaterial];
|
||||||
|
volume *= vol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,10 +279,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (otherPart.CollisionSoundType < 0)
|
if (otherPart.CollisionSoundType < 0)
|
||||||
continue;
|
continue;
|
||||||
if (otherPart.CollisionSoundType > 0 && otherPart.CollisionSoundVolume > 0f)
|
if (otherPart.CollisionSoundType == 1 && otherPart.CollisionSoundVolume > 0f)
|
||||||
otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position);
|
otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
float volmod = 1.0f;
|
||||||
|
if (otherPart.CollisionSoundType == 2)
|
||||||
|
{
|
||||||
|
volmod = otherPart.CollisionSoundVolume;
|
||||||
|
if(volmod == 0.0)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
volume = Math.Abs(colInfo.relativeVel);
|
volume = Math.Abs(colInfo.relativeVel);
|
||||||
// Most noral collisions (running into walls, stairs)
|
// Most noral collisions (running into walls, stairs)
|
||||||
// should never be heard.
|
// should never be heard.
|
||||||
|
@ -281,6 +306,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (otherMaterial >= MaxMaterials)
|
if (otherMaterial >= MaxMaterials)
|
||||||
otherMaterial = 3;
|
otherMaterial = 3;
|
||||||
|
|
||||||
|
volume *= volmod;
|
||||||
soundID = m_PartPart[thisMatScaled + otherMaterial];
|
soundID = m_PartPart[thisMatScaled + otherMaterial];
|
||||||
otherPart.SendCollisionSound(soundID, volume, colInfo.position);
|
otherPart.SendCollisionSound(soundID, volume, colInfo.position);
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,6 +406,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ph.SetVehicle(vd);
|
ph.SetVehicle(vd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CameraDecoupled
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if((vd.m_flags & VehicleFlag.CAMERA_DECOUPLED) != 0)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private XmlTextWriter writer;
|
private XmlTextWriter writer;
|
||||||
|
|
||||||
private void XWint(string name, int i)
|
private void XWint(string name, int i)
|
||||||
|
|
|
@ -164,55 +164,39 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="primLocalID"></param>
|
/// <param name="primLocalID"></param>
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
|
public void SelectPrim(List<uint> primIDs, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
/*
|
List<ISceneEntity> needUpdates = new List<ISceneEntity>();
|
||||||
SceneObjectPart part = GetSceneObjectPart(primLocalID);
|
|
||||||
|
|
||||||
if (null == part)
|
foreach(uint primLocalID in primIDs)
|
||||||
return;
|
|
||||||
|
|
||||||
if (part.IsRoot)
|
|
||||||
{
|
|
||||||
SceneObjectGroup sog = part.ParentGroup;
|
|
||||||
sog.SendPropertiesToClient(remoteClient);
|
|
||||||
|
|
||||||
// A prim is only tainted if it's allowed to be edited by the person clicking it.
|
|
||||||
if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
|
|
||||||
|| Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
|
|
||||||
{
|
|
||||||
sog.IsSelected = true;
|
|
||||||
EventManager.TriggerParcelPrimCountTainted();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
part.SendPropertiesToClient(remoteClient);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
SceneObjectPart part = GetSceneObjectPart(primLocalID);
|
|
||||||
|
|
||||||
if (null == part)
|
|
||||||
return;
|
|
||||||
|
|
||||||
SceneObjectGroup sog = part.ParentGroup;
|
|
||||||
if (sog == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
part.SendPropertiesToClient(remoteClient);
|
|
||||||
|
|
||||||
// waste of time because properties do not send prim flags as they should
|
|
||||||
// if a friend got or lost edit rights after login, a full update is needed
|
|
||||||
if(sog.OwnerID != remoteClient.AgentId)
|
|
||||||
part.SendFullUpdate(remoteClient);
|
|
||||||
|
|
||||||
// A prim is only tainted if it's allowed to be edited by the person clicking it.
|
|
||||||
if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
|
|
||||||
|| Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
|
|
||||||
{
|
{
|
||||||
part.IsSelected = true;
|
SceneObjectPart part = GetSceneObjectPart(primLocalID);
|
||||||
EventManager.TriggerParcelPrimCountTainted();
|
|
||||||
|
if (part == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
SceneObjectGroup sog = part.ParentGroup;
|
||||||
|
if (sog == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
needUpdates.Add((ISceneEntity)part);
|
||||||
|
|
||||||
|
// waste of time because properties do not send prim flags as they should
|
||||||
|
// if a friend got or lost edit rights after login, a full update is needed
|
||||||
|
if(sog.OwnerID != remoteClient.AgentId)
|
||||||
|
part.SendFullUpdate(remoteClient);
|
||||||
|
|
||||||
|
// A prim is only tainted if it's allowed to be edited by the person clicking it.
|
||||||
|
if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
|
||||||
|
|| Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
|
||||||
|
{
|
||||||
|
part.IsSelected = true;
|
||||||
|
EventManager.TriggerParcelPrimCountTainted();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(needUpdates.Count > 0)
|
||||||
|
remoteClient.SendSelectedPartsProprieties(needUpdates);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -377,8 +361,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (part == null)
|
if (part == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SceneObjectGroup obj = part.ParentGroup;
|
SceneObjectGroup group = part.ParentGroup;
|
||||||
|
if(group == null || group.IsDeleted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
|
||||||
|
{
|
||||||
|
group.GrabMovement(objectID, offset, pos, remoteClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is outside the above permissions condition
|
||||||
|
// so that if the object is locked the client moving the object
|
||||||
|
// get's it's position on the simulator even if it was the same as before
|
||||||
|
// This keeps the moving user's client in sync with the rest of the world.
|
||||||
|
group.SendGroupTerseUpdate();
|
||||||
|
|
||||||
SurfaceTouchEventArgs surfaceArg = null;
|
SurfaceTouchEventArgs surfaceArg = null;
|
||||||
if (surfaceArgs != null && surfaceArgs.Count > 0)
|
if (surfaceArgs != null && surfaceArgs.Count > 0)
|
||||||
surfaceArg = surfaceArgs[0];
|
surfaceArg = surfaceArgs[0];
|
||||||
|
@ -391,9 +388,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// or if we're meant to pass on touches anyway. Don't send to root prim
|
// or if we're meant to pass on touches anyway. Don't send to root prim
|
||||||
// if prim touched is the root prim as we just did it
|
// if prim touched is the root prim as we just did it
|
||||||
if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
|
if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
|
||||||
(part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
|
(part.PassTouches && (part.LocalId != group.RootPart.LocalId)))
|
||||||
{
|
{
|
||||||
EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
|
EventManager.TriggerObjectGrabbing(group.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2780,13 +2780,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
group.StopScriptInstances();
|
group.StopScriptInstances();
|
||||||
|
|
||||||
List<ScenePresence> avatars = group.GetSittingAvatars();
|
|
||||||
foreach (ScenePresence av in avatars)
|
|
||||||
{
|
|
||||||
if(av.ParentUUID == UUID.Zero)
|
|
||||||
av.StandUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
SceneObjectPart[] partList = group.Parts;
|
SceneObjectPart[] partList = group.Parts;
|
||||||
|
|
||||||
foreach (SceneObjectPart part in partList)
|
foreach (SceneObjectPart part in partList)
|
||||||
|
@ -3336,7 +3329,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
client.OnObjectRequest += RequestPrim;
|
client.OnObjectRequest += RequestPrim;
|
||||||
client.OnObjectSelect += SelectPrim;
|
client.OnObjectSelect += SelectPrim;
|
||||||
client.OnObjectDeselect += DeselectPrim;
|
client.OnObjectDeselect += DeselectPrim;
|
||||||
client.OnGrabUpdate += m_sceneGraph.MoveObject;
|
|
||||||
client.OnSpinStart += m_sceneGraph.SpinStart;
|
client.OnSpinStart += m_sceneGraph.SpinStart;
|
||||||
client.OnSpinUpdate += m_sceneGraph.SpinObject;
|
client.OnSpinUpdate += m_sceneGraph.SpinObject;
|
||||||
client.OnDeRezObject += DeRezObjects;
|
client.OnDeRezObject += DeRezObjects;
|
||||||
|
@ -3464,7 +3456,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
client.OnObjectRequest -= RequestPrim;
|
client.OnObjectRequest -= RequestPrim;
|
||||||
client.OnObjectSelect -= SelectPrim;
|
client.OnObjectSelect -= SelectPrim;
|
||||||
client.OnObjectDeselect -= DeselectPrim;
|
client.OnObjectDeselect -= DeselectPrim;
|
||||||
client.OnGrabUpdate -= m_sceneGraph.MoveObject;
|
|
||||||
client.OnSpinStart -= m_sceneGraph.SpinStart;
|
client.OnSpinStart -= m_sceneGraph.SpinStart;
|
||||||
client.OnSpinUpdate -= m_sceneGraph.SpinObject;
|
client.OnSpinUpdate -= m_sceneGraph.SpinObject;
|
||||||
client.OnDeRezObject -= DeRezObjects;
|
client.OnDeRezObject -= DeRezObjects;
|
||||||
|
@ -3479,6 +3470,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily;
|
client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily;
|
||||||
client.OnObjectPermissions -= HandleObjectPermissionsUpdate;
|
client.OnObjectPermissions -= HandleObjectPermissionsUpdate;
|
||||||
client.OnGrabObject -= ProcessObjectGrab;
|
client.OnGrabObject -= ProcessObjectGrab;
|
||||||
|
client.OnGrabUpdate -= ProcessObjectGrabUpdate;
|
||||||
client.OnDeGrabObject -= ProcessObjectDeGrab;
|
client.OnDeGrabObject -= ProcessObjectDeGrab;
|
||||||
client.OnUndo -= m_sceneGraph.HandleUndo;
|
client.OnUndo -= m_sceneGraph.HandleUndo;
|
||||||
client.OnRedo -= m_sceneGraph.HandleRedo;
|
client.OnRedo -= m_sceneGraph.HandleRedo;
|
||||||
|
@ -5036,7 +5028,7 @@ Label_GroupsDone:
|
||||||
|
|
||||||
public LandData GetLandData(uint x, uint y)
|
public LandData GetLandData(uint x, uint y)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y);
|
// m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y);
|
||||||
ILandObject parcel = LandChannel.GetLandObject((int)x, (int)y);
|
ILandObject parcel = LandChannel.GetLandObject((int)x, (int)y);
|
||||||
if (parcel == null)
|
if (parcel == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -5439,7 +5431,6 @@ Label_GroupsDone:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteFromStorage(UUID uuid)
|
public void DeleteFromStorage(UUID uuid)
|
||||||
|
|
|
@ -1674,7 +1674,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* moved to scene ProcessObjectGrabUpdate
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Move the given object
|
/// Move the given object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1699,7 +1699,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
group.SendGroupTerseUpdate();
|
group.SendGroupTerseUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start spinning the given object
|
/// Start spinning the given object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -2078,7 +2078,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
if (!avatar.IsChildAgent && avatar.ParentID == LocalId)
|
if (!avatar.IsChildAgent && avatar.ParentID == part.LocalId && avatar.ParentUUID == UUID.Zero)
|
||||||
avatar.StandUp();
|
avatar.StandUp();
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
|
@ -2092,6 +2092,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
// Send a kill object immediately
|
// Send a kill object immediately
|
||||||
avatar.ControllingClient.SendKillObject(new List<uint> { part.LocalId });
|
avatar.ControllingClient.SendKillObject(new List<uint> { part.LocalId });
|
||||||
|
//direct enqueue another delayed kill
|
||||||
|
avatar.ControllingClient.SendEntityUpdate(part,PrimUpdateFlags.Kill);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2110,6 +2112,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
d.AddActiveScripts(count);
|
d.AddActiveScripts(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const scriptEvents PhysicsNeeedSubsEvents = (
|
||||||
|
scriptEvents.collision | scriptEvents.collision_start | scriptEvents.collision_end |
|
||||||
|
scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end);
|
||||||
|
|
||||||
|
private scriptEvents lastRootPartPhysEvents = 0;
|
||||||
|
|
||||||
public void aggregateScriptEvents()
|
public void aggregateScriptEvents()
|
||||||
{
|
{
|
||||||
PrimFlags objectflagupdate = (PrimFlags)RootPart.GetEffectiveObjectFlags();
|
PrimFlags objectflagupdate = (PrimFlags)RootPart.GetEffectiveObjectFlags();
|
||||||
|
@ -2146,6 +2154,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_scene.RemoveGroupTarget(this);
|
m_scene.RemoveGroupTarget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scriptEvents rootPartPhysEvents = RootPart.AggregateScriptEvents;
|
||||||
|
rootPartPhysEvents &= PhysicsNeeedSubsEvents;
|
||||||
|
if (rootPartPhysEvents != lastRootPartPhysEvents)
|
||||||
|
{
|
||||||
|
lastRootPartPhysEvents = rootPartPhysEvents;
|
||||||
|
for (int i = 0; i < parts.Length; i++)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = parts[i];
|
||||||
|
if (part == null)
|
||||||
|
continue;
|
||||||
|
part.UpdatePhysicsSubscribedEvents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ScheduleGroupForFullUpdate();
|
ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2174,7 +2196,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Apply physics to the root prim
|
// Apply physics to the root prim
|
||||||
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, true);
|
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, true);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = parts[i];
|
SceneObjectPart part = parts[i];
|
||||||
|
@ -2242,10 +2263,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// any exception propogate upwards.
|
// any exception propogate upwards.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart
|
// if shutting down then there will be nothing to handle the return so leave till next restart
|
||||||
!m_scene.LoginsEnabled || // We're starting up or doing maintenance, don't mess with things
|
if (!m_scene.ShuttingDown &&
|
||||||
m_scene.LoadingPrims) // Land may not be valid yet
|
m_scene.LoginsEnabled && // We're starting up or doing maintenance, don't mess with things
|
||||||
|
!m_scene.LoadingPrims) // Land may not be valid yet
|
||||||
{
|
{
|
||||||
ILandObject parcel = m_scene.LandChannel.GetLandObject(
|
ILandObject parcel = m_scene.LandChannel.GetLandObject(
|
||||||
m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y);
|
m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y);
|
||||||
|
@ -3345,7 +3366,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// engine about the delink. Someday, linksets should be made first
|
// engine about the delink. Someday, linksets should be made first
|
||||||
// class objects in the physics engine interface).
|
// class objects in the physics engine interface).
|
||||||
if (linkPartPa != null)
|
if (linkPartPa != null)
|
||||||
|
{
|
||||||
m_scene.PhysicsScene.RemovePrim(linkPartPa);
|
m_scene.PhysicsScene.RemovePrim(linkPartPa);
|
||||||
|
linkPart.PhysActor = null;
|
||||||
|
}
|
||||||
|
|
||||||
// We need to reset the child part's position
|
// We need to reset the child part's position
|
||||||
// ready for life as a separate object after being a part of another object
|
// ready for life as a separate object after being a part of another object
|
||||||
|
@ -3397,10 +3421,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public virtual void DetachFromBackup()
|
public virtual void DetachFromBackup()
|
||||||
{
|
{
|
||||||
if (m_scene != null)
|
if (m_scene != null)
|
||||||
|
{
|
||||||
m_scene.SceneGraph.FireDetachFromBackup(this);
|
m_scene.SceneGraph.FireDetachFromBackup(this);
|
||||||
if (Backup && Scene != null)
|
if (Backup)
|
||||||
m_scene.EventManager.OnBackup -= ProcessBackup;
|
m_scene.EventManager.OnBackup -= ProcessBackup;
|
||||||
|
}
|
||||||
Backup = false;
|
Backup = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,6 +345,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private string m_text = String.Empty;
|
private string m_text = String.Empty;
|
||||||
private string m_touchName = String.Empty;
|
private string m_touchName = String.Empty;
|
||||||
private UndoRedoState m_UndoRedo = null;
|
private UndoRedoState m_UndoRedo = null;
|
||||||
|
private object m_UndoLock = new object();
|
||||||
|
|
||||||
private bool m_passTouches = false;
|
private bool m_passTouches = false;
|
||||||
private bool m_passCollisions = false;
|
private bool m_passCollisions = false;
|
||||||
|
@ -399,13 +400,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
|
|
||||||
// 0 for default collision sounds, -1 for script disabled sound 1 for script defined sound
|
// 0 for default collision sounds, -1 for script disabled sound 1 for script defined sound
|
||||||
private sbyte m_collisionSoundType;
|
private sbyte m_collisionSoundType = 0;
|
||||||
private UUID m_collisionSound;
|
private UUID m_collisionSound;
|
||||||
private float m_collisionSoundVolume;
|
private float m_collisionSoundVolume;
|
||||||
|
|
||||||
private int LastColSoundSentTime;
|
private int LastColSoundSentTime;
|
||||||
|
|
||||||
|
|
||||||
private SOPVehicle m_vehicleParams = null;
|
private SOPVehicle m_vehicleParams = null;
|
||||||
|
|
||||||
public KeyframeMotion KeyframeMotion
|
public KeyframeMotion KeyframeMotion
|
||||||
|
@ -1534,7 +1534,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
m_collisionSoundType = 1;
|
m_collisionSoundType = 1;
|
||||||
|
|
||||||
aggregateScriptEvents();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2164,7 +2163,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
UpdatePhysicsSubscribedEvents(); // not sure if appliable here
|
UpdatePhysicsSubscribedEvents(); // not sure if appliable here
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
PhysActor = null; // just to be sure
|
PhysActor = null; // just to be sure
|
||||||
|
RemFlag(PrimFlags.CameraDecoupled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3539,6 +3541,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_vehicleParams = value;
|
m_vehicleParams = value;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3583,7 +3586,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
|
|
||||||
m_vehicleParams.ProcessVehicleFlags(param, remove);
|
m_vehicleParams.ProcessVehicleFlags(param, remove);
|
||||||
|
|
||||||
if (_parentID ==0 && PhysActor != null)
|
if (_parentID == 0 && PhysActor != null)
|
||||||
{
|
{
|
||||||
PhysActor.VehicleFlags(param, remove);
|
PhysActor.VehicleFlags(param, remove);
|
||||||
}
|
}
|
||||||
|
@ -3932,11 +3935,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
|
|
||||||
public void StoreUndoState(ObjectChangeType change)
|
public void StoreUndoState(ObjectChangeType change)
|
||||||
{
|
{
|
||||||
if (m_UndoRedo == null)
|
lock (m_UndoLock)
|
||||||
m_UndoRedo = new UndoRedoState(5);
|
|
||||||
|
|
||||||
lock (m_UndoRedo)
|
|
||||||
{
|
{
|
||||||
|
if (m_UndoRedo == null)
|
||||||
|
m_UndoRedo = new UndoRedoState(5);
|
||||||
|
|
||||||
if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended
|
if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended
|
||||||
{
|
{
|
||||||
m_UndoRedo.StoreUndo(this, change);
|
m_UndoRedo.StoreUndo(this, change);
|
||||||
|
@ -3959,11 +3962,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
|
|
||||||
public void Undo()
|
public void Undo()
|
||||||
{
|
{
|
||||||
if (m_UndoRedo == null || Undoing || ParentGroup == null)
|
lock (m_UndoLock)
|
||||||
return;
|
|
||||||
|
|
||||||
lock (m_UndoRedo)
|
|
||||||
{
|
{
|
||||||
|
if (m_UndoRedo == null || Undoing || ParentGroup == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Undoing = true;
|
Undoing = true;
|
||||||
m_UndoRedo.Undo(this);
|
m_UndoRedo.Undo(this);
|
||||||
Undoing = false;
|
Undoing = false;
|
||||||
|
@ -3972,11 +3975,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
|
|
||||||
public void Redo()
|
public void Redo()
|
||||||
{
|
{
|
||||||
if (m_UndoRedo == null || Undoing || ParentGroup == null)
|
lock (m_UndoLock)
|
||||||
return;
|
|
||||||
|
|
||||||
lock (m_UndoRedo)
|
|
||||||
{
|
{
|
||||||
|
if (m_UndoRedo == null || Undoing || ParentGroup == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Undoing = true;
|
Undoing = true;
|
||||||
m_UndoRedo.Redo(this);
|
m_UndoRedo.Redo(this);
|
||||||
Undoing = false;
|
Undoing = false;
|
||||||
|
@ -3985,11 +3988,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
|
|
||||||
public void ClearUndoState()
|
public void ClearUndoState()
|
||||||
{
|
{
|
||||||
if (m_UndoRedo == null || Undoing)
|
lock (m_UndoLock)
|
||||||
return;
|
|
||||||
|
|
||||||
lock (m_UndoRedo)
|
|
||||||
{
|
{
|
||||||
|
if (m_UndoRedo == null || Undoing)
|
||||||
|
return;
|
||||||
|
|
||||||
m_UndoRedo.Clear();
|
m_UndoRedo.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4722,9 +4725,16 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
if (VolumeDetectActive) // change if not the default only
|
if (VolumeDetectActive) // change if not the default only
|
||||||
pa.SetVolumeDetect(1);
|
pa.SetVolumeDetect(1);
|
||||||
|
|
||||||
if (m_vehicleParams != null && LocalId == ParentGroup.RootPart.LocalId)
|
if (m_vehicleParams != null && m_localId == ParentGroup.RootPart.LocalId)
|
||||||
|
{
|
||||||
m_vehicleParams.SetVehicle(pa);
|
m_vehicleParams.SetVehicle(pa);
|
||||||
|
if(isPhysical && !isPhantom && m_vehicleParams.CameraDecoupled)
|
||||||
|
AddFlag(PrimFlags.CameraDecoupled);
|
||||||
|
else
|
||||||
|
RemFlag(PrimFlags.CameraDecoupled);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
RemFlag(PrimFlags.CameraDecoupled);
|
||||||
// we are going to tell rest of code about physics so better have this here
|
// we are going to tell rest of code about physics so better have this here
|
||||||
PhysActor = pa;
|
PhysActor = pa;
|
||||||
|
|
||||||
|
@ -4800,6 +4810,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
|
|
||||||
ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this);
|
ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this);
|
||||||
}
|
}
|
||||||
|
RemFlag(PrimFlags.CameraDecoupled);
|
||||||
PhysActor = null;
|
PhysActor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5021,7 +5032,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void UpdatePhysicsSubscribedEvents()
|
internal void UpdatePhysicsSubscribedEvents()
|
||||||
{
|
{
|
||||||
PhysicsActor pa = PhysActor;
|
PhysicsActor pa = PhysActor;
|
||||||
if (pa == null)
|
if (pa == null)
|
||||||
|
@ -5095,8 +5106,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
|
objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdatePhysicsSubscribedEvents();
|
|
||||||
|
|
||||||
LocalFlags = (PrimFlags)objectflagupdate;
|
LocalFlags = (PrimFlags)objectflagupdate;
|
||||||
|
|
||||||
if (ParentGroup != null && ParentGroup.RootPart == this)
|
if (ParentGroup != null && ParentGroup.RootPart == this)
|
||||||
|
@ -5107,6 +5116,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
|
// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
|
||||||
|
UpdatePhysicsSubscribedEvents();
|
||||||
ScheduleFullUpdate();
|
ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5408,5 +5418,24 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
Acceleration = Vector3.Zero;
|
Acceleration = Vector3.Zero;
|
||||||
APIDActive = false;
|
APIDActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handle osVolumeDetect
|
||||||
|
public void ScriptSetVolumeDetect(bool makeVolumeDetect)
|
||||||
|
{
|
||||||
|
if(_parentID == 0)
|
||||||
|
{
|
||||||
|
// if root prim do it via SOG
|
||||||
|
ParentGroup.ScriptSetVolumeDetect(makeVolumeDetect);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0);
|
||||||
|
bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0);
|
||||||
|
bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0);
|
||||||
|
|
||||||
|
if(PhysActor != null)
|
||||||
|
PhysActor.Building = true;
|
||||||
|
UpdatePrimFlags(wasUsingPhysics,wasTemporary,wasPhantom,makeVolumeDetect,false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -542,10 +542,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public Vector3 CameraPosition { get; set; }
|
public Vector3 CameraPosition { get; set; }
|
||||||
|
|
||||||
public Quaternion CameraRotation
|
public Quaternion CameraRotation { get; private set; }
|
||||||
{
|
|
||||||
get { return Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use these three vectors to figure out what the agent is looking at
|
// Use these three vectors to figure out what the agent is looking at
|
||||||
// Convert it to a Matrix and/or Quaternion
|
// Convert it to a Matrix and/or Quaternion
|
||||||
|
@ -1242,6 +1239,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ParentPart = part;
|
ParentPart = part;
|
||||||
m_pos = PrevSitOffset;
|
m_pos = PrevSitOffset;
|
||||||
pos = part.GetWorldPosition();
|
pos = part.GetWorldPosition();
|
||||||
|
PhysicsActor partPhysActor = part.PhysActor;
|
||||||
|
if(partPhysActor != null)
|
||||||
|
{
|
||||||
|
partPhysActor.OnPhysicsRequestingCameraData -=
|
||||||
|
physActor_OnPhysicsRequestingCameraData;
|
||||||
|
partPhysActor.OnPhysicsRequestingCameraData +=
|
||||||
|
physActor_OnPhysicsRequestingCameraData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ParentUUID = UUID.Zero;
|
ParentUUID = UUID.Zero;
|
||||||
}
|
}
|
||||||
|
@ -1922,6 +1927,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RotateToLookAt(Vector3 lookAt)
|
||||||
|
{
|
||||||
|
if(ParentID == 0)
|
||||||
|
{
|
||||||
|
float n = lookAt.X * lookAt.X + lookAt.Y * lookAt.Y;
|
||||||
|
if(n < 0.0001f)
|
||||||
|
{
|
||||||
|
Rotation = Quaternion.Identity;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
n = lookAt.X/(float)Math.Sqrt(n);
|
||||||
|
float angle = (float)Math.Acos(n);
|
||||||
|
angle *= 0.5f;
|
||||||
|
float s = (float)Math.Sin(angle);
|
||||||
|
if(lookAt.Y < 0)
|
||||||
|
s = -s;
|
||||||
|
Rotation = new Quaternion(
|
||||||
|
0f,
|
||||||
|
0f,
|
||||||
|
s,
|
||||||
|
(float)Math.Cos(angle)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Complete Avatar's movement into the region.
|
/// Complete Avatar's movement into the region.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1958,10 +1988,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
||||||
|
|
||||||
Vector3 look = Lookat;
|
Vector3 look = Lookat;
|
||||||
|
look.Z = 0f;
|
||||||
if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01))
|
if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01))
|
||||||
{
|
{
|
||||||
look = Velocity;
|
look = Velocity;
|
||||||
look.Z = 0;
|
|
||||||
look.Normalize();
|
look.Normalize();
|
||||||
if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) )
|
if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) )
|
||||||
look = new Vector3(0.99f, 0.042f, 0);
|
look = new Vector3(0.99f, 0.042f, 0);
|
||||||
|
@ -1995,11 +2025,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF);
|
m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!gotCrossUpdate)
|
||||||
|
RotateToLookAt(look);
|
||||||
|
|
||||||
// Tell the client that we're totally ready
|
// Tell the client that we're totally ready
|
||||||
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
|
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
|
||||||
|
|
||||||
|
|
||||||
m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(m_callbackURI))
|
if (!string.IsNullOrEmpty(m_callbackURI))
|
||||||
|
@ -2696,9 +2727,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
CameraPosition = agentData.CameraCenter;
|
CameraPosition = agentData.CameraCenter;
|
||||||
// Use these three vectors to figure out what the agent is looking at
|
// Use these three vectors to figure out what the agent is looking at
|
||||||
// Convert it to a Matrix and/or Quaternion
|
// Convert it to a Matrix and/or Quaternion
|
||||||
|
|
||||||
|
// this my need lock
|
||||||
CameraAtAxis = agentData.CameraAtAxis;
|
CameraAtAxis = agentData.CameraAtAxis;
|
||||||
CameraLeftAxis = agentData.CameraLeftAxis;
|
CameraLeftAxis = agentData.CameraLeftAxis;
|
||||||
CameraUpAxis = agentData.CameraUpAxis;
|
CameraUpAxis = agentData.CameraUpAxis;
|
||||||
|
Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis);
|
||||||
|
CameraRotation = camRot;
|
||||||
|
|
||||||
// The Agent's Draw distance setting
|
// The Agent's Draw distance setting
|
||||||
// When we get to the point of re-computing neighbors everytime this
|
// When we get to the point of re-computing neighbors everytime this
|
||||||
|
@ -3171,9 +3206,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
offset = offset * part.RotationOffset;
|
offset = offset * part.RotationOffset;
|
||||||
offset += part.OffsetPosition;
|
offset += part.OffsetPosition;
|
||||||
|
|
||||||
if (CameraAtAxis == Vector3.Zero && cameraEyeOffset == Vector3.Zero)
|
if (cameraAtOffset == Vector3.Zero && cameraEyeOffset == Vector3.Zero)
|
||||||
{
|
{
|
||||||
CameraAtAxis = part.ParentGroup.RootPart.GetCameraAtOffset();
|
cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset();
|
||||||
cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset();
|
cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3304,7 +3339,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Vector3 cameraEyeOffset = part.GetCameraEyeOffset();
|
Vector3 cameraEyeOffset = part.GetCameraEyeOffset();
|
||||||
bool forceMouselook = part.GetForceMouselook();
|
bool forceMouselook = part.GetForceMouselook();
|
||||||
|
|
||||||
m_bodyRot = Orientation;
|
|
||||||
|
|
||||||
if (!part.IsRoot)
|
if (!part.IsRoot)
|
||||||
{
|
{
|
||||||
|
@ -3312,9 +3346,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
offset = offset * part.RotationOffset;
|
offset = offset * part.RotationOffset;
|
||||||
offset += part.OffsetPosition;
|
offset += part.OffsetPosition;
|
||||||
|
|
||||||
if (CameraAtAxis == Vector3.Zero && cameraEyeOffset == Vector3.Zero)
|
if (cameraAtOffset == Vector3.Zero && cameraEyeOffset == Vector3.Zero)
|
||||||
{
|
{
|
||||||
CameraAtAxis = part.ParentGroup.RootPart.GetCameraAtOffset();
|
cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset();
|
||||||
cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset();
|
cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3326,6 +3360,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_bodyRot = Orientation;
|
||||||
m_pos = offset;
|
m_pos = offset;
|
||||||
|
|
||||||
ControllingClient.SendSitResponse(
|
ControllingClient.SendSitResponse(
|
||||||
|
@ -4571,6 +4606,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
CameraAtAxis = cAgent.AtAxis;
|
CameraAtAxis = cAgent.AtAxis;
|
||||||
CameraLeftAxis = cAgent.LeftAxis;
|
CameraLeftAxis = cAgent.LeftAxis;
|
||||||
CameraUpAxis = cAgent.UpAxis;
|
CameraUpAxis = cAgent.UpAxis;
|
||||||
|
|
||||||
|
Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis);
|
||||||
|
CameraRotation = camRot;
|
||||||
|
|
||||||
|
|
||||||
ParentUUID = cAgent.ParentPart;
|
ParentUUID = cAgent.ParentPart;
|
||||||
PrevSitOffset = cAgent.SitOffset;
|
PrevSitOffset = cAgent.SitOffset;
|
||||||
|
|
||||||
|
@ -5429,10 +5469,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CameraData physActor_OnPhysicsRequestingCameraData()
|
||||||
|
{
|
||||||
|
return new CameraData
|
||||||
|
{
|
||||||
|
Valid = true,
|
||||||
|
MouseLook = this.m_mouseLook,
|
||||||
|
CameraRotation = this.CameraRotation,
|
||||||
|
CameraAtAxis = this.CameraAtAxis
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID)
|
public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID)
|
||||||
{
|
{
|
||||||
SceneObjectPart p = m_scene.GetSceneObjectPart(Obj_localID);
|
SceneObjectPart part = m_scene.GetSceneObjectPart(Obj_localID);
|
||||||
if (p == null)
|
if (part == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ControllingClient.SendTakeControls(controls, false, false);
|
ControllingClient.SendTakeControls(controls, false, false);
|
||||||
|
@ -5442,7 +5493,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
obj.ignoreControls = ScriptControlled.CONTROL_ZERO;
|
obj.ignoreControls = ScriptControlled.CONTROL_ZERO;
|
||||||
obj.eventControls = ScriptControlled.CONTROL_ZERO;
|
obj.eventControls = ScriptControlled.CONTROL_ZERO;
|
||||||
|
|
||||||
obj.objectID = p.ParentGroup.UUID;
|
obj.objectID = part.ParentGroup.UUID;
|
||||||
obj.itemID = Script_item_UUID;
|
obj.itemID = Script_item_UUID;
|
||||||
if (pass_on == 0 && accept == 0)
|
if (pass_on == 0 && accept == 0)
|
||||||
{
|
{
|
||||||
|
@ -5470,17 +5521,43 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
IgnoredControls &= ~(ScriptControlled)controls;
|
IgnoredControls &= ~(ScriptControlled)controls;
|
||||||
if (scriptedcontrols.ContainsKey(Script_item_UUID))
|
if (scriptedcontrols.ContainsKey(Script_item_UUID))
|
||||||
scriptedcontrols.Remove(Script_item_UUID);
|
RemoveScriptFromControlNotifications(Script_item_UUID, part);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scriptedcontrols[Script_item_UUID] = obj;
|
AddScriptToControlNotifications(Script_item_UUID, part, ref obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true);
|
ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddScriptToControlNotifications(OpenMetaverse.UUID Script_item_UUID, SceneObjectPart part, ref ScriptControllers obj)
|
||||||
|
{
|
||||||
|
scriptedcontrols[Script_item_UUID] = obj;
|
||||||
|
|
||||||
|
PhysicsActor physActor = part.ParentGroup.RootPart.PhysActor;
|
||||||
|
if (physActor != null)
|
||||||
|
{
|
||||||
|
physActor.OnPhysicsRequestingCameraData -= physActor_OnPhysicsRequestingCameraData;
|
||||||
|
physActor.OnPhysicsRequestingCameraData += physActor_OnPhysicsRequestingCameraData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveScriptFromControlNotifications(OpenMetaverse.UUID Script_item_UUID, SceneObjectPart part)
|
||||||
|
{
|
||||||
|
scriptedcontrols.Remove(Script_item_UUID);
|
||||||
|
|
||||||
|
if (part != null)
|
||||||
|
{
|
||||||
|
PhysicsActor physActor = part.ParentGroup.RootPart.PhysActor;
|
||||||
|
if (physActor != null)
|
||||||
|
{
|
||||||
|
physActor.OnPhysicsRequestingCameraData -= physActor_OnPhysicsRequestingCameraData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleForceReleaseControls(IClientAPI remoteClient, UUID agentID)
|
public void HandleForceReleaseControls(IClientAPI remoteClient, UUID agentID)
|
||||||
{
|
{
|
||||||
IgnoredControls = ScriptControlled.CONTROL_ZERO;
|
IgnoredControls = ScriptControlled.CONTROL_ZERO;
|
||||||
|
@ -5518,6 +5595,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID)
|
public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID)
|
||||||
{
|
{
|
||||||
ScriptControllers takecontrols;
|
ScriptControllers takecontrols;
|
||||||
|
SceneObjectPart part = m_scene.GetSceneObjectPart(Obj_localID);
|
||||||
|
|
||||||
lock (scriptedcontrols)
|
lock (scriptedcontrols)
|
||||||
{
|
{
|
||||||
|
@ -5528,7 +5606,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ControllingClient.SendTakeControls((int)sctc, false, false);
|
ControllingClient.SendTakeControls((int)sctc, false, false);
|
||||||
ControllingClient.SendTakeControls((int)sctc, true, false);
|
ControllingClient.SendTakeControls((int)sctc, true, false);
|
||||||
|
|
||||||
scriptedcontrols.Remove(Script_item_UUID);
|
RemoveScriptFromControlNotifications(Script_item_UUID, part);
|
||||||
IgnoredControls = ScriptControlled.CONTROL_ZERO;
|
IgnoredControls = ScriptControlled.CONTROL_ZERO;
|
||||||
foreach (ScriptControllers scData in scriptedcontrols.Values)
|
foreach (ScriptControllers scData in scriptedcontrols.Values)
|
||||||
{
|
{
|
||||||
|
@ -5947,6 +6025,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
|
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
|
||||||
{
|
{
|
||||||
pos = land.LandData.UserLocation;
|
pos = land.LandData.UserLocation;
|
||||||
|
positionChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1753,6 +1753,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendSelectedPartsProprieties(List<ISceneEntity> parts)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
|
|
||||||
m_log.InfoFormat("[IRC-Connector-{0}] Closing", idn);
|
m_log.InfoFormat("[IRC-Connector-{0}] Closing", idn);
|
||||||
|
|
||||||
lock (msyncConnect)
|
lock (msyncConnect)
|
||||||
|
@ -295,7 +294,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
|
|
||||||
|
|
||||||
m_connected = false;
|
m_connected = false;
|
||||||
|
|
||||||
try { m_writer.Close(); }
|
try { m_writer.Close(); }
|
||||||
|
@ -308,10 +306,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_connectors)
|
lock (m_connectors)
|
||||||
m_connectors.Remove(this);
|
m_connectors.Remove(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,25 +323,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Delay until next WD cycle if this is too close to the last start attempt
|
// Delay until next WD cycle if this is too close to the last start attempt
|
||||||
|
if(_icc_ < ICCD_PERIOD)
|
||||||
while (_icc_ < ICCD_PERIOD)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_log.DebugFormat("[IRC-Connector-{0}]: Connection request for {1} on {2}:{3}", idn, m_nick, m_server, m_ircChannel);
|
m_log.DebugFormat("[IRC-Connector-{0}]: Connection request for {1} on {2}:{3}", idn, m_nick, m_server, m_ircChannel);
|
||||||
|
|
||||||
|
_icc_ = 0;
|
||||||
|
|
||||||
lock (msyncConnect)
|
lock (msyncConnect)
|
||||||
{
|
{
|
||||||
|
|
||||||
_icc_ = 0;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_connected) return;
|
if (m_connected) return;
|
||||||
|
|
||||||
m_connected = true;
|
m_connected = true;
|
||||||
|
@ -379,11 +371,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
// expires. By leaving them as they are, the connection will be retried
|
// expires. By leaving them as they are, the connection will be retried
|
||||||
// when the login timeout expires. Which is preferred.
|
// when the login timeout expires. Which is preferred.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reconnect is used to force a re-cycle of the IRC connection. Should generally
|
// Reconnect is used to force a re-cycle of the IRC connection. Should generally
|
||||||
|
|
|
@ -1177,18 +1177,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null);
|
GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null);
|
||||||
|
if (groupInfo == null)
|
||||||
UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(regionInfo.ScopeID, ejecteeID);
|
|
||||||
if ((groupInfo == null) || (account == null))
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
IClientAPI ejecteeClient = GetActiveRootClient(ejecteeID);
|
IClientAPI ejecteeClient = GetActiveRootClient(ejecteeID);
|
||||||
|
|
||||||
// Send Message to Ejectee
|
// Send Message to Ejectee
|
||||||
GridInstantMessage msg = new GridInstantMessage();
|
GridInstantMessage msg = new GridInstantMessage();
|
||||||
|
|
||||||
|
string ejecteeName = "Unknown member";
|
||||||
// if local send a normal message
|
// if local send a normal message
|
||||||
if(ejecteeClient != null)
|
if(ejecteeClient != null)
|
||||||
{
|
{
|
||||||
|
@ -1197,6 +1195,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
// also execute and send update
|
// also execute and send update
|
||||||
ejecteeClient.SendAgentDropGroup(groupID);
|
ejecteeClient.SendAgentDropGroup(groupID);
|
||||||
SendAgentGroupDataUpdate(ejecteeClient,true);
|
SendAgentGroupDataUpdate(ejecteeClient,true);
|
||||||
|
ejecteeName = ejecteeClient.Name;
|
||||||
}
|
}
|
||||||
else // send
|
else // send
|
||||||
{
|
{
|
||||||
|
@ -1208,6 +1207,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
msg.imSessionID = groupInfo.GroupID.Guid;
|
msg.imSessionID = groupInfo.GroupID.Guid;
|
||||||
msg.dialog = (byte)210; //interop
|
msg.dialog = (byte)210; //interop
|
||||||
|
UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(regionInfo.ScopeID, ejecteeID);
|
||||||
|
if (account != null)
|
||||||
|
ejecteeName = account.FirstName + " " + account.LastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.fromAgentID = agentID.Guid;
|
msg.fromAgentID = agentID.Guid;
|
||||||
|
@ -1234,14 +1236,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
msg.toAgentID = agentID.Guid;
|
msg.toAgentID = agentID.Guid;
|
||||||
msg.timestamp = 0;
|
msg.timestamp = 0;
|
||||||
msg.fromAgentName = agentName;
|
msg.fromAgentName = agentName;
|
||||||
if (account != null)
|
|
||||||
{
|
msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, ejecteeName);
|
||||||
msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, account.FirstName + " " + account.LastName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member");
|
|
||||||
}
|
|
||||||
// msg.dialog = (byte)210; //interop
|
// msg.dialog = (byte)210; //interop
|
||||||
msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent;
|
msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent;
|
||||||
msg.fromGroup = false;
|
msg.fromGroup = false;
|
||||||
|
|
|
@ -97,9 +97,8 @@ namespace OpenSim.Region.UserStatistics
|
||||||
sdr.Read();
|
sdr.Read();
|
||||||
totalregions = Convert.ToInt32(sdr["regcnt"]);
|
totalregions = Convert.ToInt32(sdr["regcnt"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
sdr.Close();
|
sdr.Close();
|
||||||
sdr.Dispose();
|
cmd.Dispose();
|
||||||
|
|
||||||
sql =
|
sql =
|
||||||
"select client_version, count(*) as cnt, avg(avg_sim_fps) as simfps from stats_session_data group by client_version order by count(*) desc LIMIT 10;";
|
"select client_version, count(*) as cnt, avg(avg_sim_fps) as simfps from stats_session_data group by client_version order by count(*) desc LIMIT 10;";
|
||||||
|
@ -120,7 +119,7 @@ namespace OpenSim.Region.UserStatistics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sdr.Close();
|
sdr.Close();
|
||||||
sdr.Dispose();
|
cmd.Dispose();
|
||||||
|
|
||||||
if (totalregions > 1)
|
if (totalregions > 1)
|
||||||
{
|
{
|
||||||
|
@ -143,11 +142,8 @@ namespace OpenSim.Region.UserStatistics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sdr.Close();
|
sdr.Close();
|
||||||
sdr.Dispose();
|
cmd.Dispose();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ClientVersionData cvd in cliRegData)
|
foreach (ClientVersionData cvd in cliRegData)
|
||||||
|
@ -163,9 +159,6 @@ namespace OpenSim.Region.UserStatistics
|
||||||
{
|
{
|
||||||
regionTotals.Add(cvd.region_id, cvd.count);
|
regionTotals.Add(cvd.region_id, cvd.count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modeldata["ClientData"] = clidata;
|
modeldata["ClientData"] = clidata;
|
||||||
|
|
|
@ -227,7 +227,10 @@ TD.align_top { vertical-align: top; }
|
||||||
returnstruct.avg_client_mem_use = Convert.ToSingle(sdr["sav_mem_use"]);
|
returnstruct.avg_client_mem_use = Convert.ToSingle(sdr["sav_mem_use"]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
sdr.Close();
|
||||||
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnstruct;
|
return returnstruct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,8 +145,7 @@ namespace OpenSim.Region.UserStatistics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sdr.Close();
|
sdr.Close();
|
||||||
sdr.Dispose();
|
cmd.Dispose();
|
||||||
|
|
||||||
}
|
}
|
||||||
modeldata["SessionData"] = lstSessions;
|
modeldata["SessionData"] = lstSessions;
|
||||||
return modeldata;
|
return modeldata;
|
||||||
|
|
|
@ -1337,6 +1337,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendSelectedPartsProprieties(List<ISceneEntity> parts)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -954,25 +954,6 @@ namespace OpenSim.Region.PhysicsModule.BulletS
|
||||||
// m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader);
|
// m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Although no one seems to check this, I do support combining.
|
|
||||||
public override bool SupportsCombining()
|
|
||||||
{
|
|
||||||
return TerrainManager.SupportsCombining();
|
|
||||||
}
|
|
||||||
// This call says I am a child to region zero in a mega-region. 'pScene' is that
|
|
||||||
// of region zero, 'offset' is my offset from regions zero's origin, and
|
|
||||||
// 'extents' is the largest XY that is handled in my region.
|
|
||||||
public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
|
|
||||||
{
|
|
||||||
TerrainManager.Combine(pScene, offset, extents);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unhook all the combining that I know about.
|
|
||||||
public override void UnCombine(PhysicsScene pScene)
|
|
||||||
{
|
|
||||||
TerrainManager.UnCombine(pScene);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion // Terrain
|
#endregion // Terrain
|
||||||
|
|
||||||
public override Dictionary<uint, float> GetTopColliders()
|
public override Dictionary<uint, float> GetTopColliders()
|
||||||
|
|
|
@ -1074,14 +1074,27 @@ namespace OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet
|
||||||
public static int maxdirfiltered(List<float3> p, int count, float3 dir, byte[] allow)
|
public static int maxdirfiltered(List<float3> p, int count, float3 dir, byte[] allow)
|
||||||
{
|
{
|
||||||
//Debug.Assert(count != 0);
|
//Debug.Assert(count != 0);
|
||||||
int m = 0;
|
int m = -1;
|
||||||
float currDotm = float3.dot(p[0], dir);
|
float currDotm = 0;
|
||||||
float currDoti;
|
float currDoti;
|
||||||
|
|
||||||
while (allow[m] == 0)
|
for (int i = 0; i < count; i++)
|
||||||
m++;
|
{
|
||||||
|
if (allow[i] != 0)
|
||||||
|
{
|
||||||
|
currDotm = float3.dot(p[i], dir);
|
||||||
|
m = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 1; i < count; i++)
|
if(m == -1)
|
||||||
|
{
|
||||||
|
Debug.Assert(false);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = m + 1; i < count; i++)
|
||||||
{
|
{
|
||||||
if (allow[i] != 0)
|
if (allow[i] != 0)
|
||||||
{
|
{
|
||||||
|
@ -1093,7 +1106,8 @@ namespace OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Debug.Assert(m != -1);
|
|
||||||
|
// Debug.Assert(m != -1);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1112,8 +1126,8 @@ namespace OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet
|
||||||
{
|
{
|
||||||
int mb;
|
int mb;
|
||||||
{
|
{
|
||||||
float s = (float)Math.Sin((3.14159264f / 180.0f) * (x));
|
float s = (float)Math.Sin(0.01745329f * x);
|
||||||
float c = (float)Math.Cos((3.14159264f / 180.0f) * (x));
|
float c = (float)Math.Cos(0.01745329f * x);
|
||||||
mb = maxdirfiltered(p, count, dir + (u * s + v * c) * 0.025f, allow);
|
mb = maxdirfiltered(p, count, dir + (u * s + v * c) * 0.025f, allow);
|
||||||
}
|
}
|
||||||
if (ma == m && mb == m)
|
if (ma == m && mb == m)
|
||||||
|
@ -1126,8 +1140,8 @@ namespace OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet
|
||||||
int mc = ma;
|
int mc = ma;
|
||||||
for (float xx = x - 40.0f; xx <= x; xx += 5.0f)
|
for (float xx = x - 40.0f; xx <= x; xx += 5.0f)
|
||||||
{
|
{
|
||||||
float s = (float)Math.Sin((3.14159264f / 180.0f) * (xx));
|
float s = (float)Math.Sin(0.01745329f * xx);
|
||||||
float c = (float)Math.Cos((3.14159264f / 180.0f) * (xx));
|
float c = (float)Math.Cos(0.01745329f * xx);
|
||||||
int md = maxdirfiltered(p, count, dir + (u * s + v * c) * 0.025f, allow);
|
int md = maxdirfiltered(p, count, dir + (u * s + v * c) * 0.025f, allow);
|
||||||
if (mc == m && md == m)
|
if (mc == m && md == m)
|
||||||
{
|
{
|
||||||
|
@ -1176,7 +1190,7 @@ namespace OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet
|
||||||
Debug.Assert(!(p0 == p1 || p0 == p2 || p0 == p3 || p1 == p2 || p1 == p3 || p2 == p3));
|
Debug.Assert(!(p0 == p1 || p0 == p2 || p0 == p3 || p1 == p2 || p1 == p3 || p2 == p3));
|
||||||
if (float3.dot(verts[p3] - verts[p0], float3.cross(verts[p1] - verts[p0], verts[p2] - verts[p0])) < 0)
|
if (float3.dot(verts[p3] - verts[p0], float3.cross(verts[p1] - verts[p0], verts[p2] - verts[p0])) < 0)
|
||||||
{
|
{
|
||||||
Swap(ref p2, ref p3);
|
return new int4(p0, p1, p3, p2);
|
||||||
}
|
}
|
||||||
return new int4(p0, p1, p2, p3);
|
return new int4(p0, p1, p2, p3);
|
||||||
}
|
}
|
||||||
|
@ -1207,12 +1221,12 @@ namespace OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet
|
||||||
int j;
|
int j;
|
||||||
float3 bmin = new float3(verts[0]);
|
float3 bmin = new float3(verts[0]);
|
||||||
float3 bmax = new float3(verts[0]);
|
float3 bmax = new float3(verts[0]);
|
||||||
List<int> isextreme = new List<int>(verts.Count);
|
byte[] isextreme = new byte[verts.Count];
|
||||||
byte[] allow = new byte[verts.Count];
|
byte[] allow = new byte[verts.Count];
|
||||||
for (j = 0; j < verts.Count; j++)
|
for (j = 0; j < verts.Count; j++)
|
||||||
{
|
{
|
||||||
allow[j] = 1;
|
allow[j] = 1;
|
||||||
isextreme.Add(0);
|
isextreme[j] = 0;
|
||||||
bmin = float3.VectorMin(bmin, verts[j]);
|
bmin = float3.VectorMin(bmin, verts[j]);
|
||||||
bmax = float3.VectorMax(bmax, verts[j]);
|
bmax = float3.VectorMax(bmax, verts[j]);
|
||||||
}
|
}
|
||||||
|
@ -1526,6 +1540,19 @@ namespace OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool ComputeHull(List<float3> vertices, out List<int> indices)
|
||||||
|
{
|
||||||
|
List<HullTriangle> tris = new List<HullTriangle>();
|
||||||
|
|
||||||
|
bool ret = calchull(vertices, out indices, 0, tris);
|
||||||
|
if (ret == false)
|
||||||
|
{
|
||||||
|
indices = new List<int>();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private static bool CleanupVertices(List<float3> svertices, out List<float3> vertices, float normalepsilon, out float3 scale)
|
private static bool CleanupVertices(List<float3> svertices, out List<float3> vertices, float normalepsilon, out float3 scale)
|
||||||
{
|
{
|
||||||
const float EPSILON = 0.000001f;
|
const float EPSILON = 0.000001f;
|
||||||
|
|
|
@ -258,8 +258,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
|
|
||||||
private Random fluidRandomizer = new Random(Environment.TickCount);
|
private Random fluidRandomizer = new Random(Environment.TickCount);
|
||||||
|
|
||||||
public bool m_suportCombine = true;
|
|
||||||
|
|
||||||
private uint m_regionWidth = Constants.RegionSize;
|
private uint m_regionWidth = Constants.RegionSize;
|
||||||
private uint m_regionHeight = Constants.RegionSize;
|
private uint m_regionHeight = Constants.RegionSize;
|
||||||
|
|
||||||
|
@ -542,8 +540,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
WorldExtents.Y = regionExtent.Y;
|
WorldExtents.Y = regionExtent.Y;
|
||||||
m_regionHeight = (uint)regionExtent.Y;
|
m_regionHeight = (uint)regionExtent.Y;
|
||||||
|
|
||||||
m_suportCombine = false;
|
|
||||||
|
|
||||||
nearCallback = near;
|
nearCallback = near;
|
||||||
m_rayCastManager = new ODERayCastRequestManager(this);
|
m_rayCastManager = new ODERayCastRequestManager(this);
|
||||||
|
|
||||||
|
@ -1627,15 +1623,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
|
|
||||||
{
|
|
||||||
if (!m_suportCombine)
|
|
||||||
return;
|
|
||||||
m_worldOffset = offset;
|
|
||||||
WorldExtents = new Vector2(extents.X, extents.Y);
|
|
||||||
m_parentScene = pScene;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recovered for use by fly height. Kitto Flora
|
// Recovered for use by fly height. Kitto Flora
|
||||||
internal float GetTerrainHeightAtXY(float x, float y)
|
internal float GetTerrainHeightAtXY(float x, float y)
|
||||||
{
|
{
|
||||||
|
@ -1643,12 +1630,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
int offsetX = 0;
|
int offsetX = 0;
|
||||||
int offsetY = 0;
|
int offsetY = 0;
|
||||||
|
|
||||||
if (m_suportCombine)
|
|
||||||
{
|
|
||||||
offsetX = ((int)(x / (int)Constants.RegionSize)) * (int)Constants.RegionSize;
|
|
||||||
offsetY = ((int)(y / (int)Constants.RegionSize)) * (int)Constants.RegionSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(RegionTerrain.TryGetValue(new Vector3(offsetX,offsetY,0), out heightFieldGeom))
|
if(RegionTerrain.TryGetValue(new Vector3(offsetX,offsetY,0), out heightFieldGeom))
|
||||||
{
|
{
|
||||||
if (heightFieldGeom != IntPtr.Zero)
|
if (heightFieldGeom != IntPtr.Zero)
|
||||||
|
@ -3387,11 +3368,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
return waterlevel;
|
return waterlevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool SupportsCombining()
|
|
||||||
{
|
|
||||||
return m_suportCombine;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetWaterLevel(float baseheight)
|
public override void SetWaterLevel(float baseheight)
|
||||||
{
|
{
|
||||||
waterlevel = baseheight;
|
waterlevel = baseheight;
|
||||||
|
@ -3452,6 +3428,11 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int compareByCollisionsDesc(OdePrim A, OdePrim B)
|
||||||
|
{
|
||||||
|
return -A.CollisionScore.CompareTo(B.CollisionScore);
|
||||||
|
}
|
||||||
|
|
||||||
public override Dictionary<uint, float> GetTopColliders()
|
public override Dictionary<uint, float> GetTopColliders()
|
||||||
{
|
{
|
||||||
Dictionary<uint, float> topColliders;
|
Dictionary<uint, float> topColliders;
|
||||||
|
@ -3459,7 +3440,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
lock (_prims)
|
lock (_prims)
|
||||||
{
|
{
|
||||||
List<OdePrim> orderedPrims = new List<OdePrim>(_prims);
|
List<OdePrim> orderedPrims = new List<OdePrim>(_prims);
|
||||||
orderedPrims.OrderByDescending(p => p.CollisionScore);
|
orderedPrims.Sort(compareByCollisionsDesc);
|
||||||
topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore);
|
topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore);
|
||||||
|
|
||||||
foreach (OdePrim p in _prims)
|
foreach (OdePrim p in _prims)
|
||||||
|
|
|
@ -55,6 +55,14 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
|
||||||
Absolute
|
Absolute
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct CameraData
|
||||||
|
{
|
||||||
|
public Quaternion CameraRotation;
|
||||||
|
public Vector3 CameraAtAxis;
|
||||||
|
public bool MouseLook;
|
||||||
|
public bool Valid;
|
||||||
|
}
|
||||||
|
|
||||||
public struct ContactPoint
|
public struct ContactPoint
|
||||||
{
|
{
|
||||||
public Vector3 Position;
|
public Vector3 Position;
|
||||||
|
@ -159,13 +167,15 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
|
||||||
public delegate void RequestTerseUpdate();
|
public delegate void RequestTerseUpdate();
|
||||||
public delegate void CollisionUpdate(EventArgs e);
|
public delegate void CollisionUpdate(EventArgs e);
|
||||||
public delegate void OutOfBounds(Vector3 pos);
|
public delegate void OutOfBounds(Vector3 pos);
|
||||||
|
public delegate CameraData GetCameraData();
|
||||||
|
|
||||||
// disable warning: public events
|
// disable warning: public events
|
||||||
#pragma warning disable 67
|
#pragma warning disable 67
|
||||||
public event PositionUpdate OnPositionUpdate;
|
public event PositionUpdate OnPositionUpdate;
|
||||||
public event VelocityUpdate OnVelocityUpdate;
|
public event VelocityUpdate OnVelocityUpdate;
|
||||||
public event OrientationUpdate OnOrientationUpdate;
|
public event OrientationUpdate OnOrientationUpdate;
|
||||||
public event RequestTerseUpdate OnRequestTerseUpdate;
|
public event RequestTerseUpdate OnRequestTerseUpdate;
|
||||||
|
public event GetCameraData OnPhysicsRequestingCameraData;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Subscribers to this event must synchronously handle the dictionary of collisions received, since the event
|
/// Subscribers to this event must synchronously handle the dictionary of collisions received, since the event
|
||||||
|
@ -176,6 +186,17 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
|
||||||
public event OutOfBounds OnOutOfBounds;
|
public event OutOfBounds OnOutOfBounds;
|
||||||
#pragma warning restore 67
|
#pragma warning restore 67
|
||||||
|
|
||||||
|
public CameraData TryGetCameraData()
|
||||||
|
{
|
||||||
|
GetCameraData handler = OnPhysicsRequestingCameraData;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
return handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
return new CameraData { Valid = false };
|
||||||
|
}
|
||||||
|
|
||||||
public static PhysicsActor Null
|
public static PhysicsActor Null
|
||||||
{
|
{
|
||||||
get { return new NullPhysicsActor(); }
|
get { return new NullPhysicsActor(); }
|
||||||
|
|
|
@ -332,15 +332,6 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool SupportsCombining()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {}
|
|
||||||
public virtual void CombineTerrain(float[] heightMap, Vector3 pOffset) {}
|
|
||||||
public virtual void UnCombine(PhysicsScene pScene) {}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Queue a raycast against the physics scene.
|
/// Queue a raycast against the physics scene.
|
||||||
/// The provided callback method will be called when the raycast is complete
|
/// The provided callback method will be called when the raycast is complete
|
||||||
|
|
|
@ -122,8 +122,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
private float m_buoyancy = 0f;
|
private float m_buoyancy = 0f;
|
||||||
|
|
||||||
private bool m_freemove = false;
|
private bool m_freemove = false;
|
||||||
// private CollisionLocker ode;
|
|
||||||
|
|
||||||
// private string m_name = String.Empty;
|
// private string m_name = String.Empty;
|
||||||
// other filter control
|
// other filter control
|
||||||
int m_colliderfilter = 0;
|
int m_colliderfilter = 0;
|
||||||
|
@ -1571,11 +1570,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
if (CollisionEventsThisFrame != null)
|
if (CollisionEventsThisFrame != null)
|
||||||
{
|
{
|
||||||
lock (CollisionEventsThisFrame)
|
CollisionEventsThisFrame.Clear();
|
||||||
{
|
CollisionEventsThisFrame = null;
|
||||||
CollisionEventsThisFrame.Clear();
|
|
||||||
CollisionEventsThisFrame = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m_eventsubscription = 0;
|
m_eventsubscription = 0;
|
||||||
_parent_scene.RemoveCollisionEventReporting(this);
|
_parent_scene.RemoveCollisionEventReporting(this);
|
||||||
|
@ -1585,11 +1581,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
if (CollisionEventsThisFrame == null)
|
if (CollisionEventsThisFrame == null)
|
||||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||||
lock (CollisionEventsThisFrame)
|
CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
|
||||||
{
|
_parent_scene.AddCollisionEventReporting(this);
|
||||||
CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
|
|
||||||
_parent_scene.AddCollisionEventReporting(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendCollisions(int timestep)
|
public void SendCollisions(int timestep)
|
||||||
|
@ -1600,28 +1593,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
if (CollisionEventsThisFrame == null)
|
if (CollisionEventsThisFrame == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (CollisionEventsThisFrame)
|
if (m_cureventsubscription < m_eventsubscription)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
|
||||||
|
|
||||||
|
if (!SentEmptyCollisionsEvent || ncolisions > 0)
|
||||||
{
|
{
|
||||||
if (m_cureventsubscription < m_eventsubscription)
|
base.SendCollisionUpdate(CollisionEventsThisFrame);
|
||||||
return;
|
m_cureventsubscription = 0;
|
||||||
|
|
||||||
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
|
if (ncolisions == 0)
|
||||||
|
|
||||||
if (!SentEmptyCollisionsEvent || ncolisions > 0)
|
|
||||||
{
|
{
|
||||||
base.SendCollisionUpdate(CollisionEventsThisFrame);
|
SentEmptyCollisionsEvent = true;
|
||||||
m_cureventsubscription = 0;
|
// _parent_scene.RemoveCollisionEventReporting(this);
|
||||||
|
}
|
||||||
if (ncolisions == 0)
|
else
|
||||||
{
|
{
|
||||||
SentEmptyCollisionsEvent = true;
|
SentEmptyCollisionsEvent = false;
|
||||||
// _parent_scene.RemoveCollisionEventReporting(this);
|
CollisionEventsThisFrame.Clear();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SentEmptyCollisionsEvent = false;
|
|
||||||
CollisionEventsThisFrame.Clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -648,6 +648,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// disable mouse steering
|
||||||
|
m_flags &= ~(VehicleFlag.MOUSELOOK_STEER |
|
||||||
|
VehicleFlag.MOUSELOOK_BANK |
|
||||||
|
VehicleFlag.CAMERA_DECOUPLED);
|
||||||
|
|
||||||
m_lmDecay = (1.0f - 1.0f / m_linearMotorDecayTimescale);
|
m_lmDecay = (1.0f - 1.0f / m_linearMotorDecayTimescale);
|
||||||
m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
|
m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
|
||||||
|
@ -794,6 +798,28 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
float ldampZ = 0;
|
float ldampZ = 0;
|
||||||
|
|
||||||
|
bool mousemode = false;
|
||||||
|
bool mousemodebank = false;
|
||||||
|
|
||||||
|
float bankingEfficiency;
|
||||||
|
float verticalAttractionTimescale = m_verticalAttractionTimescale;
|
||||||
|
|
||||||
|
if((m_flags & (VehicleFlag.MOUSELOOK_STEER | VehicleFlag.MOUSELOOK_BANK)) != 0 )
|
||||||
|
{
|
||||||
|
mousemode = true;
|
||||||
|
mousemodebank = (m_flags & VehicleFlag.MOUSELOOK_BANK) != 0;
|
||||||
|
if(mousemodebank)
|
||||||
|
{
|
||||||
|
bankingEfficiency = m_bankingEfficiency;
|
||||||
|
if(verticalAttractionTimescale < 149.9)
|
||||||
|
verticalAttractionTimescale *= 2.0f; // reduce current instability
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bankingEfficiency = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bankingEfficiency = m_bankingEfficiency;
|
||||||
|
|
||||||
// linear motor
|
// linear motor
|
||||||
if (m_lmEfect > 0.01 && m_linearMotorTimescale < 1000)
|
if (m_lmEfect > 0.01 && m_linearMotorTimescale < 1000)
|
||||||
{
|
{
|
||||||
|
@ -930,12 +956,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
}
|
}
|
||||||
|
|
||||||
// vertical atractor
|
// vertical atractor
|
||||||
if (m_verticalAttractionTimescale < 300)
|
if (verticalAttractionTimescale < 300)
|
||||||
{
|
{
|
||||||
float roll;
|
float roll;
|
||||||
float pitch;
|
float pitch;
|
||||||
|
|
||||||
float ftmp = m_invtimestep / m_verticalAttractionTimescale / m_verticalAttractionTimescale;
|
float ftmp = m_invtimestep / verticalAttractionTimescale / verticalAttractionTimescale;
|
||||||
|
|
||||||
float ftmp2;
|
float ftmp2;
|
||||||
ftmp2 = 0.5f * m_verticalAttractionEfficiency * m_invtimestep;
|
ftmp2 = 0.5f * m_verticalAttractionEfficiency * m_invtimestep;
|
||||||
|
@ -967,7 +993,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
torque.Y += effpitch * ftmp;
|
torque.Y += effpitch * ftmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_bankingEfficiency != 0 && Math.Abs(effroll) > 0.01)
|
if (bankingEfficiency != 0 && Math.Abs(effroll) > 0.01)
|
||||||
{
|
{
|
||||||
|
|
||||||
float broll = effroll;
|
float broll = effroll;
|
||||||
|
@ -1018,57 +1044,128 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
m_amdampZ = 1 / m_angularFrictionTimescale.Z;
|
m_amdampZ = 1 / m_angularFrictionTimescale.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
// angular motor
|
if(mousemode)
|
||||||
if (m_amEfect > 0.01 && m_angularMotorTimescale < 1000)
|
|
||||||
{
|
{
|
||||||
tmpV = m_angularMotorDirection - curLocalAngVel; // velocity error
|
CameraData cam = rootPrim.TryGetCameraData();
|
||||||
tmpV *= m_amEfect / m_angularMotorTimescale; // error to correct in this timestep
|
if(cam.Valid && cam.MouseLook)
|
||||||
torque.X += tmpV.X * m_ampwr;
|
{
|
||||||
torque.Y += tmpV.Y * m_ampwr;
|
Vector3 dirv = cam.CameraAtAxis * irotq;
|
||||||
torque.Z += tmpV.Z;
|
|
||||||
|
|
||||||
m_amEfect *= m_amDecay;
|
float invamts = 1.0f/m_angularMotorTimescale;
|
||||||
}
|
float tmp;
|
||||||
else
|
|
||||||
m_amEfect = 0;
|
|
||||||
|
|
||||||
// angular deflection
|
// get out of x == 0 plane
|
||||||
if (m_angularDeflectionEfficiency > 0)
|
if(Math.Abs(dirv.X) < 0.001f)
|
||||||
{
|
dirv.X = 0.001f;
|
||||||
Vector3 dirv;
|
|
||||||
|
if (Math.Abs(dirv.Z) > 0.01)
|
||||||
if (curLocalVel.X > 0.01f)
|
{
|
||||||
dirv = curLocalVel;
|
tmp = -(float)Math.Atan2(dirv.Z, dirv.X) * m_angularMotorDirection.Y;
|
||||||
else if (curLocalVel.X < -0.01f)
|
if(tmp < -4f)
|
||||||
// use oposite
|
tmp = -4f;
|
||||||
dirv = -curLocalVel;
|
else if(tmp > 4f)
|
||||||
|
tmp = 4f;
|
||||||
|
torque.Y += (tmp - curLocalAngVel.Y) * invamts;
|
||||||
|
torque.Y -= curLocalAngVel.Y * m_amdampY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
torque.Y -= curLocalAngVel.Y * m_invtimestep;
|
||||||
|
|
||||||
|
if (Math.Abs(dirv.Y) > 0.01)
|
||||||
|
{
|
||||||
|
if(mousemodebank)
|
||||||
|
{
|
||||||
|
tmp = -(float)Math.Atan2(dirv.Y, dirv.X) * m_angularMotorDirection.X;
|
||||||
|
if(tmp < -4f)
|
||||||
|
tmp = -4f;
|
||||||
|
else if(tmp > 4f)
|
||||||
|
tmp = 4f;
|
||||||
|
torque.X += (tmp - curLocalAngVel.X) * invamts;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmp = (float)Math.Atan2(dirv.Y, dirv.X) * m_angularMotorDirection.Z;
|
||||||
|
tmp *= invamts;
|
||||||
|
if(tmp < -4f)
|
||||||
|
tmp = -4f;
|
||||||
|
else if(tmp > 4f)
|
||||||
|
tmp = 4f;
|
||||||
|
torque.Z += (tmp - curLocalAngVel.Z) * invamts;
|
||||||
|
}
|
||||||
|
torque.X -= curLocalAngVel.X * m_amdampX;
|
||||||
|
torque.Z -= curLocalAngVel.Z * m_amdampZ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(mousemodebank)
|
||||||
|
torque.X -= curLocalAngVel.X * m_invtimestep;
|
||||||
|
else
|
||||||
|
torque.Z -= curLocalAngVel.Z * m_invtimestep;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// make it fall into small positive x case
|
if (curLocalAngVel.X != 0 || curLocalAngVel.Y != 0 || curLocalAngVel.Z != 0)
|
||||||
dirv.X = 0.01f;
|
{
|
||||||
dirv.Y = curLocalVel.Y;
|
torque.X -= curLocalAngVel.X * 10f;
|
||||||
dirv.Z = curLocalVel.Z;
|
torque.Y -= curLocalAngVel.Y * 10f;
|
||||||
}
|
torque.Z -= curLocalAngVel.Z * 10f;
|
||||||
|
}
|
||||||
float ftmp = m_angularDeflectionEfficiency / m_angularDeflectionTimescale;
|
|
||||||
|
|
||||||
if (Math.Abs(dirv.Z) > 0.01)
|
|
||||||
{
|
|
||||||
torque.Y += - (float)Math.Atan2(dirv.Z, dirv.X) * ftmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Math.Abs(dirv.Y) > 0.01)
|
|
||||||
{
|
|
||||||
torque.Z += (float)Math.Atan2(dirv.Y, dirv.X) * ftmp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// angular friction
|
|
||||||
if (curLocalAngVel.X != 0 || curLocalAngVel.Y != 0 || curLocalAngVel.Z != 0)
|
|
||||||
{
|
{
|
||||||
torque.X -= curLocalAngVel.X * m_amdampX;
|
// angular motor
|
||||||
torque.Y -= curLocalAngVel.Y * m_amdampY;
|
if (m_amEfect > 0.01 && m_angularMotorTimescale < 1000)
|
||||||
torque.Z -= curLocalAngVel.Z * m_amdampZ;
|
{
|
||||||
|
tmpV = m_angularMotorDirection - curLocalAngVel; // velocity error
|
||||||
|
tmpV *= m_amEfect / m_angularMotorTimescale; // error to correct in this timestep
|
||||||
|
torque.X += tmpV.X * m_ampwr;
|
||||||
|
torque.Y += tmpV.Y * m_ampwr;
|
||||||
|
torque.Z += tmpV.Z;
|
||||||
|
|
||||||
|
m_amEfect *= m_amDecay;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_amEfect = 0;
|
||||||
|
|
||||||
|
// angular deflection
|
||||||
|
if (m_angularDeflectionEfficiency > 0)
|
||||||
|
{
|
||||||
|
Vector3 dirv;
|
||||||
|
|
||||||
|
if (curLocalVel.X > 0.01f)
|
||||||
|
dirv = curLocalVel;
|
||||||
|
else if (curLocalVel.X < -0.01f)
|
||||||
|
// use oposite
|
||||||
|
dirv = -curLocalVel;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// make it fall into small positive x case
|
||||||
|
dirv.X = 0.01f;
|
||||||
|
dirv.Y = curLocalVel.Y;
|
||||||
|
dirv.Z = curLocalVel.Z;
|
||||||
|
}
|
||||||
|
|
||||||
|
float ftmp = m_angularDeflectionEfficiency / m_angularDeflectionTimescale;
|
||||||
|
|
||||||
|
if (Math.Abs(dirv.Z) > 0.01)
|
||||||
|
{
|
||||||
|
torque.Y += - (float)Math.Atan2(dirv.Z, dirv.X) * ftmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Math.Abs(dirv.Y) > 0.01)
|
||||||
|
{
|
||||||
|
torque.Z += (float)Math.Atan2(dirv.Y, dirv.X) * ftmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curLocalAngVel.X != 0 || curLocalAngVel.Y != 0 || curLocalAngVel.Z != 0)
|
||||||
|
{
|
||||||
|
torque.X -= curLocalAngVel.X * m_amdampX;
|
||||||
|
torque.Y -= curLocalAngVel.Y * m_amdampY;
|
||||||
|
torque.Z -= curLocalAngVel.Z * m_amdampZ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
force *= dmass.mass;
|
force *= dmass.mass;
|
||||||
|
|
|
@ -306,7 +306,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
public override uint LocalID
|
public override uint LocalID
|
||||||
{
|
{
|
||||||
get { return m_localID; }
|
get { return m_localID; }
|
||||||
set { m_localID = value; }
|
set
|
||||||
|
{
|
||||||
|
uint oldid = m_localID;
|
||||||
|
m_localID = value;
|
||||||
|
_parent_scene.changePrimID(this, oldid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor ParentActor
|
public override PhysicsActor ParentActor
|
||||||
|
@ -1066,8 +1071,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
public OdePrim(String primName, ODEScene parent_scene, Vector3 pos, Vector3 size,
|
public OdePrim(String primName, ODEScene parent_scene, Vector3 pos, Vector3 size,
|
||||||
Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID)
|
Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID)
|
||||||
{
|
{
|
||||||
|
_parent_scene = parent_scene;
|
||||||
|
|
||||||
Name = primName;
|
Name = primName;
|
||||||
LocalID = plocalID;
|
m_localID = plocalID;
|
||||||
|
|
||||||
m_vehicle = null;
|
m_vehicle = null;
|
||||||
|
|
||||||
|
@ -1113,7 +1120,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
_pbs = pbs;
|
_pbs = pbs;
|
||||||
|
|
||||||
_parent_scene = parent_scene;
|
|
||||||
m_targetSpace = IntPtr.Zero;
|
m_targetSpace = IntPtr.Zero;
|
||||||
|
|
||||||
if (pos.Z < 0)
|
if (pos.Z < 0)
|
||||||
|
@ -1159,6 +1165,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
m_OBBOffset = repData.OBBOffset;
|
m_OBBOffset = repData.OBBOffset;
|
||||||
|
|
||||||
UpdatePrimBodyData();
|
UpdatePrimBodyData();
|
||||||
|
|
||||||
|
AddChange(changes.Add, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetCollisionAccounting()
|
private void resetCollisionAccounting()
|
||||||
|
@ -2441,6 +2449,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
private void changeadd()
|
private void changeadd()
|
||||||
{
|
{
|
||||||
|
_parent_scene.addToPrims(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeAngularLock(byte newLocks)
|
private void changeAngularLock(byte newLocks)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -170,7 +171,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public bool m_OSOdeLib = false;
|
public bool m_OSOdeLib = false;
|
||||||
public bool m_suportCombine = false; // mega suport not tested
|
|
||||||
public Scene m_frameWorkScene = null;
|
public Scene m_frameWorkScene = null;
|
||||||
|
|
||||||
// private int threadid = 0;
|
// private int threadid = 0;
|
||||||
|
@ -258,9 +258,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
public ContactData[] m_materialContactsData = new ContactData[8];
|
public ContactData[] m_materialContactsData = new ContactData[8];
|
||||||
|
|
||||||
private Dictionary<Vector3, IntPtr> RegionTerrain = new Dictionary<Vector3, IntPtr>();
|
private IntPtr TerrainGeom;
|
||||||
private Dictionary<IntPtr, float[]> TerrainHeightFieldHeights = new Dictionary<IntPtr, float[]>();
|
private float[] TerrainHeightFieldHeight;
|
||||||
private Dictionary<IntPtr, GCHandle> TerrainHeightFieldHeightsHandlers = new Dictionary<IntPtr, GCHandle>();
|
private GCHandle TerrainHeightFieldHeightsHandler = new GCHandle();
|
||||||
|
|
||||||
private int m_physicsiterations = 15;
|
private int m_physicsiterations = 15;
|
||||||
private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
|
private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
|
||||||
|
@ -302,9 +302,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
public int physics_logging_interval = 0;
|
public int physics_logging_interval = 0;
|
||||||
public bool physics_logging_append_existing_logfile = false;
|
public bool physics_logging_append_existing_logfile = false;
|
||||||
|
|
||||||
private Vector3 m_worldOffset = Vector3.Zero;
|
|
||||||
public Vector2 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize);
|
public Vector2 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize);
|
||||||
private PhysicsScene m_parentScene = null;
|
|
||||||
|
|
||||||
private ODERayCastRequestManager m_rayCastManager;
|
private ODERayCastRequestManager m_rayCastManager;
|
||||||
public ODEMeshWorker m_meshWorker;
|
public ODEMeshWorker m_meshWorker;
|
||||||
|
@ -379,8 +377,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
WorldExtents.Y = m_frameWorkScene.RegionInfo.RegionSizeY;
|
WorldExtents.Y = m_frameWorkScene.RegionInfo.RegionSizeY;
|
||||||
m_regionHeight = (uint)WorldExtents.Y;
|
m_regionHeight = (uint)WorldExtents.Y;
|
||||||
|
|
||||||
m_suportCombine = false;
|
|
||||||
|
|
||||||
lock (OdeLock)
|
lock (OdeLock)
|
||||||
{
|
{
|
||||||
// Create the world and the first space
|
// Create the world and the first space
|
||||||
|
@ -803,14 +799,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update actors collision score
|
|
||||||
if (p1.CollisionScore >= float.MaxValue - count)
|
|
||||||
p1.CollisionScore = 0;
|
|
||||||
p1.CollisionScore += count;
|
|
||||||
|
|
||||||
if (p2.CollisionScore >= float.MaxValue - count)
|
|
||||||
p2.CollisionScore = 0;
|
|
||||||
p2.CollisionScore += count;
|
|
||||||
|
|
||||||
// get first contact
|
// get first contact
|
||||||
d.ContactGeom curContact = new d.ContactGeom();
|
d.ContactGeom curContact = new d.ContactGeom();
|
||||||
|
@ -1056,6 +1044,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
uint obj2LocalID = 0;
|
uint obj2LocalID = 0;
|
||||||
|
|
||||||
|
// update actors collision score
|
||||||
|
if (p1.CollisionScore < float.MaxValue)
|
||||||
|
p1.CollisionScore += 1.0f;
|
||||||
|
if (p2.CollisionScore < float.MaxValue)
|
||||||
|
p2.CollisionScore += 1.0f;
|
||||||
|
|
||||||
bool p1events = p1.SubscribedEvents();
|
bool p1events = p1.SubscribedEvents();
|
||||||
bool p2events = p2.SubscribedEvents();
|
bool p2events = p2.SubscribedEvents();
|
||||||
|
|
||||||
|
@ -1328,8 +1322,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
|
|
||||||
newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID);
|
newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID);
|
||||||
lock (_prims)
|
|
||||||
_prims[newPrim.LocalID] = newPrim;
|
|
||||||
}
|
}
|
||||||
return newPrim;
|
return newPrim;
|
||||||
}
|
}
|
||||||
|
@ -1350,7 +1342,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapeType, uint localid)
|
Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapeType, uint localid)
|
||||||
{
|
{
|
||||||
|
|
||||||
return AddPrim(primName, position, size, rotation, pbs, isPhysical,isPhantom, shapeType, localid);
|
return AddPrim(primName, position, size, rotation, pbs, isPhysical,isPhantom, shapeType, localid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1396,6 +1387,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addToPrims(OdePrim prim)
|
||||||
|
{
|
||||||
|
lock (_prims)
|
||||||
|
_prims[prim.LocalID] = prim;
|
||||||
|
}
|
||||||
|
|
||||||
public OdePrim getPrim(uint id)
|
public OdePrim getPrim(uint id)
|
||||||
{
|
{
|
||||||
lock (_prims)
|
lock (_prims)
|
||||||
|
@ -1413,6 +1410,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
return _prims.ContainsKey(prm.LocalID);
|
return _prims.ContainsKey(prm.LocalID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changePrimID(OdePrim prim,uint oldID)
|
||||||
|
{
|
||||||
|
lock (_prims)
|
||||||
|
{
|
||||||
|
if(_prims.ContainsKey(oldID))
|
||||||
|
_prims.Remove(oldID);
|
||||||
|
_prims[prim.LocalID] = prim;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool haveActor(PhysicsActor actor)
|
public bool haveActor(PhysicsActor actor)
|
||||||
{
|
{
|
||||||
if (actor is OdePrim)
|
if (actor is OdePrim)
|
||||||
|
@ -1922,30 +1929,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
public float GetTerrainHeightAtXY(float x, float y)
|
public float GetTerrainHeightAtXY(float x, float y)
|
||||||
{
|
{
|
||||||
|
if (TerrainGeom == IntPtr.Zero)
|
||||||
int offsetX = 0;
|
|
||||||
int offsetY = 0;
|
|
||||||
|
|
||||||
if (m_suportCombine)
|
|
||||||
{
|
|
||||||
offsetX = ((int)(x / (int)Constants.RegionSize)) * (int)Constants.RegionSize;
|
|
||||||
offsetY = ((int)(y / (int)Constants.RegionSize)) * (int)Constants.RegionSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get region map
|
|
||||||
IntPtr heightFieldGeom = IntPtr.Zero;
|
|
||||||
if (!RegionTerrain.TryGetValue(new Vector3(offsetX, offsetY, 0), out heightFieldGeom))
|
|
||||||
return 0f;
|
return 0f;
|
||||||
|
|
||||||
if (heightFieldGeom == IntPtr.Zero)
|
if (TerrainHeightFieldHeight == null || TerrainHeightFieldHeight.Length == 0)
|
||||||
return 0f;
|
|
||||||
|
|
||||||
if (!TerrainHeightFieldHeights.ContainsKey(heightFieldGeom))
|
|
||||||
return 0f;
|
return 0f;
|
||||||
|
|
||||||
// TerrainHeightField for ODE as offset 1m
|
// TerrainHeightField for ODE as offset 1m
|
||||||
x += 1f - offsetX;
|
x += 1f;
|
||||||
y += 1f - offsetY;
|
y += 1f;
|
||||||
|
|
||||||
// make position fit into array
|
// make position fit into array
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
@ -2024,7 +2016,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
iy *= regsize;
|
iy *= regsize;
|
||||||
iy += ix; // all indexes have iy + ix
|
iy += ix; // all indexes have iy + ix
|
||||||
|
|
||||||
float[] heights = TerrainHeightFieldHeights[heightFieldGeom];
|
float[] heights = TerrainHeightFieldHeight;
|
||||||
/*
|
/*
|
||||||
if ((dx + dy) <= 1.0f)
|
if ((dx + dy) <= 1.0f)
|
||||||
{
|
{
|
||||||
|
@ -2061,31 +2053,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
public Vector3 GetTerrainNormalAtXY(float x, float y)
|
public Vector3 GetTerrainNormalAtXY(float x, float y)
|
||||||
{
|
{
|
||||||
int offsetX = 0;
|
|
||||||
int offsetY = 0;
|
|
||||||
|
|
||||||
if (m_suportCombine)
|
|
||||||
{
|
|
||||||
offsetX = ((int)(x / (int)Constants.RegionSize)) * (int)Constants.RegionSize;
|
|
||||||
offsetY = ((int)(y / (int)Constants.RegionSize)) * (int)Constants.RegionSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get region map
|
|
||||||
IntPtr heightFieldGeom = IntPtr.Zero;
|
|
||||||
Vector3 norm = new Vector3(0, 0, 1);
|
Vector3 norm = new Vector3(0, 0, 1);
|
||||||
|
|
||||||
if (!RegionTerrain.TryGetValue(new Vector3(offsetX, offsetY, 0), out heightFieldGeom))
|
if (TerrainGeom == IntPtr.Zero)
|
||||||
return norm; ;
|
|
||||||
|
|
||||||
if (heightFieldGeom == IntPtr.Zero)
|
|
||||||
return norm;
|
return norm;
|
||||||
|
|
||||||
if (!TerrainHeightFieldHeights.ContainsKey(heightFieldGeom))
|
if (TerrainHeightFieldHeight == null || TerrainHeightFieldHeight.Length == 0)
|
||||||
return norm;
|
return norm;
|
||||||
|
|
||||||
// TerrainHeightField for ODE as offset 1m
|
// TerrainHeightField for ODE as offset 1m
|
||||||
x += 1f - offsetX;
|
x += 1f;
|
||||||
y += 1f - offsetY;
|
y += 1f;
|
||||||
|
|
||||||
// make position fit into array
|
// make position fit into array
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
|
@ -2172,7 +2150,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
iy *= regsize;
|
iy *= regsize;
|
||||||
iy += ix; // all indexes have iy + ix
|
iy += ix; // all indexes have iy + ix
|
||||||
|
|
||||||
float[] heights = TerrainHeightFieldHeights[heightFieldGeom];
|
float[] heights = TerrainHeightFieldHeight;
|
||||||
|
|
||||||
if (firstTri)
|
if (firstTri)
|
||||||
{
|
{
|
||||||
|
@ -2198,35 +2176,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetTerrain(float[] heightMap)
|
public override void SetTerrain(float[] heightMap)
|
||||||
{
|
|
||||||
if (m_worldOffset != Vector3.Zero && m_parentScene != null)
|
|
||||||
{
|
|
||||||
if (m_parentScene is ODEScene)
|
|
||||||
{
|
|
||||||
((ODEScene)m_parentScene).SetTerrain(heightMap, m_worldOffset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetTerrain(heightMap, m_worldOffset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void CombineTerrain(float[] heightMap, Vector3 pOffset)
|
|
||||||
{
|
|
||||||
if(m_suportCombine)
|
|
||||||
SetTerrain(heightMap, pOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetTerrain(float[] heightMap, Vector3 pOffset)
|
|
||||||
{
|
{
|
||||||
if (m_OSOdeLib)
|
if (m_OSOdeLib)
|
||||||
OSSetTerrain(heightMap, pOffset);
|
OSSetTerrain(heightMap);
|
||||||
else
|
else
|
||||||
OriSetTerrain(heightMap, pOffset);
|
OriSetTerrain(heightMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OriSetTerrain(float[] heightMap, Vector3 pOffset)
|
public void OriSetTerrain(float[] heightMap)
|
||||||
{
|
{
|
||||||
// assumes 1m size grid and constante size square regions
|
// assumes 1m size grid and constante size square regions
|
||||||
// needs to know about sims around in future
|
// needs to know about sims around in future
|
||||||
|
@ -2291,45 +2248,40 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
d.AllocateODEDataForThread(~0U);
|
d.AllocateODEDataForThread(~0U);
|
||||||
|
|
||||||
IntPtr GroundGeom = IntPtr.Zero;
|
if (TerrainGeom != IntPtr.Zero)
|
||||||
if (RegionTerrain.TryGetValue(pOffset, out GroundGeom))
|
|
||||||
{
|
{
|
||||||
RegionTerrain.Remove(pOffset);
|
actor_name_map.Remove(TerrainGeom);
|
||||||
if (GroundGeom != IntPtr.Zero)
|
d.GeomDestroy(TerrainGeom);
|
||||||
{
|
|
||||||
actor_name_map.Remove(GroundGeom);
|
|
||||||
d.GeomDestroy(GroundGeom);
|
|
||||||
|
|
||||||
if (TerrainHeightFieldHeights.ContainsKey(GroundGeom))
|
|
||||||
{
|
|
||||||
TerrainHeightFieldHeightsHandlers[GroundGeom].Free();
|
|
||||||
TerrainHeightFieldHeightsHandlers.Remove(GroundGeom);
|
|
||||||
TerrainHeightFieldHeights.Remove(GroundGeom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TerrainHeightFieldHeightsHandler.IsAllocated)
|
||||||
|
TerrainHeightFieldHeightsHandler.Free();
|
||||||
|
|
||||||
IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
|
IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
|
||||||
|
|
||||||
GCHandle _heightmaphandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned);
|
GC.Collect(1);
|
||||||
|
|
||||||
d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmaphandler.AddrOfPinnedObject(), 0,
|
TerrainHeightFieldHeightsHandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned);
|
||||||
|
|
||||||
|
d.GeomHeightfieldDataBuildSingle(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0,
|
||||||
heightmapHeight, heightmapWidth ,
|
heightmapHeight, heightmapWidth ,
|
||||||
(int)heightmapHeightSamples, (int)heightmapWidthSamples, scale,
|
(int)heightmapHeightSamples, (int)heightmapWidthSamples, scale,
|
||||||
offset, thickness, wrap);
|
offset, thickness, wrap);
|
||||||
|
|
||||||
d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
|
d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
|
||||||
|
|
||||||
GroundGeom = d.CreateHeightfield(GroundSpace, HeightmapData, 1);
|
TerrainGeom = d.CreateHeightfield(GroundSpace, HeightmapData, 1);
|
||||||
|
|
||||||
if (GroundGeom != IntPtr.Zero)
|
if (TerrainGeom != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
d.GeomSetCategoryBits(GroundGeom, (uint)(CollisionCategories.Land));
|
d.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land));
|
||||||
d.GeomSetCollideBits(GroundGeom, 0);
|
d.GeomSetCollideBits(TerrainGeom, 0);
|
||||||
|
|
||||||
PhysicsActor pa = new NullPhysicsActor();
|
PhysicsActor pa = new NullPhysicsActor();
|
||||||
pa.Name = "Terrain";
|
pa.Name = "Terrain";
|
||||||
pa.PhysicsActorType = (int)ActorTypes.Ground;
|
pa.PhysicsActorType = (int)ActorTypes.Ground;
|
||||||
actor_name_map[GroundGeom] = pa;
|
actor_name_map[TerrainGeom] = pa;
|
||||||
|
|
||||||
// geom_name_map[GroundGeom] = "Terrain";
|
// geom_name_map[GroundGeom] = "Terrain";
|
||||||
|
|
||||||
|
@ -2339,16 +2291,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
q.Z = 0.5f;
|
q.Z = 0.5f;
|
||||||
q.W = 0.5f;
|
q.W = 0.5f;
|
||||||
|
|
||||||
d.GeomSetQuaternion(GroundGeom, ref q);
|
d.GeomSetQuaternion(TerrainGeom, ref q);
|
||||||
d.GeomSetPosition(GroundGeom, pOffset.X + m_regionWidth * 0.5f, pOffset.Y + m_regionHeight * 0.5f, 0.0f);
|
d.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f);
|
||||||
RegionTerrain.Add(pOffset, GroundGeom);
|
TerrainHeightFieldHeight = _heightmap;
|
||||||
TerrainHeightFieldHeights.Add(GroundGeom, _heightmap);
|
|
||||||
TerrainHeightFieldHeightsHandlers.Add(GroundGeom, _heightmaphandler);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
TerrainHeightFieldHeightsHandler.Free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OSSetTerrain(float[] heightMap, Vector3 pOffset)
|
public void OSSetTerrain(float[] heightMap)
|
||||||
{
|
{
|
||||||
// assumes 1m size grid and constante size square regions
|
// assumes 1m size grid and constante size square regions
|
||||||
// needs to know about sims around in future
|
// needs to know about sims around in future
|
||||||
|
@ -2402,26 +2354,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
}
|
}
|
||||||
yt += heightmapWidthSamples;
|
yt += heightmapWidthSamples;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (OdeLock)
|
lock (OdeLock)
|
||||||
{
|
{
|
||||||
IntPtr GroundGeom = IntPtr.Zero;
|
if (TerrainGeom != IntPtr.Zero)
|
||||||
if (RegionTerrain.TryGetValue(pOffset, out GroundGeom))
|
|
||||||
{
|
{
|
||||||
RegionTerrain.Remove(pOffset);
|
actor_name_map.Remove(TerrainGeom);
|
||||||
if (GroundGeom != IntPtr.Zero)
|
d.GeomDestroy(TerrainGeom);
|
||||||
{
|
|
||||||
actor_name_map.Remove(GroundGeom);
|
|
||||||
d.GeomDestroy(GroundGeom);
|
|
||||||
|
|
||||||
if (TerrainHeightFieldHeights.ContainsKey(GroundGeom))
|
|
||||||
{
|
|
||||||
if (TerrainHeightFieldHeightsHandlers[GroundGeom].IsAllocated)
|
|
||||||
TerrainHeightFieldHeightsHandlers[GroundGeom].Free();
|
|
||||||
TerrainHeightFieldHeightsHandlers.Remove(GroundGeom);
|
|
||||||
TerrainHeightFieldHeights.Remove(GroundGeom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TerrainHeightFieldHeightsHandler.IsAllocated)
|
||||||
|
TerrainHeightFieldHeightsHandler.Free();
|
||||||
|
|
||||||
|
TerrainHeightFieldHeight = null;
|
||||||
|
|
||||||
IntPtr HeightmapData = d.GeomOSTerrainDataCreate();
|
IntPtr HeightmapData = d.GeomOSTerrainDataCreate();
|
||||||
|
|
||||||
const int wrap = 0;
|
const int wrap = 0;
|
||||||
|
@ -2429,32 +2375,31 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
if (thickness < 0)
|
if (thickness < 0)
|
||||||
thickness = 1;
|
thickness = 1;
|
||||||
|
|
||||||
GCHandle _heightmaphandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned);
|
TerrainHeightFieldHeightsHandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned);
|
||||||
|
|
||||||
d.GeomOSTerrainDataBuild(HeightmapData, _heightmaphandler.AddrOfPinnedObject(), 0, 1.0f,
|
d.GeomOSTerrainDataBuild(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0, 1.0f,
|
||||||
(int)heightmapWidthSamples, (int)heightmapHeightSamples,
|
(int)heightmapWidthSamples, (int)heightmapHeightSamples,
|
||||||
thickness, wrap);
|
thickness, wrap);
|
||||||
|
|
||||||
// d.GeomOSTerrainDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
|
// d.GeomOSTerrainDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
|
||||||
GroundGeom = d.CreateOSTerrain(GroundSpace, HeightmapData, 1);
|
TerrainGeom = d.CreateOSTerrain(GroundSpace, HeightmapData, 1);
|
||||||
if (GroundGeom != IntPtr.Zero)
|
if (TerrainGeom != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
d.GeomSetCategoryBits(GroundGeom, (uint)(CollisionCategories.Land));
|
d.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land));
|
||||||
d.GeomSetCollideBits(GroundGeom, 0);
|
d.GeomSetCollideBits(TerrainGeom, 0);
|
||||||
|
|
||||||
|
|
||||||
PhysicsActor pa = new NullPhysicsActor();
|
PhysicsActor pa = new NullPhysicsActor();
|
||||||
pa.Name = "Terrain";
|
pa.Name = "Terrain";
|
||||||
pa.PhysicsActorType = (int)ActorTypes.Ground;
|
pa.PhysicsActorType = (int)ActorTypes.Ground;
|
||||||
actor_name_map[GroundGeom] = pa;
|
actor_name_map[TerrainGeom] = pa;
|
||||||
|
|
||||||
// geom_name_map[GroundGeom] = "Terrain";
|
// geom_name_map[GroundGeom] = "Terrain";
|
||||||
|
|
||||||
d.GeomSetPosition(GroundGeom, pOffset.X + m_regionWidth * 0.5f, pOffset.Y + m_regionHeight * 0.5f, 0.0f);
|
d.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f);
|
||||||
RegionTerrain.Add(pOffset, GroundGeom);
|
TerrainHeightFieldHeight = _heightmap;
|
||||||
TerrainHeightFieldHeights.Add(GroundGeom, _heightmap);
|
}
|
||||||
TerrainHeightFieldHeightsHandlers.Add(GroundGeom, _heightmaphandler);
|
else
|
||||||
}
|
TerrainHeightFieldHeightsHandler.Free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2467,11 +2412,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
return waterlevel;
|
return waterlevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool SupportsCombining()
|
|
||||||
{
|
|
||||||
return m_suportCombine;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetWaterLevel(float baseheight)
|
public override void SetWaterLevel(float baseheight)
|
||||||
{
|
{
|
||||||
waterlevel = baseheight;
|
waterlevel = baseheight;
|
||||||
|
@ -2518,26 +2458,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
foreach (OdeCharacter ch in chtorem)
|
foreach (OdeCharacter ch in chtorem)
|
||||||
ch.DoAChange(changes.Remove, null);
|
ch.DoAChange(changes.Remove, null);
|
||||||
|
|
||||||
|
if (TerrainGeom != IntPtr.Zero)
|
||||||
|
d.GeomDestroy(TerrainGeom);
|
||||||
|
TerrainGeom = IntPtr.Zero;
|
||||||
|
|
||||||
foreach (IntPtr GroundGeom in RegionTerrain.Values)
|
if (TerrainHeightFieldHeightsHandler.IsAllocated)
|
||||||
{
|
TerrainHeightFieldHeightsHandler.Free();
|
||||||
if (GroundGeom != IntPtr.Zero)
|
|
||||||
d.GeomDestroy(GroundGeom);
|
|
||||||
}
|
|
||||||
|
|
||||||
RegionTerrain.Clear();
|
TerrainHeightFieldHeight = null;
|
||||||
|
|
||||||
if (TerrainHeightFieldHeightsHandlers.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (GCHandle gch in TerrainHeightFieldHeightsHandlers.Values)
|
|
||||||
{
|
|
||||||
if (gch.IsAllocated)
|
|
||||||
gch.Free();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TerrainHeightFieldHeightsHandlers.Clear();
|
|
||||||
TerrainHeightFieldHeights.Clear();
|
|
||||||
|
|
||||||
if (ContactgeomsArray != IntPtr.Zero)
|
if (ContactgeomsArray != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
@ -2556,27 +2484,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int compareByCollisionsDesc(OdePrim A, OdePrim B)
|
||||||
|
{
|
||||||
|
return -A.CollisionScore.CompareTo(B.CollisionScore);
|
||||||
|
}
|
||||||
|
|
||||||
public override Dictionary<uint, float> GetTopColliders()
|
public override Dictionary<uint, float> GetTopColliders()
|
||||||
{
|
{
|
||||||
Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
|
Dictionary<uint, float> topColliders;
|
||||||
int cnt = 0;
|
List<OdePrim> orderedPrims;
|
||||||
lock (_prims)
|
lock (_activeprims)
|
||||||
{
|
orderedPrims = new List<OdePrim>(_activeprims);
|
||||||
foreach (OdePrim prm in _prims.Values)
|
|
||||||
{
|
orderedPrims.Sort(compareByCollisionsDesc);
|
||||||
if (prm.CollisionScore > 0)
|
topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore);
|
||||||
{
|
|
||||||
returncolliders.Add(prm.LocalID, prm.CollisionScore);
|
return topColliders;
|
||||||
cnt++;
|
|
||||||
prm.CollisionScore = 0f;
|
|
||||||
if (cnt > 25)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return returncolliders;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool SupportsRayCast()
|
public override bool SupportsRayCast()
|
||||||
|
|
|
@ -121,9 +121,9 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
|
|
||||||
CacheExpire = TimeSpan.FromHours(fcache);
|
CacheExpire = TimeSpan.FromHours(fcache);
|
||||||
|
|
||||||
if(doMeshFileCache && cachePath != "")
|
lock (diskLock)
|
||||||
{
|
{
|
||||||
lock (diskLock)
|
if(doMeshFileCache && cachePath != "")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -619,7 +619,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
vs.Clear();
|
vs.Clear();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f))
|
if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f))
|
||||||
{
|
{
|
||||||
vs.Clear();
|
vs.Clear();
|
||||||
|
@ -657,6 +657,45 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3);
|
f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3);
|
||||||
faces.Add(f);
|
faces.Add(f);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
List<int> indices;
|
||||||
|
if (!HullUtils.ComputeHull(vs, out indices))
|
||||||
|
{
|
||||||
|
vs.Clear();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
nverts = vs.Count;
|
||||||
|
nindexs = indices.Count;
|
||||||
|
|
||||||
|
if (nindexs % 3 != 0)
|
||||||
|
{
|
||||||
|
vs.Clear();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < nverts; i++)
|
||||||
|
{
|
||||||
|
c.X = vs[i].x;
|
||||||
|
c.Y = vs[i].y;
|
||||||
|
c.Z = vs[i].z;
|
||||||
|
coords.Add(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < nindexs; i += 3)
|
||||||
|
{
|
||||||
|
t1 = indices[i];
|
||||||
|
if (t1 > nverts)
|
||||||
|
break;
|
||||||
|
t2 = indices[i + 1];
|
||||||
|
if (t2 > nverts)
|
||||||
|
break;
|
||||||
|
t3 = indices[i + 2];
|
||||||
|
if (t3 > nverts)
|
||||||
|
break;
|
||||||
|
f = new Face(vertsoffset + t1, vertsoffset + t2, vertsoffset + t3);
|
||||||
|
faces.Add(f);
|
||||||
|
}
|
||||||
vertsoffset += nverts;
|
vertsoffset += nverts;
|
||||||
vs.Clear();
|
vs.Clear();
|
||||||
}
|
}
|
||||||
|
@ -686,13 +725,15 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
vs.Add(f3);
|
vs.Add(f3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vs.Count < 3)
|
nverts = vs.Count;
|
||||||
|
|
||||||
|
if (nverts < 3)
|
||||||
{
|
{
|
||||||
vs.Clear();
|
vs.Clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vs.Count < 5)
|
if (nverts < 5)
|
||||||
{
|
{
|
||||||
foreach (float3 point in vs)
|
foreach (float3 point in vs)
|
||||||
{
|
{
|
||||||
|
@ -701,10 +742,11 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
c.Z = point.z;
|
c.Z = point.z;
|
||||||
coords.Add(c);
|
coords.Add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
f = new Face(0, 1, 2);
|
f = new Face(0, 1, 2);
|
||||||
faces.Add(f);
|
faces.Add(f);
|
||||||
|
|
||||||
if (vs.Count == 4)
|
if (nverts == 4)
|
||||||
{
|
{
|
||||||
f = new Face(0, 2, 3);
|
f = new Face(0, 2, 3);
|
||||||
faces.Add(f);
|
faces.Add(f);
|
||||||
|
@ -716,7 +758,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
vs.Clear();
|
vs.Clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f))
|
if (!HullUtils.ComputeHull(vs, ref hullr, 0, 0.0f))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -747,7 +789,38 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
f = new Face(t1, t2, t3);
|
f = new Face(t1, t2, t3);
|
||||||
faces.Add(f);
|
faces.Add(f);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
List<int> indices;
|
||||||
|
if (!HullUtils.ComputeHull(vs, out indices))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
nindexs = indices.Count;
|
||||||
|
|
||||||
|
if (nindexs % 3 != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (i = 0; i < nverts; i++)
|
||||||
|
{
|
||||||
|
c.X = vs[i].x;
|
||||||
|
c.Y = vs[i].y;
|
||||||
|
c.Z = vs[i].z;
|
||||||
|
coords.Add(c);
|
||||||
|
}
|
||||||
|
for (i = 0; i < nindexs; i += 3)
|
||||||
|
{
|
||||||
|
t1 = indices[i];
|
||||||
|
if (t1 > nverts)
|
||||||
|
break;
|
||||||
|
t2 = indices[i + 1];
|
||||||
|
if (t2 > nverts)
|
||||||
|
break;
|
||||||
|
t3 = indices[i + 2];
|
||||||
|
if (t3 > nverts)
|
||||||
|
break;
|
||||||
|
f = new Face(t1, t2, t3);
|
||||||
|
faces.Add(f);
|
||||||
|
}
|
||||||
|
vs.Clear();
|
||||||
if (coords.Count > 0 && faces.Count > 0)
|
if (coords.Count > 0 && faces.Count > 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace PrimMesher
|
||||||
int numLodPixels = lod * lod; // (32 * 2)^2 = 64^2 pixels for default sculpt map image
|
int numLodPixels = lod * lod; // (32 * 2)^2 = 64^2 pixels for default sculpt map image
|
||||||
|
|
||||||
bool needsScaling = false;
|
bool needsScaling = false;
|
||||||
bool smallMap = false;
|
bool smallMap = false;
|
||||||
|
|
||||||
width = bmW;
|
width = bmW;
|
||||||
height = bmH;
|
height = bmH;
|
||||||
|
@ -69,16 +69,8 @@ namespace PrimMesher
|
||||||
needsScaling = true;
|
needsScaling = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
if (needsScaling)
|
||||||
{
|
bm = ScaleImage(bm, width, height);
|
||||||
if (needsScaling)
|
|
||||||
bm = ScaleImage(bm, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new Exception("Exception in ScaleImage(): e: " + e.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (width * height > numLodPixels)
|
if (width * height > numLodPixels)
|
||||||
{
|
{
|
||||||
|
@ -129,11 +121,15 @@ namespace PrimMesher
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
if (needsScaling)
|
||||||
|
bm.Dispose();
|
||||||
throw new Exception("Caught exception processing byte arrays in SculptMap(): e: " + e.ToString());
|
throw new Exception("Caught exception processing byte arrays in SculptMap(): e: " + e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
width++;
|
width++;
|
||||||
height++;
|
height++;
|
||||||
|
if(needsScaling)
|
||||||
|
bm.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<List<Coord>> ToRows(bool mirror)
|
public List<List<Coord>> ToRows(bool mirror)
|
||||||
|
@ -168,11 +164,9 @@ namespace PrimMesher
|
||||||
|
|
||||||
private Bitmap ScaleImage(Bitmap srcImage, int destWidth, int destHeight)
|
private Bitmap ScaleImage(Bitmap srcImage, int destWidth, int destHeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
Bitmap scaledImage = new Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb);
|
Bitmap scaledImage = new Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb);
|
||||||
|
|
||||||
Color c;
|
Color c;
|
||||||
|
|
||||||
|
|
||||||
// will let last step to be eventually diferent, as seems to be in sl
|
// will let last step to be eventually diferent, as seems to be in sl
|
||||||
|
|
||||||
|
|
|
@ -4323,6 +4323,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID);
|
SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID);
|
||||||
|
if (targetPart == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (targetPart.ParentGroup.AttachmentPoint != 0)
|
if (targetPart.ParentGroup.AttachmentPoint != 0)
|
||||||
return; // Fail silently if attached
|
return; // Fail silently if attached
|
||||||
|
@ -4332,23 +4334,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
SceneObjectGroup parentPrim = null, childPrim = null;
|
SceneObjectGroup parentPrim = null, childPrim = null;
|
||||||
|
|
||||||
if (targetPart != null)
|
if (parent != 0)
|
||||||
{
|
{
|
||||||
if (parent != 0)
|
parentPrim = m_host.ParentGroup;
|
||||||
{
|
childPrim = targetPart.ParentGroup;
|
||||||
parentPrim = m_host.ParentGroup;
|
|
||||||
childPrim = targetPart.ParentGroup;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
parentPrim = targetPart.ParentGroup;
|
|
||||||
childPrim = m_host.ParentGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Required for linking
|
|
||||||
childPrim.RootPart.ClearUpdateSchedule();
|
|
||||||
parentPrim.LinkToGroup(childPrim, true);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
parentPrim = targetPart.ParentGroup;
|
||||||
|
childPrim = m_host.ParentGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required for linking
|
||||||
|
childPrim.RootPart.ClearUpdateSchedule();
|
||||||
|
parentPrim.LinkToGroup(childPrim, true);
|
||||||
|
|
||||||
|
|
||||||
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
|
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
parentPrim.RootPart.CreateSelected = true;
|
parentPrim.RootPart.CreateSelected = true;
|
||||||
|
@ -4741,20 +4741,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
Vector3 av3 = Util.Clip(color, 0.0f, 1.0f);
|
Vector3 av3 = Util.Clip(color, 0.0f, 1.0f);
|
||||||
if (text.Length > 254)
|
|
||||||
text = text.Remove(254);
|
|
||||||
|
|
||||||
byte[] data;
|
byte[] data;
|
||||||
do
|
data = Util.StringToBytes256(text);
|
||||||
{
|
text = Util.UTF8.GetString(data);
|
||||||
data = Util.UTF8.GetBytes(text);
|
|
||||||
if (data.Length > 254)
|
|
||||||
text = text.Substring(0, text.Length - 1);
|
|
||||||
} while (data.Length > 254);
|
|
||||||
|
|
||||||
m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
|
m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
|
||||||
//m_host.ParentGroup.HasGroupChanged = true;
|
|
||||||
//m_host.ParentGroup.ScheduleGroupForFullUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Float llWater(LSL_Vector offset)
|
public LSL_Float llWater(LSL_Vector offset)
|
||||||
|
@ -5118,13 +5108,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.CollisionSoundVolume = (float)impact_volume;
|
m_host.CollisionSoundVolume = (float)impact_volume;
|
||||||
m_host.CollisionSound = m_host.invalidCollisionSoundUUID;
|
m_host.CollisionSound = m_host.invalidCollisionSoundUUID;
|
||||||
m_host.CollisionSoundType = 0;
|
m_host.CollisionSoundType = -1; // disable all sounds
|
||||||
|
m_host.aggregateScriptEvents();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Parameter check logic required.
|
// TODO: Parameter check logic required.
|
||||||
m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound);
|
UUID soundId = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound);
|
||||||
m_host.CollisionSoundVolume = (float)impact_volume;
|
if(soundId != UUID.Zero)
|
||||||
m_host.CollisionSoundType = 1;
|
{
|
||||||
|
m_host.CollisionSound = soundId;
|
||||||
|
m_host.CollisionSoundVolume = (float)impact_volume;
|
||||||
|
m_host.CollisionSoundType = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_host.CollisionSoundType = -1;
|
||||||
|
|
||||||
|
m_host.aggregateScriptEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_String llGetAnimation(string id)
|
public LSL_String llGetAnimation(string id)
|
||||||
|
@ -14679,13 +14679,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
msAvailable -= m_castRayCalls[i].UsedMs;
|
msAvailable -= m_castRayCalls[i].UsedMs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Return failure if not enough available time
|
// Return failure if not enough available time
|
||||||
if (msAvailable < m_msMinInCastRay)
|
if (msAvailable < m_msMinInCastRay)
|
||||||
{
|
{
|
||||||
result.Add(new LSL_Integer(ScriptBaseClass.RCERR_CAST_TIME_EXCEEDED));
|
result.Add(new LSL_Integer(ScriptBaseClass.RCERR_CAST_TIME_EXCEEDED));
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
|
@ -15073,13 +15073,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
// Add to throttle data
|
// Add to throttle data
|
||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
CastRayCall castRayCall = new CastRayCall();
|
|
||||||
castRayCall.RegionId = regionId;
|
|
||||||
castRayCall.UserId = userId;
|
|
||||||
castRayCall.CalledMs = calledMs;
|
|
||||||
castRayCall.UsedMs = (int)stopWatch.ElapsedMilliseconds;
|
|
||||||
lock (m_castRayCalls)
|
lock (m_castRayCalls)
|
||||||
{
|
{
|
||||||
|
CastRayCall castRayCall = new CastRayCall();
|
||||||
|
castRayCall.RegionId = regionId;
|
||||||
|
castRayCall.UserId = userId;
|
||||||
|
castRayCall.CalledMs = calledMs;
|
||||||
|
castRayCall.UsedMs = (int)stopWatch.ElapsedMilliseconds;
|
||||||
m_castRayCalls.Add(castRayCall);
|
m_castRayCalls.Add(castRayCall);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.Framework.Scenes.Scripting;
|
||||||
using OpenSim.Region.ScriptEngine.Shared;
|
using OpenSim.Region.ScriptEngine.Shared;
|
||||||
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
||||||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||||
|
@ -4250,5 +4251,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, opts).ToString();
|
return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, opts).ToString();
|
||||||
return UUID.Zero.ToString();
|
return UUID.Zero.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void osCollisionSound(string impact_sound, double impact_volume)
|
||||||
|
{
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
if(impact_sound == "")
|
||||||
|
{
|
||||||
|
m_host.CollisionSoundVolume = (float)impact_volume;
|
||||||
|
m_host.CollisionSound = m_host.invalidCollisionSoundUUID;
|
||||||
|
if(impact_volume == 0.0)
|
||||||
|
m_host.CollisionSoundType = -1; // disable all sounds
|
||||||
|
else if(impact_volume == 1.0f)
|
||||||
|
m_host.CollisionSoundType = 0; // full return to default sounds
|
||||||
|
else
|
||||||
|
m_host.CollisionSoundType = 2; // default sounds with volume
|
||||||
|
m_host.aggregateScriptEvents();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// TODO: Parameter check logic required.
|
||||||
|
UUID soundId = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound);
|
||||||
|
if(soundId != UUID.Zero)
|
||||||
|
{
|
||||||
|
m_host.CollisionSound = soundId;
|
||||||
|
m_host.CollisionSoundVolume = (float)impact_volume;
|
||||||
|
m_host.CollisionSoundType = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_host.CollisionSoundType = -1;
|
||||||
|
|
||||||
|
m_host.aggregateScriptEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
// still not very usefull, detector is lost on rez, restarts, etc
|
||||||
|
public void osVolumeDetect(int detect)
|
||||||
|
{
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_host.ScriptSetVolumeDetect(detect != 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -476,5 +476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
|
|
||||||
LSL_String osRequestURL(LSL_List options);
|
LSL_String osRequestURL(LSL_List options);
|
||||||
LSL_String osRequestSecureURL(LSL_List options);
|
LSL_String osRequestSecureURL(LSL_List options);
|
||||||
|
void osCollisionSound(string impact_sound, double impact_volume);
|
||||||
|
void osVolumeDetect(int detect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1089,5 +1089,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
{
|
{
|
||||||
return m_OSSL_Functions.osRequestSecureURL(options);
|
return m_OSSL_Functions.osRequestSecureURL(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void osCollisionSound(string impact_sound, double impact_volume)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osCollisionSound(impact_sound, impact_volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void osVolumeDetect(int detect)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osVolumeDetect(detect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -81,8 +81,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||||
|
|
||||||
// private object m_syncy = new object();
|
// private object m_syncy = new object();
|
||||||
|
|
||||||
private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
|
// private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
|
||||||
private static VBCodeProvider VBcodeProvider = new VBCodeProvider();
|
// private static VBCodeProvider VBcodeProvider = new VBCodeProvider();
|
||||||
|
|
||||||
// private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files
|
// private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files
|
||||||
private static UInt64 scriptCompileCounter = 0; // And a counter
|
private static UInt64 scriptCompileCounter = 0; // And a counter
|
||||||
|
@ -356,14 +356,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||||
throw new Exception(errtext);
|
throw new Exception(errtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
string compileScript = source;
|
string compileScript = string.Empty;
|
||||||
|
|
||||||
if (language == enumCompileType.lsl)
|
if (language == enumCompileType.lsl)
|
||||||
{
|
{
|
||||||
// Its LSL, convert it to C#
|
// Its LSL, convert it to C#
|
||||||
LSL_Converter = (ICodeConverter)new CSCodeGenerator(comms, m_insertCoopTerminationCalls);
|
|
||||||
compileScript = LSL_Converter.Convert(source);
|
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder(16394);
|
||||||
|
|
||||||
|
LSL_Converter = (ICodeConverter)new CSCodeGenerator(comms, m_insertCoopTerminationCalls);
|
||||||
|
AddCSScriptHeader(
|
||||||
|
m_scriptEngine.ScriptClassName,
|
||||||
|
m_scriptEngine.ScriptBaseClassName,
|
||||||
|
m_scriptEngine.ScriptBaseClassParameters,
|
||||||
|
sb);
|
||||||
|
|
||||||
|
LSL_Converter.Convert(source,sb);
|
||||||
|
AddCSScriptTail(sb);
|
||||||
|
compileScript = sb.ToString();
|
||||||
// copy converter warnings into our warnings.
|
// copy converter warnings into our warnings.
|
||||||
foreach (string warning in LSL_Converter.GetWarnings())
|
foreach (string warning in LSL_Converter.GetWarnings())
|
||||||
{
|
{
|
||||||
|
@ -374,22 +384,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||||
// Write the linemap to a file and save it in our dictionary for next time.
|
// Write the linemap to a file and save it in our dictionary for next time.
|
||||||
m_lineMaps[assembly] = linemap;
|
m_lineMaps[assembly] = linemap;
|
||||||
WriteMapFile(assembly + ".map", linemap);
|
WriteMapFile(assembly + ".map", linemap);
|
||||||
|
LSL_Converter.Clear();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
switch (language)
|
{
|
||||||
{
|
switch (language)
|
||||||
case enumCompileType.cs:
|
{
|
||||||
case enumCompileType.lsl:
|
case enumCompileType.cs:
|
||||||
compileScript = CreateCSCompilerScript(
|
compileScript = CreateCSCompilerScript(
|
||||||
compileScript,
|
compileScript,
|
||||||
m_scriptEngine.ScriptClassName,
|
m_scriptEngine.ScriptClassName,
|
||||||
m_scriptEngine.ScriptBaseClassName,
|
m_scriptEngine.ScriptBaseClassName,
|
||||||
m_scriptEngine.ScriptBaseClassParameters);
|
m_scriptEngine.ScriptBaseClassParameters);
|
||||||
break;
|
break;
|
||||||
case enumCompileType.vb:
|
case enumCompileType.vb:
|
||||||
compileScript = CreateVBCompilerScript(
|
compileScript = CreateVBCompilerScript(
|
||||||
compileScript, m_scriptEngine.ScriptClassName, m_scriptEngine.ScriptBaseClassName);
|
compileScript, m_scriptEngine.ScriptClassName, m_scriptEngine.ScriptBaseClassName);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assembly = CompileFromDotNetText(compileScript, language, asset, assembly);
|
assembly = CompileFromDotNetText(compileScript, language, asset, assembly);
|
||||||
|
@ -419,6 +431,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||||
// return compileScript;
|
// return compileScript;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
public static void AddCSScriptHeader(string className, string baseClassName, ParameterInfo[] constructorParameters, StringBuilder sb)
|
||||||
|
{
|
||||||
|
sb.Append(string.Format(
|
||||||
|
@"using OpenSim.Region.ScriptEngine.Shared;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SecondLife
|
||||||
|
{{
|
||||||
|
public class {0} : {1}
|
||||||
|
{{
|
||||||
|
public {0}({2}) : base({3}) {{}}
|
||||||
|
",
|
||||||
|
className,
|
||||||
|
baseClassName,
|
||||||
|
constructorParameters != null
|
||||||
|
? string.Join(", ", Array.ConvertAll<ParameterInfo, string>(constructorParameters, pi => pi.ToString()))
|
||||||
|
: "",
|
||||||
|
constructorParameters != null
|
||||||
|
? string.Join(", ", Array.ConvertAll<ParameterInfo, string>(constructorParameters, pi => pi.Name))
|
||||||
|
: ""
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddCSScriptTail(StringBuilder sb)
|
||||||
|
{
|
||||||
|
sb.Append(string.Format(" }}\n}}\n"));
|
||||||
|
}
|
||||||
|
|
||||||
public static string CreateCSCompilerScript(
|
public static string CreateCSCompilerScript(
|
||||||
string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters)
|
string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters)
|
||||||
{
|
{
|
||||||
|
@ -511,8 +551,6 @@ namespace SecondLife
|
||||||
// Do actual compile
|
// Do actual compile
|
||||||
CompilerParameters parameters = new CompilerParameters();
|
CompilerParameters parameters = new CompilerParameters();
|
||||||
|
|
||||||
parameters.IncludeDebugInformation = true;
|
|
||||||
|
|
||||||
string rootPath = AppDomain.CurrentDomain.BaseDirectory;
|
string rootPath = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
|
||||||
parameters.ReferencedAssemblies.Add(Path.Combine(rootPath,
|
parameters.ReferencedAssemblies.Add(Path.Combine(rootPath,
|
||||||
|
@ -532,26 +570,44 @@ namespace SecondLife
|
||||||
parameters.IncludeDebugInformation = CompileWithDebugInformation;
|
parameters.IncludeDebugInformation = CompileWithDebugInformation;
|
||||||
//parameters.WarningLevel = 1; // Should be 4?
|
//parameters.WarningLevel = 1; // Should be 4?
|
||||||
parameters.TreatWarningsAsErrors = false;
|
parameters.TreatWarningsAsErrors = false;
|
||||||
|
parameters.GenerateInMemory = false;
|
||||||
|
|
||||||
CompilerResults results;
|
CompilerResults results;
|
||||||
|
|
||||||
|
CodeDomProvider provider;
|
||||||
switch (lang)
|
switch (lang)
|
||||||
{
|
{
|
||||||
case enumCompileType.vb:
|
case enumCompileType.vb:
|
||||||
results = VBcodeProvider.CompileAssemblyFromSource(
|
// results = VBcodeProvider.CompileAssemblyFromSource(
|
||||||
parameters, Script);
|
// parameters, Script);
|
||||||
|
provider = CodeDomProvider.CreateProvider("VisualBasic");
|
||||||
break;
|
break;
|
||||||
case enumCompileType.cs:
|
case enumCompileType.cs:
|
||||||
case enumCompileType.lsl:
|
case enumCompileType.lsl:
|
||||||
|
provider = CodeDomProvider.CreateProvider("CSharp");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Compiler is not able to recongnize " +
|
||||||
|
"language type \"" + lang.ToString() + "\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(provider == null)
|
||||||
|
throw new Exception("Compiler failed to load ");
|
||||||
|
|
||||||
|
|
||||||
bool complete = false;
|
bool complete = false;
|
||||||
bool retried = false;
|
bool retried = false;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
lock (CScodeProvider)
|
// lock (CScodeProvider)
|
||||||
{
|
// {
|
||||||
results = CScodeProvider.CompileAssemblyFromSource(
|
// results = CScodeProvider.CompileAssemblyFromSource(
|
||||||
|
// parameters, Script);
|
||||||
|
// }
|
||||||
|
|
||||||
|
results = provider.CompileAssemblyFromSource(
|
||||||
parameters, Script);
|
parameters, Script);
|
||||||
}
|
|
||||||
|
|
||||||
// Deal with an occasional segv in the compiler.
|
// Deal with an occasional segv in the compiler.
|
||||||
// Rarely, if ever, occurs twice in succession.
|
// Rarely, if ever, occurs twice in succession.
|
||||||
// Line # == 0 and no file name are indications that
|
// Line # == 0 and no file name are indications that
|
||||||
|
@ -575,11 +631,11 @@ namespace SecondLife
|
||||||
complete = true;
|
complete = true;
|
||||||
}
|
}
|
||||||
} while (!complete);
|
} while (!complete);
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
throw new Exception("Compiler is not able to recongnize " +
|
// throw new Exception("Compiler is not able to recongnize " +
|
||||||
"language type \"" + lang.ToString() + "\"");
|
// "language type \"" + lang.ToString() + "\"");
|
||||||
}
|
// }
|
||||||
|
|
||||||
// foreach (Type type in results.CompiledAssembly.GetTypes())
|
// foreach (Type type in results.CompiledAssembly.GetTypes())
|
||||||
// {
|
// {
|
||||||
|
@ -628,6 +684,8 @@ namespace SecondLife
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provider.Dispose();
|
||||||
|
|
||||||
if (hadErrors)
|
if (hadErrors)
|
||||||
{
|
{
|
||||||
throw new Exception(errtext);
|
throw new Exception(errtext);
|
||||||
|
@ -785,15 +843,16 @@ namespace SecondLife
|
||||||
|
|
||||||
private static void WriteMapFile(string filename, Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap)
|
private static void WriteMapFile(string filename, Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap)
|
||||||
{
|
{
|
||||||
string mapstring = String.Empty;
|
StringBuilder mapbuilder = new StringBuilder(1024);
|
||||||
|
|
||||||
foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> kvp in linemap)
|
foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> kvp in linemap)
|
||||||
{
|
{
|
||||||
KeyValuePair<int, int> k = kvp.Key;
|
KeyValuePair<int, int> k = kvp.Key;
|
||||||
KeyValuePair<int, int> v = kvp.Value;
|
KeyValuePair<int, int> v = kvp.Value;
|
||||||
mapstring += String.Format("{0},{1},{2},{3}\n", k.Key, k.Value, v.Key, v.Value);
|
mapbuilder.Append(String.Format("{0},{1},{2},{3}\n", k.Key, k.Value, v.Key, v.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
Byte[] mapbytes = Encoding.ASCII.GetBytes(mapstring);
|
Byte[] mapbytes = Encoding.ASCII.GetBytes(mapbuilder.ToString());
|
||||||
|
|
||||||
using (FileStream mfs = File.Create(filename))
|
using (FileStream mfs = File.Create(filename))
|
||||||
mfs.Write(mapbytes, 0, mapbytes.Length);
|
mfs.Write(mapbytes, 0, mapbytes.Length);
|
||||||
|
|
|
@ -27,12 +27,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||||
{
|
{
|
||||||
public interface ICodeConverter
|
public interface ICodeConverter
|
||||||
{
|
{
|
||||||
string Convert(string script);
|
string Convert(string script);
|
||||||
|
void Convert(string script, StringBuilder sb);
|
||||||
string[] GetWarnings();
|
string[] GetWarnings();
|
||||||
|
void Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||||
Constant rca = new Constant(p, "float", "0.0");
|
Constant rca = new Constant(p, "float", "0.0");
|
||||||
Constant rcb = new Constant(p, "float", "0.0");
|
Constant rcb = new Constant(p, "float", "0.0");
|
||||||
Constant rcc = new Constant(p, "float", "0.0");
|
Constant rcc = new Constant(p, "float", "0.0");
|
||||||
Constant rcd = new Constant(p, "float", "0.0");
|
Constant rcd = new Constant(p, "float", "1.0");
|
||||||
ConstantExpression rcea = new ConstantExpression(p, rca);
|
ConstantExpression rcea = new ConstantExpression(p, rca);
|
||||||
ConstantExpression rceb = new ConstantExpression(p, rcb);
|
ConstantExpression rceb = new ConstantExpression(p, rcb);
|
||||||
ConstantExpression rcec = new ConstantExpression(p, rcc);
|
ConstantExpression rcec = new ConstantExpression(p, rcc);
|
||||||
|
|
|
@ -1388,7 +1388,7 @@ default
|
||||||
"\n LSL_Types.list m = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger(2), new LSL_Types.LSLInteger(3));" +
|
"\n LSL_Types.list m = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger(2), new LSL_Types.LSLInteger(3));" +
|
||||||
"\n LSL_Types.Vector3 v = new LSL_Types.Vector3(new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0));" +
|
"\n LSL_Types.Vector3 v = new LSL_Types.Vector3(new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0));" +
|
||||||
"\n LSL_Types.Vector3 w = new LSL_Types.Vector3(new LSL_Types.LSLFloat(1.0), new LSL_Types.LSLFloat(0.1), new LSL_Types.LSLFloat(0.5));" +
|
"\n LSL_Types.Vector3 w = new LSL_Types.Vector3(new LSL_Types.LSLFloat(1.0), new LSL_Types.LSLFloat(0.1), new LSL_Types.LSLFloat(0.5));" +
|
||||||
"\n LSL_Types.Quaternion r = new LSL_Types.Quaternion(new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0));" +
|
"\n LSL_Types.Quaternion r = new LSL_Types.Quaternion(new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(1.0));" +
|
||||||
"\n LSL_Types.Quaternion u = new LSL_Types.Quaternion(new LSL_Types.LSLFloat(0.8), new LSL_Types.LSLFloat(0.7), new LSL_Types.LSLFloat(0.6), llSomeFunc());" +
|
"\n LSL_Types.Quaternion u = new LSL_Types.Quaternion(new LSL_Types.LSLFloat(0.8), new LSL_Types.LSLFloat(0.7), new LSL_Types.LSLFloat(0.6), llSomeFunc());" +
|
||||||
"\n LSL_Types.LSLString k = new LSL_Types.LSLString(\"\");" +
|
"\n LSL_Types.LSLString k = new LSL_Types.LSLString(\"\");" +
|
||||||
"\n LSL_Types.LSLString n = new LSL_Types.LSLString(\"ping\");" +
|
"\n LSL_Types.LSLString n = new LSL_Types.LSLString(\"ping\");" +
|
||||||
|
|
|
@ -37,6 +37,7 @@ using OpenSim.Tests.Common;
|
||||||
|
|
||||||
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the LSL compiler. Among other things, test that error messages
|
/// Tests the LSL compiler. Among other things, test that error messages
|
||||||
/// generated by the C# compiler can be mapped to prper lines/columns in
|
/// generated by the C# compiler can be mapped to prper lines/columns in
|
||||||
|
@ -132,7 +133,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
||||||
|
|
||||||
return compilerResults;
|
return compilerResults;
|
||||||
}
|
}
|
||||||
|
/* test too depedent on counting lines and columns maping code generation changes
|
||||||
|
erros position is better tested on viewers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test that line number errors are resolved as expected when preceding code contains a jump.
|
/// Test that line number errors are resolved as expected when preceding code contains a jump.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -159,6 +161,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
||||||
positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]);
|
positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test the C# compiler error message can be mapped to the correct
|
/// Test the C# compiler error message can be mapped to the correct
|
||||||
/// line/column in the LSL source when an undeclared variable is used.
|
/// line/column in the LSL source when an undeclared variable is used.
|
||||||
|
@ -183,7 +186,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
||||||
new KeyValuePair<int, int>(5, 21),
|
new KeyValuePair<int, int>(5, 21),
|
||||||
positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]);
|
positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test that a string can be cast to string and another string
|
/// Test that a string can be cast to string and another string
|
||||||
/// concatenated.
|
/// concatenated.
|
||||||
|
|
|
@ -416,7 +416,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
PostEvent(new EventParams("on_rez",
|
PostEvent(new EventParams("on_rez",
|
||||||
new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0]));
|
new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_stateSource == StateSource.AttachedRez)
|
if (m_stateSource == StateSource.AttachedRez)
|
||||||
{
|
{
|
||||||
PostEvent(new EventParams("attach",
|
PostEvent(new EventParams("attach",
|
||||||
|
@ -457,7 +456,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
PostEvent(new EventParams("attach",
|
PostEvent(new EventParams("attach",
|
||||||
new object[] { new LSL_Types.LSLString(m_AttachedAvatar.ToString()) }, new DetectParams[0]));
|
new object[] { new LSL_Types.LSLString(m_AttachedAvatar.ToString()) }, new DetectParams[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,9 +805,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
lock (EventQueue)
|
lock (EventQueue)
|
||||||
{
|
{
|
||||||
data = (EventParams)EventQueue.Dequeue();
|
data = (EventParams)EventQueue.Dequeue();
|
||||||
if (data == null) // Shouldn't happen
|
if (data == null)
|
||||||
{
|
{
|
||||||
if (EventQueue.Count > 0 && Running && !ShuttingDown)
|
// check if a null event was enqueued or if its really empty
|
||||||
|
if (EventQueue.Count > 0 && Running && !ShuttingDown && !m_InSelfDelete)
|
||||||
{
|
{
|
||||||
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||||
}
|
}
|
||||||
|
@ -870,13 +869,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Exception e = null;
|
||||||
|
|
||||||
if (Engine.World.PipeEventsForScript(LocalID) ||
|
if (Engine.World.PipeEventsForScript(LocalID) ||
|
||||||
data.EventName == "control") // Don't freeze avies!
|
data.EventName == "control") // Don't freeze avies!
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
|
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
|
||||||
// PrimName, ScriptName, data.EventName, State);
|
// PrimName, ScriptName, data.EventName, State);
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_CurrentEvent = data.EventName;
|
m_CurrentEvent = data.EventName;
|
||||||
|
@ -891,6 +891,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
{
|
{
|
||||||
m_InEvent = false;
|
m_InEvent = false;
|
||||||
m_CurrentEvent = String.Empty;
|
m_CurrentEvent = String.Empty;
|
||||||
|
lock (EventQueue)
|
||||||
|
m_CurrentWorkItem = null; // no longer in a event that can be canceled
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_SaveState)
|
if (m_SaveState)
|
||||||
|
@ -903,7 +905,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
m_SaveState = false;
|
m_SaveState = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception exx)
|
||||||
|
{
|
||||||
|
e = exx;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e != null)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
|
// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
|
||||||
|
@ -979,7 +986,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
ScriptTask.ItemID, ScriptTask.AssetID, data.EventName, EventsProcessed);
|
ScriptTask.ItemID, ScriptTask.AssetID, data.EventName, EventsProcessed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EventQueue.Count > 0 && Running && !ShuttingDown)
|
if (EventQueue.Count > 0 && Running && !ShuttingDown && !m_InSelfDelete)
|
||||||
{
|
{
|
||||||
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,7 +339,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
y = (float)Quat.y;
|
y = (float)Quat.y;
|
||||||
z = (float)Quat.z;
|
z = (float)Quat.z;
|
||||||
s = (float)Quat.s;
|
s = (float)Quat.s;
|
||||||
if (x == 0 && y == 0 && z == 0 && s == 0)
|
if (s == 0 && x == 0 && y == 0 && z == 0)
|
||||||
s = 1;
|
s = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
y = Y;
|
y = Y;
|
||||||
z = Z;
|
z = Z;
|
||||||
s = S;
|
s = S;
|
||||||
if (x == 0 && y == 0 && z == 0 && s == 0)
|
if (s == 0 && x == 0 && y == 0 && z == 0)
|
||||||
s = 1;
|
s = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
res = res & Double.TryParse(tmps[1], NumberStyles.Float, Culture.NumberFormatInfo, out y);
|
res = res & Double.TryParse(tmps[1], NumberStyles.Float, Culture.NumberFormatInfo, out y);
|
||||||
res = res & Double.TryParse(tmps[2], NumberStyles.Float, Culture.NumberFormatInfo, out z);
|
res = res & Double.TryParse(tmps[2], NumberStyles.Float, Culture.NumberFormatInfo, out z);
|
||||||
res = res & Double.TryParse(tmps[3], NumberStyles.Float, Culture.NumberFormatInfo, out s);
|
res = res & Double.TryParse(tmps[3], NumberStyles.Float, Culture.NumberFormatInfo, out s);
|
||||||
if (x == 0 && y == 0 && z == 0 && s == 0)
|
if (s == 0 && x == 0 && y == 0 && z == 0)
|
||||||
s = 1;
|
s = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -408,10 +408,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
public void attach(uint localID, UUID itemID, UUID avatar)
|
public void attach(uint localID, UUID itemID, UUID avatar)
|
||||||
{
|
{
|
||||||
myScriptEngine.PostObjectEvent(localID, new EventParams(
|
SceneObjectGroup grp = myScriptEngine.World.GetSceneObjectGroup(localID);
|
||||||
|
if(grp == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach(SceneObjectPart part in grp.Parts)
|
||||||
|
{
|
||||||
|
myScriptEngine.PostObjectEvent(part.LocalId, new EventParams(
|
||||||
"attach",new object[] {
|
"attach",new object[] {
|
||||||
new LSL_Types.LSLString(avatar.ToString()) },
|
new LSL_Types.LSLString(avatar.ToString()) },
|
||||||
new DetectParams[0]));
|
new DetectParams[0]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dataserver: not handled here
|
// dataserver: not handled here
|
||||||
|
|
|
@ -1024,18 +1024,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
// m_log.DebugFormat("[XEngine]: Added script {0} to compile queue", itemID);
|
// m_log.DebugFormat("[XEngine]: Added script {0} to compile queue", itemID);
|
||||||
|
|
||||||
if (m_CurrentCompile == null)
|
// NOTE: Although we use a lockless queue, the lock here
|
||||||
|
// is required. It ensures that there are never two
|
||||||
|
// compile threads running, which, due to a race
|
||||||
|
// conndition, might otherwise happen
|
||||||
|
//
|
||||||
|
lock (m_CompileQueue)
|
||||||
{
|
{
|
||||||
// NOTE: Although we use a lockless queue, the lock here
|
if (m_CurrentCompile == null)
|
||||||
// is required. It ensures that there are never two
|
m_CurrentCompile = m_ThreadPool.QueueWorkItem(DoOnRezScriptQueue, null);
|
||||||
// compile threads running, which, due to a race
|
|
||||||
// conndition, might otherwise happen
|
|
||||||
//
|
|
||||||
lock (m_CompileQueue)
|
|
||||||
{
|
|
||||||
if (m_CurrentCompile == null)
|
|
||||||
m_CurrentCompile = m_ThreadPool.QueueWorkItem(DoOnRezScriptQueue, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1281,6 +1278,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// do not load a assembly on top of a lot of to release memory
|
||||||
|
// also yield a bit
|
||||||
|
// only if logins disable since causes a lot of rubber banding
|
||||||
|
if(!m_Scene.LoginsEnabled)
|
||||||
|
GC.Collect(2);
|
||||||
|
|
||||||
ScriptInstance instance = null;
|
ScriptInstance instance = null;
|
||||||
lock (m_Scripts)
|
lock (m_Scripts)
|
||||||
{
|
{
|
||||||
|
@ -1288,26 +1291,27 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
if ((!m_Scripts.ContainsKey(itemID)) ||
|
if ((!m_Scripts.ContainsKey(itemID)) ||
|
||||||
(m_Scripts[itemID].AssetID != assetID))
|
(m_Scripts[itemID].AssetID != assetID))
|
||||||
{
|
{
|
||||||
UUID appDomain = assetID;
|
// UUID appDomain = assetID;
|
||||||
|
|
||||||
if (part.ParentGroup.IsAttachment)
|
// if (part.ParentGroup.IsAttachment)
|
||||||
appDomain = part.ParentGroup.RootPart.UUID;
|
// appDomain = part.ParentGroup.RootPart.UUID;
|
||||||
|
UUID appDomain = part.ParentGroup.RootPart.UUID;
|
||||||
|
|
||||||
if (!m_AppDomains.ContainsKey(appDomain))
|
if (!m_AppDomains.ContainsKey(appDomain))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AppDomainSetup appSetup = new AppDomainSetup();
|
|
||||||
appSetup.PrivateBinPath = Path.Combine(
|
|
||||||
m_ScriptEnginesPath,
|
|
||||||
m_Scene.RegionInfo.RegionID.ToString());
|
|
||||||
|
|
||||||
Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
|
|
||||||
Evidence evidence = new Evidence(baseEvidence);
|
|
||||||
|
|
||||||
AppDomain sandbox;
|
AppDomain sandbox;
|
||||||
if (m_AppDomainLoading)
|
if (m_AppDomainLoading)
|
||||||
{
|
{
|
||||||
|
AppDomainSetup appSetup = new AppDomainSetup();
|
||||||
|
appSetup.PrivateBinPath = Path.Combine(
|
||||||
|
m_ScriptEnginesPath,
|
||||||
|
m_Scene.RegionInfo.RegionID.ToString());
|
||||||
|
|
||||||
|
Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
|
||||||
|
Evidence evidence = new Evidence(baseEvidence);
|
||||||
|
|
||||||
sandbox = AppDomain.CreateDomain(
|
sandbox = AppDomain.CreateDomain(
|
||||||
m_Scene.RegionInfo.RegionID.ToString(),
|
m_Scene.RegionInfo.RegionID.ToString(),
|
||||||
evidence, appSetup);
|
evidence, appSetup);
|
||||||
|
@ -1472,9 +1476,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
startParam, postOnRez,
|
startParam, postOnRez,
|
||||||
m_MaxScriptQueue);
|
m_MaxScriptQueue);
|
||||||
|
|
||||||
if (
|
if(!instance.Load(scriptObj, coopSleepHandle, assemblyPath,
|
||||||
!instance.Load(
|
|
||||||
scriptObj, coopSleepHandle, assemblyPath,
|
|
||||||
Path.Combine(ScriptEnginePath, World.RegionInfo.RegionID.ToString()), stateSource, coopTerminationForThisScript))
|
Path.Combine(ScriptEnginePath, World.RegionInfo.RegionID.ToString()), stateSource, coopTerminationForThisScript))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1506,11 +1508,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_PrimObjects[localID].Add(itemID);
|
m_PrimObjects[localID].Add(itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_Assemblies.ContainsKey(assetID))
|
|
||||||
m_Assemblies[assetID] = assemblyPath;
|
|
||||||
|
|
||||||
lock (m_AddingAssemblies)
|
lock (m_AddingAssemblies)
|
||||||
{
|
{
|
||||||
|
if (!m_Assemblies.ContainsKey(assetID))
|
||||||
|
m_Assemblies[assetID] = assemblyPath;
|
||||||
|
|
||||||
m_AddingAssemblies[assemblyPath]--;
|
m_AddingAssemblies[assemblyPath]--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,10 +139,12 @@ namespace OpenSim.Server.Base
|
||||||
startupConfig = Config.Configs["Startup"];
|
startupConfig = Config.Configs["Startup"];
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigDirectory = startupConfig.GetString("ConfigDirectory", ".");
|
if (startupConfig != null)
|
||||||
|
{
|
||||||
prompt = startupConfig.GetString("Prompt", prompt);
|
ConfigDirectory = startupConfig.GetString("ConfigDirectory", ".");
|
||||||
|
|
||||||
|
prompt = startupConfig.GetString("Prompt", prompt);
|
||||||
|
}
|
||||||
// Allow derived classes to load config before the console is opened.
|
// Allow derived classes to load config before the console is opened.
|
||||||
ReadConfig();
|
ReadConfig();
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Land
|
||||||
ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]);
|
ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]);
|
||||||
uint x = Convert.ToUInt32(requestData["x"]);
|
uint x = Convert.ToUInt32(requestData["x"]);
|
||||||
uint y = Convert.ToUInt32(requestData["y"]);
|
uint y = Convert.ToUInt32(requestData["y"]);
|
||||||
m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle);
|
// m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle);
|
||||||
|
|
||||||
byte regionAccess;
|
byte regionAccess;
|
||||||
LandData landData = m_LocalService.GetLandData(UUID.Zero, regionHandle, x, y, out regionAccess);
|
LandData landData = m_LocalService.GetLandData(UUID.Zero, regionHandle, x, y, out regionAccess);
|
||||||
|
|
|
@ -328,12 +328,16 @@ namespace OpenSim.Server.Handlers.UserAccounts
|
||||||
if (request.ContainsKey("Email"))
|
if (request.ContainsKey("Email"))
|
||||||
email = request["Email"].ToString();
|
email = request["Email"].ToString();
|
||||||
|
|
||||||
|
string model = "";
|
||||||
|
if (request.ContainsKey("Model"))
|
||||||
|
model = request["Model"].ToString();
|
||||||
|
|
||||||
UserAccount createdUserAccount = null;
|
UserAccount createdUserAccount = null;
|
||||||
|
|
||||||
if (m_UserAccountService is UserAccountService)
|
if (m_UserAccountService is UserAccountService)
|
||||||
createdUserAccount
|
createdUserAccount
|
||||||
= ((UserAccountService)m_UserAccountService).CreateUser(
|
= ((UserAccountService)m_UserAccountService).CreateUser(
|
||||||
scopeID, principalID, firstName, lastName, password, email);
|
scopeID, principalID, firstName, lastName, password, email, model);
|
||||||
|
|
||||||
if (createdUserAccount == null)
|
if (createdUserAccount == null)
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
@ -393,4 +397,4 @@ namespace OpenSim.Server.Handlers.UserAccounts
|
||||||
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
|
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,10 +46,13 @@ namespace OpenSim.Services.Connectors
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
const int MAXSENDRETRIESLEN = 30;
|
||||||
|
|
||||||
private string m_ServerURI = String.Empty;
|
private string m_ServerURI = String.Empty;
|
||||||
private IImprovedAssetCache m_Cache = null;
|
private IImprovedAssetCache m_Cache = null;
|
||||||
private int m_retryCounter;
|
private int m_retryCounter;
|
||||||
private Dictionary<int, List<AssetBase>> m_retryQueue = new Dictionary<int, List<AssetBase>>();
|
private bool m_inRetries;
|
||||||
|
private List<AssetBase>[] m_sendRetries = new List<AssetBase>[MAXSENDRETRIESLEN];
|
||||||
private System.Timers.Timer m_retryTimer;
|
private System.Timers.Timer m_retryTimer;
|
||||||
private int m_maxAssetRequestConcurrency = 30;
|
private int m_maxAssetRequestConcurrency = 30;
|
||||||
|
|
||||||
|
@ -110,9 +113,9 @@ namespace OpenSim.Services.Connectors
|
||||||
throw new Exception("Asset connector init error");
|
throw new Exception("Asset connector init error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_retryTimer = new System.Timers.Timer();
|
m_retryTimer = new System.Timers.Timer();
|
||||||
m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck);
|
m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck);
|
||||||
|
m_retryTimer.AutoReset = true;
|
||||||
m_retryTimer.Interval = 60000;
|
m_retryTimer.Interval = 60000;
|
||||||
|
|
||||||
Uri serverUri = new Uri(m_ServerURI);
|
Uri serverUri = new Uri(m_ServerURI);
|
||||||
|
@ -166,48 +169,67 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
protected void retryCheck(object source, ElapsedEventArgs e)
|
protected void retryCheck(object source, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
m_retryCounter++;
|
lock(m_sendRetries)
|
||||||
if (m_retryCounter > 60)
|
|
||||||
m_retryCounter -= 60;
|
|
||||||
|
|
||||||
List<int> keys = new List<int>();
|
|
||||||
foreach (int a in m_retryQueue.Keys)
|
|
||||||
{
|
{
|
||||||
keys.Add(a);
|
if(m_inRetries)
|
||||||
|
return;
|
||||||
|
m_inRetries = true;
|
||||||
}
|
}
|
||||||
foreach (int a in keys)
|
|
||||||
|
m_retryCounter++;
|
||||||
|
if(m_retryCounter >= 61 ) // avoid overflow 60 is max in use below
|
||||||
|
m_retryCounter = 1;
|
||||||
|
|
||||||
|
int inUse = 0;
|
||||||
|
int nextlevel;
|
||||||
|
int timefactor;
|
||||||
|
List<AssetBase> retrylist;
|
||||||
|
// we need to go down
|
||||||
|
for(int i = MAXSENDRETRIESLEN - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
lock(m_sendRetries)
|
||||||
|
retrylist = m_sendRetries[i];
|
||||||
|
|
||||||
|
if(retrylist == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
inUse++;
|
||||||
|
nextlevel = i + 1;
|
||||||
|
|
||||||
//We exponentially fall back on frequency until we reach one attempt per hour
|
//We exponentially fall back on frequency until we reach one attempt per hour
|
||||||
//The net result is that we end up in the queue for roughly 24 hours..
|
//The net result is that we end up in the queue for roughly 24 hours..
|
||||||
//24 hours worth of assets could be a lot, so the hope is that the region admin
|
//24 hours worth of assets could be a lot, so the hope is that the region admin
|
||||||
//will have gotten the asset connector back online quickly!
|
//will have gotten the asset connector back online quickly!
|
||||||
|
if(i == 0)
|
||||||
int timefactor = a ^ 2;
|
timefactor = 1;
|
||||||
if (timefactor > 60)
|
else
|
||||||
{
|
{
|
||||||
timefactor = 60;
|
timefactor = 1 << nextlevel;
|
||||||
|
if (timefactor > 60)
|
||||||
|
timefactor = 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
//First, find out if we care about this timefactor
|
if(m_retryCounter < timefactor)
|
||||||
if (timefactor % a == 0)
|
continue; // to update inUse;
|
||||||
{
|
|
||||||
//Yes, we do!
|
|
||||||
List<AssetBase> retrylist = m_retryQueue[a];
|
|
||||||
m_retryQueue.Remove(a);
|
|
||||||
|
|
||||||
foreach(AssetBase ass in retrylist)
|
if (m_retryCounter % timefactor != 0)
|
||||||
{
|
continue;
|
||||||
Store(ass); //Store my ass. This function will put it back in the dictionary if it fails
|
|
||||||
}
|
// a list to retry
|
||||||
}
|
lock(m_sendRetries)
|
||||||
|
m_sendRetries[i] = null;
|
||||||
|
|
||||||
|
// we are the only ones with a copy of this retrylist now
|
||||||
|
foreach(AssetBase ass in retrylist)
|
||||||
|
retryStore(ass, nextlevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_retryQueue.Count == 0)
|
lock(m_sendRetries)
|
||||||
{
|
{
|
||||||
//It might only be one tick per minute, but I have
|
if(inUse == 0 )
|
||||||
//repented and abandoned my wasteful ways
|
m_retryTimer.Stop();
|
||||||
m_retryCounter = 0;
|
|
||||||
m_retryTimer.Stop();
|
m_inRetries = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,8 +259,9 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth);
|
asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth);
|
||||||
|
|
||||||
if (m_Cache != null)
|
|
||||||
m_Cache.Cache(asset);
|
if (asset != null && m_Cache != null)
|
||||||
|
m_Cache.Cache(asset);
|
||||||
}
|
}
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
@ -340,25 +363,18 @@ namespace OpenSim.Services.Connectors
|
||||||
m_AssetHandlers.Remove(id);
|
m_AssetHandlers.Remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.FireAndForget(x =>
|
if(handlers != null)
|
||||||
|
{
|
||||||
|
Util.FireAndForget(x =>
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach (AssetRetrievedEx h in handlers)
|
foreach (AssetRetrievedEx h in handlers)
|
||||||
{
|
{
|
||||||
// Util.FireAndForget(x =>
|
|
||||||
// {
|
|
||||||
try { h.Invoke(a); }
|
try { h.Invoke(a); }
|
||||||
catch { }
|
catch { }
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
handlers.Clear();
|
||||||
if (handlers != null)
|
|
||||||
handlers.Clear();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
// if (handlers != null)
|
|
||||||
// handlers.Clear();
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -393,29 +409,24 @@ namespace OpenSim.Services.Connectors
|
||||||
{
|
{
|
||||||
AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); });
|
AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); });
|
||||||
|
|
||||||
// AssetRetrievedEx handlers;
|
|
||||||
List<AssetRetrievedEx> handlers;
|
List<AssetRetrievedEx> handlers;
|
||||||
if (m_AssetHandlers.TryGetValue(id, out handlers))
|
if (m_AssetHandlers.TryGetValue(id, out handlers))
|
||||||
{
|
{
|
||||||
// Someone else is already loading this asset. It will notify our handler when done.
|
// Someone else is already loading this asset. It will notify our handler when done.
|
||||||
// handlers += handlerEx;
|
|
||||||
handlers.Add(handlerEx);
|
handlers.Add(handlerEx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the asset ourselves
|
|
||||||
// handlers += handlerEx;
|
|
||||||
handlers = new List<AssetRetrievedEx>();
|
handlers = new List<AssetRetrievedEx>();
|
||||||
handlers.Add(handlerEx);
|
handlers.Add(handlerEx);
|
||||||
|
|
||||||
m_AssetHandlers.Add(id, handlers);
|
m_AssetHandlers.Add(id, handlers);
|
||||||
|
|
||||||
|
QueuedAssetRequest request = new QueuedAssetRequest();
|
||||||
|
request.id = id;
|
||||||
|
request.uri = uri;
|
||||||
|
m_requestQueue.Enqueue(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueuedAssetRequest request = new QueuedAssetRequest();
|
|
||||||
request.id = id;
|
|
||||||
request.uri = uri;
|
|
||||||
|
|
||||||
m_requestQueue.Enqueue(request);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -495,43 +506,34 @@ namespace OpenSim.Services.Connectors
|
||||||
newID = SynchronousRestObjectRequester.
|
newID = SynchronousRestObjectRequester.
|
||||||
MakeRequest<AssetBase, string>("POST", uri, asset, 100000, m_Auth);
|
MakeRequest<AssetBase, string>("POST", uri, asset, 100000, m_Auth);
|
||||||
}
|
}
|
||||||
catch {}
|
catch
|
||||||
|
{
|
||||||
|
newID = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (newID == null || newID == String.Empty || newID == stringUUIDZero)
|
if (newID == null || newID == String.Empty || newID == stringUUIDZero)
|
||||||
{
|
{
|
||||||
//The asset upload failed, put it in a queue for later
|
//The asset upload failed, try later
|
||||||
asset.UploadAttempts++;
|
lock(m_sendRetries)
|
||||||
if (asset.UploadAttempts > 30)
|
|
||||||
{
|
{
|
||||||
//By this stage we've been in the queue for a good few hours;
|
if (m_sendRetries[0] == null)
|
||||||
//We're going to drop the asset.
|
m_sendRetries[0] = new List<AssetBase>();
|
||||||
m_log.ErrorFormat("[Assets] Dropping asset {0} - Upload has been in the queue for too long.", asset.ID.ToString());
|
List<AssetBase> m_queue = m_sendRetries[0];
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!m_retryQueue.ContainsKey(asset.UploadAttempts))
|
|
||||||
{
|
|
||||||
m_retryQueue.Add(asset.UploadAttempts, new List<AssetBase>());
|
|
||||||
}
|
|
||||||
List<AssetBase> m_queue = m_retryQueue[asset.UploadAttempts];
|
|
||||||
m_queue.Add(asset);
|
m_queue.Add(asset);
|
||||||
m_log.WarnFormat("[Assets] Upload failed: {0} - Requeuing asset for another run.", asset.ID.ToString());
|
m_log.WarnFormat("[Assets] Upload failed: {0} type {1} will retry later",
|
||||||
|
asset.ID.ToString(), asset.Type.ToString());
|
||||||
m_retryTimer.Start();
|
m_retryTimer.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (asset.UploadAttempts > 0)
|
|
||||||
{
|
|
||||||
m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString());
|
|
||||||
}
|
|
||||||
if (newID != asset.ID)
|
if (newID != asset.ID)
|
||||||
{
|
{
|
||||||
// Placing this here, so that this work with old asset servers that don't send any reply back
|
// Placing this here, so that this work with old asset servers that don't send any reply back
|
||||||
// SynchronousRestObjectRequester returns somethins that is not an empty string
|
// SynchronousRestObjectRequester returns somethins that is not an empty string
|
||||||
|
|
||||||
asset.ID = newID;
|
asset.ID = newID;
|
||||||
// what about FullID ????
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
m_Cache.Cache(asset);
|
m_Cache.Cache(asset);
|
||||||
}
|
}
|
||||||
|
@ -539,6 +541,62 @@ namespace OpenSim.Services.Connectors
|
||||||
return asset.ID;
|
return asset.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void retryStore(AssetBase asset, int nextRetryLevel)
|
||||||
|
{
|
||||||
|
/* this may be bad, so excluding
|
||||||
|
if (m_Cache != null && !m_Cache.Check(asset.ID))
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[Assets] Upload giveup asset bc no longer in local cache: {0}",
|
||||||
|
asset.ID.ToString();
|
||||||
|
return; // if no longer in cache, it was deleted or expired
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
string uri = MapServer(asset.FullID.ToString()) + "/assets/";
|
||||||
|
|
||||||
|
string newID = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
newID = SynchronousRestObjectRequester.
|
||||||
|
MakeRequest<AssetBase, string>("POST", uri, asset, 100000, m_Auth);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
newID = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newID == null || newID == String.Empty || newID == stringUUIDZero)
|
||||||
|
{
|
||||||
|
if(nextRetryLevel >= MAXSENDRETRIESLEN)
|
||||||
|
m_log.WarnFormat("[Assets] Upload giveup after several retries id: {0} type {1}",
|
||||||
|
asset.ID.ToString(), asset.Type.ToString());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lock(m_sendRetries)
|
||||||
|
{
|
||||||
|
if (m_sendRetries[nextRetryLevel] == null)
|
||||||
|
{
|
||||||
|
m_sendRetries[nextRetryLevel] = new List<AssetBase>();
|
||||||
|
}
|
||||||
|
List<AssetBase> m_queue = m_sendRetries[nextRetryLevel];
|
||||||
|
m_queue.Add(asset);
|
||||||
|
m_log.WarnFormat("[Assets] Upload failed: {0} type {1} will retry later",
|
||||||
|
asset.ID.ToString(), asset.Type.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), nextRetryLevel.ToString());
|
||||||
|
if (newID != asset.ID)
|
||||||
|
{
|
||||||
|
asset.ID = newID;
|
||||||
|
|
||||||
|
if (m_Cache != null)
|
||||||
|
m_Cache.Cache(asset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool UpdateContent(string id, byte[] data)
|
public bool UpdateContent(string id, byte[] data)
|
||||||
{
|
{
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
|
@ -569,6 +627,7 @@ namespace OpenSim.Services.Connectors
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool Delete(string id)
|
public bool Delete(string id)
|
||||||
{
|
{
|
||||||
string uri = MapServer(id) + "/assets/" + id;
|
string uri = MapServer(id) + "/assets/" + id;
|
||||||
|
|
|
@ -159,8 +159,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
string filename = string.Empty;
|
string filename = string.Empty;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WebClient c = new WebClient();
|
|
||||||
//m_log.Debug("JPEG: " + imageURL);
|
//m_log.Debug("JPEG: " + imageURL);
|
||||||
string name = regionID.ToString();
|
string name = regionID.ToString();
|
||||||
filename = Path.Combine(storagePath, name + ".jpg");
|
filename = Path.Combine(storagePath, name + ".jpg");
|
||||||
|
@ -168,7 +167,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
if (!File.Exists(filename))
|
if (!File.Exists(filename))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: downloading...");
|
m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: downloading...");
|
||||||
c.DownloadFile(imageURL, filename);
|
using(WebClient c = new WebClient())
|
||||||
|
c.DownloadFile(imageURL, filename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,17 +106,18 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
|
|
||||||
public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string myipaddress, out string reason)
|
public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string myipaddress, out string reason)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI);
|
|
||||||
reason = String.Empty;
|
reason = String.Empty;
|
||||||
myipaddress = String.Empty;
|
myipaddress = String.Empty;
|
||||||
|
|
||||||
if (destination == null)
|
if (destination == null)
|
||||||
{
|
{
|
||||||
reason = "Destination not found";
|
reason = "Destination not found";
|
||||||
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null");
|
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Create agent destination is null");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI);
|
||||||
|
|
||||||
string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
|
string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -512,8 +512,8 @@ namespace OpenSim.Services.LLLoginService
|
||||||
//
|
//
|
||||||
if (m_MessageUrl != String.Empty)
|
if (m_MessageUrl != String.Empty)
|
||||||
{
|
{
|
||||||
WebClient client = new WebClient();
|
using(WebClient client = new WebClient())
|
||||||
processedMessage = client.DownloadString(m_MessageUrl);
|
processedMessage = client.DownloadString(m_MessageUrl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,7 +92,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
m_RootInstance = this;
|
m_RootInstance = this;
|
||||||
MainConsole.Instance.Commands.AddCommand("Users", false,
|
MainConsole.Instance.Commands.AddCommand("Users", false,
|
||||||
"create user",
|
"create user",
|
||||||
"create user [<first> [<last> [<pass> [<email> [<user id>]]]]]",
|
"create user [<first> [<last> [<pass> [<email> [<user id> [<model>]]]]]]",
|
||||||
"Create a new user", HandleCreateUser);
|
"Create a new user", HandleCreateUser);
|
||||||
|
|
||||||
MainConsole.Instance.Commands.AddCommand("Users", false,
|
MainConsole.Instance.Commands.AddCommand("Users", false,
|
||||||
|
@ -353,7 +353,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle the create user command from the console.
|
/// Handle the create user command from the console.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
|
/// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email, userID, model name </param>
|
||||||
protected void HandleCreateUser(string module, string[] cmdparams)
|
protected void HandleCreateUser(string module, string[] cmdparams)
|
||||||
{
|
{
|
||||||
string firstName;
|
string firstName;
|
||||||
|
@ -361,6 +361,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
string password;
|
string password;
|
||||||
string email;
|
string email;
|
||||||
string rawPrincipalId;
|
string rawPrincipalId;
|
||||||
|
string model;
|
||||||
|
|
||||||
List<char> excluded = new List<char>(new char[]{' '});
|
List<char> excluded = new List<char>(new char[]{' '});
|
||||||
|
|
||||||
|
@ -385,11 +386,16 @@ namespace OpenSim.Services.UserAccountService
|
||||||
else
|
else
|
||||||
rawPrincipalId = cmdparams[6];
|
rawPrincipalId = cmdparams[6];
|
||||||
|
|
||||||
|
if (cmdparams.Length < 8)
|
||||||
|
model = MainConsole.Instance.CmdPrompt("Model name","");
|
||||||
|
else
|
||||||
|
model = cmdparams[7];
|
||||||
|
|
||||||
UUID principalId = UUID.Zero;
|
UUID principalId = UUID.Zero;
|
||||||
if (!UUID.TryParse(rawPrincipalId, out principalId))
|
if (!UUID.TryParse(rawPrincipalId, out principalId))
|
||||||
throw new Exception(string.Format("ID {0} is not a valid UUID", rawPrincipalId));
|
throw new Exception(string.Format("ID {0} is not a valid UUID", rawPrincipalId));
|
||||||
|
|
||||||
CreateUser(UUID.Zero, principalId, firstName, lastName, password, email);
|
CreateUser(UUID.Zero, principalId, firstName, lastName, password, email, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void HandleShowAccount(string module, string[] cmdparams)
|
protected void HandleShowAccount(string module, string[] cmdparams)
|
||||||
|
@ -544,7 +550,8 @@ namespace OpenSim.Services.UserAccountService
|
||||||
/// <param name="lastName"></param>
|
/// <param name="lastName"></param>
|
||||||
/// <param name="password"></param>
|
/// <param name="password"></param>
|
||||||
/// <param name="email"></param>
|
/// <param name="email"></param>
|
||||||
public UserAccount CreateUser(UUID scopeID, UUID principalID, string firstName, string lastName, string password, string email)
|
/// <param name="model"></param>
|
||||||
|
public UserAccount CreateUser(UUID scopeID, UUID principalID, string firstName, string lastName, string password, string email, string model = "")
|
||||||
{
|
{
|
||||||
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
|
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
|
||||||
if (null == account)
|
if (null == account)
|
||||||
|
@ -603,7 +610,12 @@ namespace OpenSim.Services.UserAccountService
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_CreateDefaultAvatarEntries)
|
if (m_CreateDefaultAvatarEntries)
|
||||||
CreateDefaultAppearanceEntries(account.PrincipalID);
|
{
|
||||||
|
if (String.IsNullOrEmpty(model))
|
||||||
|
CreateDefaultAppearanceEntries(account.PrincipalID);
|
||||||
|
else
|
||||||
|
EstablishAppearance(account.PrincipalID, model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
|
@ -734,6 +746,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
wearables[AvatarWearable.PANTS] = new AvatarWearable(pants.ID, pants.AssetID);
|
wearables[AvatarWearable.PANTS] = new AvatarWearable(pants.ID, pants.AssetID);
|
||||||
|
|
||||||
AvatarAppearance ap = new AvatarAppearance();
|
AvatarAppearance ap = new AvatarAppearance();
|
||||||
|
// this loop works, but is questionable
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
ap.SetWearable(i, wearables[i]);
|
ap.SetWearable(i, wearables[i]);
|
||||||
|
@ -742,5 +755,205 @@ namespace OpenSim.Services.UserAccountService
|
||||||
m_AvatarService.SetAppearance(principalID, ap);
|
m_AvatarService.SetAppearance(principalID, ap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void EstablishAppearance(UUID destinationAgent, string model)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[USER ACCOUNT SERVICE]: Establishing new appearance for {0} - {1}",
|
||||||
|
destinationAgent.ToString(), model);
|
||||||
|
|
||||||
|
string[] modelSpecifiers = model.Split();
|
||||||
|
if (modelSpecifiers.Length != 2)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Invalid model name \'{0}\'. Falling back to Ruth for {1}",
|
||||||
|
model, destinationAgent);
|
||||||
|
CreateDefaultAppearanceEntries(destinationAgent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Does the source model exist?
|
||||||
|
UserAccount modelAccount = GetUserAccount(UUID.Zero, modelSpecifiers[0], modelSpecifiers[1]);
|
||||||
|
if (modelAccount == null)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Requested model \'{0}\' not found. Falling back to Ruth for {1}",
|
||||||
|
model, destinationAgent);
|
||||||
|
CreateDefaultAppearanceEntries(destinationAgent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Does the source model have an established appearance herself?
|
||||||
|
AvatarAppearance modelAppearance = m_AvatarService.GetAppearance(modelAccount.PrincipalID);
|
||||||
|
if (modelAppearance == null)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("USER ACCOUNT SERVICE]: Requested model \'{0}\' does not have an established appearance. Falling back to Ruth for {1}",
|
||||||
|
model, destinationAgent);
|
||||||
|
CreateDefaultAppearanceEntries(destinationAgent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CopyWearablesAndAttachments(destinationAgent, modelAccount.PrincipalID, modelAppearance);
|
||||||
|
|
||||||
|
m_AvatarService.SetAppearance(destinationAgent, modelAppearance);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Error transferring appearance for {0} : {1}",
|
||||||
|
destinationAgent, e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.DebugFormat("[USER ACCOUNT SERVICE]: Finished establishing appearance for {0}",
|
||||||
|
destinationAgent.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This method is called by EstablishAppearance to do a copy all inventory items
|
||||||
|
/// worn or attached to the Clothing inventory folder of the receiving avatar.
|
||||||
|
/// In parallel the avatar wearables and attachments are updated.
|
||||||
|
/// </summary>
|
||||||
|
private void CopyWearablesAndAttachments(UUID destination, UUID source, AvatarAppearance avatarAppearance)
|
||||||
|
{
|
||||||
|
// Get Clothing folder of receiver
|
||||||
|
InventoryFolderBase destinationFolder = m_InventoryService.GetFolderForType(destination, FolderType.Clothing);
|
||||||
|
|
||||||
|
if (destinationFolder == null)
|
||||||
|
throw new Exception("Cannot locate folder(s)");
|
||||||
|
|
||||||
|
// Missing destination folder? This should *never* be the case
|
||||||
|
if (destinationFolder.Type != (short)FolderType.Clothing)
|
||||||
|
{
|
||||||
|
destinationFolder = new InventoryFolderBase();
|
||||||
|
|
||||||
|
destinationFolder.ID = UUID.Random();
|
||||||
|
destinationFolder.Name = "Clothing";
|
||||||
|
destinationFolder.Owner = destination;
|
||||||
|
destinationFolder.Type = (short)AssetType.Clothing;
|
||||||
|
destinationFolder.ParentID = m_InventoryService.GetRootFolder(destination).ID;
|
||||||
|
destinationFolder.Version = 1;
|
||||||
|
m_InventoryService.AddFolder(destinationFolder); // store base record
|
||||||
|
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Created folder for destination {0}", source);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wearables
|
||||||
|
AvatarWearable[] wearables = avatarAppearance.Wearables;
|
||||||
|
AvatarWearable wearable;
|
||||||
|
|
||||||
|
for (int i = 0; i < wearables.Length; i++)
|
||||||
|
{
|
||||||
|
wearable = wearables[i];
|
||||||
|
if (wearable[0].ItemID != UUID.Zero)
|
||||||
|
{
|
||||||
|
// Get inventory item and copy it
|
||||||
|
InventoryItemBase item = m_InventoryService.GetItem(source, wearable[0].ItemID);
|
||||||
|
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
|
||||||
|
destinationItem.Name = item.Name;
|
||||||
|
destinationItem.Owner = destination;
|
||||||
|
destinationItem.Description = item.Description;
|
||||||
|
destinationItem.InvType = item.InvType;
|
||||||
|
destinationItem.CreatorId = item.CreatorId;
|
||||||
|
destinationItem.CreatorData = item.CreatorData;
|
||||||
|
destinationItem.NextPermissions = item.NextPermissions;
|
||||||
|
destinationItem.CurrentPermissions = item.CurrentPermissions;
|
||||||
|
destinationItem.BasePermissions = item.BasePermissions;
|
||||||
|
destinationItem.EveryOnePermissions = item.EveryOnePermissions;
|
||||||
|
destinationItem.GroupPermissions = item.GroupPermissions;
|
||||||
|
destinationItem.AssetType = item.AssetType;
|
||||||
|
destinationItem.AssetID = item.AssetID;
|
||||||
|
destinationItem.GroupID = item.GroupID;
|
||||||
|
destinationItem.GroupOwned = item.GroupOwned;
|
||||||
|
destinationItem.SalePrice = item.SalePrice;
|
||||||
|
destinationItem.SaleType = item.SaleType;
|
||||||
|
destinationItem.Flags = item.Flags;
|
||||||
|
destinationItem.CreationDate = item.CreationDate;
|
||||||
|
destinationItem.Folder = destinationFolder.ID;
|
||||||
|
ApplyNextOwnerPermissions(destinationItem);
|
||||||
|
|
||||||
|
m_InventoryService.AddItem(destinationItem);
|
||||||
|
m_log.DebugFormat("[USER ACCOUNT SERVICE]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
|
||||||
|
|
||||||
|
// Wear item
|
||||||
|
AvatarWearable newWearable = new AvatarWearable();
|
||||||
|
newWearable.Wear(destinationItem.ID, wearable[0].AssetID);
|
||||||
|
avatarAppearance.SetWearable(i, newWearable);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Error transferring {0} to folder {1}", wearable[0].ItemID, destinationFolder.ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attachments
|
||||||
|
List<AvatarAttachment> attachments = avatarAppearance.GetAttachments();
|
||||||
|
|
||||||
|
foreach (AvatarAttachment attachment in attachments)
|
||||||
|
{
|
||||||
|
int attachpoint = attachment.AttachPoint;
|
||||||
|
UUID itemID = attachment.ItemID;
|
||||||
|
|
||||||
|
if (itemID != UUID.Zero)
|
||||||
|
{
|
||||||
|
// Get inventory item and copy it
|
||||||
|
InventoryItemBase item = m_InventoryService.GetItem(source, itemID);
|
||||||
|
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
|
||||||
|
destinationItem.Name = item.Name;
|
||||||
|
destinationItem.Owner = destination;
|
||||||
|
destinationItem.Description = item.Description;
|
||||||
|
destinationItem.InvType = item.InvType;
|
||||||
|
destinationItem.CreatorId = item.CreatorId;
|
||||||
|
destinationItem.CreatorData = item.CreatorData;
|
||||||
|
destinationItem.NextPermissions = item.NextPermissions;
|
||||||
|
destinationItem.CurrentPermissions = item.CurrentPermissions;
|
||||||
|
destinationItem.BasePermissions = item.BasePermissions;
|
||||||
|
destinationItem.EveryOnePermissions = item.EveryOnePermissions;
|
||||||
|
destinationItem.GroupPermissions = item.GroupPermissions;
|
||||||
|
destinationItem.AssetType = item.AssetType;
|
||||||
|
destinationItem.AssetID = item.AssetID;
|
||||||
|
destinationItem.GroupID = item.GroupID;
|
||||||
|
destinationItem.GroupOwned = item.GroupOwned;
|
||||||
|
destinationItem.SalePrice = item.SalePrice;
|
||||||
|
destinationItem.SaleType = item.SaleType;
|
||||||
|
destinationItem.Flags = item.Flags;
|
||||||
|
destinationItem.CreationDate = item.CreationDate;
|
||||||
|
destinationItem.Folder = destinationFolder.ID;
|
||||||
|
ApplyNextOwnerPermissions(destinationItem);
|
||||||
|
|
||||||
|
m_InventoryService.AddItem(destinationItem);
|
||||||
|
m_log.DebugFormat("[USER ACCOUNT SERVICE]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
|
||||||
|
|
||||||
|
// Attach item
|
||||||
|
avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
|
||||||
|
m_log.DebugFormat("[USER ACCOUNT SERVICE]: Attached {0}", destinationItem.ID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Error transferring {0} to folder {1}", itemID, destinationFolder.ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Apply next owner permissions.
|
||||||
|
/// </summary>
|
||||||
|
private void ApplyNextOwnerPermissions(InventoryItemBase item)
|
||||||
|
{
|
||||||
|
if (item.InvType == (int)InventoryType.Object)
|
||||||
|
{
|
||||||
|
uint perms = item.CurrentPermissions;
|
||||||
|
PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);
|
||||||
|
item.CurrentPermissions = perms;
|
||||||
|
}
|
||||||
|
|
||||||
|
item.CurrentPermissions &= item.NextPermissions;
|
||||||
|
item.BasePermissions &= item.NextPermissions;
|
||||||
|
item.EveryOnePermissions &= item.NextPermissions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1384,6 +1384,10 @@ namespace OpenSim.Tests.Common
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendSelectedPartsProprieties(List<ISceneEntity> parts)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1485,6 +1485,9 @@ namespace Amib.Threading
|
||||||
_isIdleWaitHandle = null;
|
_isIdleWaitHandle = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_stpStartInfo.EnableLocalPerformanceCounters)
|
||||||
|
_localPCs.Dispose();
|
||||||
|
|
||||||
_isDisposed = true;
|
_isDisposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1684,6 +1687,7 @@ namespace Amib.Threading
|
||||||
}
|
}
|
||||||
workItemsGroup.Start();
|
workItemsGroup.Start();
|
||||||
anActionCompleted.WaitOne();
|
anActionCompleted.WaitOne();
|
||||||
|
anActionCompleted.Dispose();
|
||||||
|
|
||||||
return choiceIndex._index;
|
return choiceIndex._index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,15 +192,6 @@
|
||||||
;; YOU HAVE BEEN WARNED!!!
|
;; YOU HAVE BEEN WARNED!!!
|
||||||
; TrustBinaries = false
|
; TrustBinaries = false
|
||||||
|
|
||||||
;# {CombineContiguousRegions} {} {Create megaregions where possible? (Do not use with existing content or varregions!)} {true false} false
|
|
||||||
;; Combine all contiguous regions into one large megaregion
|
|
||||||
;; Order your regions from South to North, West to East in your regions.ini
|
|
||||||
;; and then set this to true
|
|
||||||
;; Warning! Don't use this with regions that have existing content!,
|
|
||||||
;; This will likely break them
|
|
||||||
;; Also, this setting should be set to false for varregions as they are proper larger single regions rather than combined smaller regions.
|
|
||||||
; CombineContiguousRegions = false
|
|
||||||
|
|
||||||
;# {InworldRestartShutsDown} {} {Shutdown instance on region restart?} {true false} false
|
;# {InworldRestartShutsDown} {} {Shutdown instance on region restart?} {true false} false
|
||||||
;; If you have only one region in an instance, or to avoid the many bugs
|
;; If you have only one region in an instance, or to avoid the many bugs
|
||||||
;; that you can trigger in modules by restarting a region, set this to
|
;; that you can trigger in modules by restarting a region, set this to
|
||||||
|
|
|
@ -156,11 +156,6 @@
|
||||||
; YOU HAVE BEEN WARNED!!!
|
; YOU HAVE BEEN WARNED!!!
|
||||||
TrustBinaries = false
|
TrustBinaries = false
|
||||||
|
|
||||||
; Combine all contiguous regions into one large megaregion
|
|
||||||
; Order your regions from South to North, West to East in your regions.ini and then set this to true
|
|
||||||
; Warning! Don't use this with regions that have existing content!, This will likely break them
|
|
||||||
CombineContiguousRegions = false
|
|
||||||
|
|
||||||
; the default view range. Viewers override this ( no major effect still )
|
; the default view range. Viewers override this ( no major effect still )
|
||||||
DefaultDrawDistance = 255.0
|
DefaultDrawDistance = 255.0
|
||||||
|
|
||||||
|
|
BIN
bin/Warp3D.dll
BIN
bin/Warp3D.dll
Binary file not shown.
Loading…
Reference in New Issue