diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index d121d1a8ce..2831326027 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs @@ -1296,7 +1296,7 @@ namespace OpenSim.Groups presence.Grouptitle = Title; if (! presence.IsChildAgent) - presence.SendAvatarDataToAllClients(); + presence.SendAvatarDataToAllAgents(); } } } diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs index 7fcc798147..a9b81f3138 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs @@ -25,37 +25,39 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; +using System.Collections; +using System.Collections.Specialized; +using System.Reflection; +using System.IO; +using System.Web; using log4net; +using Nini.Config; using OpenMetaverse; -using OpenMetaverse.Imaging; +using OpenMetaverse.StructuredData; using OpenSim.Framework; +using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Services.Interfaces; -using System; -using System.Collections.Specialized; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Reflection; -using System.Web; +using Caps = OpenSim.Framework.Capabilities.Caps; + + + namespace OpenSim.Capabilities.Handlers { - public class GetMeshHandler : BaseStreamHandler + public class GetMeshHandler { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + private IAssetService m_assetService; public const string DefaultFormat = "vnd.ll.mesh"; - + public GetMeshHandler(IAssetService assService) { m_assetService = assService; - m_RedirectURL = redirectURL; - if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/")) - m_RedirectURL += "/"; } public Hashtable Handle(Hashtable request) { @@ -67,7 +69,7 @@ namespace OpenSim.Capabilities.Handlers ret["int_bytes"] = 0; ret["int_lod"] = 0; string MeshStr = (string)request["mesh_id"]; - + //m_log.DebugFormat("[GETMESH]: called {0}", MeshStr); @@ -81,122 +83,53 @@ namespace OpenSim.Capabilities.Handlers { // m_log.DebugFormat("[GETMESH]: Received request for mesh id {0}", meshID); - + ret = ProcessGetMesh(request, UUID.Zero, null); - - + + } else { m_log.Warn("[GETMESH]: Failed to parse a mesh_id from GetMesh request: " + (string)request["uri"]); } - + return ret; } public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap) { - // Try to parse the texture ID from the request URL - NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); - string textureStr = query.GetOne("mesh_id"); + Hashtable responsedata = new Hashtable(); + responsedata["int_response_code"] = 400; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Request wasn't what was expected"; responsedata["reusecontext"] = false; responsedata["int_lod"] = 0; responsedata["int_bytes"] = 0; - if (m_assetService == null) + string meshStr = string.Empty; + + if (request.ContainsKey("mesh_id")) + meshStr = request["mesh_id"].ToString(); + + UUID meshID = UUID.Zero; + if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID)) { - m_log.Error("[GETMESH]: Cannot fetch mesh " + textureStr + " without an asset service"); - httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; - } - - UUID meshID; - if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out meshID)) - { - // OK, we have an array with preferred formats, possibly with only one entry - - httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; - AssetBase mesh; - - if (!String.IsNullOrEmpty(m_RedirectURL)) + if (m_assetService == null) { - // Only try to fetch locally cached meshes. Misses are redirected - mesh = m_assetService.GetCached(meshID.ToString()); - - if (mesh != null) - { - if (mesh.Type != (sbyte)AssetType.Mesh) - { - httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; - } - WriteMeshData(httpRequest, httpResponse, mesh); - } - else - { - string textureUrl = m_RedirectURL + "?mesh_id="+ meshID.ToString(); - m_log.Debug("[GETMESH]: Redirecting mesh request to " + textureUrl); - httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently; - httpResponse.RedirectLocation = textureUrl; - return null; - } - } - else // no redirect - { - // try the cache - mesh = m_assetService.GetCached(meshID.ToString()); - - if (mesh == null) - { - // Fetch locally or remotely. Misses return a 404 - mesh = m_assetService.Get(meshID.ToString()); - - if (mesh != null) - { - if (mesh.Type != (sbyte)AssetType.Mesh) - { - httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; - return null; - } - WriteMeshData(httpRequest, httpResponse, mesh); - return null; - } - } - else // it was on the cache - { - if (mesh.Type != (sbyte)AssetType.Mesh) - { - httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; - return null; - } - WriteMeshData(httpRequest, httpResponse, mesh); - return null; - } + responsedata["int_response_code"] = 404; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh."; + responsedata["reusecontext"] = false; + return responsedata; } - // not found - httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; - return null; - } - else - { - m_log.Warn("[GETTEXTURE]: Failed to parse a mesh_id from GetMesh request: " + httpRequest.Url); - } + AssetBase mesh = m_assetService.Get(meshID.ToString()); - return null; - } - - private void WriteMeshData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture) - { - string range = request.Headers.GetOne("Range"); - - if (!String.IsNullOrEmpty(range)) - { - // Range request - int start, end; - if (TryParseRange(range, out start, out end)) + if (mesh != null) { - // Before clamping start make sure we can satisfy it in order to avoid - // sending back the last byte instead of an error status - if (start >= texture.Data.Length) + if (mesh.Type == (SByte)AssetType.Mesh) { Hashtable headers = new Hashtable(); @@ -212,12 +145,12 @@ namespace OpenSim.Capabilities.Handlers if (!String.IsNullOrEmpty(range)) // Mesh Asset LOD // Physics { - // Range request + // Range request int start, end; if (TryParseRange(range, out start, out end)) { - // Before clamping start make sure we can satisfy it in order to avoid - // sending back the last byte instead of an error status + // Before clamping start make sure we can satisfy it in order to avoid + // sending back the last byte instead of an error status if (start >= mesh.Data.Length) { responsedata["int_response_code"] = 404; //501; //410; //404; @@ -249,20 +182,20 @@ namespace OpenSim.Capabilities.Handlers responsedata["int_lod"] = 2; } - + if (start == 0 && len == mesh.Data.Length) // well redudante maybe { - responsedata["int_response_code"] = (int) System.Net.HttpStatusCode.OK; + responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK; responsedata["bin_response_data"] = mesh.Data; responsedata["int_bytes"] = mesh.Data.Length; responsedata["reusecontext"] = false; responsedata["int_lod"] = 3; - + } else { responsedata["int_response_code"] = - (int) System.Net.HttpStatusCode.PartialContent; + (int)System.Net.HttpStatusCode.PartialContent; headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, mesh.Data.Length); @@ -293,6 +226,7 @@ namespace OpenSim.Capabilities.Handlers responsedata["int_lod"] = 3; } } + // Optionally add additional mesh types here else { responsedata["int_response_code"] = 404; //501; //410; //404; @@ -315,58 +249,8 @@ namespace OpenSim.Capabilities.Handlers return responsedata; } } - else - { - // Full content request - response.StatusCode = (int)System.Net.HttpStatusCode.OK; - response.ContentLength = texture.Data.Length; - response.ContentType = "application/vnd.ll.mesh"; - response.Body.Write(texture.Data, 0, texture.Data.Length); - } - } - /// - /// Parse a range header. - /// - /// - /// As per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, - /// this obeys range headers with two values (e.g. 533-4165) and no second value (e.g. 533-). - /// Where there is no value, -1 is returned. - /// FIXME: Need to cover the case where only a second value is specified (e.g. -4165), probably by returning -1 - /// for start. - /// - /// - /// Start of the range. Undefined if this was not a number. - /// End of the range. Will be -1 if no end specified. Undefined if there was a raw string but this was not a number. - private bool TryParseRange(string header, out int start, out int end) - { - start = end = 0; - - if (header.StartsWith("bytes=")) - { - string[] rangeValues = header.Substring(6).Split('-'); - - if (rangeValues.Length == 2) - { - if (!Int32.TryParse(rangeValues[0], out start)) - return false; - - string rawEnd = rangeValues[1]; - - if (rawEnd == "") - { - end = -1; - return true; - } - else if (Int32.TryParse(rawEnd, out end)) - { - return true; - } - } - } - - start = end = 0; - return false; + return responsedata; } private bool TryParseRange(string header, out int start, out int end) { diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs index 19de3cfea5..b494aa4962 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs @@ -64,13 +64,15 @@ namespace OpenSim.Capabilities.Handlers string rurl = serverConfig.GetString("GetMeshRedirectURL"); - server.AddStreamHandler( - new GetTextureHandler("/CAPS/GetMesh/" /*+ UUID.Random() */, m_AssetService, "GetMesh", null, rurl)); - - rurl = serverConfig.GetString("GetMesh2RedirectURL"); - - server.AddStreamHandler( - new GetTextureHandler("/CAPS/GetMesh2/" /*+ UUID.Random() */, m_AssetService, "GetMesh2", null, rurl)); + GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); + IRequestHandler reqHandler + = new RestHTTPHandler( + "GET", + "/CAPS/" + UUID.Random(), + httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null), + "GetMesh", + null); + server.AddStreamHandler(reqHandler); ; } } } \ No newline at end of file diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index a8e0fb5662..59d8b9abec 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs @@ -63,9 +63,6 @@ namespace OpenSim.Capabilities.Handlers public GetTextureHandler(IAssetService assService) { m_assetService = assService; - m_RedirectURL = redirectURL; - if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/")) - m_RedirectURL += "/"; } public Hashtable Handle(Hashtable request) diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs index d55e0ffa0e..3f6d162f35 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs @@ -66,7 +66,7 @@ namespace OpenSim.Capabilities.Handlers string rurl = serverConfig.GetString("GetTextureRedirectURL"); ; server.AddStreamHandler( - new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null, rurl)); + new GetTextureHandler("/CAPS/GetTexture/" */ /*+ UUID.Random() */ /*, m_AssetService, "GetTexture", null, rurl)); } } } diff --git a/OpenSim/Data/IProfilesData.cs b/OpenSim/Data/IProfilesData.cs index 0de7f68af9..a4a32a911b 100644 --- a/OpenSim/Data/IProfilesData.cs +++ b/OpenSim/Data/IProfilesData.cs @@ -48,6 +48,8 @@ namespace OpenSim.Data bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result); bool UpdateAvatarInterests(UserProfileProperties up, ref string result); bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result); + bool UpdateUserPreferences(ref UserPreferences pref, ref string result); + bool GetUserPreferences(ref UserPreferences pref, ref string result); bool GetUserAppData(ref UserAppData props, ref string result); bool SetUserAppData(UserAppData props, ref string result); OSDArray GetUserImageAssets(UUID avatarId); diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index cb5a38e6db..76b1e38f0e 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -202,52 +202,15 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); cmd.Parameters.AddWithValue("?data", asset.Data); cmd.ExecuteNonQuery(); - } - - string assetDescription = asset.Description; - if (asset.Description.Length > 64) - { - assetDescription = asset.Description.Substring(0, 64); - m_log.WarnFormat( - "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", - asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); - } - - try - { - using (cmd) - { - // create unix epoch time - int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); - cmd.Parameters.AddWithValue("?id", asset.ID); - cmd.Parameters.AddWithValue("?name", assetName); - cmd.Parameters.AddWithValue("?description", assetDescription); - cmd.Parameters.AddWithValue("?assetType", asset.Type); - cmd.Parameters.AddWithValue("?local", asset.Local); - cmd.Parameters.AddWithValue("?temporary", asset.Temporary); - cmd.Parameters.AddWithValue("?create_time", now); - cmd.Parameters.AddWithValue("?access_time", now); - cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID); - cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); - cmd.Parameters.AddWithValue("?data", asset.Data); - cmd.ExecuteNonQuery(); - return true; - } - } - catch (Exception e) - { - m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", - asset.FullID, asset.Name, e.Message); - return false; + return true; } } + catch (Exception e) { - m_log.Error( - string.Format( - "[ASSET DB]: MySQL failure creating asset {0} with name {1}. Exception ", - asset.FullID, asset.Name) - , e); + m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", + asset.FullID, asset.Name, e.Message); + return false; } } } diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 81b5ec4f54..549d1293ad 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -1105,7 +1105,7 @@ namespace OpenSim.Data.MySQL "use_estate_sun, fixed_sun, sun_position, " + "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + "sunvectorz, loaded_creation_datetime, " + - "loaded_creation_id, map_tile_ID, " + + "loaded_creation_id, map_tile_ID, block_search, casino, " + "TelehubObject, parcel_tile_ID) " + "values (?RegionUUID, ?BlockTerraform, " + "?BlockFly, ?AllowDamage, ?RestrictPushing, " + @@ -1122,53 +1122,14 @@ namespace OpenSim.Data.MySQL "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + "?LoadedCreationDateTime, ?LoadedCreationID, " + - "?TerrainImageID, " + + "?TerrainImageID, ?block_search, ?casino, " + "?TelehubObject, ?ParcelImageID)"; - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "replace into regionsettings (regionUUID, " + - "block_terraform, block_fly, allow_damage, " + - "restrict_pushing, allow_land_resell, " + - "allow_land_join_divide, block_show_in_search, " + - "agent_limit, object_bonus, maturity, " + - "disable_scripts, disable_collisions, " + - "disable_physics, terrain_texture_1, " + - "terrain_texture_2, terrain_texture_3, " + - "terrain_texture_4, elevation_1_nw, " + - "elevation_2_nw, elevation_1_ne, " + - "elevation_2_ne, elevation_1_se, " + - "elevation_2_se, elevation_1_sw, " + - "elevation_2_sw, water_height, " + - "terrain_raise_limit, terrain_lower_limit, " + - "use_estate_sun, fixed_sun, sun_position, " + - "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + - "sunvectorz, loaded_creation_datetime, " + - "loaded_creation_id, map_tile_ID, block_search, casino, " + - "TelehubObject, parcel_tile_ID) " + - "values (?RegionUUID, ?BlockTerraform, " + - "?BlockFly, ?AllowDamage, ?RestrictPushing, " + - "?AllowLandResell, ?AllowLandJoinDivide, " + - "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + - "?Maturity, ?DisableScripts, ?DisableCollisions, " + - "?DisablePhysics, ?TerrainTexture1, " + - "?TerrainTexture2, ?TerrainTexture3, " + - "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + - "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + - "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + - "?WaterHeight, ?TerrainRaiseLimit, " + - "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + - "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + - "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + - "?LoadedCreationDateTime, ?LoadedCreationID, " + - "?TerrainImageID, ?block_search, ?casino, " + - "?TelehubObject, ?ParcelImageID)"; - ExecuteNonQuery(cmd); } - } - SaveSpawnPoints(rs); + SaveSpawnPoints(rs); + } } public virtual List LoadLandObjects(UUID regionUUID) diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index c213dd1c57..c241e90d48 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs @@ -896,16 +896,16 @@ namespace OpenSim.Data.MySQL } #region User Preferences - public OSDArray GetUserPreferences(UUID avatarId) + public bool GetUserPreferences(ref UserPreferences pref, ref string result) { string query = string.Empty; - + query += "SELECT imviaemail,visible,email FROM "; query += "usersettings WHERE "; query += "useruuid = ?Id"; - + OSDArray data = new OSDArray(); - + try { using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) @@ -913,33 +913,30 @@ namespace OpenSim.Data.MySQL dbcon.Open(); using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) { - cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); - + cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); + using (MySqlDataReader reader = cmd.ExecuteReader()) { - if(reader.HasRows) + if (reader.HasRows) { reader.Read(); - OSDMap record = new OSDMap(); - - record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); - record.Add("visible",OSD.FromString((string)reader["visible"])); - record.Add("email",OSD.FromString((string)reader["email"])); - data.Add(record); + bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); + bool.TryParse((string)reader["visible"], out pref.Visible); + pref.EMail = (string)reader["email"]; } else { dbcon.Close(); dbcon.Open(); - + query = "INSERT INTO usersettings VALUES "; query += "(?uuid,'false','false', ?Email)"; using (MySqlCommand put = new MySqlCommand(query, dbcon)) { - -// put.Parameters.AddWithValue("?Email", pref.EMail); -// put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); + + put.Parameters.AddWithValue("?Email", pref.EMail); + put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); put.ExecuteNonQuery(); } @@ -952,20 +949,22 @@ namespace OpenSim.Data.MySQL { m_log.ErrorFormat("[PROFILES_DATA]" + ": Get preferences exception {0}", e.Message); + result = e.Message; + return false; } - return data; + return true; } - - public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) - { + + public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) + { string query = string.Empty; - - query += "UPDATE userpsettings SET "; + + query += "UPDATE usersettings SET "; query += "imviaemail=?ImViaEmail, "; query += "visible=?Visible, "; query += "email=?EMail "; query += "WHERE useruuid=?uuid"; - + try { using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) @@ -986,6 +985,7 @@ namespace OpenSim.Data.MySQL { m_log.ErrorFormat("[PROFILES_DATA]" + ": UserPreferencesUpdate exception {0} {1}", e.Message, e.InnerException); + result = e.Message; return false; } return true; diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index 77d87d43e9..a006c5876d 100644 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs @@ -2227,6 +2227,11 @@ namespace OpenSim.Data.PGSQL } } + public UUID[] GetObjectIDs(UUID regionID) + { + return new UUID[0]; + } + public void SaveExtra(UUID regionID, string name, string value) { } diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 9a47e37d7b..70267de6f5 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -2013,7 +2013,7 @@ namespace OpenSim.Data.SQLite return entry; } - /* + /// /// /// diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs index 70579afab6..2dfdba3817 100644 --- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs @@ -741,7 +741,7 @@ namespace OpenSim.Data.SQLite return true; } - /* + public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) { string query = string.Empty; @@ -826,7 +826,6 @@ namespace OpenSim.Data.SQLite } return true; } - */ public bool GetUserAppData(ref UserAppData props, ref string result) { diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 3937d9c667..33be612402 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -150,12 +150,8 @@ namespace OpenSim.Framework Type == (sbyte)AssetType.Folder || Type == (sbyte)AssetType.ImageJPEG || Type == (sbyte)AssetType.ImageTGA || -<<<<<<< HEAD - Type == (sbyte)AssetType.LSLBytecode); -======= Type == (sbyte)AssetType.Mesh || Type == (sbyte) AssetType.LSLBytecode); ->>>>>>> avn/ubitvar } } diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index 4403f4091f..7c89e6bcfe 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs @@ -395,26 +395,7 @@ namespace OpenSim.Framework.Communications return null; } -<<<<<<< HEAD -======= - using (Stream src = _response.GetResponseStream()) - { - int length = src.Read(_readbuf, 0, BufferSize); - while (length > 0) - { - _resource.Write(_readbuf, 0, length); - length = src.Read(_readbuf, 0, BufferSize); - } - } - // TODO! Implement timeout, without killing the server - // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted - //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); - -// _allDone.WaitOne(); - if (_response != null) - _response.Close(); ->>>>>>> avn/ubitvar if (_asyncException != null) throw _asyncException; @@ -444,7 +425,6 @@ namespace OpenSim.Framework.Communications auth.AddAuthorization(_request.Headers); src.Seek(0, SeekOrigin.Begin); -<<<<<<< HEAD int reqnum = WebUtil.RequestNumber++; if (WebUtil.DebugLevel >= 3) @@ -452,16 +432,7 @@ namespace OpenSim.Framework.Communications if (WebUtil.DebugLevel >= 5) WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src); - Stream dst = _request.GetRequestStream(); - - byte[] buf = new byte[1024]; - int length = src.Read(buf, 0, 1024); - while (length > 0) -======= - m_log.Info("[REST]: Seek is ok"); - using (Stream dst = _request.GetRequestStream()) ->>>>>>> avn/ubitvar { m_log.Info("[REST]: GetRequestStream is ok"); diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 3aec437d5d..4c9f6e9b38 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -363,30 +363,43 @@ namespace OpenSim.Framework return false; } + public bool IsBanned(UUID avatarID) + { + if (!IsEstateManagerOrOwner(avatarID)) + { + foreach (EstateBan ban in l_EstateBans) + if (ban.BannedUserID == avatarID) + return true; + } + return false; + } + public bool IsBanned(UUID avatarID, int userFlags) { - foreach (EstateBan ban in l_EstateBans) + if (!IsEstateManagerOrOwner(avatarID)) + { + foreach (EstateBan ban in l_EstateBans) if (ban.BannedUserID == avatarID) return true; - if (!IsEstateManagerOrOwner(avatarID) && !HasAccess(avatarID)) - { - if (DenyMinors) + if (!HasAccess(avatarID)) { - if ((userFlags & 32) == 0) + if (DenyMinors) { - return true; + if ((userFlags & 32) == 0) + { + return true; + } } - } - if (DenyAnonymous) - { - if ((userFlags & 4) == 0) + if (DenyAnonymous) { - return true; + if ((userFlags & 4) == 0) + { + return true; + } } } } - return false; } diff --git a/OpenSim/Framework/ISceneAgent.cs b/OpenSim/Framework/ISceneAgent.cs index ca1399c784..be11931109 100644 --- a/OpenSim/Framework/ISceneAgent.cs +++ b/OpenSim/Framework/ISceneAgent.cs @@ -65,20 +65,15 @@ namespace OpenSim.Framework /// AvatarAppearance Appearance { get; set; } - /// - /// Set if initial data about the scene (avatars, objects) has been sent to the client. - /// - bool SentInitialDataToClient { get; } - /// /// Send initial scene data to the client controlling this agent /// /// /// This includes scene object data and the appearance data of other avatars. /// - void SendInitialDataToClient(); + void SendInitialDataToMe(); - /// + /// /// Direction in which the scene presence is looking. /// /// Will be Vector3.Zero for a child agent. diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs index 5fa27d61c7..1e5e8bf9bf 100644 --- a/OpenSim/Framework/PluginLoader.cs +++ b/OpenSim/Framework/PluginLoader.cs @@ -245,15 +245,6 @@ namespace OpenSim.Framework // occasionally seems to corrupt its addin cache // Hence, as a temporary solution we'll remove it before each startup -<<<<<<< HEAD - try - { - if (Directory.Exists(dir + "/addin-db-000")) - Directory.Delete(dir + "/addin-db-000", true); - - if (Directory.Exists(dir + "/addin-db-001")) - Directory.Delete(dir + "/addin-db-001", true); -======= string customDir = Environment.GetEnvironmentVariable ("MONO_ADDINS_REGISTRY"); string v0 = "addin-db-000"; string v1 = "addin-db-001"; @@ -269,7 +260,7 @@ namespace OpenSim.Framework if (Directory.Exists(v1)) Directory.Delete(v1, true); ->>>>>>> avn/ubitvar + } catch (IOException) { diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index d75a6cf4eb..ac7735248a 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -102,12 +102,11 @@ namespace OpenSim.Framework private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly string LogHeader = "[REGION INFO]"; -<<<<<<< HEAD -======= + public bool commFailTF = false; public ConfigurationMember configMember; public string DataStore = String.Empty; ->>>>>>> avn/ubitvar + public string RegionFile = String.Empty; public bool isSandbox = false; public bool Persistent = true; @@ -534,11 +533,7 @@ namespace OpenSim.Framework return null; } -<<<<<<< HEAD - private void SetExtraSetting(string key, string value) -======= public void SetExtraSetting(string key, string value) ->>>>>>> avn/ubitvar { string keylower = key.ToLower(); m_extraSettings[keylower] = value; @@ -834,22 +829,16 @@ namespace OpenSim.Framework string location = String.Format("{0},{1}", RegionLocX, RegionLocY); config.Set("Location", location); -<<<<<<< HEAD - if (RegionSizeX > 0) -======= if (DataStore != String.Empty) config.Set("Datastore", DataStore); if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize) { ->>>>>>> avn/ubitvar config.Set("SizeX", RegionSizeX); - - if (RegionSizeY > 0) config.Set("SizeY", RegionSizeY); - -// if (RegionSizeZ > 0) -// config.Set("SizeZ", RegionSizeZ); + // if (RegionSizeZ > 0) + // config.Set("SizeZ", RegionSizeZ); + } config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); config.Set("InternalPort", m_internalEndPoint.Port); @@ -920,8 +909,6 @@ namespace OpenSim.Framework throw new Exception("Invalid file type for region persistence."); } -<<<<<<< HEAD -======= public void loadConfigurationOptionsFromMe() { configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_UUID_NULL_FREE, @@ -984,7 +971,7 @@ namespace OpenSim.Framework "Max prims an object will hold", m_linksetCapacity.ToString(), true); configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, - "Max avatars this sim will hold", m_agentCapacity.ToString(), true); + "Max avatars this sim will hold",AgentCapacity.ToString(), true); configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, "Scope ID for this region", ScopeID.ToString(), true); @@ -1131,7 +1118,7 @@ namespace OpenSim.Framework m_linksetCapacity = (int)configuration_result; break; case "agent_capacity": - m_agentCapacity = (int)configuration_result; + AgentCapacity = (int)configuration_result; break; case "scope_id": ScopeID = (UUID)configuration_result; @@ -1147,7 +1134,7 @@ namespace OpenSim.Framework return true; } ->>>>>>> avn/ubitvar + public void SaveLastMapUUID(UUID mapUUID) { lastMapUUID = mapUUID; diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index 487c0875ff..098c4b9ea6 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs @@ -58,7 +58,7 @@ namespace OpenSim.Framework.RegionLoader.Web } else { - IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"]; + IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"]; string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim(); bool allowRegionless = startupConfig.GetBoolean("allow_regionless", false); @@ -69,101 +69,74 @@ namespace OpenSim.Framework.RegionLoader.Web } else { - while(tries > 0) - { - RegionInfo[] regionInfos = new RegionInfo[] {}; - int regionCount = 0; - HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); - webRequest.Timeout = 30000; //30 Second Timeout - m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); + while (tries > 0) + { + RegionInfo[] regionInfos = new RegionInfo[] { }; + int regionCount = 0; + HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); + webRequest.Timeout = 30000; //30 Second Timeout + m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); - try - { - HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); - m_log.Debug("[WEBLOADER]: Downloading region information..."); - StreamReader reader = new StreamReader(webResponse.GetResponseStream()); - string xmlSource = String.Empty; - string tempStr = reader.ReadLine(); - while (tempStr != null) - { - xmlSource = xmlSource + tempStr; - tempStr = reader.ReadLine(); - } - m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + - xmlSource.Length); - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.LoadXml(xmlSource); - if (xmlDoc.FirstChild.Name == "Nini") - { - regionCount = xmlDoc.FirstChild.ChildNodes.Count; - - if (regionCount > 0) - { - regionInfos = new RegionInfo[regionCount]; - int i; - for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) - { - m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); - regionInfos[i] = - new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); - } - } - } - } - catch (WebException ex) - { - if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound) - { - if (!allowRegionless) - throw ex; - } - else - throw ex; - } - -<<<<<<< HEAD - m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + - xmlSource.Length); - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.LoadXml(xmlSource); - if (xmlDoc.FirstChild.Name == "Nini") + try { - regionCount = xmlDoc.FirstChild.ChildNodes.Count; - - if (regionCount > 0) + HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); + m_log.Debug("[WEBLOADER]: Downloading region information..."); + StreamReader reader = new StreamReader(webResponse.GetResponseStream()); + string xmlSource = String.Empty; + string tempStr = reader.ReadLine(); + while (tempStr != null) { - regionInfos = new RegionInfo[regionCount]; - int i; - for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) + xmlSource = xmlSource + tempStr; + tempStr = reader.ReadLine(); + } + m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + + xmlSource.Length); + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.LoadXml(xmlSource); + if (xmlDoc.FirstChild.Name == "Nini") + { + regionCount = xmlDoc.FirstChild.ChildNodes.Count; + + if (regionCount > 0) { - m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); - regionInfos[i] = - new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); + regionInfos = new RegionInfo[regionCount]; + int i; + for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) + { + m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); + regionInfos[i] = + new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i], false, m_configSource); + } } } } - } - catch (WebException ex) - { - using (HttpWebResponse response = (HttpWebResponse)ex.Response) -======= - if (regionCount > 0 | allowRegionless) - return regionInfos; + catch (WebException ex) + { + if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound) + { + if (!allowRegionless) + throw ex; + } + else + throw ex; + } + + if (regionCount > 0 | allowRegionless) + return regionInfos; m_log.Debug("[WEBLOADER]: Request yielded no regions."); tries--; if (tries > 0) ->>>>>>> avn/ubitvar { m_log.Debug("[WEBLOADER]: Retrying"); System.Threading.Thread.Sleep(wait); } - } + } - m_log.Error("[WEBLOADER]: No region configs were available."); - return null; + m_log.Error("[WEBLOADER]: No region configs were available."); + return null; } } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 60702d4cee..09b08011e2 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -65,12 +65,9 @@ namespace OpenSim.Framework.Servers /// This will control a periodic log printout of the current 'show stats' (if they are active) for this /// server. /// -<<<<<<< HEAD + private int m_periodDiagnosticTimerMS = 60 * 60 * 1000; private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); -======= -// private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); ->>>>>>> avn/ubitvar /// /// Random uuid for private data @@ -88,11 +85,8 @@ namespace OpenSim.Framework.Servers // Random uuid for private data m_osSecret = UUID.Random().ToString(); -<<<<<<< HEAD -======= -// m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); -// m_periodicDiagnosticsTimer.Enabled = true; ->>>>>>> avn/ubitvar + m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); + m_periodicDiagnosticsTimer.Enabled = true; } /// diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 616c673107..85976abfa9 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1947,14 +1947,10 @@ namespace OpenSim.Framework.Servers.HttpServer m_httpListener2.Start(64); // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events -<<<<<<< HEAD + PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 3, 25000); PollServiceRequestManager.Start(); -======= - m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000); - m_PollServiceManager.Start(); ->>>>>>> avn/ubitvar HTTPDRunning = true; //HttpListenerContext context; diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 4ffe6e575c..571e8d8b1a 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -74,16 +74,11 @@ namespace OpenSim.Framework.Servers.HttpServer private Thread[] m_workerThreads; private Thread m_retrysThread; -<<<<<<< HEAD - private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); - -// private int m_timeout = 1000; // increase timeout 250; now use the event one -======= private bool m_running = true; private int slowCount = 0; private SmartThreadPool m_threadPool; ->>>>>>> avn/ubitvar + public PollServiceRequestManager( BaseHttpServer pSrv, bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout) @@ -93,7 +88,7 @@ namespace OpenSim.Framework.Servers.HttpServer m_WorkerThreadCount = pWorkerThreadCount; m_workerThreads = new Thread[m_WorkerThreadCount]; -<<<<<<< HEAD +/* StatsManager.RegisterStat( new Stat( "QueuedPollResponses", @@ -119,7 +114,7 @@ namespace OpenSim.Framework.Servers.HttpServer MeasuresOfInterest.AverageChangeOverTime, stat => stat.Value = ResponsesProcessed, StatVerbosity.Debug)); -======= +*/ PollServiceHttpRequestComparer preqCp = new PollServiceHttpRequestComparer(); m_bycontext = new Dictionary>(preqCp); @@ -132,46 +127,16 @@ namespace OpenSim.Framework.Servers.HttpServer startInfo.ThreadPoolName = "PoolService"; m_threadPool = new SmartThreadPool(startInfo); ->>>>>>> avn/ubitvar } public void Start() { -<<<<<<< HEAD - IsRunning = true; - - if (PerformResponsesAsync) - { - //startup worker threads - for (uint i = 0; i < m_WorkerThreadCount; i++) - { - m_workerThreads[i] - = WorkManager.StartThread( - PoolWorkerJob, - string.Format("PollServiceWorkerThread{0}:{1}", i, m_server.Port), - ThreadPriority.Normal, - false, - false, - null, - int.MaxValue); - } - - WorkManager.StartThread( - this.CheckLongPollThreads, - string.Format("LongPollServiceWatcherThread:{0}", m_server.Port), - ThreadPriority.Normal, - false, - true, - null, - 1000 * 60 * 10); - } -======= m_threadPool.Start(); //startup worker threads for (uint i = 0; i < m_WorkerThreadCount; i++) { m_workerThreads[i] - = Watchdog.StartThread( + = WorkManager.StartThread( PoolWorkerJob, string.Format("PollServiceWorkerThread {0}:{1}", i, m_server.Port), ThreadPriority.Normal, @@ -181,7 +146,7 @@ namespace OpenSim.Framework.Servers.HttpServer int.MaxValue); } - m_retrysThread = Watchdog.StartThread( + m_retrysThread = WorkManager.StartThread( this.CheckRetries, string.Format("PollServiceWatcherThread:{0}", m_server.Port), ThreadPriority.Normal, @@ -189,7 +154,7 @@ namespace OpenSim.Framework.Servers.HttpServer true, null, 1000 * 60 * 10); ->>>>>>> avn/ubitvar + } private void ReQueueEvent(PollServiceHttpRequest req) @@ -258,36 +223,13 @@ namespace OpenSim.Framework.Servers.HttpServer private void CheckRetries() { -<<<<<<< HEAD - // The only purpose of this thread is to check the EQs for events. - // If there are events, that thread will be placed in the "ready-to-serve" queue, m_requests. - // If there are no events, that thread will be back to its "waiting" queue, m_longPollRequests. - // All other types of tasks (Inventory handlers, http-in, etc) don't have the long-poll nature, - // so if they aren't ready to be served by a worker thread (no events), they are placed - // directly back in the "ready-to-serve" queue by the worker thread. - while (IsRunning) -======= while (m_running) ->>>>>>> avn/ubitvar + { Thread.Sleep(100); // let the world move .. back to faster rate Watchdog.UpdateThread(); lock (m_retryRequests) { -<<<<<<< HEAD - if (m_longPollRequests.Count > 0 && IsRunning) - { - List ready = m_longPollRequests.FindAll(req => - (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id) || // there are events in this EQ - (Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) // no events, but timeout - ); - - ready.ForEach(req => - { - m_requests.Enqueue(req); - m_longPollRequests.Remove(req); - }); -======= while (m_retryRequests.Count > 0 && m_running) m_requests.Enqueue(m_retryRequests.Dequeue()); } @@ -295,7 +237,6 @@ namespace OpenSim.Framework.Servers.HttpServer if (slowCount >= 10) { slowCount = 0; ->>>>>>> avn/ubitvar lock (m_slowRequests) { @@ -308,12 +249,8 @@ namespace OpenSim.Framework.Servers.HttpServer public void Stop() { -<<<<<<< HEAD - IsRunning = false; -// m_timeout = -10000; // cause all to expire -======= m_running = false; ->>>>>>> avn/ubitvar + Thread.Sleep(1000); // let the world move foreach (Thread t in m_workerThreads) @@ -341,13 +278,9 @@ namespace OpenSim.Framework.Servers.HttpServer lock (m_slowRequests) { -<<<<<<< HEAD - if (m_longPollRequests.Count > 0 && IsRunning) - m_longPollRequests.ForEach(req => m_requests.Enqueue(req)); -======= while (m_slowRequests.Count > 0) m_requests.Enqueue(m_slowRequests.Dequeue()); ->>>>>>> avn/ubitvar + } while (m_requests.Count() > 0) @@ -355,13 +288,8 @@ namespace OpenSim.Framework.Servers.HttpServer try { wreq = m_requests.Dequeue(0); -<<<<<<< HEAD - ResponsesProcessed++; - wreq.DoHTTPGruntWork( - m_server, wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); -======= wreq.DoHTTPstop(m_server); ->>>>>>> avn/ubitvar + } catch { @@ -375,91 +303,35 @@ namespace OpenSim.Framework.Servers.HttpServer private void PoolWorkerJob() { - while (IsRunning) + while (m_running) { -<<<<<<< HEAD -======= PollServiceHttpRequest req = m_requests.Dequeue(5000); ->>>>>>> avn/ubitvar Watchdog.UpdateThread(); - WaitPerformResponse(); - } - } - - public void WaitPerformResponse() - { - PollServiceHttpRequest req = m_requests.Dequeue(5000); -// m_log.DebugFormat("[YYY]: Dequeued {0}", (req == null ? "null" : req.PollServiceArgs.Type.ToString())); - - if (req != null) - { - try + if (req != null) { - if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) + try { - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); - -<<<<<<< HEAD - if (responsedata == null) - return; - - // This is the event queue. - // Even if we're not running we can still perform responses by explicit request. - if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll - || !PerformResponsesAsync) + if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) { - try - { - ResponsesProcessed++; - req.DoHTTPGruntWork(m_server, responsedata); - } - catch (ObjectDisposedException e) // Browser aborted before we could read body, server closed the stream - { - // Ignore it, no need to reply - m_log.Error(e); - } - } - else - { - m_threadPool.QueueWorkItem(x => -======= + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); + if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll) // This is the event queue ->>>>>>> avn/ubitvar { try { - ResponsesProcessed++; req.DoHTTPGruntWork(m_server, responsedata); byContextDequeue(req); } - catch (ObjectDisposedException e) // Browser aborted before we could read body, server closed the stream + catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream { // Ignore it, no need to reply - m_log.Error(e); } - catch (Exception e) + } + else + { + m_threadPool.QueueWorkItem(x => { -<<<<<<< HEAD - m_log.Error(e); - } - - return null; - }, null); - } - } - else - { - if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) - { - ResponsesProcessed++; - req.DoHTTPGruntWork( - m_server, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); - } - else - { - ReQueueEvent(req); -======= try { req.DoHTTPGruntWork(m_server, responsedata); @@ -478,7 +350,7 @@ namespace OpenSim.Framework.Servers.HttpServer { if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) { - req.DoHTTPGruntWork(m_server, + req.DoHTTPGruntWork(m_server, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); byContextDequeue(req); } @@ -486,17 +358,15 @@ namespace OpenSim.Framework.Servers.HttpServer { ReQueueEvent(req); } ->>>>>>> avn/ubitvar } } - } - catch (Exception e) - { - m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); + catch (Exception e) + { + m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); + } } } } } } - diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs index e13551cb54..1b47cc6efe 100644 --- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs +++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs @@ -41,9 +41,6 @@ namespace OpenSim.Framework.Servers.Tests { [TestFixture] public class OSHttpTests : OpenSimTestCase -<<<<<<< HEAD - { -======= { // we need an IHttpClientContext for our tests public class TestHttpClientContext: IHttpClientContext @@ -363,9 +360,8 @@ namespace OpenSim.Framework.Servers.Tests public void Redirect(Uri uri) {} public void Redirect(string url) {} } + - ->>>>>>> avn/ubitvar public OSHttpRequest req0; public OSHttpRequest req1; diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs index 61d8fe553a..f7069a56a2 100644 --- a/OpenSim/Framework/UserProfileData.cs +++ b/OpenSim/Framework/UserProfileData.cs @@ -160,11 +160,7 @@ namespace OpenSim.Framework public virtual ulong HomeRegion { get -<<<<<<< HEAD - { -======= { ->>>>>>> avn/ubitvar return Util.RegionWorldLocToHandle(Util.RegionToWorldLoc(m_homeRegionX), Util.RegionToWorldLoc(m_homeRegionY)); // return Utils.UIntsToLong( m_homeRegionX * (uint)Constants.RegionSize, m_homeRegionY * (uint)Constants.RegionSize); } diff --git a/OpenSim/Framework/UserProfiles.cs b/OpenSim/Framework/UserProfiles.cs index 944a492eb4..98ab651324 100644 --- a/OpenSim/Framework/UserProfiles.cs +++ b/OpenSim/Framework/UserProfiles.cs @@ -91,6 +91,14 @@ namespace OpenSim.Framework public UUID TargetId; public string Notes; } + + public class UserPreferences + { + public UUID UserId; + public bool IMViaEmail = false; + public bool Visible = false; + public string EMail = string.Empty; + } public class UserAccountProperties { diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index eb3526a1d2..77985bd72f 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1688,69 +1688,6 @@ namespace OpenSim.Framework return displayConnectionString; } - public static T ReadSettingsFromIniFile(IConfig config, T settingsClass) - { - Type settingsType = settingsClass.GetType(); - - FieldInfo[] fieldInfos = settingsType.GetFields(); - foreach (FieldInfo fieldInfo in fieldInfos) - { - if (!fieldInfo.IsStatic) - { - if (fieldInfo.FieldType == typeof(System.String)) - { - fieldInfo.SetValue(settingsClass, config.Get(fieldInfo.Name, (string)fieldInfo.GetValue(settingsClass))); - } - else if (fieldInfo.FieldType == typeof(System.Boolean)) - { - fieldInfo.SetValue(settingsClass, config.GetBoolean(fieldInfo.Name, (bool)fieldInfo.GetValue(settingsClass))); - } - else if (fieldInfo.FieldType == typeof(System.Int32)) - { - fieldInfo.SetValue(settingsClass, config.GetInt(fieldInfo.Name, (int)fieldInfo.GetValue(settingsClass))); - } - else if (fieldInfo.FieldType == typeof(System.Single)) - { - fieldInfo.SetValue(settingsClass, config.GetFloat(fieldInfo.Name, (float)fieldInfo.GetValue(settingsClass))); - } - else if (fieldInfo.FieldType == typeof(System.UInt32)) - { - fieldInfo.SetValue(settingsClass, Convert.ToUInt32(config.Get(fieldInfo.Name, ((uint)fieldInfo.GetValue(settingsClass)).ToString()))); - } - } - } - - PropertyInfo[] propertyInfos = settingsType.GetProperties(); - foreach (PropertyInfo propInfo in propertyInfos) - { - if ((propInfo.CanRead) && (propInfo.CanWrite)) - { - if (propInfo.PropertyType == typeof(System.String)) - { - propInfo.SetValue(settingsClass, config.Get(propInfo.Name, (string)propInfo.GetValue(settingsClass, null)), null); - } - else if (propInfo.PropertyType == typeof(System.Boolean)) - { - propInfo.SetValue(settingsClass, config.GetBoolean(propInfo.Name, (bool)propInfo.GetValue(settingsClass, null)), null); - } - else if (propInfo.PropertyType == typeof(System.Int32)) - { - propInfo.SetValue(settingsClass, config.GetInt(propInfo.Name, (int)propInfo.GetValue(settingsClass, null)), null); - } - else if (propInfo.PropertyType == typeof(System.Single)) - { - propInfo.SetValue(settingsClass, config.GetFloat(propInfo.Name, (float)propInfo.GetValue(settingsClass, null)), null); - } - if (propInfo.PropertyType == typeof(System.UInt32)) - { - propInfo.SetValue(settingsClass, Convert.ToUInt32(config.Get(propInfo.Name, ((uint)propInfo.GetValue(settingsClass, null)).ToString())), null); - } - } - } - - return settingsClass; - } - public static string Base64ToString(string str) { Decoder utf8Decode = Encoding.UTF8.GetDecoder(); @@ -2156,11 +2093,6 @@ namespace OpenSim.Framework } } - public static void FireAndForget(System.Threading.WaitCallback callback) - { - FireAndForget(callback, null); - } - public static void InitThreadPool(int minThreads, int maxThreads) { if (maxThreads < 2) diff --git a/OpenSim/Framework/VersionInfo.cs b/OpenSim/Framework/VersionInfo.cs index ea99444f0f..f0ea96f68a 100644 --- a/OpenSim/Framework/VersionInfo.cs +++ b/OpenSim/Framework/VersionInfo.cs @@ -29,11 +29,7 @@ namespace OpenSim { public class VersionInfo { -<<<<<<< HEAD:OpenSim/Framework/VersionInfo.cs - public const string VersionNumber = "0.8.2.0"; -======= - private const string VERSION_NUMBER = "0.8.0CM"; ->>>>>>> avn/ubitvar:OpenSim/Framework/Servers/VersionInfo.cs + public const string VersionNumber = "0.8.2.0CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 94b5230609..44d931868f 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -205,16 +205,8 @@ namespace OpenSim.Framework { if (DebugLevel == 5) { -<<<<<<< HEAD if (output.Length > MaxRequestDiagLength) output = output.Substring(0, MaxRequestDiagLength) + "..."; -======= - int len = output.Length; - if(len > 80) - len = 80; - output = output.Substring(0, len); - output = output + "..."; ->>>>>>> avn/ubitvar } m_log.DebugFormat("[LOGHTTP]: {0}{1}", context, Util.BinaryToASCII(output)); @@ -295,12 +287,9 @@ namespace OpenSim.Framework } else { -<<<<<<< HEAD -======= tickcompressdata = tickJsondata; compsize = buffer.Length; - request.ContentType = "application/json"; ->>>>>>> avn/ubitvar + request.ContentLength = buffer.Length; //Count bytes to send using (Stream requestStream = request.GetRequestStream()) requestStream.Write(buffer, 0, buffer.Length); //Send it @@ -315,7 +304,6 @@ namespace OpenSim.Framework { using (Stream responseStream = response.GetResponseStream()) { -<<<<<<< HEAD using (StreamReader reader = new StreamReader(responseStream)) { string responseStr = reader.ReadToEnd(); @@ -323,12 +311,6 @@ namespace OpenSim.Framework WebUtil.LogResponseDetail(reqnum, responseStr); return CanonicalizeResults(responseStr); } -======= - string responseStr = null; - responseStr = responseStream.GetStreamString(); - //m_log.DebugFormat("[WEB UTIL]: <{0}> response is <{1}>",reqnum,responseStr); - return CanonicalizeResults(responseStr); ->>>>>>> avn/ubitvar } } } @@ -352,10 +334,6 @@ namespace OpenSim.Framework if (tickdiff > LongCallTime) { m_log.InfoFormat( -<<<<<<< HEAD - "[LOGHTTP]: Slow JSON-RPC request {0} {1} to {2} took {3}ms, {4}ms writing, {5}", - reqnum, method, url, tickdiff, tickdata, -======= "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing({5} at Json; {6} at comp), {7} bytes ({8} uncomp): {9}", reqnum, method, @@ -366,7 +344,7 @@ namespace OpenSim.Framework tickcompressdata, compsize, strBuffer != null ? strBuffer.Length : 0, ->>>>>>> avn/ubitvar + strBuffer != null ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) : ""); @@ -823,6 +801,20 @@ namespace OpenSim.Framework MakeRequest(verb, requestUrl, obj, action, maxConnections, null); } + /// + /// Perform a synchronous REST request. + /// + /// + /// + /// + /// + /// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds) + /// + /// + /// + /// The response. If there was an internal exception or the request timed out, + /// then the default(TResponse) is returned. + /// public static void MakeRequest(string verb, string requestUrl, TRequest obj, Action action, int maxConnections, IServiceAuth auth) @@ -834,7 +826,7 @@ namespace OpenSim.Framework reqnum, verb, requestUrl); int tickstart = Util.EnvironmentTickCount(); -// int tickdata = 0; + int tickdata = 0; int tickdiff = 0; Type type = typeof(TRequest); @@ -876,27 +868,19 @@ namespace OpenSim.Framework request.ContentLength = length; byte[] data = buffer.ToArray(); -<<<<<<< HEAD if (WebUtil.DebugLevel >= 5) WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data)); request.BeginGetRequestStream(delegate(IAsyncResult res) -======= - // capture how much time was spent writing - // useless in this async -// tickdata = Util.EnvironmentTickCountSubtract(tickstart); - request.BeginGetResponse(delegate(IAsyncResult ar) ->>>>>>> avn/ubitvar { using (Stream requestStream = request.EndGetRequestStream(res)) requestStream.Write(data, 0, length); // capture how much time was spent writing - tickdata = Util.EnvironmentTickCountSubtract(tickstart); +// tickdata = Util.EnvironmentTickCountSubtract(tickstart); request.BeginGetResponse(delegate(IAsyncResult ar) { -<<<<<<< HEAD using (WebResponse response = request.EndGetResponse(ar)) { try @@ -911,14 +895,6 @@ namespace OpenSim.Framework { } } -======= - // Let's not close this - // yes do close it - buffer.Close(); - respStream.Close(); - response.Close(); - } ->>>>>>> avn/ubitvar action(deserial); @@ -980,7 +956,6 @@ namespace OpenSim.Framework "[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}", verb, requestUrl, e.Message, e.StackTrace); } -<<<<<<< HEAD // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); @@ -998,83 +973,34 @@ namespace OpenSim.Framework }, null); } - int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); + tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > WebUtil.LongCallTime) { string originalRequest = null; if (buffer != null) -======= - } - catch (Exception e) - { - m_log.ErrorFormat( - "[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}", - verb, requestUrl, e.Message, e.StackTrace); - } - - // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); - try - { - action(deserial); - } - catch (Exception e) ->>>>>>> avn/ubitvar { originalRequest = Encoding.UTF8.GetString(buffer.ToArray()); -<<<<<<< HEAD if (originalRequest.Length > WebUtil.MaxRequestDiagLength) originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength); } -======= - tickdiff = Util.EnvironmentTickCountSubtract(tickstart); - if (tickdiff > WebUtil.LongCallTime) - { -/* - string originalRequest = null; ->>>>>>> avn/ubitvar - - m_log.InfoFormat( + m_log.InfoFormat( "[LOGHTTP]: Slow AsynchronousRequestObject request {0} {1} to {2} took {3}ms, {4}ms writing, {5}", reqnum, verb, requestUrl, tickdiff, tickdata, originalRequest); } else if (WebUtil.DebugLevel >= 4) { - m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing", - reqnum, tickdiff, tickdata); + m_log.DebugFormat( + "[WEB UTIL]: HTTP OUT {0} took {1}ms", + reqnum, tickdiff); } -<<<<<<< HEAD } finally { if (buffer != null) buffer.Dispose(); -======= - - m_log.InfoFormat( - "[ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", - reqnum, - verb, - requestUrl, - tickdiff, - tickdata, - originalRequest); -*/ - m_log.InfoFormat( - "[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms", - reqnum, - verb, - requestUrl, - tickdiff); - } - else if (WebUtil.DebugLevel >= 4) - { - m_log.DebugFormat( - "[WEB UTIL]: HTTP OUT {0} took {1}ms", - reqnum, tickdiff); ->>>>>>> avn/ubitvar } } } @@ -1136,11 +1062,8 @@ namespace OpenSim.Framework request.ContentLength = length; byte[] data = buffer.ToArray(); -<<<<<<< HEAD if (WebUtil.DebugLevel >= 5) WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data)); -======= ->>>>>>> avn/ubitvar Stream requestStream = null; try @@ -1188,10 +1111,6 @@ namespace OpenSim.Framework if (tickdiff > WebUtil.LongCallTime) { m_log.InfoFormat( -<<<<<<< HEAD - "[LOGHTTP]: Slow SynchronousRestForms request {0} {1} to {2} took {3}ms, {4}ms writing, {5}", - reqnum, verb, requestUrl, tickdiff, tickdata, -======= "[FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", reqnum, verb, @@ -1199,7 +1118,6 @@ namespace OpenSim.Framework tickdiff, tickset, tickdata, ->>>>>>> avn/ubitvar obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); } else if (WebUtil.DebugLevel >= 4) @@ -1336,8 +1254,6 @@ namespace OpenSim.Framework ht.ServicePoint.ConnectionLimit = maxConnections; request.Method = verb; - if (pTimeout != 0) - request.Timeout = pTimeout * 1000; MemoryStream buffer = null; try @@ -1351,29 +1267,17 @@ namespace OpenSim.Framework XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = Encoding.UTF8; -<<<<<<< HEAD using (XmlWriter writer = XmlWriter.Create(buffer, settings)) { XmlSerializer serializer = new XmlSerializer(type); serializer.Serialize(writer, obj); writer.Flush(); } -======= - using (XmlWriter writer = XmlWriter.Create(buffer, settings)) - { - XmlSerializer serializer = new XmlSerializer(type); - serializer.Serialize(writer, obj); - writer.Flush(); - if (WebUtil.DebugLevel >= 5) - WebUtil.LogOutgoingDetail(buffer); - } ->>>>>>> avn/ubitvar int length = (int)buffer.Length; request.ContentLength = length; byte[] data = buffer.ToArray(); -<<<<<<< HEAD if (WebUtil.DebugLevel >= 5) WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data)); @@ -1397,9 +1301,6 @@ namespace OpenSim.Framework } } -======= - Stream requestStream = null; ->>>>>>> avn/ubitvar try { using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse()) @@ -1488,7 +1389,6 @@ namespace OpenSim.Framework return deserial; } - public static class XMLResponseHelper { diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index a350510cf7..a49981134c 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -115,13 +115,8 @@ namespace OpenSim if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse(asyncCallMethodStr, out asyncCallMethod)) Util.FireAndForgetMethod = asyncCallMethod; -<<<<<<< HEAD - stpMinThreads = startupConfig.GetInt("MinPoolThreads", 15); - stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 300); -======= stpMinThreads = startupConfig.GetInt("MinPoolThreads", 2 ); stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 25); ->>>>>>> avn/ubitvar m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) "); } @@ -273,20 +268,12 @@ namespace OpenSim SavePrimsXml2); m_console.Commands.AddCommand("Archiving", false, "load oar", -<<<<<<< HEAD -======= - ->>>>>>> avn/ubitvar "load oar [--merge] [--skip-assets]" + " [--default-user \"User Name\"]" + " [--force-terrain] [--force-parcels]" + " [--no-objects]" + " [--rotation degrees] [--rotation-center \"\"]" -<<<<<<< HEAD - + " [--displacement \"\"]" -======= + " [--displacement \"\"]" ->>>>>>> avn/ubitvar + " []", "Load a region's data from an OAR archive.", "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading).\n" diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 760decda4d..5cd9045c61 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -276,13 +276,9 @@ namespace OpenSim base.StartupSpecific(); -<<<<<<< HEAD - if (EnableInitialPluginLoad) - LoadPlugins(); // We still want to post initalize any plugins even if loading has been disabled since a test may have // inserted them manually. -======= LoadPlugins(); if (m_plugins.Count == 0) // We failed to load any modules. Mono Addins glitch! @@ -290,7 +286,6 @@ namespace OpenSim Environment.Exit(1); } ->>>>>>> avn/ubitvar foreach (IApplicationPlugin plugin in m_plugins) plugin.PostInitialise(); @@ -832,10 +827,6 @@ namespace OpenSim { Vector3 regionExtent = new Vector3(regionInfo.RegionSizeX, regionInfo.RegionSizeY, regionInfo.RegionSizeZ); PhysicsScene physicsScene = GetPhysicsScene(regionInfo.RegionName, regionExtent); -<<<<<<< HEAD - -======= ->>>>>>> avn/ubitvar SceneCommunicationService sceneGridService = new SceneCommunicationService(); return new Scene( diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 4e6d196f3f..1236e83da5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -45,7 +45,6 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Framework.Client; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; @@ -360,8 +359,8 @@ namespace OpenSim.Region.ClientStack.Linden public string SeedCapRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { -// m_log.DebugFormat( -// "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); + m_log.DebugFormat( + "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); if (!m_HostCapsObj.WaitForActivation()) return string.Empty; @@ -789,99 +788,10 @@ namespace OpenSim.Region.ClientStack.Linden } else if (inventoryType == "object") { -<<<<<<< HEAD - inType = (sbyte)InventoryType.Object; - assType = (sbyte)AssetType.Object; - - List positions = new List(); - List rotations = new List(); - OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); - OSDArray instance_list = (OSDArray)request["instance_list"]; - OSDArray mesh_list = (OSDArray)request["mesh_list"]; - OSDArray texture_list = (OSDArray)request["texture_list"]; - SceneObjectGroup grp = null; - - InventoryFolderBase textureUploadFolder = null; - - List foldersToUpdate = new List(); - List itemsToUpdate = new List(); - IClientInventory clientInv = null; - - if (texture_list.Count > 0) - { - ScenePresence avatar = null; - m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); - - if (avatar != null) - { - IClientCore core = (IClientCore)avatar.ControllingClient; - - if (core.TryGet(out clientInv)) - { - var systemTextureFolder = m_Scene.InventoryService.GetFolderForType(m_HostCapsObj.AgentID, FolderType.Texture); - textureUploadFolder = new InventoryFolderBase(UUID.Random(), assetName, m_HostCapsObj.AgentID, (short)FolderType.None, systemTextureFolder.ID, 1); - if (m_Scene.InventoryService.AddFolder(textureUploadFolder)) - { - foldersToUpdate.Add(textureUploadFolder); - - m_log.DebugFormat( - "[BUNCH OF CAPS]: Created new folder '{0}' ({1}) for textures uploaded with mesh object {2}", - textureUploadFolder.Name, textureUploadFolder.ID, assetName); - } - else - { - textureUploadFolder = null; - } - } - } - } - - List textures = new List(); - for (int i = 0; i < texture_list.Count; i++) - { - AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, ""); - textureAsset.Data = texture_list[i].AsBinary(); - m_assetService.Store(textureAsset); - textures.Add(textureAsset.FullID); - - if (textureUploadFolder != null) - { - InventoryItemBase textureItem = new InventoryItemBase(); - textureItem.Owner = m_HostCapsObj.AgentID; - textureItem.CreatorId = m_HostCapsObj.AgentID.ToString(); - textureItem.CreatorData = String.Empty; - textureItem.ID = UUID.Random(); - textureItem.AssetID = textureAsset.FullID; - textureItem.Description = assetDescription; - textureItem.Name = assetName + " - Texture " + (i + 1).ToString(); - textureItem.AssetType = (int)AssetType.Texture; - textureItem.InvType = (int)InventoryType.Texture; - textureItem.Folder = textureUploadFolder.ID; - textureItem.CurrentPermissions - = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export); - textureItem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; - textureItem.EveryOnePermissions = 0; - textureItem.NextPermissions = (uint)PermissionMask.All; - textureItem.CreationDate = Util.UnixTimeSinceEpoch(); - m_Scene.InventoryService.AddItem(textureItem); - itemsToUpdate.Add(textureItem); - - m_log.DebugFormat( - "[BUNCH OF CAPS]: Created new inventory item '{0}' ({1}) for texture uploaded with mesh object {2}", - textureItem.Name, textureItem.ID, assetName); - } - } - - if (clientInv != null && (foldersToUpdate.Count > 0 || itemsToUpdate.Count > 0)) - { - clientInv.SendBulkUpdateInventory(foldersToUpdate.ToArray(), itemsToUpdate.ToArray()); - } -======= if (assetType == "mesh") // this code for now is for mesh models uploads only { inType = (sbyte)InventoryType.Object; assType = (sbyte)AssetType.Object; ->>>>>>> avn/ubitvar List positions = new List(); List rotations = new List(); @@ -1467,24 +1377,17 @@ namespace OpenSim.Region.ClientStack.Linden { string message; copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID, out message); - if (client != null) + if (copyItem != null && client != null) { - if (copyItem != null) - { - m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder); - client.SendBulkUpdateInventory(copyItem); - } - else - { - client.SendAgentAlertMessage(message, false); - } + m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder); + client.SendBulkUpdateInventory(copyItem); } } else { m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); if (client != null) - client.SendAgentAlertMessage("Failed to retrieve item", false); + client.SendAlertMessage("Failed to retrieve item"); } } catch (Exception e) @@ -1656,14 +1559,13 @@ namespace OpenSim.Region.ClientStack.Linden string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); - OSDMap accessPrefs = (OSDMap)req["access_prefs"]; - string desiredMaturity = accessPrefs["max"]; - +// OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); OSDMap resp = new OSDMap(); - OSDMap respAccessPrefs = new OSDMap(); - respAccessPrefs["max"] = desiredMaturity; // echoing the maturity back means success - resp["access_prefs"] = respAccessPrefs; + + OSDMap accessPrefs = new OSDMap(); + accessPrefs["max"] = "A"; + + resp["access_prefs"] = accessPrefs; string response = OSDParser.SerializeLLSDXmlString(resp); return response; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs index c241075b52..b735dfa244 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs @@ -40,8 +40,8 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using Caps = OpenSim.Framework.Capabilities.Caps; -[assembly: Addin("LindenCaps", OpenSim.VersionInfo.VersionNumber)] -[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] +[assembly: Addin("LindenCaps", "0.1")] +[assembly: AddinDependency("OpenSim", "0.5")] namespace OpenSim.Region.ClientStack.Linden { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 5fb028c932..5d50eba127 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -177,7 +177,6 @@ namespace OpenSim.Region.ClientStack.Linden } /// -<<<<<<< HEAD /// Always returns a valid queue /// /// @@ -201,8 +200,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// -======= ->>>>>>> avn/ubitvar + /// May return a null queue /// /// @@ -290,17 +288,11 @@ namespace OpenSim.Region.ClientStack.Linden public void OnRegisterCaps(UUID agentID, Caps caps) { // Register an event queue for the client -<<<<<<< HEAD if (DebugLevel > 0) m_log.DebugFormat( "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}", agentID, caps, m_scene.RegionInfo.RegionName); -======= - m_log.DebugFormat( - "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}", - agentID, caps, m_scene.RegionInfo.RegionName); ->>>>>>> avn/ubitvar UUID eventQueueGetUUID; Queue queue; @@ -519,14 +511,9 @@ namespace OpenSim.Region.ClientStack.Linden public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) { -<<<<<<< HEAD if (DebugLevel > 0) m_log.DebugFormat("{0} EnableSimulator. handle={1}, endPoint={2}, avatarID={3}", LogHeader, handle, endPoint, avatarID, regionSizeX, regionSizeY); -======= - m_log.DebugFormat("{0} EnableSimulator. handle={1}, avatarID={2}, regionSize={3},{4}>", - LogHeader, handle, avatarID, regionSizeX, regionSizeY); ->>>>>>> avn/ubitvar OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY); Enqueue(item, avatarID); @@ -535,15 +522,10 @@ namespace OpenSim.Region.ClientStack.Linden public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath, ulong regionHandle, int regionSizeX, int regionSizeY) { -<<<<<<< HEAD if (DebugLevel > 0) m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, endPoint={2}, avatarID={3}", LogHeader, regionHandle, endPoint, avatarID, regionSizeX, regionSizeY); -======= - m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, avatarID={2}, regionSize={3},{4}>", - LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY); ->>>>>>> avn/ubitvar OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY); Enqueue(item, avatarID); } @@ -553,14 +535,9 @@ namespace OpenSim.Region.ClientStack.Linden uint locationID, uint flags, string capsURL, UUID avatarID, int regionSizeX, int regionSizeY) { -<<<<<<< HEAD if (DebugLevel > 0) m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, endPoint={2}, avatarID={3}", LogHeader, regionHandle, regionExternalEndPoint, avatarID, regionSizeX, regionSizeY); -======= - m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, avatarID={2}, regionSize={3},{4}>", - LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY); ->>>>>>> avn/ubitvar OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY); @@ -571,14 +548,9 @@ namespace OpenSim.Region.ClientStack.Linden IPEndPoint newRegionExternalEndPoint, string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY) { -<<<<<<< HEAD if (DebugLevel > 0) m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>", LogHeader, handle, avatarID, regionSizeX, regionSizeY); -======= - m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>", - LogHeader, handle, avatarID, regionSizeX, regionSizeY); ->>>>>>> avn/ubitvar OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint, capsURL, avatarID, sessionID, regionSizeX, regionSizeY); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index 8b7e4c1232..50e22f561e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs @@ -77,13 +77,8 @@ namespace OpenSim.Region.ClientStack.Linden llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle))); llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes())); llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port)); -<<<<<<< HEAD - llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint) regionSizeX)); - llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint) regionSizeY)); -======= llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); ->>>>>>> avn/ubitvar OSDArray arr = new OSDArray(1); arr.Add(llsdSimInfo); @@ -176,12 +171,8 @@ namespace OpenSim.Region.ClientStack.Linden info.Add("SimAccess", OSD.FromInteger(simAccess)); info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); -<<<<<<< HEAD - info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation -======= // info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation info.Add("TeleportFlags", OSD.FromUInteger(flags)); ->>>>>>> avn/ubitvar info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 91efe8ad82..b5a7004049 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -60,11 +60,10 @@ namespace OpenSim.Region.ClientStack.Linden private IAssetService m_AssetService; private bool m_Enabled = true; private string m_URL; -<<<<<<< HEAD + private string m_URL2; private string m_RedirectURL = null; private string m_RedirectURL2 = null; -======= struct aPollRequest { @@ -94,7 +93,7 @@ namespace OpenSim.Region.ClientStack.Linden new OpenMetaverse.BlockingQueue(); private Dictionary m_pollservices = new Dictionary(); ->>>>>>> avn/ubitvar + #region Region Module interfaceBase Members @@ -129,12 +128,9 @@ namespace OpenSim.Region.ClientStack.Linden if (m_URL2 != string.Empty) { m_Enabled = true; -<<<<<<< HEAD + m_RedirectURL2 = config.GetString("GetMesh2RedirectURL"); } -======= - ->>>>>>> avn/ubitvar } public void AddRegion(Scene pScene) @@ -177,7 +173,7 @@ namespace OpenSim.Region.ClientStack.Linden for (uint i = 0; i < 2; i++) { - m_workerThreads[i] = Watchdog.StartThread(DoMeshRequests, + m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests, String.Format("MeshWorkerThread{0}", i), ThreadPriority.Normal, false, @@ -336,21 +332,6 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterCaps(UUID agentID, Caps caps) { -<<<<<<< HEAD - UUID capID = UUID.Random(); - bool getMeshRegistered = false; - - if (m_URL == string.Empty) - { - - } - else if (m_URL == "localhost") - { - getMeshRegistered = true; - caps.RegisterHandler( - "GetMesh", - new GetMeshHandler("/CAPS/" + capID + "/", m_AssetService, "GetMesh", agentID.ToString(), m_RedirectURL)); -======= // UUID capID = UUID.Random(); if (m_URL == "localhost") { @@ -375,34 +356,13 @@ namespace OpenSim.Region.ClientStack.Linden caps.RegisterHandler("GetMesh", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); m_pollservices[agentID] = args; m_capsDict[agentID] = capUrl; - - - ->>>>>>> avn/ubitvar } else { caps.RegisterHandler("GetMesh", m_URL); } - - if(m_URL2 == string.Empty) - { - - } - else if (m_URL2 == "localhost") - { - if (!getMeshRegistered) - { - caps.RegisterHandler( - "GetMesh2", - new GetMeshHandler("/CAPS/" + capID + "/", m_AssetService, "GetMesh2", agentID.ToString(), m_RedirectURL2)); - } - } - else - { - caps.RegisterHandler("GetMesh2", m_URL2); - } } + private void DeregisterCaps(UUID agentID, Caps caps) { string capUrl; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index b9396b7f20..79a345857a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -82,24 +82,22 @@ namespace OpenSim.Region.ClientStack.Linden private static OpenMetaverse.BlockingQueue m_queue = new OpenMetaverse.BlockingQueue(); -<<<<<<< HEAD + // TODO: Change this to a config option private string m_RedirectURL = null; -======= - private Dictionary m_pollservices = new Dictionary(); ->>>>>>> avn/ubitvar - private string m_URL; + private Dictionary m_pollservices = new Dictionary(); + #region ISharedRegionModule Members public void Initialise(IConfigSource source) { IConfig config = source.Configs["ClientStack.LindenCaps"]; -<<<<<<< HEAD + if (config == null) return; - +/* m_URL = config.GetString("Cap_GetTexture", string.Empty); // Cap doesn't exist if (m_URL != string.Empty) @@ -107,10 +105,8 @@ namespace OpenSim.Region.ClientStack.Linden m_Enabled = true; m_RedirectURL = config.GetString("GetTextureRedirectURL"); } -======= - if (config != null) - m_Url = config.GetString("Cap_GetTexture", "localhost"); ->>>>>>> avn/ubitvar +*/ + m_Url = config.GetString("Cap_GetTexture", "localhost"); } public void AddRegion(Scene s) @@ -142,7 +138,7 @@ namespace OpenSim.Region.ClientStack.Linden for (uint i = 0; i < 2; i++) { - m_workerThreads[i] = Watchdog.StartThread(DoTextureRequests, + m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests, String.Format("TextureWorkerThread{0}", i), ThreadPriority.Normal, false, @@ -237,12 +233,6 @@ namespace OpenSim.Region.ClientStack.Linden public PollServiceTextureEventArgs(UUID pId, Scene scene) : base(null, "", null, null, null, pId, int.MaxValue) { -<<<<<<< HEAD -// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); - caps.RegisterHandler( - "GetTexture", - new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString(), m_RedirectURL)); -======= m_scene = scene; // x is request id, y is userid HasEvents = (x, y) => @@ -312,7 +302,6 @@ namespace OpenSim.Region.ClientStack.Linden return response; }; ->>>>>>> avn/ubitvar } public void Process(aPollRequest requestinfo) @@ -402,11 +391,7 @@ namespace OpenSim.Region.ClientStack.Linden } IExternalCapsModule handler = m_scene.RequestModuleInterface(); if (handler != null) -<<<<<<< HEAD - handler.RegisterExternalUserCapsHandler(agentID,caps,"GetTexture", m_URL); -======= handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", capUrl); ->>>>>>> avn/ubitvar else caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); m_pollservices[agentID] = args; @@ -422,7 +407,7 @@ namespace OpenSim.Region.ClientStack.Linden { PollServiceTextureEventArgs args; - MainServer.Instance.RemoveHTTPHandler("", m_URL); + MainServer.Instance.RemoveHTTPHandler("", m_Url); m_capsDict.Remove(agentID); if (m_pollservices.TryGetValue(agentID, out args)) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 54542c928c..d07f66ef75 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -157,11 +157,7 @@ namespace OpenSim.Region.ClientStack.Linden m_features["MeshXferEnabled"] = true; m_features["PhysicsMaterialsEnabled"] = true; -<<<<<<< HEAD -======= - ->>>>>>> avn/ubitvar OSDMap typesMap = new OSDMap(); typesMap["convex"] = true; typesMap["none"] = true; @@ -169,7 +165,6 @@ namespace OpenSim.Region.ClientStack.Linden m_features["PhysicsShapeTypes"] = typesMap; // Extra information for viewers that want to use it -<<<<<<< HEAD // TODO: Take these out of here into their respective modules, like map-server-url OSDMap extrasMap; if(m_features.ContainsKey("OpenSimExtras")) @@ -179,15 +174,10 @@ namespace OpenSim.Region.ClientStack.Linden else extrasMap = new OSDMap(); -======= - - OSDMap extrasMap = new OSDMap(); - extrasMap["AvatarSkeleton"] = true; extrasMap["AnimationSet"] = true; // TODO: Take these out of here into their respective modules, like map-server-url ->>>>>>> avn/ubitvar if (m_SearchURL != string.Empty) extrasMap["search-server-url"] = m_SearchURL; if (!string.IsNullOrEmpty(m_DestinationGuideURL)) @@ -199,13 +189,8 @@ namespace OpenSim.Region.ClientStack.Linden if (m_GridName != string.Empty) extrasMap["GridName"] = m_GridName; -<<<<<<< HEAD if (extrasMap.Count > 0) m_features["OpenSimExtras"] = extrasMap; -======= - m_features["OpenSimExtras"] = extrasMap; - ->>>>>>> avn/ubitvar } } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs index dd4a691225..db16ccb6a4 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs @@ -52,6 +52,7 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap; namespace OpenSim.Region.ClientStack.Linden.Caps.Tests { + /* [TestFixture] public class WebFetchInvDescModuleTests : OpenSimTestCase { @@ -156,4 +157,5 @@ namespace OpenSim.Region.ClientStack.Linden.Caps.Tests Assert.That((int)folderOsd["descendents"], Is.EqualTo(16)); } } + */ } \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index c27d101489..8fd8d1ff64 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -66,16 +66,19 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_persistBakedTextures; private IBakedTextureModule m_BakedTextureModule; - - private IBakedTextureModule m_BakedTextureModule; + private string m_URL; public void Initialise(IConfigSource source) { + IConfig config = source.Configs["ClientStack.LindenCaps"]; + if (config == null) + return; + + m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty); + IConfig appearanceConfig = source.Configs["Appearance"]; if (appearanceConfig != null) m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); - - } public void AddRegion(Scene s) @@ -91,13 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden s.EventManager.OnRemovePresence -= DeRegisterPresence; m_BakedTextureModule = null; m_scene = null; -<<<<<<< HEAD - } -======= } ->>>>>>> avn/ubitvar - - public void RegionLoaded(Scene s) { @@ -109,173 +106,6 @@ namespace OpenSim.Region.ClientStack.Linden private void DeRegisterPresence(UUID agentId) { -<<<<<<< HEAD - ScenePresence presence = null; - if (m_scene.TryGetScenePresence(agentId, out presence)) - { - presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings; - } - - } - - private void RegisterNewPresence(ScenePresence presence) - { - presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings; - - } - - private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) - { - int maxCacheitemsLoop = cacheItems.Length; - if (maxCacheitemsLoop > AvatarWearable.MAX_WEARABLES) - { - maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES; - m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES); - } - - m_BakedTextureModule = m_scene.RequestModuleInterface(); - if (cacheItems.Length > 0) - { -// m_log.Debug("[Cacheitems]: " + cacheItems.Length); -// for (int iter = 0; iter < maxCacheitemsLoop; iter++) -// { -// m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + -// cacheItems[iter].TextureID); -// } - - ScenePresence p = null; - if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) - { - - WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems; - if (existingitems == null) - { - if (m_BakedTextureModule != null) - { - WearableCacheItem[] savedcache = null; - try - { - if (p.Appearance.WearableCacheItemsDirty) - { - savedcache = m_BakedTextureModule.Get(p.UUID); - p.Appearance.WearableCacheItems = savedcache; - p.Appearance.WearableCacheItemsDirty = false; - } - - } - /* - * The following Catch types DO NOT WORK with m_BakedTextureModule.Get - * it jumps to the General Packet Exception Handler if you don't catch Exception! - * - catch (System.Net.Sockets.SocketException) - { - cacheItems = null; - } - catch (WebException) - { - cacheItems = null; - } - catch (InvalidOperationException) - { - cacheItems = null; - } */ - catch (Exception) - { - // The service logs a sufficient error message. - } - - - if (savedcache != null) - existingitems = savedcache; - } - } - // Existing items null means it's a fully new appearance - if (existingitems == null) - { - - for (int i = 0; i < maxCacheitemsLoop; i++) - { - if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) - { - Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; - if (face == null) - { - textureEntry.CreateFace(cacheItems[i].TextureIndex); - textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = - AppearanceManager.DEFAULT_AVATAR_TEXTURE; - continue; - } - cacheItems[i].TextureID =face.TextureID; - if (m_scene.AssetService != null) - cacheItems[i].TextureAsset = - m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); - } - else - { - m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); - } - - - } - } - else - - - { - // for each uploaded baked texture - for (int i = 0; i < maxCacheitemsLoop; i++) - { - if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) - { - Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; - if (face == null) - { - textureEntry.CreateFace(cacheItems[i].TextureIndex); - textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = - AppearanceManager.DEFAULT_AVATAR_TEXTURE; - continue; - } - cacheItems[i].TextureID = - face.TextureID; - } - else - { - m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); - } - } - - for (int i = 0; i < maxCacheitemsLoop; i++) - { - if (cacheItems[i].TextureAsset == null) - { - cacheItems[i].TextureAsset = - m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); - } - } - } - - - - p.Appearance.WearableCacheItems = cacheItems; - - - - if (m_BakedTextureModule != null) - { - m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems); - p.Appearance.WearableCacheItemsDirty = true; - - } - } - } -======= -// ScenePresence presence = null; -// if (m_scene.TryGetScenePresence(agentId, out presence)) - { -// presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings; - } - ->>>>>>> avn/ubitvar } private void RegisterNewPresence(ScenePresence presence) @@ -441,25 +271,6 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterCaps(UUID agentID, Caps caps) { - UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( - caps, m_scene.AssetService, m_persistBakedTextures); - -<<<<<<< HEAD - - - caps.RegisterHandler( - "UploadBakedTexture", - new RestStreamHandler( - "POST", - "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, - avatarhandler.UploadBakedTexture, - "UploadBakedTexture", - agentID.ToString())); - - - - -======= //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") { @@ -480,7 +291,6 @@ namespace OpenSim.Region.ClientStack.Linden { caps.RegisterHandler("UploadBakedTexture", m_URL); } ->>>>>>> avn/ubitvar } } } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 92f8c5140b..6e2f7f3244 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -64,11 +64,7 @@ namespace OpenSim.Region.ClientStack.Linden public List folders; } -<<<<<<< HEAD - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); -======= private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); ->>>>>>> avn/ubitvar /// /// Control whether requests will be processed asynchronously. diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 806269f272..f76db1ecdb 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -723,11 +723,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!m_packetHandlers.ContainsKey(packetType)) { m_packetHandlers.Add( -<<<<<<< HEAD packetType, new PacketProcessor() { method = handler, Async = doAsync, InEngine = inEngine }); -======= - packetType, new PacketProcessor() { method = handler, Async = doAsync }); ->>>>>>> avn/ubitvar result = true; } } @@ -1228,15 +1224,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// heightmap public virtual void SendLayerData(float[] map) { -<<<<<<< HEAD Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData"); -======= - Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData()); // Send it sync, and async. It's not that much data // and it improves user experience just so much! // DoSendLayerData(map); ->>>>>>> avn/ubitvar } /// @@ -1250,18 +1242,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP try { // Send LayerData in typerwriter pattern -<<<<<<< HEAD - //for (int y = 0; y < 16; y++) - //{ - // for (int x = 0; x < 16; x++) - // { - // SendLayerData(x, y, map); - // } - //} - // Send LayerData in a spiral pattern. Fun! - SendLayerTopRight(map, 0, 0, map.SizeX/Constants.TerrainPatchSize-1, map.SizeY/Constants.TerrainPatchSize-1); -======= for (int y = 0; y < 16; y++) { for (int x = 0; x < 16; x++) @@ -1269,7 +1250,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP SendLayerData(x, y, map); } } ->>>>>>> avn/ubitvar } catch (Exception e) { @@ -1277,74 +1257,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } -<<<<<<< HEAD - private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2) -======= - // Legacy form of invocation that passes around a bare data array. - // Just ignore what was passed and use the real terrain info that is part of the scene. - // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI, - // there is a special form for specifying multiple terrain patches to send. - // The form is to pass 'px' as negative the number of patches to send and to - // pass the float array as pairs of patch X and Y coordinates. So, passing 'px' - // as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches - // and the patches to send are <3,5> and <8,4>. - public void SendLayerData(int px, int py, float[] map) ->>>>>>> avn/ubitvar - { - if (px >= 0) - { - SendLayerData(px, py, m_scene.Heightmap.GetTerrainData()); - } - else - { - int numPatches = -px; - int[] xPatches = new int[numPatches]; - int[] yPatches = new int[numPatches]; - for (int pp = 0; pp < numPatches; pp++) - { - xPatches[pp] = (int)map[pp * 2]; - yPatches[pp] = (int)map[pp * 2 + 1]; - } - - // DebugSendingPatches("SendLayerData", xPatches, yPatches); - -<<<<<<< HEAD - if (x2 - x1 > 0 && y2 - y1 > 0) - SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); - } - - void SendLayerBottomLeft(TerrainData map, int x1, int y1, int x2, int y2) - { - // Row in reverse - for (int i = x2; i >= x1; i--) - SendLayerData(i, y2, map); - - // Column in reverse - for (int j = y2 - 1; j >= y1; j--) - SendLayerData(x1, j, map); - - if (x2 - x1 > 0 && y2 - y1 > 0) - SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); - } - - /// - /// Sends a set of four patches (x, x+1, ..., x+3) to the client - /// - /// heightmap - /// X coordinate for patches 0..12 - /// Y coordinate for patches 0..15 - // private void SendLayerPacket(float[] map, int y, int x) - // { - // int[] patches = new int[4]; - // patches[0] = x + 0 + y * 16; - // patches[1] = x + 1 + y * 16; - // patches[2] = x + 2 + y * 16; - // patches[3] = x + 3 + y * 16; - - // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); - // OutPacket(layerpack, ThrottleOutPacketType.Land); - // } - // Legacy form of invocation that passes around a bare data array. // Just ignore what was passed and use the real terrain info that is part of the scene. // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI, @@ -1393,29 +1305,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// -======= - SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData()); - } - } - private void DebugSendingPatches(string pWho, int[] pX, int[] pY) - { - if (m_log.IsDebugEnabled) - { - int numPatches = pX.Length; - string Xs = ""; - string Ys = ""; - for (int pp = 0; pp < numPatches; pp++) - { - Xs += String.Format("{0}", (int)pX[pp]) + ","; - Ys += String.Format("{0}", (int)pY[pp]) + ","; - } - m_log.DebugFormat("{0} {1}: numPatches={2}, X={3}, Y={4}", LogHeader, pWho, numPatches, Xs, Ys); - } - } - - /// ->>>>>>> avn/ubitvar /// Sends a terrain packet for the point specified. /// This is a legacy call that has refarbed the terrain into a flat map of floats. /// We just use the terrain from the region we know about. @@ -1467,40 +1357,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } -<<<<<<< HEAD - // When a user edits the terrain, so much data is sent, the data queues up fast and presents a - // sub optimal editing experience. To alleviate this issue, when the user edits the terrain, we - // start skipping the queues until they're done editing the terrain. We also make them - // unreliable because it's extremely likely that multiple packets will be sent for a terrain patch - // area invalidating previous packets for that area. - - // It's possible for an editing user to flood themselves with edited packets but the majority - // of use cases are such that only a tiny percentage of users will be editing the terrain. - // Other, non-editing users will see the edits much slower. - - // One last note on this topic, by the time users are going to be editing the terrain, it's - // extremely likely that the sim will have rezzed already and therefore this is not likely going - // to cause any additional issues with lost packets, objects or terrain patches. - - // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we - // only have one cache miss. private void SendTheLayerPacket(LayerDataPacket layerpack) { - if (m_justEditedTerrain) - { - layerpack.Header.Reliable = false; - OutPacket(layerpack, ThrottleOutPacketType.Unknown ); - } - else - { - layerpack.Header.Reliable = true; OutPacket(layerpack, ThrottleOutPacketType.Land); - } -======= - private void SendTheLayerPacket(LayerDataPacket layerpack) - { - OutPacket(layerpack, ThrottleOutPacketType.Land); ->>>>>>> avn/ubitvar } /// @@ -2490,15 +2349,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (agentid == AgentId) { -<<<<<<< HEAD ActiveGroupId = activegroupid; ActiveGroupName = groupname; ActiveGroupPowers = grouppowers; -======= - m_activeGroupID = activegroupid; - m_activeGroupName = groupname; - m_activeGroupPowers = grouppowers; ->>>>>>> avn/ubitvar } AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); @@ -3888,15 +3741,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; -<<<<<<< HEAD avp.AppearanceHover = new AvatarAppearancePacket.AppearanceHoverBlock[0]; -======= - // this need be use in future - // avp.AppearanceData[0].AppearanceVersion = 0; - // avp.AppearanceData[0].CofVersion = 0; +// this need be use in future ? +// avp.AppearanceData[0].AppearanceVersion = 0; +// avp.AppearanceData[0].CofVersion = 0; ->>>>>>> avn/ubitvar //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); } @@ -4014,22 +3864,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) { -<<<<<<< HEAD if (entity.UUID == m_agentId && !updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) { ImprovedTerseObjectUpdatePacket packet = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); -======= - if (entity is SceneObjectPart) - { - SceneObjectPart e = (SceneObjectPart)entity; - SceneObjectGroup g = e.ParentGroup; - if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId) - return; // Don't send updates for other people's HUDs - } - - uint priority = m_prioritizer.GetUpdatePriority(this, entity); ->>>>>>> avn/ubitvar packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; packet.RegionData.TimeDilation = Utils.FloatToUInt16(1, 0.0f, 1.0f); @@ -4037,6 +3875,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP packet.ObjectData[0] = CreateImprovedTerseBlock(entity, false); OutPacket(packet, ThrottleOutPacketType.Unknown, true); } + + else if (entity is SceneObjectPart) + { + SceneObjectPart e = (SceneObjectPart)entity; + SceneObjectGroup g = e.ParentGroup; + if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId) + return; // Don't send updates for other people's HUDs + } + else { //double priority = m_prioritizer.GetUpdatePriority(this, entity); @@ -4385,15 +4232,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task, true); } -<<<<<<< HEAD // m_log.DebugFormat( // "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}", // updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name); // - #endregion Packet Sending -======= ->>>>>>> avn/ubitvar } public void ReprioritizeUpdates() @@ -5360,11 +5203,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ScenePresence presence = (ScenePresence)entity; -<<<<<<< HEAD -// m_log.DebugFormat( -// "[LLCLIENTVIEW]: Sending terse update to {0} with pos {1}, vel {2} in {3}", -// Name, presence.OffsetPosition, presence.Velocity, m_scene.Name); -======= position = presence.OffsetPosition; rotation = presence.Rotation; angularVelocity = presence.AngularVelocity; @@ -5373,7 +5211,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP attachPoint = 0; // m_log.DebugFormat( // "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); ->>>>>>> avn/ubitvar // attachPoint = presence.State; // Core: commented collisionPlane = presence.CollisionPlane; @@ -5495,24 +5332,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name); byte[] objectData = new byte[76]; -<<<<<<< HEAD - - data.CollisionPlane.ToBytes(objectData, 0); - data.OffsetPosition.ToBytes(objectData, 16); - data.Velocity.ToBytes(objectData, 28); -// data.Acceleration.ToBytes(objectData, 40); - - // Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis - // it rotates around. - // In mouselook, X and Y co-ordinate will also be sent but when used in Rotation, these cause unwanted - // excessive up and down movements of the camera when looking up and down. - // See http://opensimulator.org/mantis/view.php?id=3274 - // This does not affect head movement, since this is controlled entirely by camera movement rather than - // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change - // the rotation in this case. - Quaternion rot = data.Rotation; -======= ->>>>>>> avn/ubitvar Vector3 velocity = new Vector3(0, 0, 0); Vector3 acceleration = new Vector3(0, 0, 0); @@ -5596,11 +5415,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //update.JointType = 0; update.Material = data.Material; update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim -<<<<<<< HEAD - -======= /* ->>>>>>> avn/ubitvar if (data.ParentGroup.IsAttachment) { update.NameValue @@ -5625,7 +5440,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // case for attachments may contain conflicting values that can end up crashing the viewer. update.State = data.ParentGroup.RootPart.Shape.State; } - */ +*/ if (data.ParentGroup.IsAttachment) { @@ -9365,11 +9180,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if ((locX >= m_scene.RegionInfo.WorldLocX) && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX)) && (locY >= m_scene.RegionInfo.WorldLocY) -<<<<<<< HEAD - && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) ) -======= && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY))) ->>>>>>> avn/ubitvar { tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle; tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX; @@ -12285,7 +12096,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// // TODO: Convert old handler to use new method - /*protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) +/* + protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) { AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); @@ -12340,27 +12152,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } -<<<<<<< HEAD - if (cacheItems != null) - { - // We need to make sure the asset stored in the bake is available on this server also by its assetid before we map it to a Cacheid. - // Copy the baked textures to the sim's assets cache (local only). - foreach (WearableCacheItem item in cacheItems) - { - if (cache.GetCached(item.TextureID.ToString()) == null) - { - item.TextureAsset.Temporary = true; - item.TextureAsset.Local = true; - cache.Store(item.TextureAsset); - } - } - - // Return the cached textures - for (int i = 0; i < maxWearablesLoop; i++) - { - WearableCacheItem item = - WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex, cacheItems); -======= CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; if (handlerCachedTextureRequest != null) { @@ -12368,7 +12159,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return true; - }*/ + } +*/ protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) { @@ -12408,21 +12200,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < maxWearablesLoop; i++) { int idx = cachedtex.WearableData[i].TextureIndex; ->>>>>>> avn/ubitvar - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].HostName = new byte[0]; -<<<<<<< HEAD - if (item != null && cachedtex.WearableData[i].ID == item.CacheId) - { - cachedresp.WearableData[i].TextureID = item.TextureID; -======= if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) { cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; cacheHits++; ->>>>>>> avn/ubitvar } else { @@ -12432,29 +12216,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { -<<<<<<< HEAD - // Cached textures not available -======= ->>>>>>> avn/ubitvar for (int i = 0; i < maxWearablesLoop; i++) { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].TextureID = UUID.Zero; -<<<<<<< HEAD - cachedresp.WearableData[i].HostName = new byte[0]; - } - } - -======= - //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); cachedresp.WearableData[i].HostName = new byte[0]; } } m_log.DebugFormat("texture cached: hits {0}", cacheHits); ->>>>>>> avn/ubitvar cachedresp.Header.Zerocoded = true; OutPacket(cachedresp, ThrottleOutPacketType.Task); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 92938828fa..86a71881e6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -96,9 +96,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP set { m_throttleDebugLevel = value; +/* m_throttleClient.DebugLevel = m_throttleDebugLevel; foreach (TokenBucket tb in m_throttleCategories) tb.DebugLevel = m_throttleDebugLevel; + */ } } private int m_throttleDebugLevel; @@ -250,22 +252,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (maxRTO != 0) m_maxRTO = maxRTO; -<<<<<<< HEAD - ProcessUnackedSends = true; - - // Create a token bucket throttle for this client that has the scene token bucket as a parent - m_throttleClient - = new AdaptiveTokenBucket( - string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name), - parentThrottle, 0, rates.Total, rates.MinimumAdaptiveThrottleRate, rates.AdaptiveThrottlesEnabled); - -======= m_burstTime = rates.BrustTime; float m_burst = rates.ClientMaxRate * m_burstTime; // Create a token bucket throttle for this client that has the scene token bucket as a parent m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.ClientMaxRate, m_burst, rates.AdaptiveThrottlesEnabled); ->>>>>>> avn/ubitvar + // Create an array of token buckets for this clients different throttle categories m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; @@ -278,19 +270,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP ThrottleOutPacketType type = (ThrottleOutPacketType)i; // Initialize the packet outboxes, where packets sit while they are waiting for tokens -<<<<<<< HEAD - m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); - - // Initialize the token buckets that control the throttling for each category - m_throttleCategories[i] - = new TokenBucket( - string.Format("{0} throttle for {1} in {2}", type, AgentID, server.Scene.Name), - m_throttleClient, rates.GetRate(type), 0); -======= m_packetOutboxes[i] = new DoubleLocklessQueue(); // Initialize the token buckets that control the throttling for each category m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); ->>>>>>> avn/ubitvar } // Default the retransmission timeout to one second @@ -337,12 +319,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; m_info.totalThrottle = (int)m_throttleClient.DripRate; -<<<<<<< HEAD - m_info.targetThrottle = (int)m_throttleClient.TargetDripRate; - m_info.maxThrottle = (int)m_throttleClient.MaxDripRate; -======= ->>>>>>> avn/ubitvar - return m_info; } @@ -460,13 +436,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale); - if (ThrottleDebugLevel > 0) - { - long total = resend + land + wind + cloud + task + texture + asset; - m_log.DebugFormat( - "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}", - AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total); - } + // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged @@ -486,32 +456,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP // the task queue (e.g. object updates) task = task + (int)(m_cannibalrate * texture); texture = (int)((1 - m_cannibalrate) * texture); -<<<<<<< HEAD - - //int total = resend + land + wind + cloud + task + texture + asset; - - if (ThrottleDebugLevel > 0) - { - long total = resend + land + wind + cloud + task + texture + asset; - m_log.DebugFormat( - "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}", - AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total); - } -======= int total = resend + land + wind + cloud + task + texture + asset; float m_burst = total * m_burstTime; - //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", - // AgentID, resend, land, wind, cloud, task, texture, asset, total); ->>>>>>> avn/ubitvar - - // Update the token buckets with new throttle values - if (m_throttleClient.AdaptiveEnabled) + if (ThrottleDebugLevel > 0) { - long total = resend + land + wind + cloud + task + texture + asset; - m_throttleClient.TargetDripRate = total; + m_log.DebugFormat( + "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}", + AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total); } TokenBucket bucket; @@ -887,20 +841,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// signature public void FireQueueEmpty(object o) { -<<<<<<< HEAD -// m_log.DebugFormat("[LLUDPCLIENT]: FireQueueEmpty for {0} in {1}", AgentID, m_udpServer.Scene.Name); - -// int start = Environment.TickCount & Int32.MaxValue; -// const int MIN_CALLBACK_MS = 30; - -// if (m_udpServer.IsRunningOutbound) -// { - ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; - QueueEmpty callback = OnQueueEmpty; -======= ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; QueueEmpty callback = OnQueueEmpty; ->>>>>>> avn/ubitvar if (callback != null) { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 41e19fd72e..cb05e8f19c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -473,17 +473,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion BinaryStats -<<<<<<< HEAD - // FIXME: Can't add info here because don't know scene yet. -// m_throttle -// = new TokenBucket( -// string.Format("server throttle bucket for {0}", Scene.Name), null, sceneThrottleBps); - - Throttle = new TokenBucket("server throttle bucket", null, 0, sceneThrottleBps); - -======= - m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f); ->>>>>>> avn/ubitvar + Throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f); ThrottleRates = new ThrottleRates(configSource); Random rnd = new Random(Util.EnvironmentTickCount()); @@ -784,151 +774,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (UsePools) EnablePoolStats(); -<<<<<<< HEAD + LLUDPServerCommands commands = new LLUDPServerCommands(MainConsole.Instance, this); commands.Register(); -======= - MainConsole.Instance.Commands.AddCommand( - "Debug", false, "debug lludp packet", - "debug lludp packet [--default] [ ]", - "Turn on packet debugging", - "If level > 255 then all incoming and outgoing packets are logged.\n" - + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" - + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" - + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" - + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n" - + "If level <= 0 then no packets are logged.\n" - + "If --default is specified then the level becomes the default logging level for all subsequent agents.\n" - + "In this case, you cannot also specify an avatar name.\n" - + "If an avatar name is given then only packets from that avatar are logged.", - HandlePacketCommand); - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp start", - "debug lludp start ", - "Control LLUDP packet processing.", - "No effect if packet processing has already started.\n" - + "in - start inbound processing.\n" - + "out - start outbound processing.\n" - + "all - start in and outbound processing.\n", - HandleStartCommand); - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp stop", - "debug lludp stop ", - "Stop LLUDP packet processing.", - "No effect if packet processing has already stopped.\n" - + "in - stop inbound processing.\n" - + "out - stop outbound processing.\n" - + "all - stop in and outbound processing.\n", - HandleStopCommand); - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp pool", - "debug lludp pool ", - "Turn object pooling within the lludp component on or off.", - HandlePoolCommand); - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp status", - "debug lludp status", - "Return status of LLUDP packet processing.", - HandleStatusCommand); -/* disabled - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp toggle agentupdate", - "debug lludp toggle agentupdate", - "Toggle whether agentupdate packets are processed or simply discarded.", - HandleAgentUpdateCommand); - */ - } - - private void HandlePacketCommand(string module, string[] args) - { - if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) - return; - - bool setAsDefaultLevel = false; - OptionSet optionSet = new OptionSet().Add("default", o => setAsDefaultLevel = o != null); - List filteredArgs = optionSet.Parse(args); - - string name = null; - - if (filteredArgs.Count == 6) - { - if (!setAsDefaultLevel) - { - name = string.Format("{0} {1}", filteredArgs[4], filteredArgs[5]); - } - else - { - MainConsole.Instance.OutputFormat("ERROR: Cannot specify a user name when setting default logging level"); - return; - } - } - - if (filteredArgs.Count > 3) - { - int newDebug; - if (int.TryParse(filteredArgs[3], out newDebug)) - { - if (setAsDefaultLevel) - { - DefaultClientPacketDebugLevel = newDebug; - MainConsole.Instance.OutputFormat( - "Debug packet debug for new clients set to {0} in {1}", DefaultClientPacketDebugLevel, m_scene.Name); - } - else - { - m_scene.ForEachScenePresence(sp => - { - if (name == null || sp.Name == name) - { - MainConsole.Instance.OutputFormat( - "Packet debug for {0} ({1}) set to {2} in {3}", - sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_scene.Name); - - sp.ControllingClient.DebugPacketLevel = newDebug; - } - }); - } - } - else - { - MainConsole.Instance.Output("Usage: debug lludp packet [--default] 0..255 [ ]"); - } - } - } - - private void HandleStartCommand(string module, string[] args) - { - if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) - return; - - if (args.Length != 4) - { - MainConsole.Instance.Output("Usage: debug lludp start "); - return; - } - - string subCommand = args[3]; - - if (subCommand == "in" || subCommand == "all") - StartInbound(); - - if (subCommand == "out" || subCommand == "all") - StartOutbound(); ->>>>>>> avn/ubitvar } public bool HandlesRegion(Location x) @@ -1126,36 +975,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will // continue to display the deleted object until relog. Therefore, we need to always queue a kill object // packet so that it isn't sent before a queued update packet. -<<<<<<< HEAD - bool forceQueue = (type == PacketType.KillObject); -// if (type == PacketType.ImprovedTerseObjectUpdate) -// { -// m_log.DebugFormat("Direct send ITOU to {0} in {1}", udpClient.AgentID, Scene.Name); -// SendPacketFinal(outgoingPacket); -// return false; -// } -// else -// { - if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, forceQueue)) -======= bool requestQueue = type == PacketType.KillObject; if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority)) ->>>>>>> avn/ubitvar { SendPacketFinal(outgoingPacket); return true; } -<<<<<<< HEAD - else - { - return false; - } -// } -======= return false; ->>>>>>> avn/ubitvar #endregion Queue or Send } @@ -1462,7 +1290,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If there is already a client for this endpoint, don't process UseCircuitCode IClientAPI client = null; - if (!m_scene.TryGetClient(endPoint, out client) || !(client is LLClientView)) + if (!Scene.TryGetClient(endPoint, out client) || !(client is LLClientView)) { // UseCircuitCode handling if (packet.Type == PacketType.UseCircuitCode) @@ -1473,12 +1301,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_pendingCache.Contains(endPoint)) return; -<<<<<<< HEAD - Util.FireAndForget(HandleUseCircuitCode, array, "LLUDPServer.HandleUseCircuitCode"); -======= m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); } ->>>>>>> avn/ubitvar // We need to copy the endpoint so that it doesn't get changed when another thread reuses the // buffer. @@ -1507,14 +1331,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send ack straight away to let the viewer know that we got it. SendAckImmediate(endPoint, packet.Header.Sequence); -<<<<<<< HEAD - Util.FireAndForget( - HandleCompleteMovementIntoRegion, array, "LLUDPServer.HandleCompleteMovementIntoRegion"); -======= // We need to copy the endpoint so that it doesn't get changed when another thread reuses the // buffer. object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet }; ->>>>>>> avn/ubitvar Util.FireAndForget(HandleCompleteMovementIntoRegion, array); @@ -1524,12 +1343,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } // Determine which agent this packet came from -<<<<<<< HEAD - IClientAPI client; - if (!Scene.TryGetClient(endPoint, out client) || !(client is LLClientView)) -======= if (client == null || !(client is LLClientView)) ->>>>>>> avn/ubitvar { //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); @@ -1547,7 +1361,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!udpClient.IsConnected) { - m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + Scene.RegionInfo.RegionName); return; } @@ -1652,28 +1466,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP LogPacketHeader(true, udpClient.CircuitCode, 0, packet.Type, (ushort)packet.Length); #endregion BinaryStats -<<<<<<< HEAD - if (packet.Type == PacketType.AgentUpdate) - { - if (DiscardInboundAgentUpdates) - return; - ((LLClientView)client).TotalAgentUpdates++; +//Ubit AgentUpdate mess removed from here - AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; - - LLClientView llClient = client as LLClientView; - if (agentUpdate.AgentData.SessionID != client.SessionId - || agentUpdate.AgentData.AgentID != client.AgentId - || !(llClient == null || llClient.CheckAgentUpdateSignificance(agentUpdate.AgentData)) ) - { - PacketPool.Instance.ReturnPacket(packet); - return; - } - } -======= -// AgentUpdate mess removed from here ->>>>>>> avn/ubitvar #region Ping Check Handling @@ -1853,7 +1648,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AuthenticateResponse sessionInfo; if (IsClientAuthorized(uccp, out sessionInfo)) { - AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); + AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); // Begin the process of adding the client to the simulator client @@ -1868,7 +1663,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // an existing child agent, and there is no circuit data if (client != null && aCircuit == null) { - m_scene.CloseAgent(client.AgentId, true); + Scene.CloseAgent(client.AgentId, true); return; } @@ -1908,14 +1703,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We only want to send initial data to new clients, not ones which are being converted from child to root. if (client != null) { -<<<<<<< HEAD - AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); -======= ->>>>>>> avn/ubitvar bool tp = (aCircuit.teleportFlags > 0); // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from - if (!tp && !client.SceneAgent.SentInitialDataToClient) - client.SceneAgent.SendInitialDataToClient(); + if (!tp) + client.SceneAgent.SendInitialDataToMe(); } } else @@ -1923,17 +1714,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Don't create clients for unauthorized requesters. m_log.WarnFormat( "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", -<<<<<<< HEAD + uccp.CircuitCode.ID, Scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); - } - -======= - uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); lock (m_pendingCache) m_pendingCache.Remove(endPoint); } ->>>>>>> avn/ubitvar + // m_log.DebugFormat( // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); @@ -2127,24 +1914,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (!Scene.TryGetClient(agentID, out client)) { -<<<<<<< HEAD - LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); -======= createNew = true; } else { if (client.SceneAgent == null) { - m_scene.CloseAgent(agentID, true); + Scene.CloseAgent(agentID, true); createNew = true; } } if (createNew) { - LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); ->>>>>>> avn/ubitvar + LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); + client = new LLClientView(Scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); client.OnLogout += LogoutHandler; @@ -2174,29 +1958,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ClientLogoutsDueToNoReceives++; -<<<<<<< HEAD - m_log.WarnFormat( - "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", - client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name); -======= if (client.SceneAgent != null) { m_log.WarnFormat( "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", - client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name); ->>>>>>> avn/ubitvar + client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name); if (!client.SceneAgent.IsChildAgent) client.Kick("Simulator logged you out due to connection timeout."); } } -<<<<<<< HEAD - Scene.CloseAgent(client.AgentId, true); -======= - if (!m_scene.CloseAgent(client.AgentId, true)) + if (!Scene.CloseAgent(client.AgentId, true)) client.Close(true,true); ->>>>>>> avn/ubitvar } private void IncomingPacketHandler() @@ -2209,7 +1983,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP while (IsRunningInbound) { - m_scene.ThreadAlive(1); + Scene.ThreadAlive(1); try { IncomingPacket incomingPacket = null; @@ -2261,7 +2035,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP while (base.IsRunningOutbound) { - m_scene.ThreadAlive(2); + Scene.ThreadAlive(2); try { m_packetSent = false; @@ -2524,15 +2298,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_currentIncomingClient = null; } -<<<<<<< HEAD - } - else - { - m_log.DebugFormat( - "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", - packet.Type, client.Name, Scene.RegionInfo.RegionName); - } -======= // } // else // { @@ -2540,7 +2305,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", // packet.Type, client.Name, m_scene.RegionInfo.RegionName); // } ->>>>>>> avn/ubitvar IncomingPacketsProcessed++; } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs index ac6c0b4251..4ff52ebf8e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs @@ -224,7 +224,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ConsoleDisplayList cdl = new ConsoleDisplayList(); cdl.AddRow("Adaptive throttles", m_udpServer.ThrottleRates.AdaptiveThrottlesEnabled); - long maxSceneDripRate = m_udpServer.Throttle.MaxDripRate; + long maxSceneDripRate = (long)m_udpServer.Throttle.MaxDripRate; cdl.AddRow( "Max scene throttle", maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset"); @@ -505,7 +505,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_console.OutputFormat("Debug settings for {0}", m_udpServer.Scene.Name); ConsoleDisplayList cdl = new ConsoleDisplayList(); - long maxSceneDripRate = m_udpServer.Throttle.MaxDripRate; + long maxSceneDripRate = (long)m_udpServer.Throttle.MaxDripRate; cdl.AddRow( "max-scene-throttle", maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset"); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 3c82a7882f..5e41dbd6ad 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs @@ -35,6 +35,7 @@ using OpenSim.Tests.Common; namespace OpenSim.Region.ClientStack.LindenUDP.Tests { + /* [TestFixture] public class ThrottleTests : OpenSimTestCase { @@ -57,16 +58,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests [Test] public void TestSetRequestDripRate() { + TestHelpers.InMethod(); - TokenBucket tb = new TokenBucket("tb", null, 5000, 0); + TokenBucket tb = new TokenBucket(null, 5000f,10000f); AssertRates(tb, 5000, 0, 5000, 0); - tb.RequestedDripRate = 4000; + tb.RequestedDripRate = 4000f; AssertRates(tb, 4000, 0, 4000, 0); tb.RequestedDripRate = 6000; AssertRates(tb, 6000, 0, 6000, 0); + } [Test] @@ -74,7 +77,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests { TestHelpers.InMethod(); - TokenBucket tb = new TokenBucket("tb", null, 5000, 10000); + TokenBucket tb = new TokenBucket(null, 5000,15000); AssertRates(tb, 5000, 0, 5000, 10000); tb.RequestedDripRate = 4000; @@ -92,9 +95,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests { TestHelpers.InMethod(); - TokenBucket tbParent = new TokenBucket("tbParent", null, 0, 0); - TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000, 0); - TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000, 0); + TokenBucket tbParent = new TokenBucket("tbParent", null, 0); + TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000); + TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000); AssertRates(tbParent, 8000, 8000, 8000, 0); AssertRates(tbChild1, 3000, 0, 3000, 0); @@ -113,6 +116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests AssertRates(tbParent, 6000, 8000, 6000, 0); AssertRates(tbChild1, 3000, 0, 6000 / 8 * 3, 0); AssertRates(tbChild2, 5000, 0, 6000 / 8 * 5, 0); + } private void AssertRates( @@ -424,4 +428,5 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpClient.SetThrottles(throttles); } } + */ } \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 7a42d82828..14099fe5dc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -42,24 +42,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP public class TokenBucket { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); -<<<<<<< HEAD - public string Identifier { get; private set; } - - public int DebugLevel { get; set; } - - /// - /// Number of ticks (ms) per quantum, drip rate and max burst - /// are defined over this interval. - /// - protected const Int32 m_ticksPerQuantum = 1000; -======= private static Int32 m_counter = 0; // private Int32 m_identifier; protected const float m_timeScale = 1e-3f; ->>>>>>> avn/ubitvar /// /// This is the number of m_minimumDripRate bytes @@ -72,11 +60,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// -<<<<<<< HEAD - protected const Int32 m_minimumDripRate = LLUDPServer.MTU; -======= protected const float m_minimumDripRate = 1400; ->>>>>>> avn/ubitvar /// Time of the last drip, in system ticks protected Int32 m_lastDrip; @@ -90,27 +74,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// Map of children buckets and their requested maximum burst rate /// -<<<<<<< HEAD - protected Dictionary m_children = new Dictionary(); -======= + protected Dictionary m_children = new Dictionary(); #region Properties ->>>>>>> avn/ubitvar /// /// The parent bucket of this bucket, or null if this bucket has no /// parent. The parent bucket will limit the aggregate bandwidth of all /// of its children buckets /// - public TokenBucket Parent { get; protected set; } - + protected TokenBucket m_parent; + public TokenBucket Parent + { + get { return m_parent; } + set { m_parent = value; } + } /// /// This is the maximum number /// of tokens that can accumulate in the bucket at any one time. This /// also sets the total request for leaf nodes /// protected float m_burst; +//not in use + public float MaxDripRate { get; set; } + public float RequestedBurst { get { return m_burst; } @@ -143,63 +131,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Can never be above MaxDripRate. /// Tokens are added to the bucket at any time /// is called, at the granularity of -<<<<<<< HEAD - /// the system tick interval (typically around 15-22ms) - /// FIXME: It is extremely confusing to be able to set a RequestedDripRate of 0 and then receive a positive - /// number on get if TotalDripRequest is set. This also stops us being able to retrieve the fact that - /// RequestedDripRate is set to 0. Really, this should always return m_dripRate and then we can get - /// (m_dripRate == 0 ? TotalDripRequest : m_dripRate) on some other properties. - /// - public virtual Int64 RequestedDripRate - { - get { return (m_dripRate == 0 ? TotalDripRequest : m_dripRate); } - set - { - if (value <= 0) - m_dripRate = 0; - else if (MaxDripRate > 0 && value > MaxDripRate) - m_dripRate = MaxDripRate; - else - m_dripRate = value; - - m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst); - - if (Parent != null) - Parent.RegisterRequest(this, m_dripRate); - } - } - - /// - /// Gets the drip rate. - /// - /// - /// DripRate can never be above max drip rate or below min drip rate. - /// If we are a child bucket then the drip rate return is modifed by the total load on the capacity of the - /// parent bucket. - /// - public virtual Int64 DripRate - { - get - { - double rate; - - // FIXME: This doesn't properly work if we have a parent and children and a requested drip rate set - // on ourselves which is not equal to the child drip rates. - if (Parent == null) - { - if (TotalDripRequest > 0) - rate = Math.Min(RequestedDripRate, TotalDripRequest); - else - rate = RequestedDripRate; - } - else - { - rate = (double)RequestedDripRate * Parent.DripRateModifier(); - } - -======= /// the system tick interval (typically around 15-22ms) protected float m_dripRate; + public virtual float RequestedDripRate { get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); } @@ -212,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - public virtual float DripRate + public virtual float DripRate { get { float rate = Math.Min(RequestedDripRate,TotalDripRequest); @@ -220,28 +154,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP return rate; rate *= m_parent.DripRateModifier(); ->>>>>>> avn/ubitvar if (rate < m_minimumDripRate) rate = m_minimumDripRate; - else if (MaxDripRate > 0 && rate > MaxDripRate) - rate = MaxDripRate; return (float)rate; } } - protected Int64 m_dripRate; - - // - // The maximum rate for flow control. Drip rate can never be greater than this. - // - public Int64 MaxDripRate { get; set; } /// /// The current total of the requested maximum burst rates of children buckets. /// -<<<<<<< HEAD - public Int64 TotalDripRequest { get; protected set; } -======= protected float m_totalDripRequest; public float TotalDripRequest { @@ -252,7 +174,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion Properties #region Constructor ->>>>>>> avn/ubitvar + /// /// Default constructor @@ -260,36 +182,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Identifier for this token bucket /// Parent bucket if this is a child bucket, or /// null if this is a root bucket -<<<<<<< HEAD - /// - /// Requested rate that the bucket fills, in bytes per - /// second. If zero, the bucket always remains full. - /// - public TokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate) -======= /// Maximum size of the bucket in bytes, or /// zero if this bucket has no maximum capacity /// Rate that the bucket fills, in bytes per /// second. If zero, the bucket always remains full public TokenBucket(TokenBucket parent, float dripRate, float MaxBurst) ->>>>>>> avn/ubitvar { - Identifier = identifier; + m_counter++; Parent = parent; -<<<<<<< HEAD - RequestedDripRate = requestedDripRate; - MaxDripRate = maxDripRate; - m_lastDrip = Util.EnvironmentTickCount(); -======= RequestedDripRate = dripRate; RequestedBurst = MaxBurst; // TotalDripRequest = dripRate; // this will be overwritten when a child node registers // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst); m_lastDrip = Util.EnvironmentTickCount() + 100000; ->>>>>>> avn/ubitvar } +#endregion Constructor + /// /// Compute a modifier for the MaxBurst rate. This is 1.0, meaning /// no modification if the requested bandwidth is less than the @@ -299,20 +209,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected float DripRateModifier() { -<<<<<<< HEAD - Int64 driprate = DripRate; - double modifier = driprate >= TotalDripRequest ? 1.0 : (double)driprate / (double)TotalDripRequest; - -// if (DebugLevel > 0) -// m_log.DebugFormat( -// "[TOKEN BUCKET]: Returning drip modifier {0}/{1} = {2} from {3}", -// driprate, TotalDripRequest, modifier, Identifier); - - return modifier; -======= float driprate = DripRate; return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest; ->>>>>>> avn/ubitvar } /// @@ -335,29 +233,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_children[child] = request; -<<<<<<< HEAD - TotalDripRequest = 0; - foreach (KeyValuePair cref in m_children) - TotalDripRequest += cref.Value; -======= m_totalDripRequest = 0; foreach (KeyValuePair cref in m_children) m_totalDripRequest += cref.Value; ->>>>>>> avn/ubitvar } // Pass the new values up to the parent - if (Parent != null) - { - Int64 effectiveDripRate; - - if (RequestedDripRate > 0) - effectiveDripRate = Math.Min(RequestedDripRate, TotalDripRequest); - else - effectiveDripRate = TotalDripRequest; - - Parent.RegisterRequest(this, effectiveDripRate); - } + if (m_parent != null) + m_parent.RegisterRequest(this, Math.Min(RequestedDripRate, TotalDripRequest)); } /// @@ -370,15 +253,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_children.Remove(child); -<<<<<<< HEAD - TotalDripRequest = 0; - foreach (KeyValuePair cref in m_children) - TotalDripRequest += cref.Value; -======= m_totalDripRequest = 0; foreach (KeyValuePair cref in m_children) m_totalDripRequest += cref.Value; ->>>>>>> avn/ubitvar } // Pass the new values up to the parent @@ -427,7 +304,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // with no drip rate... if (DripRate == 0) { - m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0 for {0}", Identifier); + m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0 for {0}", m_counter); return; } @@ -453,17 +330,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public bool AdaptiveEnabled { get; set; } /// -<<<<<<< HEAD - /// Target drip rate for this bucket. - /// - /// Usually set by the client. If adaptive is enabled then throttles will increase until we reach this. - public Int64 TargetDripRate - { - get { return m_targetDripRate; } - set - { - m_targetDripRate = Math.Max(value, m_minimumFlow); -======= /// The minimum rate for flow control. Minimum drip rate is one /// packet per second. /// @@ -479,13 +345,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP public float MaxDripRate { get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); } - set + set { m_maxDripRate = (value == 0 ? m_totalDripRequest : Math.Max(value, m_minimumFlow)); ->>>>>>> avn/ubitvar } } - protected Int64 m_targetDripRate; + + private bool m_enabled = false; // // Adjust drip rate in response to network conditions. @@ -493,109 +359,50 @@ namespace OpenSim.Region.ClientStack.LindenUDP public virtual float AdjustedDripRate { get { return m_dripRate; } -<<<<<<< HEAD - set + set { - m_dripRate = OpenSim.Framework.Util.Clamp(value, m_minimumFlow, TargetDripRate); - m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst); - - if (Parent != null) - Parent.RegisterRequest(this, m_dripRate); -======= - set { - m_dripRate = OpenSim.Framework.Util.Clamp(value,m_minimumFlow,MaxDripRate); + m_dripRate = OpenSim.Framework.Util.Clamp(value, m_minimumFlow, MaxDripRate); if (m_parent != null) - m_parent.RegisterRequest(this,m_dripRate); ->>>>>>> avn/ubitvar + m_parent.RegisterRequest(this, m_dripRate); } } - /// - /// The minimum rate for adaptive flow control. - /// - protected Int64 m_minimumFlow = 32000; - -<<<<<<< HEAD - /// - /// Constructor for the AdaptiveTokenBucket class - /// Unique identifier for the client - /// Parent bucket in the hierarchy - /// - /// The ceiling rate for adaptation - /// The floor rate for adaptation - /// - public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate, Int64 minDripRate, bool enabled) - : base(identifier, parent, requestedDripRate, maxDripRate) - { - AdaptiveEnabled = enabled; - - if (AdaptiveEnabled) - { -// m_log.DebugFormat("[TOKENBUCKET]: Adaptive throttle enabled"); - m_minimumFlow = minDripRate; - TargetDripRate = m_minimumFlow; - AdjustedDripRate = m_minimumFlow; - } -======= + // // // - public AdaptiveTokenBucket(TokenBucket parent, float maxDripRate,float maxBurst, bool enabled) - : base(parent, maxDripRate,maxBurst) + public AdaptiveTokenBucket(TokenBucket parent, float maxDripRate, float maxBurst, bool enabled) + : base(parent, maxDripRate, maxBurst) { m_enabled = enabled; - + MaxDripRate = maxDripRate; if (enabled) AdjustedDripRate = m_maxDripRate * .5f; else AdjustedDripRate = m_maxDripRate; ->>>>>>> avn/ubitvar } /// /// Reliable packets sent to the client for which we never received an ack adjust the drip rate down. /// Number of packets that expired without successful delivery /// - public void ExpirePackets(Int32 packets) + public void ExpirePackets(Int32 count) { - if (AdaptiveEnabled) - { - if (DebugLevel > 0) - m_log.WarnFormat( - "[ADAPTIVEBUCKET] drop {0} by {1} expired packets for {2}", - AdjustedDripRate, packets, Identifier); - - // AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,packets)); - - // Compute the fallback solely on the rate allocated beyond the minimum, this - // should smooth out the fallback to the minimum rate - AdjustedDripRate = m_minimumFlow + (Int64) ((AdjustedDripRate - m_minimumFlow) / Math.Pow(2, packets)); - } + // m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count); + if (m_enabled) + AdjustedDripRate = (Int64)(AdjustedDripRate / Math.Pow(2, count)); } - /// - /// Reliable packets acked by the client adjust the drip rate up. - /// Number of packets successfully acknowledged - /// - public void AcknowledgePackets(Int32 packets) + // + // + // + public void AcknowledgePackets(Int32 count) { - if (AdaptiveEnabled) - AdjustedDripRate = AdjustedDripRate + packets * LLUDPServer.MTU; - } - - /// - /// Adjust the minimum flow level for the adaptive throttle, this will drop adjusted - /// throttles back to the minimum levels - /// minDripRate--the new minimum flow - /// - public void ResetMinimumAdaptiveFlow(Int64 minDripRate) - { - m_minimumFlow = minDripRate; - TargetDripRate = m_minimumFlow; - AdjustedDripRate = m_minimumFlow; + if (m_enabled) + AdjustedDripRate = AdjustedDripRate + count; } } } diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index d58ab9419b..332bff9b40 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -141,11 +141,6 @@ namespace OpenSim.Region.ClientStack PhysicsPluginManager physicsPluginManager; physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssemblies("Physics"); -<<<<<<< HEAD - -======= - ->>>>>>> avn/ubitvar return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent); } } diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index 345b53d55f..fdff199986 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs @@ -455,8 +455,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction m_transactions.RemoveXferUploader(m_transactionID); } -<<<<<<< HEAD -======= + private void ValidateAssets() { if (m_asset.Type == (sbyte)CustomAssetType.AnimationSet) @@ -599,6 +598,5 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction return result; } ->>>>>>> avn/ubitvar } } diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index b24dc0c83b..92beed2413 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -406,25 +406,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments Dictionary scriptStates = new Dictionary(); -<<<<<<< HEAD - foreach (SceneObjectGroup so in attachments) - { - // Scripts MUST be snapshotted before the object is - // removed from the scene because doing otherwise will - // clobber the run flag - // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from - // scripts performing attachment operations at the same time. Getting object states stops the scripts. - scriptStates[so] = PrepareScriptInstanceForSave(so, false); -// m_log.DebugFormat( -// "[ATTACHMENTS MODULE]: For object {0} for {1} in {2} got saved state {3}", -// so.Name, sp.Name, m_scene.Name, scriptStates[so]); - } - - lock (sp.AttachmentsSyncLock) -======= if (sp.PresenceType != PresenceType.Npc) ->>>>>>> avn/ubitvar { foreach (SceneObjectGroup so in attachments) { @@ -477,18 +460,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (!Enabled) return false; -<<<<<<< HEAD - group.DetachFromBackup(); - - bool success = AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, false, append); - - if (!success) - group.AttachToBackup(); - - return success; -======= return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, addToInventory, false, append); ->>>>>>> avn/ubitvar } /// diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 1e9cfba4a9..0d3b39e7f2 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -229,7 +229,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory private void SendAppearance(ScenePresence sp) { // Send the appearance to everyone in the scene - sp.SendAppearanceToAllOtherClients(); + sp.SendAppearanceToAllOtherAgents(); // Send animations back to the avatar as well sp.Animator.SendAnimPack(); @@ -460,7 +460,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { m_log.Debug("[UpdateBakedCache] uploading to bakedModule cache"); - m_BakedTextureModule.Store(sp.UUID); + m_BakedTextureModule.Store(sp.UUID, wearableCache); } } @@ -529,12 +529,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory ); } } -<<<<<<< HEAD - -// m_log.DebugFormat( -// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", -// face.TextureID, idx, client.Name, client.AgentId); -======= */ bool wearableCacheValid = false; if (wearableCache == null) @@ -577,15 +571,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (wearableCacheValid) m_log.Debug("[ValidateBakedCache] have valid local cache"); } ->>>>>>> avn/ubitvar bool checkExternal = false; -<<<<<<< HEAD - if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) - return false; - } -======= if (!wearableCacheValid) { // only use external bake module on login condition check @@ -658,7 +646,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } } ->>>>>>> avn/ubitvar sp.Appearance.WearableCacheItems = wearableCache; diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index b7ff4e0d12..dd9344955d 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -132,7 +132,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory for (byte i = 0; i < visualParams.Length; i++) visualParams[i] = i; -<<<<<<< HEAD Primitive.TextureEntry bakedTextureEntry = new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)); uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes); Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex); @@ -145,12 +144,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory afm.SetAppearance(sp, bakedTextureEntry, visualParams, null); Assert.That(rebakeRequestsReceived, Is.EqualTo(0)); -======= - afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams, new WearableCacheItem[0]); - - // TODO: Check baked texture - Assert.AreEqual(visualParams, sp.Appearance.VisualParams); ->>>>>>> avn/ubitvar } [Test] @@ -188,11 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex); eyesFace.TextureID = eyesTextureId; -<<<<<<< HEAD - afm.SetAppearance(sp, bakedTextureEntry, visualParams, null); -======= afm.SetAppearance(sp, bakedTextureEntry, visualParams, new WearableCacheItem[0]); ->>>>>>> avn/ubitvar afm.SaveBakedTextures(userId); // Dictionary bakedTextures = afm.GetBakedTextureFaces(userId); diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs index 7d2cad67c3..b8a1dba359 100644 --- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs @@ -151,6 +151,14 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures } } + public void Store(UUID agentId) + { + } + public void UpdateMeshAvatar(UUID agentId) + { + } + + public void Store(UUID agentId, WearableCacheItem[] data) { if (m_URL == String.Empty) diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 2801ef030c..0b5d95b9ba 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -214,13 +214,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat UUID destination = c.Destination; Vector3 fromPos = c.Position; Vector3 regionPos = new Vector3(scene.RegionInfo.WorldLocX, scene.RegionInfo.WorldLocY, 0); -<<<<<<< HEAD -======= bool checkParcelHide = false; UUID sourceParcelID = UUID.Zero; Vector3 hidePos = fromPos; ->>>>>>> avn/ubitvar if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel; @@ -377,27 +374,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); HashSet receiverIDs = new HashSet(); -<<<<<<< HEAD - ((Scene)c.Scene).ForEachRootClient( - delegate(IClientAPI client) - { - // don't forward SayOwner chat from objects to - // non-owner agents - if ((c.Type == ChatTypeEnum.Owner) && - (null != c.SenderObject) && - (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) - return; - - client.SendChatMessage( - c.Message, (byte)cType, CenterOfRegion, fromName, fromID, ownerID, - (byte)sourceType, (byte)ChatAudibleLevel.Fully); - - receiverIDs.Add(client.AgentId); - }); - - (c.Scene as Scene).EventManager.TriggerOnChatToClients( - fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully); -======= if (c.Scene != null) { ((Scene)c.Scene).ForEachRootClient @@ -419,7 +395,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat (c.Scene as Scene).EventManager.TriggerOnChatToClients( fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully); } ->>>>>>> avn/ubitvar } /// diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index b0b7054508..4e1958a9c4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -183,15 +183,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule try { ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); -<<<<<<< HEAD - if (obj == null) return; - -======= - if (obj == null) - return; ->>>>>>> avn/ubitvar if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0 || avatar.Scene.RegionInfo.RegionSettings.AllowDamage) { diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 5573c94238..3c82fd9145 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -188,7 +188,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage SendGridInstantMessageViaXMLRPC(im, result); } - public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result) + public virtual void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result) { UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; @@ -445,14 +445,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return resp; } -<<<<<<< HEAD + /// /// delegate for sending a grid instant message asynchronously /// - public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result); -======= private delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result); ->>>>>>> avn/ubitvar private class GIM { public GridInstantMessage im; @@ -479,31 +476,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } -<<<<<<< HEAD - d.BeginInvoke(im, result, GridInstantMessageCompleted, d); -======= + private void GridInstantMessageCompleted(IAsyncResult iar) { GridInstantMessageDelegate d = (GridInstantMessageDelegate)iar.AsyncState; d.EndInvoke(iar); ->>>>>>> avn/ubitvar } /// /// Internal SendGridInstantMessage over XMLRPC method. /// -<<<<<<< HEAD - /// - /// This is called from within a dedicated thread. - /// - private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result) -======= + /// /// Pass in 0 the first time this method is called. It will be called recursively with the last /// regionhandle tried /// private void SendGridInstantMessageViaXMLRPCAsyncMain(GridInstantMessage im, MessageResultNotification result) ->>>>>>> avn/ubitvar { GIM gim; do { @@ -525,87 +513,124 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } while (gim != null); } + private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) { UUID toAgentID = new UUID(im.toAgentID); + PresenceInfo upd = null; UUID regionID; - bool needToLookupAgent; + bool lookupAgent = false; lock (m_UserRegionMap) - needToLookupAgent = !m_UserRegionMap.TryGetValue(toAgentID, out regionID); - - while (true) { - if (needToLookupAgent) + if (m_UserRegionMap.ContainsKey(toAgentID)) { - PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); + upd = new PresenceInfo(); + upd.RegionID = m_UserRegionMap[toAgentID]; - UUID foundRegionID = UUID.Zero; - - if (presences != null) + // We need to compare the current regionhandle with the previous region handle + // or the recursive loop will never end because it will never try to lookup the agent again + if (prevRegionID == upd.RegionID) { - foreach (PresenceInfo p in presences) + lookupAgent = true; + } + } + else + { + lookupAgent = true; + } + } + + + // Are we needing to look-up an agent? + if (lookupAgent) + { + // Non-cached user agent lookup. + PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); + if (presences != null && presences.Length > 0) + { + foreach (PresenceInfo p in presences) + { + if (p.RegionID != UUID.Zero) { - if (p.RegionID != UUID.Zero) - { - foundRegionID = p.RegionID; - break; - } + upd = p; + break; } } - - // If not found or the found region is the same as the last lookup, then message is undeliverable - if (foundRegionID == UUID.Zero || foundRegionID == regionID) - break; - else - regionID = foundRegionID; } - GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, regionID); - if (reginfo == null) + if (upd != null) { - m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", regionID); - break; + // check if we've tried this before.. + // This is one way to end the recursive loop + // + if (upd.RegionID == prevRegionID) + { + // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); + HandleUndeliverableMessage(im, result); + return; + } } + else + { + // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); + HandleUndeliverableMessage(im, result); + return; + } + } -<<<<<<< HEAD - // Try to send the message to the agent via the retrieved region. - Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); - msgdata["region_handle"] = 0; - bool imresult = doIMSending(reginfo, msgdata); - - // If the message delivery was successful, then cache the entry. - if (imresult) -======= if (upd != null) { GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero, upd.RegionID); if (reginfo != null) ->>>>>>> avn/ubitvar { - lock (m_UserRegionMap) + Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); + // Not actually used anymore, left in for compatibility + // Remove at next interface change + // + msgdata["region_handle"] = 0; + bool imresult = doIMSending(reginfo, msgdata); + if (imresult) { - m_UserRegionMap[toAgentID] = regionID; + // IM delivery successful, so store the Agent's location in our local cache. + lock (m_UserRegionMap) + { + if (m_UserRegionMap.ContainsKey(toAgentID)) + { + m_UserRegionMap[toAgentID] = upd.RegionID; + } + else + { + m_UserRegionMap.Add(toAgentID, upd.RegionID); + } + } + result(true); + } + else + { + // try again, but lookup user this time. + // Warning, this must call the Async version + // of this method or we'll be making thousands of threads + // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync + // The version that spawns the thread is SendGridInstantMessageViaXMLRPC + + // This is recursive!!!!! + SendGridInstantMessageViaXMLRPCAsync(im, result, + upd.RegionID); } - result(true); - return; } - - // If we reach this point in the first iteration of the while, then we may have unsuccessfully tried - // to use a locally cached region ID. All subsequent attempts need to lookup agent details from - // the presence service. - needToLookupAgent = true; + else + { + m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID); + HandleUndeliverableMessage(im, result); + } + } + else + { + HandleUndeliverableMessage(im, result); } - - // If we reached this point then the message was not deliverable. Remove the bad cache entry and - // signal the delivery failure. - lock (m_UserRegionMap) - m_UserRegionMap.Remove(toAgentID); - - // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); - HandleUndeliverableMessage(im, result); } /// @@ -709,6 +734,5 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage gim["message_key"] = m_MessageKey; return gim; } - } } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 76023bd3dd..1650097f0e 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -238,7 +238,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } -<<<<<<< HEAD if (!m_ForwardOfflineGroupMessages) { if (im.dialog == (byte)InstantMessageDialog.GroupNotice || @@ -246,9 +245,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } - bool success = SynchronousRestObjectRequester.MakeRequest( - "POST", m_RestURL+"/SaveMessage/", im, 10000); -======= Scene scene = FindScene(new UUID(im.fromAgentID)); if (scene == null) scene = m_SceneList[0]; @@ -256,7 +252,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage SendReply reply = SynchronousRestObjectRequester.MakeRequest( "POST", m_RestURL+"/SaveMessage/?scope=" + scene.RegionInfo.ScopeID.ToString(), im); ->>>>>>> avn/ubitvar if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) { diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 18e18a9acb..2d15b47346 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -180,13 +180,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", folderID, new UUID(im.toAgentID)); -<<<<<<< HEAD InventoryFolderBase folderCopy - = scene.GiveInventoryFolder(client, receipientID, client.AgentId, folderID, UUID.Zero); -======= - InventoryFolderBase folderCopy - = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); ->>>>>>> avn/ubitvar + = scene.GiveInventoryFolder(client, recipientID, client.AgentId, folderID, UUID.Zero); if (folderCopy == null) { @@ -475,7 +470,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer /// private void OnGridInstantMessage(GridInstantMessage im) { -<<<<<<< HEAD // Check if it's a type of message that we should handle if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered) || (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered) @@ -488,8 +482,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer "[INVENTORY TRANSFER]: {0} IM type received from grid. From={1} ({2}), To={3}", (InstantMessageDialog)im.dialog, im.fromAgentID, im.fromAgentName, im.toAgentID); -======= ->>>>>>> avn/ubitvar // Check if this is ours to handle // Scene scene = FindClientScene(new UUID(im.toAgentID)); diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index bea2834b2e..4d1611c1d6 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -869,7 +869,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles } #endregion Notes -<<<<<<< HEAD + #region User Preferences /// /// Updates the user preferences. @@ -933,8 +933,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles } #endregion User Preferences -======= ->>>>>>> avn/ubitvar #region Avatar Properties /// /// Update the avatars interests . @@ -1401,8 +1399,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return null; } #endregion Util -<<<<<<< HEAD -======= #region Web Util /// @@ -1580,6 +1576,5 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return true; } #endregion Web Util ->>>>>>> avn/ubitvar } } diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 793738301a..9a57599c98 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -154,16 +154,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Add this agent in this region as a banned person public void Add(ulong pRegionHandle, UUID pAgentID) { -<<<<<<< HEAD - if (!m_bannedRegions.TryGetValue(pAgentID, out m_idCache)) - { - m_idCache = new ExpiringCache(); - m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(45)); - } - m_idCache.Add(pRegionHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); -======= this.Add(pRegionHandle, pAgentID, 45, 15); } + public void Add(ulong pRegionHandle, UUID pAgentID, double newTime, double extendTime) { if (!m_bannedRegions.TryGetValue(pAgentID, out m_idCache)) @@ -172,8 +165,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime)); } m_idCache.Add(pRegionHandle, DateTime.Now + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime)); ->>>>>>> avn/ubitvar } + // Remove the agent from the region's banned list public void Remove(ulong pRegionHandle, UUID pAgentID) { @@ -183,6 +176,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } } + private BannedRegionCache m_bannedRegionCache = new BannedRegionCache(); private IEventQueue m_eqModule; @@ -222,7 +216,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { string transferVersionName = "SIMULATION"; float maxTransferVersion = 0.3f; -<<<<<<< HEAD IConfig hypergridConfig = source.Configs["Hypergrid"]; if (hypergridConfig != null) @@ -235,8 +228,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (m_GatekeeperURI != string.Empty && !m_GatekeeperURI.EndsWith("/")) m_GatekeeperURI += '/'; } -======= ->>>>>>> avn/ubitvar IConfig transferConfig = source.Configs["EntityTransfer"]; if (transferConfig != null) @@ -515,11 +506,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // TODO: Check other Scene HeightField posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; -<<<<<<< HEAD -======= posZLimit += localHalfAVHeight + 0.1f; ->>>>>>> avn/ubitvar if ((position.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) { @@ -622,15 +610,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY); MapBlockData block = new MapBlockData(); -<<<<<<< HEAD - block.X = (ushort)regX; - block.Y = (ushort)regY; - block.Access = (byte)SimAccess.Down; -======= block.X = (ushort)(regX); block.Y = (ushort)(regY); block.Access = (byte)SimAccess.Down; // == not there ->>>>>>> avn/ubitvar List blocks = new List(); blocks.Add(block); @@ -765,13 +747,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return; } -<<<<<<< HEAD - uint newRegionX, newRegionY, oldRegionX, oldRegionY; - Util.RegionHandleToRegionLoc(reg.RegionHandle, out newRegionX, out newRegionY); - Util.RegionHandleToRegionLoc(sp.Scene.RegionInfo.RegionHandle, out oldRegionX, out oldRegionY); - -======= ->>>>>>> avn/ubitvar ulong destinationHandle = finalDestination.RegionHandle; // Let's do DNS resolution only once in this process, please! @@ -794,11 +769,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string version; string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); if (!Scene.SimulationService.QueryAccess( -<<<<<<< HEAD finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, sp.Scene.GetFormatsOffered(), out version, out reason)) -======= - finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason)) ->>>>>>> avn/ubitvar { sp.ControllingClient.SendTeleportFailed(reason); @@ -860,12 +831,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agentCircuit.Id0 = currentAgentCircuit.Id0; } -<<<<<<< HEAD - // if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) - float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance, - (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY)); - if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY)) -======= IClientIPEndpoint ipepClient; uint newRegionX, newRegionY, oldRegionX, oldRegionY; @@ -880,7 +845,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer oldSizeX, oldSizeY, newSizeX, newSizeY); if (OutSideViewRange) ->>>>>>> avn/ubitvar { m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", @@ -911,11 +875,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer float.TryParse(versionComponents[1], out versionNumber); if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber) -<<<<<<< HEAD - TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); -======= TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , version, out reason); ->>>>>>> avn/ubitvar else TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, version, out reason); } @@ -973,21 +933,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); // OK, it got this agent. Let's close some child agents -<<<<<<< HEAD - sp.CloseChildAgents(newRegionX, newRegionY); - - IClientIPEndpoint ipepClient; - string capsPath = String.Empty; - float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance, - (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY)); - if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY)) - { - m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for incoming agent {3} from {4}", - finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name); -======= ->>>>>>> avn/ubitvar - if (OutSideViewRange) { @@ -1157,11 +1102,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone -<<<<<<< HEAD - if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) -======= if (OutSideViewRange) ->>>>>>> avn/ubitvar { if (!sp.Scene.IncomingPreCloseClient(sp)) return; @@ -1226,35 +1167,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Past this point we have to attempt clean up if the teleport fails, so update transfer state. m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); -<<<<<<< HEAD - IClientIPEndpoint ipepClient; - string capsPath = String.Empty; - float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance, - (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY)); - if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY)) - { - m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", - finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name); - - //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); - #region IP Translation for NAT - // Uses ipepClient above - if (sp.ClientView.TryGet(out ipepClient)) - { - endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); - } - #endregion - capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); - } - else - { - agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); - capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); - } - -======= ->>>>>>> avn/ubitvar // We need to set this here to avoid an unlikely race condition when teleporting to a neighbour simulator, // where that neighbour simulator could otherwise request a child agent create on the source which then // closes our existing agent which is still signalled as root. @@ -1333,11 +1245,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.MakeChildAgent(destinationHandle); // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone -<<<<<<< HEAD - if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) -======= if (OutSideViewRange) ->>>>>>> avn/ubitvar { if (!sp.Scene.IncomingPreCloseClient(sp)) return; @@ -1465,12 +1373,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // This returns 'true' if the new region already has a child agent for our // incoming agent. The implication is that, if 'false', we have to create the // child and then teleport into the region. -<<<<<<< HEAD - protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) -======= protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, int oldsizeX, int oldsizeY, int newsizeX, int newsizeY) ->>>>>>> avn/ubitvar { if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) { @@ -1487,9 +1391,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, oldsizeX, oldsizeY, newsizeX, newsizeY); } -<<<<<<< HEAD - -======= /* protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, uint oldsizeX, uint oldsizeY, uint newsizeX, uint newsizeY, GridRegion reg) @@ -1499,7 +1400,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer oldsizeX, oldsizeY, newsizeX, newsizeY); } */ ->>>>>>> avn/ubitvar #endregion #region Landmark Teleport @@ -1580,82 +1480,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #region Agent Crossings -<<<<<<< HEAD - // Given a position relative to the current region (which has previously been tested to - // see that it is actually outside the current region), find the new region that the - // point is actually in. - // Returns the coordinates and information of the new region or 'null' of it doesn't exist. - public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, - out string version, out Vector3 newpos, out string failureReason) -======= public bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason) ->>>>>>> avn/ubitvar { reason = String.Empty; version = String.Empty; -<<<<<<< HEAD - newpos = pos; - failureReason = string.Empty; - string homeURI = scene.GetAgentHomeURI(agentID); - -// m_log.DebugFormat( -// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name); - - // Compute world location of the object's position - double presenceWorldX = (double)scene.RegionInfo.WorldLocX + pos.X; - double presenceWorldY = (double)scene.RegionInfo.WorldLocY + pos.Y; - - // Call the grid service to lookup the region containing the new position. - GridRegion neighbourRegion = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID, - presenceWorldX, presenceWorldY, - Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY)); - - if (neighbourRegion != null) - { - // Compute the entity's position relative to the new region - newpos = new Vector3((float)(presenceWorldX - (double)neighbourRegion.RegionLocX), - (float)(presenceWorldY - (double)neighbourRegion.RegionLocY), - pos.Z); - - if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID)) - { - failureReason = "Cannot region cross into banned parcel"; - neighbourRegion = null; - } - else - { - // If not banned, make sure this agent is not in the list. - m_bannedRegionCache.Remove(neighbourRegion.RegionHandle, agentID); - } - - // Check to see if we have access to the target region. - string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); - if (neighbourRegion != null - && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, scene.GetFormatsOffered(), out version, out failureReason)) - { - // remember banned - m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); - neighbourRegion = null; - } - } - else - { - // The destination region just doesn't exist - failureReason = "Cannot cross into non-existent region"; - } - - if (neighbourRegion == null) - m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}", - LogHeader, scene.RegionInfo.RegionName, - scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, - scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, - pos); - else - m_log.DebugFormat("{0} GetDestination: new region={1} at <{2},{3}> of size <{4},{5}>, newpos=<{6},{7}>", - LogHeader, neighbourRegion.RegionName, - neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY, - newpos.X, newpos.Y); -======= UUID agentID = agent.UUID; ulong destinyHandle = destiny.RegionHandle; @@ -1672,7 +1500,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (!ascene.SimulationService.QueryAccess(destiny, agentID, homeURI, false, position, - myversion, out version, out reason)) + myversion, agent.Scene.GetFormatsOffered(), out version, out reason)) { m_bannedRegionCache.Add(destinyHandle, agentID, 30.0, 30.0); return false; @@ -1735,7 +1563,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); string homeURI = scene.GetAgentHomeURI(agentID); if (neighbourRegion != null - && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, out version, out failureReason)) + && !scene.SimulationService.QueryAccess( + neighbourRegion, agentID, homeURI, false, newpos, myversion, + new List(), out version, out failureReason)) { // remember banned m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); @@ -1747,7 +1577,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // The destination region just doesn't exist failureReason = "Cannot cross into non-existent region"; } ->>>>>>> avn/ubitvar if (neighbourRegion == null) m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}", @@ -1766,8 +1595,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer public bool Cross(ScenePresence agent, bool isFlying) { -<<<<<<< HEAD -======= agent.IsInTransit = true; CrossAsyncDelegate d = CrossAsync; d.BeginInvoke(agent, isFlying, CrossCompleted, d); @@ -1793,19 +1620,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { uint x; uint y; ->>>>>>> avn/ubitvar Vector3 newpos; string version; string failureReason; -<<<<<<< HEAD - GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, - out version, out newpos, out failureReason); - if (neighbourRegion == null) - { - agent.ControllingClient.SendAlertMessage(failureReason); - return false; -======= Vector3 pos = agent.AbsolutePosition + agent.Velocity; GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos, @@ -1815,23 +1633,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (failureReason != String.Empty) agent.ControllingClient.SendAlertMessage(failureReason); return agent; ->>>>>>> avn/ubitvar } // agent.IsInTransit = true; -<<<<<<< HEAD - Scene.EventManager.TriggerCrossAgentToNewRegion(agent, isFlying, neighbourRegion); - - return true; -======= CrossAgentToNewRegionAsync(agent, newpos, neighbourRegion, isFlying, version); agent.IsInTransit = false; return agent; ->>>>>>> avn/ubitvar } - public delegate void InformClientToInitiateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene); @@ -1958,10 +1768,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { AgentData cAgent = new AgentData(); agent.CopyTo(cAgent); -<<<<<<< HEAD - cAgent.Position = pos; - -======= // agent.Appearance.WearableCacheItems = null; @@ -1969,7 +1775,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer cAgent.ChildrenCapSeeds = agent.KnownRegions; ->>>>>>> avn/ubitvar if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; @@ -2048,25 +1853,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer capsPath); } -<<<<<<< HEAD - // SUCCESS! - m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); - - // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. - m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); - - agent.MakeChildAgent(); - - // FIXME: Possibly this should occur lower down after other commands to close other agents, - // but not sure yet what the side effects would be. - m_entityTransferStateMachine.ResetFromTransit(agent.UUID); - - // now we have a child agent in this region. Request all interesting data about other (root) agents - agent.SendOtherAgentsAvatarDataToClient(); - agent.SendOtherAgentsAppearanceToClient(); - -======= ->>>>>>> avn/ubitvar // Backwards compatibility. Best effort if (version == "Unknown" || version == string.Empty) { @@ -2075,12 +1861,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); } -<<<<<<< HEAD - // Next, let's close the child agent connections that are too far away. - uint neighbourx; - uint neighboury; - Util.RegionHandleToRegionLoc(neighbourRegion.RegionHandle, out neighbourx, out neighboury); -======= // SUCCESS! m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); @@ -2096,7 +1876,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // FIXME: Possibly this should occur lower down after other commands to close other agents, // but not sure yet what the side effects would be. m_entityTransferStateMachine.ResetFromTransit(agent.UUID); ->>>>>>> avn/ubitvar agent.CloseChildAgents(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); @@ -2177,24 +1956,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer seeds.Add(regionhandler, agent.CapsPath); -<<<<<<< HEAD - sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath); - //foreach (ulong h in agent.ChildrenCapSeeds.Keys) - // m_log.DebugFormat("[XXX] --> {0}", h); - //m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle); - if (agent.ChildrenCapSeeds.ContainsKey(region.RegionHandle)) - { - m_log.WarnFormat( - "[ENTITY TRANSFER]: Overwriting caps seed {0} with {1} for region {2} (handle {3}) for {4} in {5}", - agent.ChildrenCapSeeds[region.RegionHandle], agent.CapsPath, - region.RegionName, region.RegionHandle, sp.Name, Scene.Name); - } - agent.ChildrenCapSeeds[region.RegionHandle] = agent.CapsPath; -======= // agent.ChildrenCapSeeds = new Dictionary(seeds); agent.ChildrenCapSeeds = null; ->>>>>>> avn/ubitvar if (sp.Scene.CapsModule != null) { @@ -2278,11 +2042,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (m_regionInfo != null) { -<<<<<<< HEAD - neighbours = GetNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); -======= neighbours = GetNeighbors(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); ->>>>>>> avn/ubitvar } else { @@ -2531,127 +2291,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #endregion // NotFoundLocationCache class private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); -<<<<<<< HEAD - // Computes the difference between two region bases. - // Returns a vector of world coordinates (meters) from base of first region to the second. - // The first region is the home region of the passed scene presence. - Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) - { - /* - int rRegionX = (int)sp.Scene.RegionInfo.LegacyRegionLocX; - int rRegionY = (int)sp.Scene.RegionInfo.LegacyRegionLocY; - int tRegionX = neighbour.RegionLocX / (int)Constants.RegionSize; - int tRegionY = neighbour.RegionLocY / (int)Constants.RegionSize; - int shiftx = (rRegionX - tRegionX) * (int)Constants.RegionSize; - int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize; - return new Vector3(shiftx, shifty, 0f); - */ - return new Vector3( sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX, - sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY, - 0f); - } - - public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) - { - // Since we don't know how big the regions could be, we have to search a very large area - // to find possible regions. - return GetRegionContainingWorldLocation(pGridService, pScopeID, px, py, Constants.MaximumRegionSize); - } - - #region NotFoundLocationCache class - // A collection of not found locations to make future lookups 'not found' lookups quick. - // A simple expiring cache that keeps not found locations for some number of seconds. - // A 'not found' location is presumed to be anywhere in the minimum sized region that - // contains that point. A conservitive estimate. - private class NotFoundLocationCache - { - private struct NotFoundLocation - { - public double minX, maxX, minY, maxY; - public DateTime expireTime; - } - private List m_notFoundLocations = new List(); - public NotFoundLocationCache() - { - } - // Add an area to the list of 'not found' places. The area is the snapped region - // area around the added point. - public void Add(double pX, double pY) - { - lock (m_notFoundLocations) - { - if (!LockedContains(pX, pY)) - { - NotFoundLocation nfl = new NotFoundLocation(); - // A not found location is not found for at least a whole region sized area - nfl.minX = pX - (pX % (double)Constants.RegionSize); - nfl.minY = pY - (pY % (double)Constants.RegionSize); - nfl.maxX = nfl.minX + (double)Constants.RegionSize; - nfl.maxY = nfl.minY + (double)Constants.RegionSize; - nfl.expireTime = DateTime.Now + TimeSpan.FromSeconds(30); - m_notFoundLocations.Add(nfl); - } - } - - } - // Test to see of this point is in any of the 'not found' areas. - // Return 'true' if the point is found inside the 'not found' areas. - public bool Contains(double pX, double pY) - { - bool ret = false; - lock (m_notFoundLocations) - ret = LockedContains(pX, pY); - return ret; - } - private bool LockedContains(double pX, double pY) - { - bool ret = false; - this.DoExpiration(); - foreach (NotFoundLocation nfl in m_notFoundLocations) - { - if (pX >= nfl.minX && pX < nfl.maxX && pY >= nfl.minY && pY < nfl.maxY) - { - ret = true; - break; - } - } - return ret; - } - private void DoExpiration() - { - List m_toRemove = null; - DateTime now = DateTime.Now; - foreach (NotFoundLocation nfl in m_notFoundLocations) - { - if (nfl.expireTime < now) - { - if (m_toRemove == null) - m_toRemove = new List(); - m_toRemove.Add(nfl); - } - } - if (m_toRemove != null) - { - foreach (NotFoundLocation nfl in m_toRemove) - m_notFoundLocations.Remove(nfl); - m_toRemove.Clear(); - } - } - } - #endregion // NotFoundLocationCache class - private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); - - // Given a world position (fractional meter coordinate), get the GridRegion info for - // the region containing that point. - // Someday this should be a method on GridService. - // 'pSizeHint' is the size of the source region but since the destination point can be anywhere - // the size of the target region is unknown thus the search area might have to be very large. - // Return 'null' if no such region exists. - public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, - double px, double py, uint pSizeHint) - { - m_log.DebugFormat("{0} GetRegionContainingWorldLocation: query, loc=<{1},{2}>", LogHeader, px, py); -======= // needed for current OSG or old grid code public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) @@ -2671,7 +2310,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer double px, double py, uint pSizeHint) { m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); ->>>>>>> avn/ubitvar GridRegion ret = null; const double fudge = 2.0; @@ -2765,13 +2403,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer IPEndPoint endPoint, bool newAgent) { -<<<<<<< HEAD - Scene scene = sp.Scene; - - m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", - sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); -======= if (newAgent) { Scene scene = sp.Scene; @@ -2779,17 +2410,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); ->>>>>>> avn/ubitvar string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); string reason = String.Empty; -<<<<<<< HEAD - bool regionAccepted = scene.SimulationService.CreateAgent(null, reg, a, (uint)TeleportFlags.Default, out reason); -======= - bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); ->>>>>>> avn/ubitvar + bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, a, (uint)TeleportFlags.Default, out reason); if (regionAccepted) { @@ -2848,10 +2474,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y); } -<<<<<<< HEAD -======= - ->>>>>>> avn/ubitvar swCorner.X = Scene.RegionInfo.RegionLocX - 1; swCorner.Y = Scene.RegionInfo.RegionLocY - 1; neCorner.X = Scene.RegionInfo.RegionLocX + extent.X; @@ -2865,11 +2487,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// /// /// -<<<<<<< HEAD - protected List GetNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) -======= protected List GetNeighbors(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) ->>>>>>> avn/ubitvar { Scene pScene = avatar.Scene; RegionInfo m_regionInfo = pScene.RegionInfo; @@ -2880,22 +2498,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // view to include everything in the megaregion if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) { -<<<<<<< HEAD - // The area to check is as big as the current region. - // We presume all adjacent regions are the same size as this region. - uint dd = Math.Max((uint)avatar.Scene.DefaultDrawDistance, - Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY)); - - uint startX = Util.RegionToWorldLoc(pRegionLocX) - dd + Constants.RegionSize/2; - uint startY = Util.RegionToWorldLoc(pRegionLocY) - dd + Constants.RegionSize/2; - - uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2; - uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2; - - neighbours - = avatar.Scene.GridService.GetRegionRange( - m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); -======= uint dd = (uint)avatar.DrawDistance; // until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors @@ -2919,8 +2521,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer neighbours = avatar.Scene.GridService.GetRegionRange( m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); - ->>>>>>> avn/ubitvar } else { @@ -2934,24 +2534,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y)); } -<<<<<<< HEAD -// neighbours.ForEach( -// n => -// m_log.DebugFormat( -// "[ENTITY TRANSFER MODULE]: Region flags for {0} as seen by {1} are {2}", -// n.RegionName, Scene.Name, n.RegionFlags != null ? n.RegionFlags.ToString() : "not present")); - - // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). - neighbours.RemoveAll( - r => - r.RegionID == m_regionInfo.RegionID - || (r.RegionFlags != null && (r.RegionFlags & OpenSim.Framework.RegionFlags.RegionOnline) == 0)); - -======= // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID ); ->>>>>>> avn/ubitvar return neighbours; } #endregion @@ -3036,23 +2621,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (scene == null) return; -<<<<<<< HEAD - if (grp.RootPart.DIE_AT_EDGE) - { - // We remove the object here - try - { - scene.DeleteSceneObject(grp, false); - } - catch (Exception) - { - m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); - } - return; - } - -======= ->>>>>>> avn/ubitvar // Remember the old group position in case the region lookup fails so position can be restored. Vector3 oldGroupPosition = grp.RootPart.GroupPosition; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 233b251702..5ec688c85c 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -434,14 +434,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // return base.UpdateAgent(reg, finalDestination, agentData, sp); //} -<<<<<<< HEAD - public override void TriggerTeleportHome(UUID id, IClientAPI client) - { - TeleportHome(id, client); - } -======= ->>>>>>> avn/ubitvar public override bool TeleportHome(UUID id, IClientAPI client) { m_log.DebugFormat( diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index dff9126fb4..96f1198449 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -207,17 +207,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { byte[] data = null; -<<<<<<< HEAD - AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); - m_Scene.AssetService.Store(asset); - m_Scene.CreateNewInventoryItem( - remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, - name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate); - } - else -======= if (invType == (sbyte)InventoryType.Landmark && presence != null) ->>>>>>> avn/ubitvar { string suffix = string.Empty, prefix = string.Empty; string strdata = GenerateLandmark(presence, out prefix, out suffix); @@ -229,8 +219,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); m_Scene.AssetService.Store(asset); m_Scene.CreateNewInventoryItem( - remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, - name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate,transactionID); + remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, + name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate); } else { @@ -420,26 +410,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { if (objectGroup.RootPart.KeyframeMotion != null) { -<<<<<<< HEAD - objectGroup.RootPart.KeyframeMotion.Pause(); - group2Keyframe.Add(objectGroup, objectGroup.RootPart.KeyframeMotion); - objectGroup.RootPart.KeyframeMotion = null; - } - -// Vector3 inventoryStoredPosition = new Vector3 -// (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) -// ? 250 -// : objectGroup.AbsolutePosition.X) -// , -// (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize) -// ? 250 -// : objectGroup.AbsolutePosition.Y, -// objectGroup.AbsolutePosition.Z); -// -// originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; -// -// objectGroup.AbsolutePosition = inventoryStoredPosition; -======= objectGroup.RootPart.KeyframeMotion.Suspend(); } objectGroup.RootPart.SetForce(Vector3.Zero); @@ -480,7 +450,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess objectGroup.AbsolutePosition = inventoryStoredPosition; objectGroup.RootPart.RotationOffset = inventoryStoredRotation; ->>>>>>> avn/ubitvar // Make sure all bits but the ones we want are clear // on take. @@ -626,6 +595,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess IClientAPI remoteClient) { uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; + uint allObjectsNextOwnerPerms = 0x7fffffff; + // For the porposes of inventory, an object is modify if the prims // are modify. This allows renaming an object that contains no // mod items. diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index a53675703f..7d0c47f23f 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -336,8 +336,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } -<<<<<<< HEAD -======= /// /// /// @@ -433,7 +431,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } ->>>>>>> avn/ubitvar + #region IUserManagement public UUID GetUserIdByName(string name) diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 235fbbb099..c0faad89a3 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -358,9 +358,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); -<<<<<<< HEAD + m_outboundUrlFilter = new OutboundUrlFilter("Script HTTP request module", config); -======= int maxThreads = 15; IConfig httpConfig = config.Configs["HttpRequestModule"]; @@ -368,7 +367,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest { maxThreads = httpConfig.GetInt("MaxPoolThreads", maxThreads); } ->>>>>>> avn/ubitvar m_pendingRequests = new Dictionary(); @@ -532,16 +530,12 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest try { -<<<<<<< HEAD Request = (HttpWebRequest)WebRequest.Create(Url); Request.AllowAutoRedirect = false; -======= - Request = (HttpWebRequest) WebRequest.Create(Url); //This works around some buggy HTTP Servers like Lighttpd Request.ServicePoint.Expect100Continue = false; ->>>>>>> avn/ubitvar Request.Method = HttpMethod; Request.ContentType = HttpMIMEType; @@ -646,7 +640,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest { using (Stream responseStream = webRsp.GetResponseStream()) { - ResponseBody = responseStream.GetStreamString(); + using (StreamReader reader = new StreamReader(responseStream)) + ResponseBody = reader.ReadToEnd(); } } catch @@ -676,7 +671,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest resStream.Close(); if (response != null) response.Close(); -<<<<<<< HEAD // We need to resubmit if ( @@ -724,8 +718,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest { _finished = true; } -======= ->>>>>>> avn/ubitvar } if (ResponseBody == null) diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 1c3a714d58..93a4f09e47 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -380,28 +380,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm if (sp != null) { -<<<<<<< HEAD - // ignore if a child agent this is restricted to inside one - // region - if (sp.IsChildAgent) - return; - - // Channel zero only goes to the avatar - // non zero channel messages only go to the attachments of the avatar. - if (channel != 0) - { - List attachments = sp.GetAttachments(); - if (attachments.Count == 0) - return; -======= - // Send message to avatar + // Send message to avatar if (channel == 0) { - // Channel 0 goes to viewer ONLY + // Channel 0 goes to viewer ONLY m_scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, target, false, false); return true; } ->>>>>>> avn/ubitvar List attachments = sp.GetAttachments(); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index d786c80468..db3f9002b4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs @@ -53,11 +53,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceModule")] -<<<<<<< HEAD + public class MapImageServiceModule : IMapImageUploadModule, ISharedRegionModule -======= - public class MapImageServiceModule : ISharedRegionModule, IMapImageUploadModule ->>>>>>> avn/ubitvar { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -97,13 +94,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage if (config == null) return; -<<<<<<< HEAD - int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime")); - - // if refresh is less than zero, disable the module -======= int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime", "-1")); ->>>>>>> avn/ubitvar if (refreshminutes < 0) { m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Negative refresh time given in config. Module disabled."); @@ -136,19 +127,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage m_refreshTimer.Interval = m_refreshtime; m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh); -<<<<<<< HEAD - m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0} min and service object {1}", -======= - if (m_refreshtime > 0) - { - m_refreshTimer.Enabled = true; - m_refreshTimer.AutoReset = true; - m_refreshTimer.Interval = m_refreshtime; - m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh); - } - m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0} min and service object {1}", ->>>>>>> avn/ubitvar + m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0} min and service object {1}", refreshminutes, service); } else @@ -174,10 +154,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage // v2 Map generation on startup is now handled by scene to allow bmp to be shared with // v1 service and not generate map tiles twice as was previous behavior //scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) UploadMapTile(s); }; -<<<<<<< HEAD -======= ->>>>>>> avn/ubitvar scene.RegisterModuleInterface(this); } @@ -235,15 +212,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage // If the region/maptile is legacy sized, just upload the one tile like it has always been done if (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize) { -<<<<<<< HEAD - ConvertAndUploadMaptile(mapTile, + ConvertAndUploadMaptile(scene, mapTile, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, scene.RegionInfo.RegionName); -======= - ConvertAndUploadMaptile(mapTile, scene, - scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, - scene.RegionInfo.RegionName); ->>>>>>> avn/ubitvar } else { @@ -263,17 +234,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage (int)Constants.RegionSize, (int)Constants.RegionSize); using (Bitmap subMapTile = mapTile.Clone(rect, mapTile.PixelFormat)) { -<<<<<<< HEAD - ConvertAndUploadMaptile(subMapTile, + ConvertAndUploadMaptile(scene, subMapTile, scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize), scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize), scene.Name); -======= - ConvertAndUploadMaptile(subMapTile, scene, - scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize), - scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize), - scene.Name); ->>>>>>> avn/ubitvar } } } @@ -285,11 +249,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage /// public void UploadMapTile(IScene scene) { -<<<<<<< HEAD -======= m_log.DebugFormat("{0}: upload maptile for {1}", LogHeader, scene.RegionInfo.RegionName); ->>>>>>> avn/ubitvar // Create a JPG map tile and upload it to the AddMapTile API IMapImageGenerator tileGenerator = scene.RequestModuleInterface(); if (tileGenerator == null) @@ -300,23 +261,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage using (Bitmap mapTile = tileGenerator.CreateMapTile()) { -<<<<<<< HEAD - if (mapTile != null) - { - UploadMapTile(scene, mapTile); - } - else - { - m_log.WarnFormat("{0} Tile image generation failed", LogHeader); - } - } - } - - private void ConvertAndUploadMaptile(Image tileImage, uint locX, uint locY, string regionName) - { - byte[] jpgData = Utils.EmptyBytes; - -======= // XXX: The MapImageModule will return a null if the user has chosen not to create map tiles and there // is no static map tile. if (mapTile == null) @@ -326,11 +270,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage } } - private void ConvertAndUploadMaptile(Image tileImage, IScene scene, uint locX, uint locY, string regionName) + private void ConvertAndUploadMaptile(IScene scene, Image tileImage, uint locX, uint locY, string regionName) { byte[] jpgData = Utils.EmptyBytes; ->>>>>>> avn/ubitvar using (MemoryStream stream = new MemoryStream()) { tileImage.Save(stream, ImageFormat.Jpeg); @@ -339,11 +282,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage if (jpgData != Utils.EmptyBytes) { string reason = string.Empty; -<<<<<<< HEAD - if (!m_MapService.AddMapTile((int)locX, (int)locY, jpgData, out reason)) -======= if (!m_MapService.AddMapTile((int)locX, (int)locY, jpgData, scene.RegionInfo.ScopeID, out reason)) ->>>>>>> avn/ubitvar { m_log.DebugFormat("{0} Unable to upload tile image for {1} at {2}-{3}: {4}", LogHeader, regionName, locX, locY, reason); @@ -351,11 +290,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage } else { -<<<<<<< HEAD m_log.WarnFormat("{0} Tile image generation failed for region {1}", LogHeader, regionName); -======= - m_log.WarnFormat("{0} Tile image generation failed for region {1}", LogHeader, scene.RegionInfo.RegionName); ->>>>>>> avn/ubitvar } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 50238a5d9d..9d4c2827f5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -269,11 +269,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return true; } -<<<<<<< HEAD + public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, List features, out string version, out string reason) -======= - public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, out string version, out string reason) ->>>>>>> avn/ubitvar { reason = "Communications failure"; version = ServiceVersion; @@ -302,29 +299,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation } -<<<<<<< HEAD + return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, features, out reason); -======= - - // not really need on a grid running var regions sims - - uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX; - - float theirVersionNumber = 0f; - string[] versionComponents = theirversion.Split(new char[] { '/' }); - if (versionComponents.Length >= 2) - float.TryParse(versionComponents[1], out theirVersionNumber); - - // Var regions here, and the requesting simulator is in an older version. - // We will forbide this, because it crashes the viewers - if (theirVersionNumber < 0.3f && size > 256) - { - reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading."; - m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber); - return false; - } - return m_scenes[destination.RegionID].QueryAccess(agentID, position, out reason); ->>>>>>> avn/ubitvar } //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 7044d920be..12ffc010c4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -206,11 +206,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return m_remoteConnector.UpdateAgent(destination, cAgentData); } -<<<<<<< HEAD + public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, List features, out string version, out string reason) -======= - public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason) ->>>>>>> avn/ubitvar { reason = "Communications failure"; version = "Unknown"; @@ -219,22 +216,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return false; // Try local first -<<<<<<< HEAD if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason)) -======= - if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason)) - return true; ->>>>>>> avn/ubitvar return true; // else do the remote thing if (!m_localBackend.IsLocalRegion(destination.RegionID)) -<<<<<<< HEAD return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason); -======= - return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason); - ->>>>>>> avn/ubitvar return false; } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index f0b0f4a2ec..406f4a84c7 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -162,13 +162,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver private UUID m_defaultUser; -<<<<<<< HEAD - private UUID m_defaultUser; - - public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionaryoptions) -======= public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary options) ->>>>>>> avn/ubitvar { m_rootScene = scene; @@ -177,11 +171,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_defaultUser = (UUID)options["default-user"]; m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString()); } -<<<<<<< HEAD - else -======= else ->>>>>>> avn/ubitvar { m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; } @@ -200,10 +190,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver } m_errorMessage = String.Empty; -<<<<<<< HEAD -======= ->>>>>>> avn/ubitvar m_merge = options.ContainsKey("merge"); m_forceTerrain = options.ContainsKey("force-terrain"); m_forceParcels = options.ContainsKey("force-parcels"); @@ -212,34 +199,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_requestId = requestId; m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; -<<<<<<< HEAD - m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] - : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); - - // Zero can never be a valid user or group id - m_validUserUuids[UUID.Zero] = false; - m_validGroupUuids[UUID.Zero] = false; -======= m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); - m_requestId = requestId; - // Zero can never be a valid user id (or group) m_validUserUuids[UUID.Zero] = false; m_validGroupUuids[UUID.Zero] = false; ->>>>>>> avn/ubitvar - m_groupsModule = m_rootScene.RequestModuleInterface(); m_assetService = m_rootScene.AssetService; } -<<<<<<< HEAD - public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionaryoptions) -======= public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary options) ->>>>>>> avn/ubitvar { m_rootScene = scene; m_loadPath = null; @@ -249,11 +220,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_requestId = requestId; m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; -<<<<<<< HEAD - -======= ->>>>>>> avn/ubitvar // Zero can never be a valid user id m_validUserUuids[UUID.Zero] = false; @@ -327,24 +294,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver if ((successfulAssetRestores + failedAssetRestores) % 250 == 0) m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets..."); } -<<<<<<< HEAD else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH) && (!m_merge || m_forceTerrain)) -======= - else if ((!m_merge || m_forceTerrain) && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH)) ->>>>>>> avn/ubitvar { LoadTerrain(scene, filePath, data); } else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) { LoadRegionSettings(scene, filePath, data, dearchivedScenes); -<<<<<<< HEAD } else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH) && (!m_merge || m_forceParcels)) -======= - } - else if ((!m_merge || m_forceParcels) && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH)) ->>>>>>> avn/ubitvar { sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data)); } @@ -565,10 +523,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver } } -<<<<<<< HEAD - -======= ->>>>>>> avn/ubitvar bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero); // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned @@ -585,10 +539,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver } ModifySceneObject(scene, sceneObject); -<<<<<<< HEAD -======= - ->>>>>>> avn/ubitvar if (scene.AddRestoredSceneObject(sceneObject, true, false)) { @@ -649,8 +599,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver // being no copy/no mod for everyone lock (part.TaskInventory) { -<<<<<<< HEAD -======= // And zap any troublesome sit target information part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); part.SitTargetPosition = new Vector3(0, 0, 0); @@ -659,7 +607,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver // Not doing so results in inventory items // being no copy/no mod for everyone part.TaskInventory.LockItemsForRead(true); ->>>>>>> avn/ubitvar + TaskInventoryDictionary inv = part.TaskInventory; foreach (KeyValuePair kvp in inv) { @@ -680,18 +628,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (!ResolveGroupUuid(kvp.Value.GroupID)) kvp.Value.GroupID = UUID.Zero; } -<<<<<<< HEAD -======= part.TaskInventory.LockItemsForRead(false); ->>>>>>> avn/ubitvar + } } } -<<<<<<< HEAD - -======= ->>>>>>> avn/ubitvar /// /// Load serialized parcels. /// @@ -712,11 +654,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver parcel.AABBMin += parcelDisp; parcel.AABBMax += parcelDisp; } -<<<<<<< HEAD - -======= - ->>>>>>> avn/ubitvar + // Validate User and Group UUID's if (!ResolveGroupUuid(parcel.GroupID)) @@ -731,26 +669,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver } else { -<<<<<<< HEAD - parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner; -======= parcel.OwnerID = m_defaultUser; parcel.GroupID = UUID.Zero; ->>>>>>> avn/ubitvar parcel.IsGroupOwned = false; } } else { if (!ResolveUserUuid(scene, parcel.OwnerID)) -<<<<<<< HEAD - parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner; -======= parcel.OwnerID = m_defaultUser; if (!ResolveGroupUuid(parcel.GroupID)) parcel.GroupID = UUID.Zero; ->>>>>>> avn/ubitvar } List accessList = new List(); @@ -879,10 +809,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (data == null) return false; } -<<<<<<< HEAD -======= ->>>>>>> avn/ubitvar //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero.ToString()); @@ -1004,11 +931,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver private bool LoadTerrain(Scene scene, string terrainPath, byte[] data) { ITerrainModule terrainModule = scene.RequestModuleInterface(); -<<<<<<< HEAD - -======= - ->>>>>>> avn/ubitvar using (MemoryStream ms = new MemoryStream(data)) { if (m_displacement != Vector3.Zero || m_rotation != 0f) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 0fb8a3205a..4178a570ee 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -111,19 +111,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver String defaultUser = ""; float rotation = 0f; Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); -<<<<<<< HEAD - - OptionSet options = new OptionSet(); - options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); - options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); }); - options.Add("force-terrain", delegate (string v) { forceTerrain = (v != null); }); - options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); // downward compatibility - options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); }); - options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility - options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); - options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; }); - options.Add("displacement=", delegate (string v) { -======= + OptionSet options = new OptionSet(); options.Add("m|merge", delegate(string v) { mergeOar = (v != null); }); @@ -136,7 +124,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; }); options.Add("displacement=", delegate(string v) { ->>>>>>> avn/ubitvar try { displacement = v == null ? Vector3.Zero : Vector3.Parse(v); @@ -163,12 +150,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver // Convert to radians for internals rotation = Util.Clamp(rotation, -359f, 359f) / 180f * (float)Math.PI; }); -<<<<<<< HEAD - options.Add("rotation-center=", delegate (string v) { -======= options.Add("rotation-center=", delegate(string v) { ->>>>>>> avn/ubitvar try { rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); @@ -308,21 +291,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver Dictionary archiveOptions = new Dictionary(); DearchiveRegion(loadPath, Guid.Empty, archiveOptions); } -<<<<<<< HEAD - - public void DearchiveRegion(string loadPath, Guid requestId, Dictionary options) - { - m_log.InfoFormat( - "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); - -======= public void DearchiveRegion(string loadPath, Guid requestId, Dictionary options) { m_log.InfoFormat( "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); ->>>>>>> avn/ubitvar new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion(); } @@ -331,11 +305,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver Dictionary archiveOptions = new Dictionary(); DearchiveRegion(loadStream, Guid.Empty, archiveOptions); } -<<<<<<< HEAD - -======= - ->>>>>>> avn/ubitvar public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary options) { new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion(); diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index e6e6485858..3ded00c213 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -68,6 +68,8 @@ namespace OpenSim.Region.CoreModules.World.Estate public event ChangeDelegate OnEstateInfoChange; public event MessageDelegate OnEstateMessage; + private int m_delayCount = 0; + #region Region Module interface public string Name { get { return "EstateManagementModule"; } } @@ -146,6 +148,10 @@ namespace OpenSim.Region.CoreModules.World.Estate flags |= RegionFlags.AllowParcelChanges; if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) flags |= RegionFlags.BlockParcelSearch; + if (Scene.RegionInfo.RegionSettings.GodBlockSearch) + flags |= (RegionFlags)(1 << 11); + if (Scene.RegionInfo.RegionSettings.Casino) + flags |= (RegionFlags)(1 << 10); if (Scene.RegionInfo.RegionSettings.FixedSun) flags |= RegionFlags.SunFixed; @@ -198,6 +204,14 @@ namespace OpenSim.Region.CoreModules.World.Estate change(Scene.RegionInfo.RegionID); } + protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e) + { + ChangeDelegate change = OnRegionInfoChange; + + if (change != null) + change(Scene.RegionInfo.RegionID); + } + public void TriggerRegionInfoChange() { m_regionChangeTimer.Stop(); @@ -1491,68 +1505,8 @@ namespace OpenSim.Region.CoreModules.World.Estate sendRegionHandshake(client); } -<<<<<<< HEAD - private uint GetEstateFlags() -======= - public uint GetRegionFlags() - { - RegionFlags flags = RegionFlags.None; - - // Fully implemented - // - if (Scene.RegionInfo.RegionSettings.AllowDamage) - flags |= RegionFlags.AllowDamage; - if (Scene.RegionInfo.RegionSettings.BlockTerraform) - flags |= RegionFlags.BlockTerraform; - if (!Scene.RegionInfo.RegionSettings.AllowLandResell) - flags |= RegionFlags.BlockLandResell; - if (Scene.RegionInfo.RegionSettings.DisableCollisions) - flags |= RegionFlags.SkipCollisions; - if (Scene.RegionInfo.RegionSettings.DisableScripts) - flags |= RegionFlags.SkipScripts; - if (Scene.RegionInfo.RegionSettings.DisablePhysics) - flags |= RegionFlags.SkipPhysics; - if (Scene.RegionInfo.RegionSettings.BlockFly) - flags |= RegionFlags.NoFly; - if (Scene.RegionInfo.RegionSettings.RestrictPushing) - flags |= RegionFlags.RestrictPushObject; - if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide) - flags |= RegionFlags.AllowParcelChanges; - if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) - flags |= RegionFlags.BlockParcelSearch; - if (Scene.RegionInfo.RegionSettings.GodBlockSearch) - flags |= (RegionFlags)(1 << 11); - if (Scene.RegionInfo.RegionSettings.Casino) - flags |= (RegionFlags)(1 << 10); - - if (Scene.RegionInfo.RegionSettings.FixedSun) - flags |= RegionFlags.SunFixed; - if (Scene.RegionInfo.RegionSettings.Sandbox) - flags |= RegionFlags.Sandbox; - if (Scene.RegionInfo.EstateSettings.AllowVoice) - flags |= RegionFlags.AllowVoice; - if (Scene.RegionInfo.EstateSettings.AllowLandmark) - flags |= RegionFlags.AllowLandmark; - if (Scene.RegionInfo.EstateSettings.AllowSetHome) - flags |= RegionFlags.AllowSetHome; - if (Scene.RegionInfo.EstateSettings.BlockDwell) - flags |= RegionFlags.BlockDwell; - if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) - flags |= RegionFlags.ResetHomeOnTeleport; - - - // TODO: SkipUpdateInterestList - - // Omitted - // - // Omitted: NullLayer (what is that?) - // Omitted: SkipAgentAction (what does it do?) - - return (uint)flags; - } public uint GetEstateFlags() ->>>>>>> avn/ubitvar { RegionFlags flags = RegionFlags.None; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 8bd46f67db..749c2cc66c 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -69,11 +69,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// /// Minimum land unit size in region co-ordinates. /// -<<<<<<< HEAD + public const int LandUnit = 4; -======= - public const int landUnit = 4; ->>>>>>> avn/ubitvar private static readonly string remoteParcelRequestPath = "0009/"; @@ -106,17 +103,12 @@ namespace OpenSim.Region.CoreModules.World.Land // caches ExtendedLandData private Cache parcelInfoCache; -<<<<<<< HEAD - /// /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. /// private Dictionary forcedPosition = new Dictionary(); -======= - private Dictionary forcedPosition = - new Dictionary(); ->>>>>>> avn/ubitvar + // Enables limiting parcel layer info transmission when doing simple updates private bool shouldLimitParcelLayerInfoToViewDistance { get; set; } @@ -132,7 +124,6 @@ namespace OpenSim.Region.CoreModules.World.Land public void Initialise(IConfigSource source) { -<<<<<<< HEAD shouldLimitParcelLayerInfoToViewDistance = true; parcelLayerViewDistance = 128; IConfig landManagementConfig = source.Configs["LandManagement"]; @@ -140,24 +131,16 @@ namespace OpenSim.Region.CoreModules.World.Land { shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance); parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance); -======= - IConfig cnf = source.Configs["LandManagement"]; - if (cnf != null) - { - DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); - DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); ->>>>>>> avn/ubitvar + DefaultGodParcelGroup = new UUID(landManagementConfig.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); + DefaultGodParcelName = landManagementConfig.GetString("DefaultAdministratorParcelName", "Default Parcel"); } } public void AddRegion(Scene scene) { m_scene = scene; -<<<<<<< HEAD m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; -======= - m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; ->>>>>>> avn/ubitvar + landChannel = new LandChannel(scene, this); parcelInfoCache = new Cache(); @@ -299,11 +282,8 @@ namespace OpenSim.Region.CoreModules.World.Land { m_landList.Clear(); m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; -<<<<<<< HEAD + m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; -======= - m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; ->>>>>>> avn/ubitvar } } @@ -313,16 +293,10 @@ namespace OpenSim.Region.CoreModules.World.Land /// The parcel created. protected ILandObject CreateDefaultParcel() { -<<<<<<< HEAD - m_log.DebugFormat( - "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); - - ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); -======= m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName); ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); ->>>>>>> avn/ubitvar + fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY)); fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; @@ -456,15 +430,10 @@ namespace OpenSim.Region.CoreModules.World.Land public void SendLandUpdate(ScenePresence avatar, bool force) { -<<<<<<< HEAD - ILandObject over = GetLandObject((int)Math.Min(((int)m_scene.RegionInfo.RegionSizeX - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), - (int)Math.Min(((int)m_scene.RegionInfo.RegionSizeY - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); -======= if (avatar.IsChildAgent) return; ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); ->>>>>>> avn/ubitvar if (over != null) { @@ -621,28 +590,17 @@ namespace OpenSim.Region.CoreModules.World.Land new_land.LandData.LocalID = newLandLocalID; bool[,] landBitmap = new_land.GetLandBitmap(); -<<<<<<< HEAD - // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}", - // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID); - -======= ->>>>>>> avn/ubitvar if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) { // Going to variable sized regions can cause mismatches m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", -<<<<<<< HEAD - LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1) ); -======= LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1)); ->>>>>>> avn/ubitvar } else { // If other land objects still believe that they occupy any parts of the same space, // then do not allow the add to proceed. for (int x = 0; x < landBitmap.GetLength(0); x++) -<<<<<<< HEAD { for (int y = 0; y < landBitmap.GetLength(1); y++) { @@ -650,40 +608,6 @@ namespace OpenSim.Region.CoreModules.World.Land { int lastRecordedLandId = m_landIDList[x, y]; - if (lastRecordedLandId > 0) - { - ILandObject lastRecordedLo = m_landList[lastRecordedLandId]; - - if (lastRecordedLo.LandBitmap[x, y]) - { - m_log.ErrorFormat( - "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}", - LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y, - lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name); - - return null; - } - } - } - } - } - - for (int x = 0; x < landBitmap.GetLength(0); x++) -======= ->>>>>>> avn/ubitvar - { - for (int y = 0; y < landBitmap.GetLength(1); y++) - { - if (landBitmap[x, y]) - { -<<<<<<< HEAD - // m_log.DebugFormat( - // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", - // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); - -======= - int lastRecordedLandId = m_landIDList[x, y]; - if (lastRecordedLandId > 0) { ILandObject lastRecordedLo = m_landList[lastRecordedLandId]; @@ -712,7 +636,6 @@ namespace OpenSim.Region.CoreModules.World.Land // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); ->>>>>>> avn/ubitvar m_landIDList[x, y] = newLandLocalID; } } @@ -829,33 +752,6 @@ namespace OpenSim.Region.CoreModules.World.Land /// Land object at the point supplied public ILandObject GetLandObject(float x_float, float y_float) { -<<<<<<< HEAD - return GetLandObject((int)x_float, (int)y_float, true /* returnNullIfLandObjectNotFound */); - /* - int x; - int y; - - if (x_float >= m_scene.RegionInfo.RegionSizeX || x_float < 0 || y_float >= m_scene.RegionInfo.RegionSizeX || y_float < 0) - return null; - - try - { - x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / (float)landUnit)); - y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / (float)landUnit)); - } - catch (OverflowException) - { - return null; - } - - if (x >= (m_scene.RegionInfo.RegionSizeX / landUnit) - || y >= (m_scene.RegionInfo.RegionSizeY / landUnit) - || x < 0 - || y < 0) - { - return null; - } -======= return GetLandObject((int)x_float, (int)y_float, true); } @@ -875,45 +771,18 @@ namespace OpenSim.Region.CoreModules.World.Land avy = 0; else if (avy >= m_scene.RegionInfo.RegionSizeY) avy = (int)Constants.RegionSize - 1; ->>>>>>> avn/ubitvar lock (m_landIDList) { -<<<<<<< HEAD - // Corner case. If an autoreturn happens during sim startup - // we will come here with the list uninitialized - // -// int landId = m_landIDList[x, y]; - -// if (landId == 0) -// m_log.DebugFormat( -// "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}", -// x, y, m_scene.RegionInfo.RegionName); - try { - if (m_landList.ContainsKey(m_landIDList[x, y])) - return m_landList[m_landIDList[x, y]]; - } - catch (Exception e) - { - m_log.DebugFormat("{0} GetLandObject exception. x={1}, y={2}, m_landIDList.len=({3},{4})", - LogHeader, x, y, m_landIDList.GetLength(0), m_landIDList.GetLength(1)); - } - - return null; -======= - try - { - return m_landList[m_landIDList[avx / landUnit, avy / landUnit]]; + return m_landList[m_landIDList[avx / LandUnit, avy / LandUnit]]; } catch (IndexOutOfRangeException) { return null; } ->>>>>>> avn/ubitvar } - */ } // Public entry. @@ -923,38 +792,15 @@ namespace OpenSim.Region.CoreModules.World.Land return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */); } -<<<<<<< HEAD - /// - /// Given a region position, return the parcel land object for that location - /// - /// - /// The land object. - /// - /// - /// - /// - /// Return null if the land object requested is not within the region's bounds. - /// - private ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds) - { - if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) -======= public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds) { if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) ->>>>>>> avn/ubitvar { // These exceptions here will cause a lot of complaints from the users specifically because // they happen every time at border crossings if (returnNullIfLandObjectOutsideBounds) return null; else -<<<<<<< HEAD - throw new Exception( - String.Format("{0} GetLandObject for non-existent position. Region={1}, pos=<{2},{3}", - LogHeader, m_scene.RegionInfo.RegionName, x, y) - ); -======= throw new Exception("Error: Parcel not found at point " + x + ", " + y); } @@ -968,7 +814,6 @@ namespace OpenSim.Region.CoreModules.World.Land { return null; } ->>>>>>> avn/ubitvar } return m_landList[m_landIDList[x / 4, y / 4]]; @@ -987,19 +832,6 @@ namespace OpenSim.Region.CoreModules.World.Land return ret; } - // Create a 'parcel is here' bitmap for the parcel identified by the passed landID - private bool[,] CreateBitmapForID(int landID) - { - bool[,] ret = new bool[m_landIDList.GetLength(0), m_landIDList.GetLength(1)]; - - for (int xx = 0; xx < m_landIDList.GetLength(0); xx++) - for (int yy = 0; yy < m_landIDList.GetLength(0); yy++) - if (m_landIDList[xx, yy] == landID) - ret[xx, yy] = true; - - return ret; - } - #endregion #region Parcel Modification @@ -1169,19 +1001,12 @@ namespace OpenSim.Region.CoreModules.World.Land //Now add the new land object ILandObject result = AddLandObject(newLand); -<<<<<<< HEAD - if (result != null) - { - UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); - result.SendLandUpdateToAvatarsOverMe(); - } -======= UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); result.SendLandUpdateToAvatarsOverMe(); startLandObject.SendLandUpdateToAvatarsOverMe(); m_scene.ForEachClient(SendParcelOverlay); ->>>>>>> avn/ubitvar + } /// @@ -1263,15 +1088,6 @@ namespace OpenSim.Region.CoreModules.World.Land #region Parcel Updating -<<<<<<< HEAD - // Send parcel layer info for the whole region - public void SendParcelOverlay(IClientAPI remote_client) - { - SendParcelOverlay(remote_client, 0, 0, (int)Constants.MaximumRegionSize); - } -======= ->>>>>>> avn/ubitvar - /// /// Send the parcel overlay blocks to the client. We send the overlay packets /// around a location and limited by the 'parcelLayerViewDistance'. This number @@ -1285,7 +1101,7 @@ namespace OpenSim.Region.CoreModules.World.Land /// X position in the region to send surrounding parcel layer info /// y position in the region to send surrounding parcel layer info /// Distance from x,y position to send parcel layer info - private void SendParcelOverlay(IClientAPI remote_client, int xPlace, int yPlace, int layerViewDistance) + public void SendParcelOverlay(IClientAPI remote_client) { if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) return; @@ -1295,149 +1111,18 @@ namespace OpenSim.Region.CoreModules.World.Land byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; int byteArrayCount = 0; int sequenceID = 0; -<<<<<<< HEAD - int xLow = 0; - int xHigh = (int)m_scene.RegionInfo.RegionSizeX; - int yLow = 0; - int yHigh = (int)m_scene.RegionInfo.RegionSizeY; - - if (shouldLimitParcelLayerInfoToViewDistance) + // Layer data is in LandUnit (4m) chunks + for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += LandUnit) { - // Compute view distance around the given point - int txLow = xPlace - layerViewDistance; - int txHigh = xPlace + layerViewDistance; - // If the distance is outside the region area, move the view distance to ba all in the region - if (txLow < xLow) -======= + for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += LandUnit) + { + byte tempByte = 0; //This represents the byte for the current 4x4 - // Layer data is in landUnit (4m) chunks - for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += landUnit) - { - for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += landUnit) ->>>>>>> avn/ubitvar - { - txLow = xLow; - txHigh = Math.Min(yLow + (layerViewDistance * 2), xHigh); - } - if (txHigh > xHigh) - { - txLow = Math.Max(xLow, xHigh - (layerViewDistance * 2)); - txHigh = xHigh; - } - xLow = txLow; - xHigh = txHigh; - -<<<<<<< HEAD - int tyLow = yPlace - layerViewDistance; - int tyHigh = yPlace + layerViewDistance; - if (tyLow < yLow) - { - tyLow = yLow; - tyHigh = Math.Min(yLow + (layerViewDistance * 2), yHigh); - } - if (tyHigh > yHigh) - { - tyLow = Math.Max(yLow, yHigh - (layerViewDistance * 2)); - tyHigh = yHigh; - } - yLow = tyLow; - yHigh = tyHigh; - } - // m_log.DebugFormat("{0} SendParcelOverlay: place=<{1},{2}>, vDist={3}, xLH=<{4},{5}, yLH=<{6},{7}>", - // LogHeader, xPlace, yPlace, layerViewDistance, xLow, xHigh, yLow, yHigh); -======= ILandObject currentParcelBlock = GetLandObject(x, y); ->>>>>>> avn/ubitvar - // Layer data is in landUnit (4m) chunks - for (int y = yLow; y < yHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) - { - for (int x = xLow; x < xHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++) - { - byteArray[byteArrayCount] = BuildLayerByte(GetLandObject(x * LandUnit, y * LandUnit), x, y, remote_client); - byteArrayCount++; - if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) + if (currentParcelBlock != null) { -<<<<<<< HEAD - // m_log.DebugFormat("{0} SendParcelOverlay, sending packet, bytes={1}", LogHeader, byteArray.Length); - remote_client.SendLandParcelOverlay(byteArray, sequenceID); - byteArrayCount = 0; - sequenceID++; - byteArray = new byte[LAND_BLOCKS_PER_PACKET]; - } - - } - } - - if (byteArrayCount != 0) - { - remote_client.SendLandParcelOverlay(byteArray, sequenceID); - // m_log.DebugFormat("{0} SendParcelOverlay, complete sending packet, bytes={1}", LogHeader, byteArray.Length); - } - } - - private byte BuildLayerByte(ILandObject currentParcelBlock, int x, int y, IClientAPI remote_client) - { - byte tempByte = 0; //This represents the byte for the current 4x4 - - if (currentParcelBlock != null) - { - if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) - { - //Owner Flag - tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); - } - else if (currentParcelBlock.LandData.SalePrice > 0 && - (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || - currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) - { - //Sale Flag - tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE); - } - else if (currentParcelBlock.LandData.OwnerID == UUID.Zero) - { - //Public Flag - tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC); - } - else - { - //Other Flag - tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_OTHER); - } - - //Now for border control - - ILandObject westParcel = null; - ILandObject southParcel = null; - if (x > 0) - { - westParcel = GetLandObject((x - 1) * LandUnit, y * LandUnit); - } - if (y > 0) - { - southParcel = GetLandObject(x * LandUnit, (y - 1) * LandUnit); - } - - if (x == 0) - { - tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST); - } - else if (westParcel != null && westParcel != currentParcelBlock) - { - tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST); - } - - if (y == 0) - { - tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH); - } - else if (southParcel != null && southParcel != currentParcelBlock) - { - tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH); - } - -======= // types if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) { @@ -1525,10 +1210,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (byteArrayCount > 0) { remote_client.SendLandParcelOverlay(byteArray, sequenceID); ->>>>>>> avn/ubitvar } - - return tempByte; } public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, @@ -1569,10 +1251,6 @@ namespace OpenSim.Region.CoreModules.World.Land temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); } -<<<<<<< HEAD - // Also send the layer data around the point of interest - SendParcelOverlay(remote_client, (start_x + end_x) / 2, (start_y + end_y) / 2, parcelLayerViewDistance); -======= // SendParcelOverlay(remote_client); } @@ -1612,7 +1290,6 @@ namespace OpenSim.Region.CoreModules.World.Land avatar.currentParcelUUID = parcelID; // force parcel flags review }); } ->>>>>>> avn/ubitvar } public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) @@ -1821,35 +1498,17 @@ namespace OpenSim.Region.CoreModules.World.Land for (int i = 0; i < data.Count; i++) IncomingLandObjectFromStorage(data[i]); -<<<<<<< HEAD - // Prevent race conditions from any auto-creation of new parcels for varregions whilst we are still loading - // the existing parcels. - lock (m_landList) - { - for (int i = 0; i < data.Count; i++) - IncomingLandObjectFromStorage(data[i]); - - // Layer data is in landUnit (4m) chunks + // Layer data is in LandUnit (4m) chunks for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) { for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++) -======= - // Layer data is in landUnit (4m) chunks - for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); y++) - { - for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); x++) ->>>>>>> avn/ubitvar { if (m_landIDList[x, y] == 0) { if (m_landList.Count == 1) { m_log.DebugFormat( -<<<<<<< HEAD - "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", -======= "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", ->>>>>>> avn/ubitvar LogHeader, x, y, m_scene.Name); int onlyParcelID = 0; @@ -1872,19 +1531,11 @@ namespace OpenSim.Region.CoreModules.World.Land else if (m_landList.Count > 1) { m_log.DebugFormat( -<<<<<<< HEAD - "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", - LogHeader, x, y, m_scene.Name); - - // There are several other parcels so we must create a new one for the unassigned space - ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); -======= "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", LogHeader, x, y, m_scene.Name); // There are several other parcels so we must create a new one for the unassigned space ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); ->>>>>>> avn/ubitvar // Claim all the unclaimed "0" ids newLand.SetLandBitmap(CreateBitmapForID(0)); newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; @@ -1895,11 +1546,7 @@ namespace OpenSim.Region.CoreModules.World.Land { // We should never reach this point as the separate code path when no land data exists should have fired instead. m_log.WarnFormat( -<<<<<<< HEAD - "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", -======= "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", ->>>>>>> avn/ubitvar LogHeader, m_scene.Name); } } @@ -1910,13 +1557,9 @@ namespace OpenSim.Region.CoreModules.World.Land private void IncomingLandObjectFromStorage(LandData data) { -<<<<<<< HEAD - ILandObject new_land = new LandObject(data, m_scene); -======= - ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); new_land.LandData = data.Copy(); ->>>>>>> avn/ubitvar + new_land.SetLandBitmapFromByteArray(); AddLandObject(new_land); // new_land.SendLandUpdateToAvatarsOverMe(); @@ -2568,17 +2211,6 @@ namespace OpenSim.Region.CoreModules.World.Land private void AppendParcelsSummaryReport(StringBuilder report) { -<<<<<<< HEAD - report.AppendFormat("Land information for {0}\n", m_scene.Name); - - ConsoleDisplayTable cdt = new ConsoleDisplayTable(); - cdt.AddColumn("Parcel Name", ConsoleDisplayUtil.ParcelNameSize); - cdt.AddColumn("ID", 3); - cdt.AddColumn("Area", 6); - cdt.AddColumn("Starts", ConsoleDisplayUtil.VectorSize); - cdt.AddColumn("Ends", ConsoleDisplayUtil.VectorSize); - cdt.AddColumn("Owner", ConsoleDisplayUtil.UserNameSize); -======= report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); report.AppendFormat( "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", @@ -2588,27 +2220,12 @@ namespace OpenSim.Region.CoreModules.World.Land "AABBMin", "AABBMax", "Owner"); ->>>>>>> avn/ubitvar lock (m_landList) { foreach (ILandObject lo in m_landList.Values) { LandData ld = lo.LandData; -<<<<<<< HEAD - string ownerName; - if (ld.IsGroupOwned) - { - GroupRecord rec = m_groupManager.GetGroupRecord(ld.GroupID); - ownerName = (rec != null) ? rec.GroupName : "Unknown Group"; - } - else - { - ownerName = m_userManager.GetUserName(ld.OwnerID); - } - cdt.AddRow( - ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, ownerName); -======= report.AppendFormat( "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", @@ -2636,11 +2253,8 @@ namespace OpenSim.Region.CoreModules.World.Land else { ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); ->>>>>>> avn/ubitvar } } - - report.Append(cdt.ToString()); } private void AppendParcelReport(StringBuilder report, ILandObject lo) diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 3b81d6b725..040c90b0eb 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -46,20 +46,12 @@ namespace OpenSim.Region.CoreModules.World.Land private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly string LogHeader = "[LAND OBJECT]"; -<<<<<<< HEAD - - private readonly int landUnit = 4; - - private int m_lastSeqId = 0; - -======= private readonly int landUnit = 4; private int m_lastSeqId = 0; private int m_expiryCounter = 0; ->>>>>>> avn/ubitvar protected Scene m_scene; protected List primsOverMe = new List(); protected Dictionary m_listTransactions = new Dictionary(); @@ -67,16 +59,12 @@ namespace OpenSim.Region.CoreModules.World.Land protected ExpiringCache m_groupMemberCache = new ExpiringCache(); protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds -<<<<<<< HEAD - public bool[,] LandBitmap { get; set; } -======= private bool[,] m_landBitmap; public bool[,] LandBitmap { get { return m_landBitmap; } set { m_landBitmap = value; } } ->>>>>>> avn/ubitvar #endregion @@ -87,9 +75,6 @@ namespace OpenSim.Region.CoreModules.World.Land return free; } -<<<<<<< HEAD - public LandData LandData { get; set; } -======= protected LandData m_landData; public LandData LandData { @@ -97,7 +82,6 @@ namespace OpenSim.Region.CoreModules.World.Land set { m_landData = value; } } ->>>>>>> avn/ubitvar public IPrimCounts PrimCounts { get; set; } @@ -225,12 +209,6 @@ namespace OpenSim.Region.CoreModules.World.Land else { // Normal Calculations -<<<<<<< HEAD - int parcelMax = (int)(((float)LandData.Area / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)) - * (float)m_scene.RegionInfo.ObjectCapacity - * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); - // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL! -======= int parcelMax = (int)( (long)LandData.Area * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus @@ -252,7 +230,6 @@ namespace OpenSim.Region.CoreModules.World.Land int parcelMax = (int)((long)LandData.Area * (long)m_scene.RegionInfo.ObjectCapacity / 65536L); ->>>>>>> avn/ubitvar return parcelMax; } } @@ -266,15 +243,10 @@ namespace OpenSim.Region.CoreModules.World.Land else { //Normal Calculations -<<<<<<< HEAD - int simMax = (int)(((float)LandData.SimwideArea / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)) - * (float)m_scene.RegionInfo.ObjectCapacity); -======= int simMax = (int)( (long)LandData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); // m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax); ->>>>>>> avn/ubitvar return simMax; } } @@ -439,12 +411,6 @@ namespace OpenSim.Region.CoreModules.World.Land { uint preserve = LandData.Flags & ~allowedDelta; newData.Flags = preserve | (args.ParcelFlags & allowedDelta); -<<<<<<< HEAD - - m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); - SendLandUpdateToAvatarsOverMe(snap_selection); - } -======= uint curdelta = LandData.Flags ^ newData.Flags; curdelta &= (uint)(ParcelFlags.SoundLocal); @@ -456,7 +422,6 @@ namespace OpenSim.Region.CoreModules.World.Land return true; } return false; ->>>>>>> avn/ubitvar } public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) @@ -806,17 +771,11 @@ namespace OpenSim.Region.CoreModules.World.Land /// private void UpdateAABBAndAreaValues() { -<<<<<<< HEAD - int min_x = 10000; - int min_y = 10000; - int max_x = 0; - int max_y = 0; -======= + int min_x = Int32.MaxValue; int min_y = Int32.MaxValue; int max_x = Int32.MinValue; int max_y = Int32.MinValue; ->>>>>>> avn/ubitvar int tempArea = 0; int x, y; for (x = 0; x < LandBitmap.GetLength(0); x++) @@ -825,12 +784,6 @@ namespace OpenSim.Region.CoreModules.World.Land { if (LandBitmap[x, y] == true) { -<<<<<<< HEAD - if (min_x > x) min_x = x; - if (min_y > y) min_y = y; - if (max_x < x) max_x = x; - if (max_y < y) max_y = y; -======= if (min_x > x) min_x = x; if (min_y > y) @@ -839,7 +792,6 @@ namespace OpenSim.Region.CoreModules.World.Land max_x = x; if (max_y < y) max_y = y; ->>>>>>> avn/ubitvar tempArea += landUnit * landUnit; //16sqm peice of land } } @@ -847,27 +799,6 @@ namespace OpenSim.Region.CoreModules.World.Land int tx = min_x * landUnit; if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1)) tx = ((int)m_scene.RegionInfo.RegionSizeX - 1); -<<<<<<< HEAD - int ty = min_y * landUnit; - if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1)) - ty = ((int)m_scene.RegionInfo.RegionSizeY - 1); - - LandData.AABBMin = - new Vector3( - (float)(min_x * landUnit), (float)(min_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0); - - tx = max_x * landUnit; - if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1)) - tx = ((int)m_scene.RegionInfo.RegionSizeX - 1); - ty = max_y * landUnit; - if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1)) - ty = ((int)m_scene.RegionInfo.RegionSizeY - 1); - - LandData.AABBMax - = new Vector3( - (float)(max_x * landUnit), (float)(max_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0); -======= - int htx; if (tx >= ((int)m_scene.RegionInfo.RegionSizeX)) htx = (int)m_scene.RegionInfo.RegionSizeX - 1; @@ -904,7 +835,6 @@ namespace OpenSim.Region.CoreModules.World.Land LandData.AABBMax = new Vector3( (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0); ->>>>>>> avn/ubitvar LandData.Area = tempArea; } @@ -920,10 +850,6 @@ namespace OpenSim.Region.CoreModules.World.Land public void SetLandBitmap(bool[,] bitmap) { LandBitmap = bitmap; -<<<<<<< HEAD - // m_log.DebugFormat("{0} SetLandBitmap. BitmapSize=<{1},{2}>", LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); -======= ->>>>>>> avn/ubitvar ForceUpdateLandInfo(); } @@ -1024,16 +950,11 @@ namespace OpenSim.Region.CoreModules.World.Land private byte[] ConvertLandBitmapToBytes() { byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8]; -<<<<<<< HEAD - byte tempByte = 0; - int byteNum = 0; - int i = 0; -======= + int tempByte = 0; int i, byteNum = 0; int mask = 1; i = 0; ->>>>>>> avn/ubitvar for (int y = 0; y < LandBitmap.GetLength(1); y++) { for (int x = 0; x < LandBitmap.GetLength(0); x++) @@ -1070,7 +991,6 @@ namespace OpenSim.Region.CoreModules.World.Land // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); ======= */ ->>>>>>> avn/ubitvar return tempConvertArr; } diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index a228e7ae57..515580417e 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs @@ -104,7 +104,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap terrainRenderer.Initialise(m_scene, m_config); -<<<<<<< HEAD mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); //long t = System.Environment.TickCount; @@ -113,17 +112,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap //} //t = System.Environment.TickCount - t; //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); -======= - mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, - System.Drawing.Imaging.PixelFormat.Format24bppRgb); - //long t = System.Environment.TickCount; - //for (int i = 0; i < 10; ++i) { - terrainRenderer.TerrainToBitmap(mapbmp); - //} - //t = System.Environment.TickCount - t; - //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); ->>>>>>> avn/ubitvar - if (drawPrimVolume) { DrawObjectVolume(m_scene, mapbmp); diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs index a9cc993f0d..0ec205363d 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs @@ -270,14 +270,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap // the heigthfield might have some jumps in values. Rendered land is smooth, though, // as a slope is rendered at that place. So average 4 neighbour values to emulate that. -<<<<<<< HEAD private float getHeight(ITerrainChannel hm, int x, int y) { if (x < (hm.Width - 1) && y < (hm.Height - 1)) -======= - private float getHeight(ITerrainChannel hm, int x, int y) - { - if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) ->>>>>>> avn/ubitvar return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); else return (float)hm[x, y]; @@ -291,14 +285,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap ITerrainChannel hm = m_scene.Heightmap; - if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height) - { - m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>", - LogHeader, mapbmp.Width, mapbmp.Height, hm.Width, hm.Height); - } - - ITerrainChannel hm = m_scene.Heightmap; - if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height) { m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>", diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs index 236584a4be..d634e8b414 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs @@ -46,10 +46,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes if (fillArea[x, y]) { double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0); -<<<<<<< HEAD - -======= ->>>>>>> avn/ubitvar map[x, y] += noise * strength; } } diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 925de2a278..22723fc25b 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -75,15 +75,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain #endregion private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); -<<<<<<< HEAD -======= - -#pragma warning disable 414 - private static readonly string LogHeader = "[TERRAIN MODULE]"; -#pragma warning restore 414 - - private readonly Commander m_commander = new Commander("terrain"); ->>>>>>> avn/ubitvar #pragma warning disable 414 private static readonly string LogHeader = "[TERRAIN MODULE]"; @@ -95,16 +86,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain private readonly Dictionary m_loaders = new Dictionary(); private readonly Dictionary m_painteffects = new Dictionary(); -<<<<<<< HEAD - private Dictionary m_plugineffects; - private Dictionary m_modifyOperations = - new Dictionary(); - private ITerrainChannel m_channel; - private ITerrainChannel m_revert; - private Scene m_scene; - private volatile bool m_tainted; - private readonly Stack m_undo = new Stack(5); -======= private Dictionary m_plugineffects; private ITerrainChannel m_channel; @@ -112,7 +93,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain private Scene m_scene; private volatile bool m_tainted; ->>>>>>> avn/ubitvar private String m_InitialTerrain = "pinhead-island"; // If true, send terrain patch updates to clients based on their view distance @@ -126,19 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain private bool[,] updated; // for each patch, whether it needs to be sent to this client private int updateCount; // number of patches that need to be sent public ScenePresence Presence; // a reference to the client to send to -<<<<<<< HEAD - public TerrainData Terrain; // reference to the underlying terrain -======= ->>>>>>> avn/ubitvar + public PatchUpdates(TerrainData terrData, ScenePresence pPresence) { updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize]; updateCount = 0; Presence = pPresence; -<<<<<<< HEAD - Terrain = terrData; -======= ->>>>>>> avn/ubitvar // Initially, send all patches to the client SetAll(true); } @@ -147,26 +120,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain { return (updateCount > 0); } -<<<<<<< HEAD -======= ->>>>>>> avn/ubitvar public void SetByXY(int x, int y, bool state) { this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state); } -<<<<<<< HEAD -======= ->>>>>>> avn/ubitvar public bool GetByPatch(int patchX, int patchY) { return updated[patchX, patchY]; } -<<<<<<< HEAD -======= ->>>>>>> avn/ubitvar public void SetByPatch(int patchX, int patchY, bool state) { bool prevState = updated[patchX, patchY]; @@ -176,24 +140,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain updateCount--; updated[patchX, patchY] = state; } -<<<<<<< HEAD - public void SetAll(bool state) - { - updateCount = 0; - for(int xx = 0; xx < updated.GetLength(0); xx++) - for(int yy = 0; yy < updated.GetLength(1); yy++) -======= public void SetAll(bool state) { updateCount = 0; for (int xx = 0; xx < updated.GetLength(0); xx++) for (int yy = 0; yy < updated.GetLength(1); yy++) ->>>>>>> avn/ubitvar updated[xx, yy] = state; if (state) updateCount = updated.GetLength(0) * updated.GetLength(1); } + // Logically OR's the terrain data's patch taint map into this client's update map. public void SetAll(TerrainData terrData) { @@ -206,15 +163,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize) ); } -<<<<<<< HEAD - for(int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) - { - for(int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) -======= + for (int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) { for (int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) ->>>>>>> avn/ubitvar { // Only set tainted. The patch bit may be set if the patch was to be sent later. if (terrData.IsTaintedAt(xx, yy, false)) @@ -275,20 +227,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain (int)m_scene.RegionInfo.RegionSizeY, (int)m_scene.RegionInfo.RegionSizeZ); m_scene.Heightmap = m_channel; -<<<<<<< HEAD - UpdateRevertMap(); -======= + UpdateBakedMap(); ->>>>>>> avn/ubitvar } else { m_channel = m_scene.Heightmap; -<<<<<<< HEAD - UpdateRevertMap(); -======= UpdateBakedMap(); ->>>>>>> avn/ubitvar } m_scene.RegisterModuleInterface(this); @@ -296,11 +241,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed; m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick; -<<<<<<< HEAD - m_scene.EventManager.OnFrame += EventManager_OnFrame; -======= m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates; ->>>>>>> avn/ubitvar } InstallDefaultEffects(); @@ -339,11 +280,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain // remove the commands m_scene.UnregisterModuleCommander(m_commander.Name); // remove the event-handlers -<<<<<<< HEAD - m_scene.EventManager.OnFrame -= EventManager_OnFrame; -======= + m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates; ->>>>>>> avn/ubitvar m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick; m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; @@ -490,11 +428,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain { ITerrainChannel channel = loader.Value.LoadStream(stream); m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement); -<<<<<<< HEAD - UpdateRevertMap(); -======= UpdateBakedMap(); ->>>>>>> avn/ubitvar } catch(NotImplementedException) { @@ -574,27 +508,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients. // ITerrainModule.TaintTerrain() -<<<<<<< HEAD - public void TaintTerrain() - { - lock(m_perClientPatchUpdates) - { - // Set the flags for all clients so the tainted patches will be sent out - foreach(PatchUpdates pups in m_perClientPatchUpdates.Values) -======= public void TaintTerrain () { lock (m_perClientPatchUpdates) { // Set the flags for all clients so the tainted patches will be sent out foreach (PatchUpdates pups in m_perClientPatchUpdates.Values) ->>>>>>> avn/ubitvar { pups.SetAll(m_scene.Heightmap.GetTerrainData()); } } -<<<<<<< HEAD -======= } // ITerrainModule.PushTerrain() @@ -615,38 +538,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain pups.SetAll(true); } } ->>>>>>> avn/ubitvar } - // ITerrainModule.PushTerrain() - public void PushTerrain(IClientAPI pClient) - { - // If view distance based, set the modified patch bits and the frame event will send the updates - if (m_sendTerrainUpdatesByViewDistance) - { - ScenePresence presence = m_scene.GetScenePresence(pClient.AgentId); - if (presence != null) - { - lock(m_perClientPatchUpdates) - { - PatchUpdates pups; - if (!m_perClientPatchUpdates.TryGetValue(pClient.AgentId, out pups)) - { - // There is a ScenePresence without a send patch map. Create one. - pups = new PatchUpdates(m_scene.Heightmap.GetTerrainData(), presence); - m_perClientPatchUpdates.Add(presence.UUID, pups); - } - // By setting all to modified, the next update tick will send the patches - pups.SetAll(true); - } - } - } - else - { - // The traditional way is to call into the protocol stack to send them all. - pClient.SendLayerData(new float[10]); - } - } #region Plugin Loading Methods private void LoadPlugins() @@ -750,6 +643,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); // Terrain Modifier operations +/* m_modifyOperations["min"] = new MinModifier(this); m_modifyOperations["max"] = new MaxModifier(this); m_modifyOperations["raise"] = new RaiseModifier(this); @@ -757,7 +651,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_modifyOperations["fill"] = new FillModifier(this); m_modifyOperations["smooth"] = new SmoothModifier(this); m_modifyOperations["noise"] = new NoiseModifier(this); - +*/ // Filesystem load/save loaders m_loaders[".r32"] = new RAW32(); m_loaders[".f32"] = m_loaders[".r32"]; @@ -778,24 +672,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain /// public void UpdateBakedMap() { -<<<<<<< HEAD - /* - int x; - for (x = 0; x < m_channel.Width; x++) - { - int y; - for (y = 0; y < m_channel.Height; y++) - { - m_revert[x, y] = m_channel[x, y]; - } - } - */ - m_revert = m_channel.MakeCopy(); -======= m_baked = m_channel.MakeCopy(); m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked); m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); ->>>>>>> avn/ubitvar } /// @@ -822,13 +701,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain { ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY, fileWidth, fileHeight, -<<<<<<< HEAD - (int)m_scene.RegionInfo.RegionSizeX, - (int)m_scene.RegionInfo.RegionSizeY); -======= (int) m_scene.RegionInfo.RegionSizeX, (int) m_scene.RegionInfo.RegionSizeY); ->>>>>>> avn/ubitvar m_scene.Heightmap = channel; m_channel = channel; UpdateBakedMap(); @@ -894,27 +768,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain } /// -<<<<<<< HEAD - /// Called before processing of every simulation frame. -======= ->>>>>>> avn/ubitvar /// This is used to check to see of any of the terrain is tainted and, if so, schedule /// updates for all the presences. /// This also checks to see if there are updates that need to be sent for each presence. /// This is where the logic is to send terrain updates to clients. /// -<<<<<<< HEAD - private void EventManager_OnFrame() - { - TerrainData terrData = m_channel.GetTerrainData(); - - bool shouldTaint = false; - for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) - { - for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) - { - if (terrData.IsTaintedAt(x, y)) -======= private void EventManager_TerrainCheckUpdates() { // this needs fixing @@ -926,7 +784,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) { if (terrData.IsTaintedAt(x, y,true)) ->>>>>>> avn/ubitvar { // Found a patch that was modified. Push this flag into the clients. SendToClients(terrData, x, y); @@ -944,10 +801,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_scene.EventManager.TriggerTerrainTainted(); m_tainted = true; } -<<<<<<< HEAD -======= - ->>>>>>> avn/ubitvar } /// @@ -1016,14 +869,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain presence.ControllingClient.OnLandUndo -= client_OnLandUndo; presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain; } -<<<<<<< HEAD - - lock(m_perClientPatchUpdates) - m_perClientPatchUpdates.Remove(client); - } -======= ->>>>>>> avn/ubitvar - lock (m_perClientPatchUpdates) m_perClientPatchUpdates.Remove(client); } @@ -1038,21 +883,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain TerrainData terrData = m_channel.GetTerrainData(); bool wasLimited = false; -<<<<<<< HEAD - for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) - { - for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) - { - if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) - { -======= for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) { for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) { if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) { ->>>>>>> avn/ubitvar // 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. @@ -1075,22 +911,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; // loop through the height map for this patch and compare it against -<<<<<<< HEAD - // the revert map - for(int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) -======= // the baked map for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) ->>>>>>> avn/ubitvar { for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++) { float requestedHeight = terrData[x, y]; -<<<<<<< HEAD - float bakedHeight = (float)m_revert[x, y]; -======= float bakedHeight = (float)m_baked[x, y]; ->>>>>>> avn/ubitvar float requestedDelta = requestedHeight - bakedHeight; if (requestedDelta > maxDelta) @@ -1111,19 +938,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain private void client_OnLandUndo(IClientAPI client) { -<<<<<<< HEAD - lock(m_undo) - { - if (m_undo.Count > 0) - { - LandUndoState goback = m_undo.Pop(); - if (goback != null) - goback.PlaybackState(); - } - } -======= - ->>>>>>> avn/ubitvar } /// @@ -1133,175 +947,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain /// The patch corner to send /// The patch corner to send private void SendToClients(TerrainData terrData, int x, int y) -<<<<<<< HEAD - { - if (m_sendTerrainUpdatesByViewDistance) - { - // Add that this patch needs to be sent to the accounting for each client. - lock(m_perClientPatchUpdates) - { - m_scene.ForEachScenePresence(presence => - { - PatchUpdates thisClientUpdates; - if (!m_perClientPatchUpdates.TryGetValue(presence.UUID, out thisClientUpdates)) - { - // There is a ScenePresence without a send patch map. Create one. - thisClientUpdates = new PatchUpdates(terrData, presence); - m_perClientPatchUpdates.Add(presence.UUID, thisClientUpdates); - } - thisClientUpdates.SetByXY(x, y, true); - } - ); - } - } - else - { - // Legacy update sending where the update is sent out as soon as noticed - // We know the actual terrain data that is passed is ignored so this passes a dummy heightmap. - //float[] heightMap = terrData.GetFloatsSerialized(); - float[] heightMap = new float[10]; - m_scene.ForEachClient( - delegate(IClientAPI controller) - { - controller.SendLayerData(x / Constants.TerrainPatchSize, - y / Constants.TerrainPatchSize, - heightMap); - } - ); - } - } - - private class PatchesToSend : IComparable - { - public int PatchX; - public int PatchY; - public float Dist; - - public PatchesToSend(int pX, int pY, float pDist) - { - PatchX = pX; - PatchY = pY; - Dist = pDist; - } - - public int CompareTo(PatchesToSend other) - { - return Dist.CompareTo(other.Dist); - } - } - - // Called each frame time to see if there are any patches to send to any of the - // ScenePresences. - // We know this is only called if we are doing view distance patch sending so some - // tests are not made. - // Loop through all the per-client info and send any patches necessary. - private void CheckSendingPatchesToClients() - { - lock(m_perClientPatchUpdates) - { - foreach(PatchUpdates pups in m_perClientPatchUpdates.Values) - { - if (pups.HasUpdates()) - { - // There is something that could be sent to this client. - List toSend = GetModifiedPatchesInViewDistance(pups); - if (toSend.Count > 0) - { - // m_log.DebugFormat("{0} CheckSendingPatchesToClient: sending {1} patches to {2} in region {3}", - // LogHeader, toSend.Count, pups.Presence.Name, m_scene.RegionInfo.RegionName); - // Sort the patches to send by the distance from the presence - toSend.Sort(); - /* old way that sent individual patches - foreach (PatchesToSend pts in toSend) - { - pups.Presence.ControllingClient.SendLayerData(pts.PatchX, pts.PatchY, null); - // presence.ControllingClient.SendLayerData(xs.ToArray(), ys.ToArray(), null, TerrainPatch.LayerType.Land); - } - */ - - // new way that sends all patches to the protocol so they can be sent in one block - int[] xPieces = new int[toSend.Count]; - int[] yPieces = new int[toSend.Count]; - float[] patchPieces = new float[toSend.Count * 2]; - int pieceIndex = 0; - foreach(PatchesToSend pts in toSend) - { - patchPieces[pieceIndex++] = pts.PatchX; - patchPieces[pieceIndex++] = pts.PatchY; - } - pups.Presence.ControllingClient.SendLayerData(-toSend.Count, 0, patchPieces); - } - } - } - } - } - - // Compute a list of modified patches that are within our view distance. - private List GetModifiedPatchesInViewDistance(PatchUpdates pups) - { - List ret = new List(); - - ScenePresence presence = pups.Presence; - if (presence == null) - return ret; - - Vector3 presencePos = presence.AbsolutePosition; - - // Before this distance check, the whole region just showed up. Adding the distance - // check causes different things to happen for the current and adjacent regions. - // So, to keep legacy views, if the region is legacy sized, don't do distance check. - bool isLegacySizedRegion = pups.Terrain.SizeX == Constants.RegionSize && pups.Terrain.SizeY == Constants.RegionSize; - bool shouldCheckViewDistance = m_sendTerrainUpdatesByViewDistance && !isLegacySizedRegion; - - int startX = 0; - int endX = (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize; - int startY = 0; - int endY = (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize; - - // The following only reduces the size of area scanned for updates. Only significant for very large varregions. - if (shouldCheckViewDistance) - { - // Compute the area of patches within our draw distance - startX = (((int)(presencePos.X - presence.DrawDistance)) / Constants.TerrainPatchSize) - 2; - startX = Math.Max(startX, 0); - startX = Math.Min(startX, (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize); - startY = (((int)(presencePos.Y - presence.DrawDistance)) / Constants.TerrainPatchSize) - 2; - startY = Math.Max(startY, 0); - startY = Math.Min(startY, (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize); - endX = (((int)(presencePos.X + presence.DrawDistance)) / Constants.TerrainPatchSize) + 2; - endX = Math.Max(endX, 0); - endX = Math.Min(endX, (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize); - endY = (((int)(presencePos.Y + presence.DrawDistance)) / Constants.TerrainPatchSize) + 2; - endY = Math.Max(endY, 0); - endY = Math.Min(endY, (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize); - } - - // m_log.DebugFormat("{0} GetModifiedPatchesInViewDistance. rName={1}, ddist={2}, apos={3}, cpos={4}, isChild={5}, start=<{6},{7}>, end=<{8},{9}>", - // LogHeader, m_scene.RegionInfo.RegionName, - // presence.DrawDistance, presencePos, presence.CameraPosition, - // isLegacySizeChildRegion, - // startX, startY, endX, endY); - for(int x = startX; x < endX; x++) - { - for(int y = startY; y < endY; y++) - { - //Need to make sure we don't send the same ones over and over - Vector3 patchPos = new Vector3(x * Constants.TerrainPatchSize, y * Constants.TerrainPatchSize, presencePos.Z); - if (pups.GetByPatch(x, y)) - { - //Check which has less distance, camera or avatar position, both have to be done. - //Its not a radius, its a diameter and we add 50 so that it doesn't look like it cuts off - if (!shouldCheckViewDistance - || Util.DistanceLessThan(presencePos, patchPos, presence.DrawDistance + 50) - || Util.DistanceLessThan(presence.CameraPosition, patchPos, presence.DrawDistance + 50)) - { - //They can see it, send it to them - pups.SetByPatch(x, y, false); - float dist = Vector3.DistanceSquared(presencePos, patchPos); - ret.Add(new PatchesToSend(x, y, dist)); - } - } -======= { // Add that this patch needs to be sent to the accounting for each client. lock (m_perClientPatchUpdates) @@ -1475,7 +1120,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain } } } ->>>>>>> avn/ubitvar } } return ret; @@ -1499,24 +1143,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain int zx = (int)(west + 0.5); int zy = (int)(north + 0.5); -<<<<<<< HEAD - int dx; - for(dx=-n; dx<=n; dx++) - { - int dy; - for(dy=-n; dy<=n; dy++) - { - int x = zx + dx; - int y = zy + dy; - if (x >= 0 && y >= 0 && x < m_channel.Width && y < m_channel.Height) - { - if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0))) - { - allowMask[x, y] = true; - allowed = true; - } -======= - int startX = zx - n; if (startX < 0) startX = 0; @@ -1542,25 +1168,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain { allowMask[x, y] = true; allowed = true; ->>>>>>> avn/ubitvar } } } if (allowed) { StoreUndoState(); -<<<<<<< HEAD - m_painteffects[(StandardTerrainEffects)action].PaintEffect( - m_channel, allowMask, west, south, height, size, seconds); - - //revert changes outside estate limits -======= m_painteffects[(StandardTerrainEffects) action].PaintEffect( m_channel, allowMask, west, south, height, size, seconds, startX, endX, startY, endY); //block changes outside estate limits ->>>>>>> avn/ubitvar if (!god) EnforceEstateLimits(); } @@ -1577,22 +1195,42 @@ namespace OpenSim.Region.CoreModules.World.Terrain bool[,] fillArea = new bool[m_channel.Width, m_channel.Height]; fillArea.Initialize(); - int x; - for(x = 0; x < m_channel.Width; x++) + int startX = (int)west; + int startY = (int)south; + int endX = (int)east; + int endY = (int)north; + + if (startX < 0) + startX = 0; + else if (startX >= m_channel.Width) + startX = m_channel.Width - 1; + + if (endX < 0) + endX = 0; + else if (endX >= m_channel.Width) + endX = m_channel.Width - 1; + + if (startY < 0) + startY = 0; + else if (startY >= m_channel.Height) + startY = m_channel.Height - 1; + + if (endY < 0) + endY = 0; + else if (endY >= m_channel.Height) + endY = m_channel.Height - 1; + + + int x, y; + + for (x = startX; x <= endX; x++) { - int y; - for(y = 0; y < m_channel.Height; y++) + for (y = startY; y <= endY; y++) { - if (x < east && x > west) + if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0))) { - if (y < north && y > south) - { - if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0))) - { - fillArea[x, y] = true; - allowed = true; - } - } + fillArea[x, y] = true; + allowed = true; } } } @@ -1600,15 +1238,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain if (allowed) { StoreUndoState(); -<<<<<<< HEAD - m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size); - - //revert changes outside estate limits -======= - m_floodeffects[(StandardTerrainEffects) action].FloodEffect(m_channel, fillArea, size); + m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size, + startX, endX, startY, endY); //block changes outside estate limits ->>>>>>> avn/ubitvar if (!god) EnforceEstateLimits(); } @@ -1641,52 +1274,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain private void StoreUndoState() { -<<<<<<< HEAD - lock(m_undo) - { - if (m_undo.Count > 0) - { - LandUndoState last = m_undo.Peek(); - if (last != null) - { - if (last.Compare(m_channel)) - return; - } - } - - LandUndoState nUndo = new LandUndoState(this, m_channel); - m_undo.Push(nUndo); - } -======= ->>>>>>> avn/ubitvar } #region Console Commands private void InterfaceLoadFile(Object[] args) { -<<<<<<< HEAD - LoadFromFile((string)args[0]); -======= LoadFromFile((string) args[0]); ->>>>>>> avn/ubitvar } private void InterfaceLoadTileFile(Object[] args) { -<<<<<<< HEAD - LoadFromFile((string)args[0], - (int)args[1], - (int)args[2], - (int)args[3], - (int)args[4]); -======= LoadFromFile((string) args[0], (int) args[1], (int) args[2], (int) args[3], (int) args[4]); ->>>>>>> avn/ubitvar } private void InterfaceSaveFile(Object[] args) @@ -1711,15 +1314,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain private void InterfaceRevertTerrain(Object[] args) { int x, y; -<<<<<<< HEAD - for(x = 0; x < m_channel.Width; x++) - for(y = 0; y < m_channel.Height; y++) - m_channel[x, y] = m_revert[x, y]; -======= for (x = 0; x < m_channel.Width; x++) for (y = 0; y < m_channel.Height; y++) m_channel[x, y] = m_baked[x, y]; ->>>>>>> avn/ubitvar } @@ -1729,15 +1326,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain if (direction.ToLower().StartsWith("y")) { -<<<<<<< HEAD - for(int x = 0; x < m_channel.Width; x++) - { - for(int y = 0; y < m_channel.Height / 2; y++) -======= for (int x = 0; x < m_channel.Width; x++) { for (int y = 0; y < m_channel.Height / 2; y++) ->>>>>>> avn/ubitvar { double height = m_channel[x, y]; double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y]; @@ -1749,15 +1340,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain } else if (direction.ToLower().StartsWith("x")) { -<<<<<<< HEAD - for(int y = 0; y < m_channel.Height; y++) - { - for(int x = 0; x < m_channel.Width / 2; x++) -======= for (int y = 0; y < m_channel.Height; y++) { for (int x = 0; x < m_channel.Width / 2; x++) ->>>>>>> avn/ubitvar { double height = m_channel[x, y]; double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y]; @@ -1837,47 +1422,29 @@ namespace OpenSim.Region.CoreModules.World.Terrain double val = (double)args[0]; int x, y; -<<<<<<< HEAD - for(x = 0; x < m_channel.Width; x++) - for(y = 0; y < m_channel.Height; y++) - m_channel[x, y] += (double)args[0]; -======= for (x = 0; x < m_channel.Width; x++) for (y = 0; y < m_channel.Height; y++) m_channel[x, y] += val; ->>>>>>> avn/ubitvar } private void InterfaceMultiplyTerrain(Object[] args) { int x, y; -<<<<<<< HEAD - for(x = 0; x < m_channel.Width; x++) - for(y = 0; y < m_channel.Height; y++) - m_channel[x, y] *= (double)args[0]; -======= double val = (double)args[0]; for (x = 0; x < m_channel.Width; x++) for (y = 0; y < m_channel.Height; y++) m_channel[x, y] *= val; ->>>>>>> avn/ubitvar } private void InterfaceLowerTerrain(Object[] args) { int x, y; -<<<<<<< HEAD - for(x = 0; x < m_channel.Width; x++) - for(y = 0; y < m_channel.Height; y++) - m_channel[x, y] -= (double)args[0]; -======= double val = (double)args[0]; for (x = 0; x < m_channel.Width; x++) for (y = 0; y < m_channel.Height; y++) m_channel[x, y] -= val; ->>>>>>> avn/ubitvar } public void InterfaceFillTerrain(Object[] args) @@ -1885,26 +1452,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain int x, y; double val = (double)args[0]; -<<<<<<< HEAD - for(x = 0; x < m_channel.Width; x++) - for(y = 0; y < m_channel.Height; y++) - m_channel[x, y] = (double)args[0]; -======= for (x = 0; x < m_channel.Width; x++) for (y = 0; y < m_channel.Height; y++) m_channel[x, y] = val; ->>>>>>> avn/ubitvar } private void InterfaceMinTerrain(Object[] args) { int x, y; -<<<<<<< HEAD - for(x = 0; x < m_channel.Width; x++) -======= double val = (double)args[0]; for (x = 0; x < m_channel.Width; x++) ->>>>>>> avn/ubitvar { for(y = 0; y < m_channel.Height; y++) { @@ -1916,19 +1473,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain private void InterfaceMaxTerrain(Object[] args) { int x, y; -<<<<<<< HEAD - for(x = 0; x < m_channel.Width; x++) -======= double val = (double)args[0]; for (x = 0; x < m_channel.Width; x++) ->>>>>>> avn/ubitvar { for(y = 0; y < m_channel.Height; y++) { m_channel[x, y] = Math.Min(val, m_channel[x, y]); } } -<<<<<<< HEAD } private void InterfaceShow(Object[] args) @@ -1944,8 +1496,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain double height = m_channel[(int)point.X, (int)point.Y]; Console.WriteLine("Terrain height at {0} is {1}", point, height); -======= ->>>>>>> avn/ubitvar } private void InterfaceShowDebugStats(Object[] args) @@ -2157,6 +1707,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain public void ModifyCommand(string module, string[] cmd) { + /* string result; Scene scene = SceneManager.Instance.CurrentScene; if ((scene != null) && (scene != m_scene)) @@ -2196,6 +1747,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain { MainConsole.Instance.Output(result); } + */ } #endregion diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs index 40db370970..b209b338aa 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs @@ -60,12 +60,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); ITerrainPaintableEffect effect = new RaiseSphere(); -<<<<<<< HEAD - effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); -======= effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, 0, midRegion - 1,0, (int)Constants.RegionSize -1); ->>>>>>> avn/ubitvar Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128)."); Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128)."); Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128)."); @@ -84,12 +80,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests } effect = new LowerSphere(); -<<<<<<< HEAD - effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); -======= effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, 0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1); ->>>>>>> avn/ubitvar Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128)."); diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs index 77c10b814c..4719ba3714 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs @@ -79,13 +79,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap /// Based on the algorithm described at http://opensimulator.org/wiki/Terrain_Splatting /// Note we create a 256x256 dimension texture even if the actual terrain is larger. /// -<<<<<<< HEAD + public static Bitmap Splat(ITerrainChannel terrain, UUID[] textureIDs, float[] startHeights, float[] heightRanges, Vector3d regionPosition, IAssetService assetService, bool textureTerrain) -======= - public static Bitmap Splat(ITerrainChannel terrain, UUID[] textureIDs, float[] startHeights, float[] heightRanges, Vector3d regionPosition, IAssetService assetService, bool textureTerrain) ->>>>>>> avn/ubitvar { Debug.Assert(textureIDs.Length == 4); Debug.Assert(startHeights.Length == 4); @@ -133,8 +130,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap asset = assetService.Get(textureIDs[i].ToString()); if (asset != null) { -// m_log.DebugFormat( -// "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID); + // m_log.DebugFormat( + // "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID); try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); } catch (Exception ex) @@ -144,7 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap } if (detailTexture[i] != null) - { + { // Make sure this texture is the correct size, otherwise resize if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) { @@ -199,74 +196,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i])) gfx.FillRectangle(brush, 0, 0, 256, 256); } - else - { - if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) - { - detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256); - } - } } -<<<<<<< HEAD else -======= - - #region Layer Map - - float[,] layermap = new float[256 , 256]; - - int xFactor = terrain.Width / 256; - int yFactor = terrain.Height / 256; - - for (int y = 0; y < 256; y++) ->>>>>>> avn/ubitvar { if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) { -<<<<<<< HEAD detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256); -======= - float height = (float)terrain[x * xFactor, y * yFactor]; - - float pctX = (float)x / 255f; - float pctY = (float)y / 255f; - - // Use bilinear interpolation between the four corners of start height and - // height range to select the current values at this position - float startHeight = ImageUtils.Bilinear( - startHeights[0], - startHeights[2], - startHeights[1], - startHeights[3], - pctX, pctY); - startHeight = Utils.Clamp(startHeight, 0f, 255f); - - float heightRange = ImageUtils.Bilinear( - heightRanges[0], - heightRanges[2], - heightRanges[1], - heightRanges[3], - pctX, pctY); - heightRange = Utils.Clamp(heightRange, 0f, 255f); - - // Generate two frequencies of perlin noise based on our global position - // The magic values were taken from http://opensimulator.org/wiki/Terrain_Splatting - Vector3 vec = new Vector3 - ( - ((float)regionPosition.X + (x * xFactor)) * 0.20319f, - ((float)regionPosition.Y + (y * yFactor)) * 0.20319f, - height * 0.25f - ); - - float lowFreq = Perlin.noise2(vec.X * 0.222222f, vec.Y * 0.222222f) * 6.5f; - float highFreq = Perlin.turbulence2(vec.X, vec.Y, 2f) * 2.25f; - float noise = (lowFreq + highFreq) * 2f; - - // Combine the current height, generated noise, start height, and height range parameters, then scale all of it - float layer = ((height + noise - startHeight) / heightRange) * 4f; - if (Single.IsNaN(layer)) layer = 0f; - layermap[x,y] = Utils.Clamp(layer, 0f, 3f); ->>>>>>> avn/ubitvar } } } @@ -286,7 +221,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap { for (int x = 0; x < 256; x++) { -<<<<<<< HEAD float height = (float)terrain[x * xFactor, y * yFactor]; float pctX = (float)x / 255f; @@ -328,58 +262,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap if (Single.IsNaN(layer)) layer = 0f; layermap[x, y] = Utils.Clamp(layer, 0f, 3f); -======= - // Get handles to all of the texture data arrays - BitmapData[] datas = new BitmapData[] - { - detailTexture[0].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[0].PixelFormat), - detailTexture[1].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[1].PixelFormat), - detailTexture[2].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[2].PixelFormat), - detailTexture[3].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[3].PixelFormat) - }; - - int[] comps = new int[] - { - (datas[0].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3, - (datas[1].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3, - (datas[2].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3, - (datas[3].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3 - }; - - for (int y = 0; y < 256; y++) - { - for (int x = 0; x < 256; x++) - { - float layer = layermap[x, y]; - - // Select two textures - int l0 = (int)Math.Floor(layer); - int l1 = Math.Min(l0 + 1, 3); - - byte* ptrA = (byte*)datas[l0].Scan0 + y * datas[l0].Stride + x * comps[l0]; - byte* ptrB = (byte*)datas[l1].Scan0 + y * datas[l1].Stride + x * comps[l1]; - byte* ptrO = (byte*)outputData.Scan0 + y * outputData.Stride + x * 3; - - float aB = *(ptrA + 0); - float aG = *(ptrA + 1); - float aR = *(ptrA + 2); - - float bB = *(ptrB + 0); - float bG = *(ptrB + 1); - float bR = *(ptrB + 2); - - float layerDiff = layer - l0; - - // Interpolate between the two selected textures - *(ptrO + 0) = (byte)Math.Floor(aB + layerDiff * (bB - aB)); - *(ptrO + 1) = (byte)Math.Floor(aG + layerDiff * (bG - aG)); - *(ptrO + 2) = (byte)Math.Floor(aR + layerDiff * (bR - aR)); - } - } - - for (int i = 0; i < 4; i++) - detailTexture[i].UnlockBits(datas[i]); ->>>>>>> avn/ubitvar } } @@ -471,10 +353,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap b.Dispose(); return result; } -<<<<<<< HEAD - -======= ->>>>>>> avn/ubitvar public static Bitmap SplatSimple(float[] heightmap) { const float BASE_HSV_H = 93f / 360f; diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index d8420d961f..8e843eedcf 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -156,13 +156,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap public Bitmap CreateMapTile() { -<<<<<<< HEAD - // Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); - // Camera above the middle of the region - Vector3 camPos = new Vector3( - m_scene.RegionInfo.RegionSizeX/2 - 0.5f, - m_scene.RegionInfo.RegionSizeY/2 - 0.5f, -======= /* this must be on all map, not just its image if ((DateTime.Now - lastImageTime).TotalSeconds < 3600) { @@ -179,16 +172,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap Vector3 camPos = new Vector3( m_scene.RegionInfo.RegionSizeX / 2 - 0.5f, m_scene.RegionInfo.RegionSizeY / 2 - 0.5f, ->>>>>>> avn/ubitvar 221.7025033688163f); // Viewport viewing down onto the region Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY, -<<<<<<< HEAD - (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY ); - // Fill the viewport and return the image - return CreateMapTile(viewport, false); -======= (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY); Bitmap tile = CreateMapTile(viewport, false); @@ -199,7 +186,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap lastImageTime = DateTime.Now; return (Bitmap)lastImage.Clone(); */ ->>>>>>> avn/ubitvar } public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) @@ -315,15 +301,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f); -<<<<<<< HEAD - renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX/2 - 0.5f, - waterHeight, - m_scene.RegionInfo.RegionSizeY/2 - 0.5f ); -======= renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX / 2 - 0.5f, waterHeight, m_scene.RegionInfo.RegionSizeY / 2 - 0.5f); ->>>>>>> avn/ubitvar warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR)); waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif @@ -352,11 +332,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap warp_Vector pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]); obj.addVertex(new warp_Vertex(pos, x / (float)m_scene.RegionInfo.RegionSizeX, -<<<<<<< HEAD - (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY) ); -======= (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY)); ->>>>>>> avn/ubitvar } } @@ -424,12 +400,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap warp_Texture texture; using ( Bitmap image -<<<<<<< HEAD - = TerrainSplat.Splat(terrain, textureIDs, startHeights, heightRanges, -======= = TerrainSplat.Splat( terrain, textureIDs, startHeights, heightRanges, ->>>>>>> avn/ubitvar new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain)) { texture = new warp_Texture(image); @@ -711,12 +683,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap return new warp_Vector(x, z, y); } - // Note: axis change. - private static warp_Vector ConvertVector(float x, float y, float z) - { - return new warp_Vector(x, z, y); - } - private static warp_Vector ConvertVector(Vector3 vector) { return new warp_Vector(vector.X, vector.Z, vector.Y); diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 553d0570bb..e08bdc0581 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -141,12 +141,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) { -<<<<<<< HEAD - List blocks = new List(); - if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) -======= Util.FireAndForget(x => ->>>>>>> avn/ubitvar { List blocks = new List(); if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) @@ -232,74 +227,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // they have different values depending on different viewers, apparently remoteClient.SendMapBlock(blocks, flags); -<<<<<<< HEAD - List regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); - - string mapNameOrig = mapName; - if (regionInfos.Count == 0) - { - // Hack to get around the fact that ll V3 now drops the port from the - // map name. See https://jira.secondlife.com/browse/VWR-28570 - // - // Caller, use this magic form instead: - // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 - // or url encode if possible. - // the hacks we do with this viewer... - // - if (mapName.Contains("|")) - mapName = mapName.Replace('|', ':'); - if (mapName.Contains("+")) - mapName = mapName.Replace('+', ' '); - if (mapName.Contains("!")) - mapName = mapName.Replace('!', '/'); - - if (mapName != mapNameOrig) - regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); - } - - m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); - - if (regionInfos.Count > 0) - { - foreach (GridRegion info in regionInfos) - { - if ((flags & 2) == 2) // V2 sends this - { - List datas = WorldMap.Map2BlockFromGridRegion(info, flags); - // ugh! V2-3 is very sensitive about the result being - // exactly the same as the requested name - if (regionInfos.Count == 1 && (mapName != mapNameOrig)) - datas.ForEach(d => d.Name = mapNameOrig); - - blocks.AddRange(datas); - } - else - { - MapBlockData data = WorldMap.MapBlockFromGridRegion(info, flags); - blocks.Add(data); - } - } - } - - // final block, closing the search result - AddFinalBlock(blocks); - - // flags are agent flags sent from the viewer. - // they have different values depending on different viewers, apparently - remoteClient.SendMapBlock(blocks, flags); - - // send extra user messages for V3 - // because the UI is very confusing - // while we don't fix the hard-coded urls - if (flags == 2) - { - if (regionInfos.Count == 0) - remoteClient.SendAlertMessage("No regions found with that name."); - // this seems unnecessary because found regions will show up in the search results - //else if (regionInfos.Count == 1) - // remoteClient.SendAlertMessage("Region found!"); - } -======= // send extra user messages for V3 // because the UI is very confusing // while we don't fix the hard-coded urls @@ -311,7 +238,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // remoteClient.SendAgentAlertMessage("Region found!", false); } }); ->>>>>>> avn/ubitvar } private void AddFinalBlock(List blocks) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 2fbd01788e..b6d96ac9c7 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -68,12 +68,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap private static readonly UUID STOP_UUID = UUID.Random(); private static readonly string m_mapLayerPath = "0001/"; -<<<<<<< HEAD - private IMapImageGenerator m_mapImageGenerator; - private IMapImageUploadModule m_mapImageServiceModule; - - private OpenSim.Framework.BlockingQueue requests = new OpenSim.Framework.BlockingQueue(); -======= private ManualResetEvent queueEvent = new ManualResetEvent(false); private Queue requests = new Queue(); @@ -82,7 +76,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap private IMapImageGenerator m_mapImageGenerator; private IMapImageUploadModule m_mapImageServiceModule; ->>>>>>> avn/ubitvar protected Scene m_scene; private List cachedMapBlocks = new List(); @@ -154,14 +147,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (!m_Enabled) return; -<<<<<<< HEAD - m_ServiceThrottle = scene.RequestModuleInterface(); -======= - m_mapImageGenerator = m_scene.RequestModuleInterface(); - m_mapImageServiceModule = m_scene.RequestModuleInterface(); - } ->>>>>>> avn/ubitvar - m_mapImageGenerator = m_scene.RequestModuleInterface(); m_mapImageServiceModule = m_scene.RequestModuleInterface(); } @@ -275,56 +260,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks. -<<<<<<< HEAD - if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) - { - ScenePresence avatarPresence = null; - - m_scene.TryGetScenePresence(agentID, out avatarPresence); - - if (avatarPresence != null) - { - bool lookup = false; - - lock (cachedMapBlocks) - { - if (cachedMapBlocks.Count > 0 && ((cachedTime + 1800) > Util.UnixTimeSinceEpoch())) - { - List mapBlocks; - - mapBlocks = cachedMapBlocks; - avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); - } - else - { - lookup = true; - } - } - if (lookup) - { - List mapBlocks = new List(); ; - - // Get regions that are within 8 regions of here - List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, - (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 8), - (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 8), - (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 8), - (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 8) ); - foreach (GridRegion r in regions) - { - MapBlockData block = MapBlockFromGridRegion(r, 0); - mapBlocks.Add(block); - } - avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); - - lock (cachedMapBlocks) - cachedMapBlocks = mapBlocks; - - cachedTime = Util.UnixTimeSinceEpoch(); - } - } - } -======= //if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) //{ // ScenePresence avatarPresence = null; @@ -373,7 +308,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // } // } //} ->>>>>>> avn/ubitvar LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); @@ -459,7 +393,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap ThreadPriority.BelowNormal, true, true); - Watchdog.StartThread( + WorkManager.StartThread( MapBlockSendThread, string.Format("MapBlockSendThread ({0})", m_scene.RegionInfo.RegionName), ThreadPriority.BelowNormal, @@ -516,12 +450,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap uint xstart = 0; uint ystart = 0; Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); -<<<<<<< HEAD - if (itemtype == (int)GridItemType.AgentLocations) -======= - if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) ->>>>>>> avn/ubitvar + if (itemtype == (int)GridItemType.AgentLocations) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) { if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) { @@ -531,22 +461,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap mapItemReply mapitem = new mapItemReply(); if (m_scene.GetRootAgentCount() <= 1) { -<<<<<<< HEAD mapitem = new mapItemReply( xstart + 1, ystart + 1, UUID.Zero, Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), 0, 0); -======= - mapitem = new mapItemReply(); - mapitem.x = xstart + 1; - mapitem.y = ystart + 1; - mapitem.id = UUID.Zero; - mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); - mapitem.Extra = 0; - mapitem.Extra2 = 0; ->>>>>>> avn/ubitvar mapitems.Add(mapitem); } else @@ -556,22 +476,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // Don't send a green dot for yourself if (sp.UUID != remoteClient.AgentId) { -<<<<<<< HEAD mapitem = new mapItemReply( xstart + (uint)sp.AbsolutePosition.X, ystart + (uint)sp.AbsolutePosition.Y, UUID.Zero, Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), 1, 0); -======= - mapitem = new mapItemReply(); - mapitem.x = xstart + (uint)sp.AbsolutePosition.X; - mapitem.y = ystart + (uint)sp.AbsolutePosition.Y; - mapitem.id = UUID.Zero; - mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); - mapitem.Extra = 1; - mapitem.Extra2 = 0; ->>>>>>> avn/ubitvar mapitems.Add(mapitem); } }); @@ -615,8 +525,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap Vector3 max = parcel.AABBMax; float x = (min.X+max.X)/2; float y = (min.Y+max.Y)/2; - -<<<<<<< HEAD mapitem = new mapItemReply( xstart + (uint)x, ystart + (uint)y, @@ -625,16 +533,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap parcel.Area, parcel.SalePrice ); -======= - mapitem = new mapItemReply(); - mapitem.x = xstart + (uint)x; - mapitem.y = ystart +(uint)y; - // mapitem.z = (uint)m_scene.GetGroundHeight(x,y); - mapitem.id = parcel.GlobalID; - mapitem.name = parcel.Name; - mapitem.Extra = parcel.Area; - mapitem.Extra2 = parcel.SalePrice; ->>>>>>> avn/ubitvar mapitems.Add(mapitem); } } @@ -659,7 +557,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); if (sog != null) { -<<<<<<< HEAD mapitem = new mapItemReply( xstart + (uint)sog.AbsolutePosition.X, ystart + (uint)sog.AbsolutePosition.Y, @@ -668,15 +565,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap 0, // color (not used) 0 // 0 = telehub / 1 = infohub ); -======= - mapitem = new mapItemReply(); - mapitem.x = xstart + (uint)sog.AbsolutePosition.X; - mapitem.y = ystart + (uint)sog.AbsolutePosition.Y; - mapitem.id = UUID.Zero; - mapitem.name = sog.Name; - mapitem.Extra = 0; // color (not used) - mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub ->>>>>>> avn/ubitvar mapitems.Add(mapitem); remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); @@ -763,126 +651,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { lock (requests) { -<<<<<<< HEAD - if (st.agentID != UUID.Zero) - { - bool dorequest = true; - lock (m_rootAgents) - { - if (!m_rootAgents.Contains(st.agentID)) - dorequest = false; - } - - if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle)) - { - if (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break - { - // AH!!! Recursive ! - // Put this request back in the queue and return - EnqueueMapItemRequest(st); - return; - } - - RequestMapItemsDelegate d = RequestMapItemsAsync; - d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null); - //OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); - //RequestMapItemsCompleted(response); - Interlocked.Increment(ref nAsyncRequests); - } - } - }); - } - - /// - /// Sends the mapitem response to the IClientAPI - /// - /// The OSDMap Response for the mapitem - private void RequestMapItemsCompleted(IAsyncResult iar) - { - AsyncResult result = (AsyncResult)iar; - RequestMapItemsDelegate icon = (RequestMapItemsDelegate)result.AsyncDelegate; - - OSDMap response = (OSDMap)icon.EndInvoke(iar); - - Interlocked.Decrement(ref nAsyncRequests); - - if (!response.ContainsKey("requestID")) - return; - - UUID requestID = response["requestID"].AsUUID(); - - if (requestID != UUID.Zero) - { - MapRequestState mrs = new MapRequestState(); - mrs.agentID = UUID.Zero; - lock (m_openRequests) - { - if (m_openRequests.ContainsKey(requestID)) - { - mrs = m_openRequests[requestID]; - m_openRequests.Remove(requestID); - } - } - - if (mrs.agentID != UUID.Zero) - { - ScenePresence av = null; - m_scene.TryGetScenePresence(mrs.agentID, out av); - if (av != null) - { - if (response.ContainsKey(mrs.itemtype.ToString())) - { - List returnitems = new List(); - OSDArray itemarray = (OSDArray)response[mrs.itemtype.ToString()]; - for (int i = 0; i < itemarray.Count; i++) - { - OSDMap mapitem = (OSDMap)itemarray[i]; - mapItemReply mi = new mapItemReply(); - mi.FromOSD(mapitem); - returnitems.Add(mi); - } - av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags); - } - - // Service 7 (MAP_ITEM_LAND_FOR_SALE) - uint itemtype = (uint)GridItemType.LandForSale; - - if (response.ContainsKey(itemtype.ToString())) - { - List returnitems = new List(); - OSDArray itemarray = (OSDArray)response[itemtype.ToString()]; - for (int i = 0; i < itemarray.Count; i++) - { - OSDMap mapitem = (OSDMap)itemarray[i]; - mapItemReply mi = new mapItemReply(); - mi.FromOSD(mapitem); - returnitems.Add(mi); - } - av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags); - } - - // Service 1 (MAP_ITEM_TELEHUB) - itemtype = (uint)GridItemType.Telehub; - - if (response.ContainsKey(itemtype.ToString())) - { - List returnitems = new List(); - OSDArray itemarray = (OSDArray)response[itemtype.ToString()]; - for (int i = 0; i < itemarray.Count; i++) - { - OSDMap mapitem = (OSDMap)itemarray[i]; - mapItemReply mi = new mapItemReply(); - mi.FromOSD(mapitem); - returnitems.Add(mi); - } - av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags); - } - } - } -======= queueEvent.Set(); requests.Enqueue(state); ->>>>>>> avn/ubitvar + } } @@ -1228,11 +999,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap /// public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) { -<<<<<<< HEAD -======= m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag); /* this flag does not seem to mean what his says ->>>>>>> avn/ubitvar if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible { List response = new List(); @@ -1241,34 +1009,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // on an unloaded square. // But make sure: Look whether the one we requested is in there List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, -<<<<<<< HEAD - (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX), - (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) ); - - m_log.DebugFormat("[WORLD MAP MODULE] RequestMapBlocks min=<{0},{1}>, max=<{2},{3}>, flag={4}, cntFound={5}", - minX, minY, maxX, maxY, flag.ToString("X"), regions.Count); -======= (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX), (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) ); ->>>>>>> avn/ubitvar if (regions != null) { foreach (GridRegion r in regions) { -<<<<<<< HEAD - if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) - && r.RegionLocY == Util.RegionToWorldLoc((uint)minY) ) - { - // found it => add it to response - // Version 2 viewers can handle the larger regions - if ((flag & 2) == 2) - response.AddRange(Map2BlockFromGridRegion(r, flag)); - else - response.Add(MapBlockFromGridRegion(r, flag)); -======= if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) && r.RegionLocY == Util.RegionToWorldLoc((uint)minY)) { @@ -1281,7 +1030,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap MapBlockFromGridRegion(block, r, flag); response.Add(block); } ->>>>>>> avn/ubitvar break; } } @@ -1373,19 +1121,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap List allBlocks = new List(); List mapBlocks = new List(); List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, -<<<<<<< HEAD - (int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)), - (int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) ); - //m_log.DebugFormat("{0} GetAndSendBlocks. min=<{1},{2}>, max=<{3},{4}>, cntFound={5}", - // LogHeader, minX, minY, maxX, maxY, regions.Count); - foreach (GridRegion r in regions) - { - // Version 2 viewers can handle the larger regions - if ((flag & 2) == 2) - mapBlocks.AddRange(Map2BlockFromGridRegion(r, flag)); - else - mapBlocks.Add(MapBlockFromGridRegion(r, flag)); -======= minX * (int)Constants.RegionSize, maxX * (int)Constants.RegionSize, minY * (int)Constants.RegionSize, @@ -1407,7 +1142,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap mapBlocks.Add(block); remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); return allBlocks; ->>>>>>> avn/ubitvar } foreach (GridRegion r in regions) @@ -1438,15 +1172,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap return allBlocks; } -<<<<<<< HEAD - // Fill a passed MapBlockData from a GridRegion - public MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag) -======= public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) ->>>>>>> avn/ubitvar { - MapBlockData block = new MapBlockData(); - block.Access = r.Access; switch (flag & 0xffff) { @@ -1461,14 +1188,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap break; } block.Name = r.RegionName; -<<<<<<< HEAD - block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX); - block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY); - block.SizeX = (ushort) r.RegionSizeX; - block.SizeY = (ushort) r.RegionSizeY; - - return block; -======= block.X = (ushort)(r.RegionLocX / Constants.RegionSize); block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); block.SizeX = (ushort)r.RegionSizeX; @@ -1508,45 +1227,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap blocks.Add(block); } return blocks; ->>>>>>> avn/ubitvar } - public List Map2BlockFromGridRegion(GridRegion r, uint flag) - { - List blocks = new List(); - MapBlockData block = new MapBlockData(); - if (r == null) - { - block.Access = (byte)SimAccess.Down; - block.MapImageId = UUID.Zero; - blocks.Add(block); - } - else - { - block.Access = r.Access; - switch (flag & 0xffff) - { - case 0: - block.MapImageId = r.TerrainImage; - break; - case 2: - block.MapImageId = r.ParcelImage; - break; - default: - block.MapImageId = UUID.Zero; - break; - } - block.Name = r.RegionName; - block.X = (ushort)(r.RegionLocX / Constants.RegionSize); - block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); - block.SizeX = (ushort)r.RegionSizeX; - block.SizeY = (ushort)r.RegionSizeY; - blocks.Add(block); - } - return blocks; - } - - public Hashtable OnHTTPThrottled(Hashtable keysvals) { Hashtable reply = new Hashtable(); @@ -1681,7 +1363,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap foreach (GridRegion r in regions) { - MapBlockData mapBlock = MapBlockFromGridRegion(r, 0); + MapBlockData mapBlock = new MapBlockData(); + MapBlockFromGridRegion(mapBlock, r , 0); AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); if (texAsset != null) @@ -1752,13 +1435,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap uint xstart = 0; uint ystart = 0; -<<<<<<< HEAD - Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); - // m_log.DebugFormat("{0} HandleRemoteMapItemRequest. loc=<{1},{2}>", - // LogHeader, Util.WorldToRegionLoc(xstart), Util.WorldToRegionLoc(ystart)); -======= Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); ->>>>>>> avn/ubitvar // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) @@ -1878,7 +1555,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap return; m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name); -<<<<<<< HEAD using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) { @@ -1894,23 +1570,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { byte[] data; -======= - - using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) - { - // V1 (This Module) - GenerateMaptile(mapbmp); - - // v2/3 (MapImageServiceModule) - m_mapImageServiceModule.UploadMapTile(m_scene, mapbmp); - } - } - - private void GenerateMaptile(Bitmap mapbmp) - { - byte[] data; - ->>>>>>> avn/ubitvar try { data = OpenJPEG.EncodeFromImage(mapbmp, true); @@ -2027,11 +1686,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX; int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY; -<<<<<<< HEAD int landTileSize = LandManagementModule.LandUnit; -======= - int landTileSize = LandManagementModule.landUnit; ->>>>>>> avn/ubitvar int regionLandTilesX = regionSizeX / landTileSize; int regionLandTilesY = regionSizeY / landTileSize; @@ -2054,10 +1709,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { using (SolidBrush transparent = new SolidBrush(background)) g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY); -<<<<<<< HEAD -======= - ->>>>>>> avn/ubitvar foreach (ILandObject land in parcels) { @@ -2080,17 +1731,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) { -<<<<<<< HEAD - for (int x = 0 ; x < regionLandTilesX ; x++) - { - for (int y = 0 ; y < regionLandTilesY ; y++) - { - if (saleBitmap[x, y]) - g.FillRectangle( - yellow, x * landTileSize, - regionSizeX - landTileSize - (y * landTileSize), - landTileSize, -======= for (int x = 0; x < regionLandTilesX ; x++) { for (int y = 0; y < regionLandTilesY ; y++) @@ -2101,7 +1741,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap x * landTileSize, regionSizeX - landTileSize - (y * landTileSize), landTileSize, ->>>>>>> avn/ubitvar landTileSize); } } diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 74720505e3..0f392731c1 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -402,7 +402,6 @@ namespace OpenSim.Region.DataSnapshot string url = services[i].Trim(); using (RestClient cli = new RestClient(url)) { -<<<<<<< HEAD cli.AddQueryParameter("service", serviceName); cli.AddQueryParameter("host", m_hostname); cli.AddQueryParameter("port", m_listener_port); @@ -436,30 +435,7 @@ namespace OpenSim.Region.DataSnapshot // string responseStr = Util.UTF8.GetString(response); m_log.Info("[DATASNAPSHOT]: data service " + url + " notified. Secret: " + m_Secret); } -======= - m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString()); - } - - byte[] response = new byte[1024]; - // int n = 0; - try - { - // n = reply.Read(response, 0, 1024); - reply.Read(response, 0, 1024); - } - catch (Exception e) - { - m_log.WarnFormat("[DATASNAPSHOT]: Unable to decode reply from data service. Ignoring. {0}", e.StackTrace); - } - // This is not quite working, so... - // string responseStr = Util.UTF8.GetString(response); - m_log.Info("[DATASNAPSHOT]: data service " + url + " notified. Secret: " + m_Secret); - - if(reply != null) - reply.Close(); ->>>>>>> avn/ubitvar } - } #endregion diff --git a/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs b/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs index 570d31c757..4d8409beeb 100644 --- a/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs @@ -35,7 +35,9 @@ namespace OpenSim.Services.Interfaces public interface IBakedTextureModule { WearableCacheItem[] Get(UUID id); + void Store(UUID id); + void Store(UUID id, WearableCacheItem[] WearableCache); void UpdateMeshAvatar(UUID id); } } diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 50448b409f..80f824445c 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs @@ -93,15 +93,9 @@ namespace OpenSim.Region.Framework.Interfaces void EnableChildAgent(ScenePresence agent, GridRegion region); -<<<<<<< HEAD - GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, - out Vector3 newpos, out string reason); - -======= GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos); GridRegion GetObjectDestination(SceneObjectGroup grp, Vector3 targetPosition, out Vector3 newpos); bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason); ->>>>>>> avn/ubitvar void Cross(SceneObjectGroup sog, Vector3 position, bool silent); bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent); diff --git a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs index 2f9b222132..efc9ddcbd2 100644 --- a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs +++ b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs @@ -58,8 +58,6 @@ namespace OpenSim.Region.Framework.Interfaces public interface IHttpRequestModule { UUID MakeHttpRequest(string url, string parameters, string body); -<<<<<<< HEAD - /// /// Starts the http request. /// @@ -86,12 +84,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Stop and remove all http requests for the given script. /// /// - void StopHttpRequestsForScript(UUID id); - -======= - UUID StartHttpRequest(uint localID, UUID itemID, string url, List parameters, Dictionary headers, string body); void StopHttpRequest(uint m_localID, UUID m_itemID); ->>>>>>> avn/ubitvar IServiceRequest GetNextCompletedRequest(); void RemoveCompletedRequest(UUID id); } diff --git a/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs b/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs index eb7971122c..5151567c6e 100644 --- a/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs @@ -25,24 +25,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -<<<<<<< HEAD -using System.Drawing; -using OpenSim.Framework; -======= using OpenMetaverse; using OpenSim.Framework; using System.Drawing; ->>>>>>> avn/ubitvar namespace OpenSim.Region.Framework.Interfaces { public interface IMapImageUploadModule { -<<<<<<< HEAD - void UploadMapTile(IScene scene, Bitmap mapTile); - } -} -======= /// /// Upload a new maptile /// @@ -50,4 +40,3 @@ namespace OpenSim.Region.Framework.Interfaces void UploadMapTile(IScene scene, Bitmap mapTile); } } ->>>>>>> avn/ubitvar diff --git a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs index 445342d442..99bc87ddb5 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs @@ -127,12 +127,7 @@ namespace OpenSim.Region.Framework.Interfaces /// If supplied, this request Id is later returned in the saved event /// /// Dictionary of options. -<<<<<<< HEAD /// void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary options); -======= - /// - void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary options); ->>>>>>> avn/ubitvar } } diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs index ff18519204..472e5a5d11 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs @@ -28,11 +28,8 @@ using System.IO; using OpenSim.Framework; -<<<<<<< HEAD -======= using System.IO; using OpenSim.Framework; ->>>>>>> avn/ubitvar using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces @@ -55,12 +52,6 @@ namespace OpenSim.Region.Framework.Interfaces /// void PushTerrain(IClientAPI pClient); - /// - /// When a client initially connects, all the terrain must be pushed to the viewer. - /// This call causes all the terrain patches to be sent to the client. - /// - void PushTerrain(IClientAPI pClient); - /// /// Load a terrain from a stream. /// @@ -69,7 +60,6 @@ namespace OpenSim.Region.Framework.Interfaces /// /// void LoadFromStream(string filename, Stream stream); - void LoadFromStream(string filename, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement, Stream stream); void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); void LoadFromStream(string filename, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement, Stream stream); diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs index 08dc3e397d..e9cf4ad145 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs @@ -37,10 +37,6 @@ namespace OpenSim.Region.Framework.Interfaces /// void GenerateMaptile(); List Map2BlockFromGridRegion(GridRegion r, uint flag); -<<<<<<< HEAD - MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag); -======= void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag); ->>>>>>> avn/ubitvar } } diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 2b95a4c29d..c00190a7cc 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -351,26 +351,7 @@ namespace OpenSim.Region.Framework.Scenes m_group = grp; m_scene = grp.Scene; -<<<<<<< HEAD - Vector3 grppos = grp.AbsolutePosition; - Vector3 offset = grppos - m_serializedPosition; - // avoid doing it more than once - // current this will happen dragging a prim to other region - m_serializedPosition = grppos; - m_basePosition += offset; - m_nextPosition += offset; - - m_currentFrame.StartPosition += offset; - m_currentFrame.Position += offset; - - for (int i = 0; i < m_frames.Count; i++) - { - Keyframe k = m_frames[i]; - k.StartPosition += offset; - k.Position += offset; - m_frames[i]=k; -======= lock (m_frames) { Vector3 grppos = grp.AbsolutePosition; @@ -390,7 +371,6 @@ namespace OpenSim.Region.Framework.Scenes k.Position += offset; m_frames[i] = k; } ->>>>>>> avn/ubitvar } if (m_running) @@ -708,29 +688,6 @@ namespace OpenSim.Region.Framework.Scenes if (m_frames.Count == 0) { -<<<<<<< HEAD - if (!m_running) return; - - GetNextList(); - - if (m_frames.Count == 0) - { - Stop(); -// Scene scene = m_group.Scene; -// -// IScriptModule[] scriptModules = scene.RequestModuleInterfaces(); -// foreach (IScriptModule m in scriptModules) -// { -// if (m == null) -// continue; -// m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]); -// } - - m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId); - - return; - } -======= lock (m_frames) { GetNextList(); @@ -738,17 +695,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_frames.Count == 0) { Done(); - Scene scene = m_group.Scene; - - IScriptModule[] scriptModules = scene.RequestModuleInterfaces(); - foreach (IScriptModule m in scriptModules) - { - if (m == null) - continue; - m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]); - } ->>>>>>> avn/ubitvar - + m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId); return; } @@ -792,21 +739,13 @@ namespace OpenSim.Region.Framework.Scenes float completed = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal; bool lastStep = m_currentFrame.TimeMS <= tickDuration; - Vector3 positionThisStep = m_currentFrame.StartPosition + (m_currentFrame.Position.Value - m_currentFrame.StartPosition) * completed; - Vector3 motionThisStep = positionThisStep - m_group.AbsolutePosition; + Vector3 v = (Vector3)m_currentFrame.Position - m_group.AbsolutePosition; + Vector3 motionThisFrame = v / (float)remainingSteps; + v = v * 1000 / m_currentFrame.TimeMS; -<<<<<<< HEAD - float mag = Vector3.Mag(motionThisStep); - - if ((mag >= 0.02f) || lastStep) - { - m_nextPosition = m_group.AbsolutePosition + motionThisStep; - m_group.AbsolutePosition = m_nextPosition; -======= m_nextPosition = m_group.AbsolutePosition + motionThisFrame; if (Vector3.Mag(motionThisFrame) >= 0.05f) ->>>>>>> avn/ubitvar update = true; //int totalSteps = m_currentFrame.TimeTotal / (int)tickDuration; @@ -819,45 +758,6 @@ namespace OpenSim.Region.Framework.Scenes Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed); step.Normalize(); -<<<<<<< HEAD -/* use simpler change detection -* float angle = 0; - - float aa = current.X * current.X + current.Y * current.Y + current.Z * current.Z + current.W * current.W; - float bb = step.X * step.X + step.Y * step.Y + step.Z * step.Z + step.W * step.W; - float aa_bb = aa * bb; - - if (aa_bb == 0) - { - angle = 0; - } - else - { - float ab = current.X * step.X + - current.Y * step.Y + - current.Z * step.Z + - current.W * step.W; - float q = (ab * ab) / aa_bb; - - if (q > 1.0f) - { - angle = 0; - } - else - { - angle = (float)Math.Acos(2 * q - 1); - } - } - - if (angle > 0.01f) -*/ - if(Math.Abs(step.X - current.X) > 0.001f - || Math.Abs(step.Y - current.Y) > 0.001f - || Math.Abs(step.Z - current.Z) > 0.001f - || lastStep) - // assuming w is a dependente var - -======= /* use simpler change detection * float angle = 0; @@ -893,9 +793,8 @@ namespace OpenSim.Region.Framework.Scenes || Math.Abs(step.Y - current.Y) > 0.001f || Math.Abs(step.Z - current.Z) > 0.001f) // assuming w is a dependente var ->>>>>>> avn/ubitvar { - // m_group.UpdateGroupRotationR(step); +// m_group.UpdateGroupRotationR(step); m_group.RootPart.RotationOffset = step; //m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2); @@ -922,22 +821,15 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup tmp = m_group; m_group = null; - if (!m_selected && tmp != null) - m_serializedPosition = tmp.AbsolutePosition; -<<<<<<< HEAD -======= - fmt.Serialize(ms, this); - m_group = tmp; - if (!timerWasStopped && m_running && !m_waitingCrossing) - StartTimer(); ->>>>>>> avn/ubitvar - + using (MemoryStream ms = new MemoryStream()) { BinaryFormatter fmt = new BinaryFormatter(); + if (!m_selected && tmp != null) + m_serializedPosition = tmp.AbsolutePosition; fmt.Serialize(ms, this); m_group = tmp; - if (m_running && !m_waitingCrossing) + if (!timerWasStopped && m_running && !m_waitingCrossing) StartTimer(); return ms.ToArray(); diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs index 9cb901a3c2..b617f52e44 100644 --- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs @@ -487,7 +487,7 @@ namespace OpenSim.Region.Framework.Scenes - XmlTextReader reader; + XmlReader reader; private int XRint() { @@ -524,7 +524,7 @@ namespace OpenSim.Region.Framework.Scenes public static bool EReadProcessors( Dictionary processors, - XmlTextReader xtr) + XmlReader xtr) { bool errors = false; @@ -564,14 +564,15 @@ namespace OpenSim.Region.Framework.Scenes public string ToXml2() { - MemoryStream ms = new MemoryStream(512); - UTF8Encoding enc = new UTF8Encoding(); - XmlTextWriter xwriter = new XmlTextWriter(ms, enc); - ToXml2(xwriter); - xwriter.Flush(); - string s = ms.GetStreamString(); - xwriter.Close(); - return s; + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter xwriter = new XmlTextWriter(sw)) + { + ToXml2(xwriter); + } + + return sw.ToString(); + } } public static SOPVehicle FromXml2(string text) @@ -598,7 +599,7 @@ namespace OpenSim.Region.Framework.Scenes return v; } - public static SOPVehicle FromXml2(XmlTextReader reader) + public static SOPVehicle FromXml2(XmlReader reader) { SOPVehicle vehicle = new SOPVehicle(); @@ -611,7 +612,7 @@ namespace OpenSim.Region.Framework.Scenes return vehicle; } - private void FromXml2(XmlTextReader _reader, out bool errors) + private void FromXml2(XmlReader _reader, out bool errors) { errors = false; reader = _reader; diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index e28966687a..edb881f6ca 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -881,14 +881,22 @@ namespace OpenSim.Region.Framework.Scenes return; } -<<<<<<< HEAD if (newName == String.Empty) newName = item.Name; -======= - if (newName == null) newName = item.Name; AssetBase asset = AssetService.Get(item.AssetID.ToString()); ->>>>>>> avn/ubitvar + + if (asset != null) + { + if (newName != String.Empty) + { + asset.Name = newName; + } + else + { + newName = item.Name; + } + if (remoteClient.AgentId == oldAgentID || (LibraryService != null @@ -916,6 +924,13 @@ namespace OpenSim.Region.Framework.Scenes } } } + else + { + m_log.ErrorFormat( + "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found", + item.Name, item.AssetID); + } + } /// /// Create a new asset data structure. @@ -982,31 +997,12 @@ namespace OpenSim.Region.Framework.Scenes public void CreateNewInventoryItem( IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, string description, uint flags, uint callbackID, -<<<<<<< HEAD UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask, int creationDate) { CreateNewInventoryItem( remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, assetID, assetType, invType, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate, true); -======= - AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID) - { - CreateNewInventoryItem( - remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, - (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate, transationID); - } - - - private void CreateNewInventoryItem( - IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, - string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, - uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) - { - CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID, - name, description, flags, callbackID, asset, invType, - baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero); ->>>>>>> avn/ubitvar } /// @@ -1030,14 +1026,9 @@ namespace OpenSim.Region.Framework.Scenes /// Unix timestamp at which this item was created. private void CreateNewInventoryItem( IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, -<<<<<<< HEAD string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType, uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate, bool assetUpload) -======= - string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, - uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID) ->>>>>>> avn/ubitvar { InventoryItemBase item = new InventoryItemBase(); item.Owner = remoteClient.AgentId; @@ -1058,17 +1049,13 @@ namespace OpenSim.Region.Framework.Scenes item.BasePermissions = baseMask; item.CreationDate = creationDate; -<<<<<<< HEAD - if (AddInventoryItem(item, assetUpload)) -======= // special AnimationSet case if (item.InvType == (int)CustomInventoryType.AnimationSet) AnimationSet.enforceItemPermitions(item,true); if (AddInventoryItem(item)) ->>>>>>> avn/ubitvar { - remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID); + remoteClient.SendInventoryItemCreateUpdate(item, callbackID); } else { @@ -1284,7 +1271,6 @@ namespace OpenSim.Region.Framework.Scenes agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); if (taskItem.InvType == (int)InventoryType.Object) { -<<<<<<< HEAD // Bake the new base permissions from folded permissions // The folded perms are in the lowest 3 bits of the current perms // We use base permissions here to avoid baking the "Locked" status @@ -1296,13 +1282,6 @@ namespace OpenSim.Region.Framework.Scenes agentItem.BasePermissions = perms | (uint)PermissionMask.Move; // Newly given items cannot be "locked" on rez. Make sure by // setting current equal to base. -======= - uint perms = taskItem.BasePermissions & taskItem.NextPermissions; - PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms); -// agentItem.BasePermissions = perms | (uint)PermissionMask.Move; -// agentItem.CurrentPermissions = agentItem.BasePermissions; - agentItem.BasePermissions = perms | (uint)PermissionMask.Move; ->>>>>>> avn/ubitvar } agentItem.CurrentPermissions = agentItem.BasePermissions; @@ -1577,12 +1556,12 @@ namespace OpenSim.Region.Framework.Scenes public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List items) { -<<<<<<< HEAD + ScenePresence avatar; IClientAPI remoteClient = null; if (TryGetScenePresence(destID, out avatar)) remoteClient = avatar.ControllingClient; -======= +// ???? SceneObjectPart destPart = GetSceneObjectPart(destID); if (destPart != null) // Move into a prim { @@ -1590,7 +1569,7 @@ namespace OpenSim.Region.Framework.Scenes MoveTaskInventoryItem(destID, host, itemID); return destID; // Prim folder ID == prim ID } ->>>>>>> avn/ubitvar +// /???? InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); @@ -2156,14 +2135,16 @@ namespace OpenSim.Region.Framework.Scenes List deleteIDs = new List(); List deleteGroups = new List(); List takeGroups = new List(); + + // Start with true for both, then remove the flags if objects + // that we can't derez are part of the selection + bool permissionToTake = true; + bool permissionToTakeCopy = true; + bool permissionToDelete = true; foreach (uint localID in localIDs) { - // Start with true for both, then remove the flags if objects - // that we can't derez are part of the selection - bool permissionToTake = true; - bool permissionToTakeCopy = true; - bool permissionToDelete = true; + // Invalid id SceneObjectPart part = GetSceneObjectPart(localID); @@ -2287,27 +2268,15 @@ namespace OpenSim.Region.Framework.Scenes } } -<<<<<<< HEAD - // OK, we're done with permissions. Let's check if any part of the code prevents the objects from being deleted - bool canDelete = EventManager.TriggerDeRezRequested(remoteClient, deleteGroups, action); - - if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) -======= - SendKillObject(deleteIDs); + SendKillObject(deleteIDs); if (deleteGroups.Count > 0) ->>>>>>> avn/ubitvar { foreach (SceneObjectGroup g in deleteGroups) deleteIDs.Remove(g.LocalId); m_asyncSceneObjectDeleter.DeleteToInventory( action, destinationID, deleteGroups, remoteClient, -<<<<<<< HEAD - permissionToDelete && canDelete); - } - else if (permissionToDelete && canDelete) -======= true); } if (takeGroups.Count > 0) @@ -2317,7 +2286,6 @@ namespace OpenSim.Region.Framework.Scenes false); } if (deleteIDs.Count > 0) ->>>>>>> avn/ubitvar { foreach (SceneObjectGroup g in deleteGroups) DeleteSceneObject(g, true); @@ -2361,7 +2329,7 @@ namespace OpenSim.Region.Framework.Scenes item.AssetType = asset.Type; item.InvType = (int)InventoryType.Object; - InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); + InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, FolderType.Object); if (folder != null) item.Folder = folder.ID; else // oopsies @@ -2435,34 +2403,10 @@ namespace OpenSim.Region.Framework.Scenes string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(assetData)); -<<<<<<< HEAD try -======= - if (e == null || attachment) // Single - { - SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); -/* - if (!attachment) - { - g.RootPart.AttachPoint = g.RootPart.Shape.State; - g.RootPart.AttachedPos = g.AbsolutePosition; - g.RootPart.AttachRotation = g.GroupRotation; - if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && - g.RootPart.Shape.PCode != (byte)PCode.Tree) - g.RootPart.Shape.State = 0; - } -*/ - objlist.Add(g); - veclist.Add(new Vector3(0, 0, 0)); - bbox = g.GetAxisAlignedBoundingBox(out offsetHeight); - return true; - } - else ->>>>>>> avn/ubitvar { using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) { -<<<<<<< HEAD using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) { reader.Read(); @@ -2481,7 +2425,7 @@ namespace OpenSim.Region.Framework.Scenes Util.LogFailedXML("[AGENT INVENTORY]:", xmlData); g = null; } - + if (g != null) { objlist.Add(g); @@ -2492,7 +2436,7 @@ namespace OpenSim.Region.Framework.Scenes return true; } else - { + { XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlData); XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); @@ -2526,28 +2470,6 @@ namespace OpenSim.Region.Framework.Scenes return false; } } -======= - SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); -/* - g.RootPart.AttachPoint = g.RootPart.Shape.State; - g.RootPart.AttachedPos = g.AbsolutePosition; - g.RootPart.AttachRotation = g.GroupRotation; - if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && - g.RootPart.Shape.PCode != (byte)PCode.Tree) - g.RootPart.Shape.State = 0; -*/ - objlist.Add(g); - - XmlElement el = (XmlElement)n; - string rawX = el.GetAttribute("offsetx"); - string rawY = el.GetAttribute("offsety"); - string rawZ = el.GetAttribute("offsetz"); - - float x = Convert.ToSingle(rawX); - float y = Convert.ToSingle(rawY); - float z = Convert.ToSingle(rawZ); - veclist.Add(new Vector3(x, y, z)); ->>>>>>> avn/ubitvar } } catch (Exception e) diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 3d9c02825f..20767e5416 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -551,7 +551,6 @@ namespace OpenSim.Region.Framework.Scenes void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) { -<<<<<<< HEAD try { SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); @@ -562,10 +561,7 @@ namespace OpenSim.Region.Framework.Scenes string.Format( "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e)); } -======= Thread.Sleep(20); - SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); ->>>>>>> avn/ubitvar } void SendInventoryComplete(IAsyncResult iar) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index deb8d398ad..c1da7faaf6 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -61,8 +61,7 @@ namespace OpenSim.Region.Framework.Scenes { private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; - - public const int m_defaultNumberFramesStored = 10; + public delegate void SynchronizeSceneHandler(Scene scene); @@ -105,15 +104,10 @@ namespace OpenSim.Region.Framework.Scenes /// /// If false then physical objects are disabled, though collisions will continue as normal. /// -<<<<<<< HEAD - public bool PhysicsEnabled - { - get -======= + public bool PhysicsEnabled { get ->>>>>>> avn/ubitvar { return m_physicsEnabled; } @@ -222,7 +216,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Maximum value of the size of a physical prim in each axis /// - public float m_maxPhys = 64; + public float m_maxPhys = 10; /// /// Max prims an object will hold @@ -234,16 +228,15 @@ namespace OpenSim.Region.Framework.Scenes public bool m_allowScriptCrossings = true; /// -<<<<<<< HEAD + /// Can avatars cross from and to this region? /// public bool AllowAvatarCrossing { get; set; } -======= + /// Max prims an Physical object will hold /// /// public int m_linksetPhysCapacity = 0; ->>>>>>> avn/ubitvar public bool m_useFlySlow; public bool m_useTrashOnDelete = true; @@ -278,7 +271,7 @@ namespace OpenSim.Region.Framework.Scenes /// public int ChildTerseUpdatePeriod { get; set; } - protected float m_defaultDrawDistance = 255.0f; + protected float m_defaultDrawDistance = 255f; public float DefaultDrawDistance { // get { return m_defaultDrawDistance; } @@ -360,17 +353,6 @@ namespace OpenSim.Region.Framework.Scenes private Dictionary m_extraSettings; - /// - /// If true then the next time the scene loop is activated, updates will be performed by firing of a timer - /// rather than on a single thread that sleeps. - /// - public bool UpdateOnTimer { get; set; } - - /// - /// Only used if we are updating scene on a timer rather than sleeping a thread. - /// - private Timer m_sceneUpdateTimer; - /// /// Current scene frame number /// @@ -386,23 +368,14 @@ namespace OpenSim.Region.Framework.Scenes public uint MaintenanceRun { get; private set; } /// - /// The minimum length of time in milliseconds that will be taken for a scene frame. If the frame takes less time then we + /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we /// will sleep for the remaining period. /// /// /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations /// occur too quickly (viewer 1) or with even more slide (viewer 2). /// - public int MinFrameTicks - { - get { return m_minFrameTicks; } - private set - { - m_minFrameTicks = value; - MinFrameSeconds = (float)m_minFrameTicks / 1000; - } - } - private int m_minFrameTicks; + public float MinFrameTime { get; private set; } /// /// The minimum length of time in seconds that will be taken for a scene frame. @@ -410,17 +383,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Always derived from MinFrameTicks. /// - public float MinFrameSeconds { get; private set; } - - /// - /// The minimum length of time in milliseconds that will be taken for a scene frame. If the frame takes less time then we - /// will sleep for the remaining period. - /// - /// - /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations - /// occur too quickly (viewer 1) or with even more slide (viewer 2). - /// - public int MinMaintenanceTicks { get; set; } + public float MinMaintenanceTime { get; private set; } private int m_update_physics = 1; private int m_update_entitymovement = 1; @@ -428,13 +391,10 @@ namespace OpenSim.Region.Framework.Scenes private int m_update_presences = 1; // Update scene presence movements private int m_update_events = 1; private int m_update_backup = 200; -<<<<<<< HEAD - private int m_update_terrain = 50; - // private int m_update_land = 1; -======= + private int m_update_terrain = 1000; private int m_update_land = 10; ->>>>>>> avn/ubitvar + private int m_update_coarse_locations = 50; private int m_update_temp_cleaning = 180; @@ -559,13 +519,12 @@ namespace OpenSim.Region.Framework.Scenes } private volatile bool m_active; -<<<<<<< HEAD /// /// If true then updates are running. This may be true for a short period after a scene is de-activated. /// public bool IsRunning { get { return m_isRunning; } } private volatile bool m_isRunning; -======= + // private int m_lastUpdate; private bool m_firstHeartbeat = true; @@ -574,7 +533,7 @@ namespace OpenSim.Region.Framework.Scenes private double m_reprioritizationInterval = 5000.0; private double m_rootReprioritizationDistance = 10.0; private double m_childReprioritizationDistance = 20.0; ->>>>>>> avn/ubitvar + private Timer m_mapGenerationTimer = new Timer(); private bool m_generateMaptiles; @@ -913,8 +872,8 @@ namespace OpenSim.Region.Framework.Scenes : this(regInfo, physicsScene) { m_config = config; - MinFrameTicks = 89; - MinMaintenanceTicks = 1000; + MinFrameTime = 0.089f; + MinMaintenanceTime = 1; SeeIntoRegion = true; Random random = new Random(); @@ -924,12 +883,9 @@ namespace OpenSim.Region.Framework.Scenes m_sceneGridService = sceneGridService; m_SimulationDataService = simDataService; m_EstateDataService = estateDataService; -<<<<<<< HEAD -======= - m_regionHandle = RegionInfo.RegionHandle; + m_lastIncoming = 0; m_lastOutgoing = 0; ->>>>>>> avn/ubitvar m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); m_asyncSceneObjectDeleter.Enabled = true; @@ -988,8 +944,6 @@ namespace OpenSim.Region.Framework.Scenes EventManager.OnLandObjectRemoved += new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); -<<<<<<< HEAD -======= m_sceneGraph = new SceneGraph(this); m_sceneGraph.PhysicsScene = physicsScene; @@ -1006,7 +960,6 @@ namespace OpenSim.Region.Framework.Scenes RestartNow(); }; ->>>>>>> avn/ubitvar RegisterDefaultSceneEvents(); // XXX: Don't set the public property since we don't want to activate here. This needs to be handled @@ -1167,8 +1120,7 @@ namespace OpenSim.Region.Framework.Scenes } } - if (startupConfig.Contains("MinFrameTime")) - MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000); + MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); @@ -1246,43 +1198,13 @@ namespace OpenSim.Region.Framework.Scenes #endregion Interest Management - // The timer used by the Stopwatch class depends on the system hardware and operating system; inform - // if the timer is based on a high-resolution performance counter or based on the system timer; - // the performance counter will provide a more precise time than the system timer - if (Stopwatch.IsHighResolution) - m_log.InfoFormat("[SCENE]: Using high-resolution performance counter for statistics."); - else - m_log.InfoFormat("[SCENE]: Using system timer for statistics."); - // Acquire the statistics section of the OpenSim.ini file located - // in the bin directory - IConfig statisticsConfig = m_config.Configs["Statistics"]; - - // Confirm that the statistics section existed in the configuration - // file - if (statisticsConfig != null) - { - // Create the StatsReporter using the number of frames to store - // for the frame time statistics, or 10 frames if the config - // file doesn't contain a value - StatsReporter = new SimStatsReporter(this, - statisticsConfig.GetInt("NumberOfFrames", - m_defaultNumberFramesStored)); - } - else - { - // Create a StatsReporter with the current scene and a default - // 10 frames stored for the frame time statistics - StatsReporter = new SimStatsReporter(this); - } + StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; -<<<<<<< HEAD -======= MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); ->>>>>>> avn/ubitvar } public Scene(RegionInfo regInfo, PhysicsScene physicsScene) @@ -1314,7 +1236,28 @@ namespace OpenSim.Region.Framework.Scenes PeriodicBackup = true; UseBackup = true; -<<<<<<< HEAD + + + + + + + + + + + + + + + + + + + + + + IsReprioritizationEnabled = true; UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; ReprioritizationInterval = 5000; @@ -1325,8 +1268,6 @@ namespace OpenSim.Region.Framework.Scenes RootReprioritizationDistance = 10.0; ChildReprioritizationDistance = 20.0; -======= ->>>>>>> avn/ubitvar m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); @@ -1376,24 +1317,8 @@ namespace OpenSim.Region.Framework.Scenes { if (RegionInfo.RegionHandle != otherRegion.RegionHandle) { -<<<<<<< HEAD - //// If these are cast to INT because long + negative values + abs returns invalid data - //int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX); - //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY); - //if (resultX <= 1 && resultY <= 1) - float dist = (float)Math.Max(DefaultDrawDistance, - (float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY)); - uint newRegionX, newRegionY, thisRegionX, thisRegionY; - Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY); - Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY); - //m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}", - // RegionInfo.RegionName, otherRegion.RegionName, newRegionX, newRegionY); - - if (!Util.IsOutsideView(dist, thisRegionX, newRegionX, thisRegionY, newRegionY)) -======= if (isNeighborRegion(otherRegion)) ->>>>>>> avn/ubitvar { // Let the grid service module know, so this can be cached m_eventManager.TriggerOnRegionUp(otherRegion); @@ -1693,45 +1618,8 @@ namespace OpenSim.Region.Framework.Scenes Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; m_lastFrameTick = Util.EnvironmentTickCount(); - - if (UpdateOnTimer) - { - m_sceneUpdateTimer = new Timer(MinFrameTicks); - m_sceneUpdateTimer.AutoReset = true; - m_sceneUpdateTimer.Elapsed += Update; - m_sceneUpdateTimer.Start(); - } - else - { - Thread.CurrentThread.Priority = ThreadPriority.Highest; - Update(-1); - Watchdog.RemoveThread(); - m_isRunning = false; - } - } - - private volatile bool m_isTimerUpdateRunning; - - private void Update(object sender, ElapsedEventArgs e) - { - if (m_isTimerUpdateRunning) - return; - - m_isTimerUpdateRunning = true; - - // If the last frame did not complete on time, then immediately start the next update on the same thread - // and ignore further timed updates until we have a frame that had spare time. - while (!Update(1) && Active) { } - - if (!Active || m_shuttingDown) - { - m_sceneUpdateTimer.Stop(); - m_sceneUpdateTimer = null; - m_isRunning = false; - } - - m_isTimerUpdateRunning = false; - } + Update(-1); + } private void Maintenance() { @@ -1800,24 +1688,24 @@ namespace OpenSim.Region.Framework.Scenes previousMaintenanceTick = m_lastMaintenanceTick; m_lastMaintenanceTick = Util.EnvironmentTickCount(); runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); - runtc = MinMaintenanceTicks - runtc; + runtc = (int)(MinMaintenanceTime * 1000) - runtc; if (runtc > 0) m_maintenanceWaitEvent.WaitOne(runtc); // Optionally warn if a frame takes double the amount of time that it should. if (DebugUpdates - && Util.EnvironmentTickCountSubtract( - m_lastMaintenanceTick, previousMaintenanceTick) > MinMaintenanceTicks * 2) + && Util.EnvironmentTickCountSubtract( + m_lastMaintenanceTick, previousMaintenanceTick) > (int)(MinMaintenanceTime * 1000 * 2)) m_log.WarnFormat( "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), - MinMaintenanceTicks, + MinMaintenanceTime * 1000, RegionInfo.RegionName); } } - public override bool Update(int frames) + public override void Update(int frames) { long? endFrame = null; @@ -1825,30 +1713,12 @@ namespace OpenSim.Region.Framework.Scenes endFrame = Frame + frames; float physicsFPS = 0f; -<<<<<<< HEAD - int previousFrameTick, tmpMS; - // These variables will be used to save the precise frame time using the - // Stopwatch class of Microsoft SDK; the times are recorded at the start - // and end of a particular section of code, and then used to calculate - // the frame times, which are the sums of the sections for each given name - double preciseTotalFrameTime = 0.0; - double preciseSimFrameTime = 0.0; - double precisePhysicsFrameTime = 0.0; - Stopwatch totalFrameStopwatch = new Stopwatch(); - Stopwatch simFrameStopwatch = new Stopwatch(); - Stopwatch physicsFrameStopwatch = new Stopwatch(); - - // Begin the stopwatch to keep track of the time that the frame - // started running to determine how long the frame took to complete - totalFrameStopwatch.Start(); -======= int tmpMS; int previousFrameTick; int maintc; int sleepMS; int framestart; ->>>>>>> avn/ubitvar while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) { @@ -1857,11 +1727,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); -<<<<<<< HEAD - agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; -======= agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; ->>>>>>> avn/ubitvar try { @@ -1877,93 +1743,42 @@ namespace OpenSim.Region.Framework.Scenes if (Frame % m_update_terrain == 0) { -<<<<<<< HEAD - // At several points inside the code there was a need to - // create a more precise measurement of time elapsed. - // This led to the addition of variables that have a - // similar function and thus remain tightly connected to - // their original counterparts. However, the original - // code is not receiving comments from our group because - // we don't feel right modifying the code to that degree - // at this point in time, the precise values all begin - // with the keyword precise - tmpMS = Util.EnvironmentTickCount(); - simFrameStopwatch.Start(); - UpdateTerrain(); - - // Get the simulation frame time that the avatar force - // input took - simFrameStopwatch.Stop(); - preciseSimFrameTime = - simFrameStopwatch.Elapsed.TotalMilliseconds; - terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); - } - - // At several points inside the code there was a need to - // create a more precise measurement of time elapsed. This - // led to the addition of variables that have a similar - // function and thus remain tightly connected to their - // original counterparts. However, the original code is - // not receiving comments from our group because we don't - // feel right modifying the code to that degree at this - // point in time, the precise values all begin with the - // keyword precise -======= UpdateTerrain(); } terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); ->>>>>>> avn/ubitvar - tmpMS = Util.EnvironmentTickCount(); - // Begin the stopwatch to track the time to prepare physics - physicsFrameStopwatch.Start(); if (PhysicsEnabled && Frame % m_update_physics == 0) m_sceneGraph.UpdatePreparePhysics(); - // Get the time it took to prepare the physics, this - // would report the most precise time that physics was - // running on the machine and should the physics not be - // enabled will report the time it took to check if physics - // was enabled - physicsFrameStopwatch.Stop(); - precisePhysicsFrameTime = physicsFrameStopwatch.Elapsed.TotalMilliseconds; physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); // Apply any pending avatar force input to the avatar's velocity tmpMS = Util.EnvironmentTickCount(); - simFrameStopwatch.Restart(); if (Frame % m_update_entitymovement == 0) m_sceneGraph.UpdateScenePresenceMovement(); // Get the simulation frame time that the avatar force input // took - simFrameStopwatch.Stop(); - preciseSimFrameTime += - simFrameStopwatch.Elapsed.TotalMilliseconds; agentMS = Util.EnvironmentTickCountSubtract(tmpMS); // Perform the main physics update. This will do the actual work of moving objects and avatars according to their // velocity tmpMS = Util.EnvironmentTickCount(); - physicsFrameStopwatch.Restart(); if (Frame % m_update_physics == 0) { if (PhysicsEnabled) - physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameSeconds); + physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); if (SynchronizeScene != null) SynchronizeScene(this); } // Add the main physics update time to the prepare physics time - physicsFrameStopwatch.Stop(); - precisePhysicsFrameTime += physicsFrameStopwatch.Elapsed.TotalMilliseconds; physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); // Start the stopwatch for the remainder of the simulation - simFrameStopwatch.Restart(); tmpMS = Util.EnvironmentTickCount(); // Check if any objects have reached their targets @@ -1980,10 +1795,7 @@ namespace OpenSim.Region.Framework.Scenes m_sceneGraph.UpdatePresences(); agentMS += Util.EnvironmentTickCountSubtract(tmpMS); - -<<<<<<< HEAD -======= - + // Delete temp-on-rez stuff if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) { @@ -1993,7 +1805,6 @@ namespace OpenSim.Region.Framework.Scenes tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); } ->>>>>>> avn/ubitvar if (Frame % m_update_events == 0) { tmpMS = Util.EnvironmentTickCount(); @@ -2062,42 +1873,9 @@ namespace OpenSim.Region.Framework.Scenes } EventManager.TriggerRegionHeartbeatEnd(this); - otherMS = eventMS + backupMS + terrainMS + landMS; - // Get the elapsed time for the simulation frame - simFrameStopwatch.Stop(); - preciseSimFrameTime += - simFrameStopwatch.Elapsed.TotalMilliseconds; + Watchdog.UpdateThread(); -<<<<<<< HEAD - if (!UpdateOnTimer) - { - Watchdog.UpdateThread(); - - spareMS = MinFrameTicks - Util.EnvironmentTickCountSubtract(m_lastFrameTick); - - if (spareMS > 0) - m_updateWaitEvent.WaitOne(spareMS); - else - spareMS = 0; - } - else - { - spareMS = Math.Max(0, MinFrameTicks - physicsMS2 - agentMS - physicsMS - otherMS); - } - - // Get the total frame time - totalFrameStopwatch.Stop(); - preciseTotalFrameTime = - totalFrameStopwatch.Elapsed.TotalMilliseconds; - - // Restart the stopwatch for the total time of the next frame - totalFrameStopwatch.Restart(); - - previousFrameTick = m_lastFrameTick; - frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); - m_lastFrameTick = Util.EnvironmentTickCount(); -======= otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; StatsReporter.AddPhysicsFPS(physicsFPS); @@ -2125,46 +1903,22 @@ namespace OpenSim.Region.Framework.Scenes frameMS = Util.EnvironmentTickCountSubtract(framestart); StatsReporter.addSleepMS(sleepMS); StatsReporter.addFrameMS(frameMS); ->>>>>>> avn/ubitvar // if (Frame%m_update_avatars == 0) // UpdateInWorldTime(); -<<<<<<< HEAD - StatsReporter.addFrameMS(frameMS); - StatsReporter.addAgentMS(agentMS); - StatsReporter.addPhysicsMS(physicsMS + physicsMS2); - StatsReporter.addOtherMS(otherMS); - StatsReporter.AddSpareMS(spareMS); - StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); - StatsReporter.AddScriptMS((int) GetAndResetScriptExecutionTime()); -======= ->>>>>>> avn/ubitvar - - // Send the correct time values to the stats reporter for the - // frame times - StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime, - preciseSimFrameTime, precisePhysicsFrameTime, 0.0); - - // Send the correct number of frames that the physics library - // has processed to the stats reporter - StatsReporter.addPhysicsFrame(1); - - // Optionally warn if a frame takes double the amount of time that it should. + // Optionally warn if a frame takes double the amount of time that it should. if (DebugUpdates && Util.EnvironmentTickCountSubtract( - m_lastFrameTick, previousFrameTick) > MinFrameTicks * 2) + m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) + m_log.WarnFormat( "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), - MinFrameTicks, + MinFrameTime * 1000, + RegionInfo.RegionName); } - - // Finished updating scene frame, so stop the total frame's Stopwatch - totalFrameStopwatch.Stop(); - - return spareMS >= 0; } /// @@ -2629,13 +2383,8 @@ namespace OpenSim.Region.Framework.Scenes if (ei.HitTF) { -<<<<<<< HEAD - pos = ei.ipoint; - } -======= pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); } ->>>>>>> avn/ubitvar else { // fall back to our stupid functionality @@ -3013,8 +2762,6 @@ namespace OpenSim.Region.Framework.Scenes m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); } return; -<<<<<<< HEAD -======= } if (grp.RootPart.RETURN_AT_EDGE) @@ -3056,70 +2803,11 @@ namespace OpenSim.Region.Framework.Scenes // Regular region. Just check for region size if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) ret = true; ->>>>>>> avn/ubitvar - } - - if (grp.RootPart.RETURN_AT_EDGE) - { -<<<<<<< HEAD - // We remove the object here - try - { - List objects = new List(); - objects.Add(grp); - SceneObjectGroup[] objectsArray = objects.ToArray(); - returnObjects(objectsArray, UUID.Zero); - } - catch (Exception) - { - m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border."); - } - return; - } - - if (EntityTransferModule != null) - EntityTransferModule.Cross(grp, attemptedPosition, silent); - } - - // Simple test to see if a position is in the current region. - // This test is mostly used to see if a region crossing is necessary. - // Assuming the position is relative to the region so anything outside its bounds. - // Return 'true' if position inside region. - public bool PositionIsInCurrentRegion(Vector3 pos) - { - bool ret = false; - int xx = (int)Math.Floor(pos.X); - int yy = (int)Math.Floor(pos.Y); - if (xx < 0 || yy < 0) - return false; - - IRegionCombinerModule regionCombinerModule = RequestModuleInterface(); - if (regionCombinerModule == null) - { - // Regular region. Just check for region size - if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY) - ret = true; - } - else - { - // We're in a mega-region so see if we are still in that larger region - ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy); } return ret; - } -======= - // We're in a mega-region so see if we are still in that larger region - ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy); - } - - return ret; - - } - ->>>>>>> avn/ubitvar /// /// Called when objects or attachments cross the border, or teleport, between regions. /// @@ -3141,10 +2829,6 @@ namespace OpenSim.Region.Framework.Scenes return false; } -<<<<<<< HEAD - if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition)) - return false; -======= // If the user is banned, we won't let any of their objects // enter. Period. // @@ -3189,7 +2873,6 @@ namespace OpenSim.Region.Framework.Scenes //if (newObject.RootPart.KeyframeMotion != null) // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); } ->>>>>>> avn/ubitvar // Do this as late as possible so that listeners have full access to the incoming object EventManager.TriggerOnIncomingSceneObject(newObject); @@ -3286,8 +2969,6 @@ namespace OpenSim.Region.Framework.Scenes return true; } -<<<<<<< HEAD -======= private int GetStateSource(SceneObjectGroup sog) { ScenePresence sp = GetScenePresence(sog.OwnerID); @@ -3316,7 +2997,7 @@ namespace OpenSim.Region.Framework.Scenes return uac.UserFlags; //} } ->>>>>>> avn/ubitvar + #endregion #region Add/Remove Avatar Methods @@ -3352,15 +3033,10 @@ namespace OpenSim.Region.Framework.Scenes vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; -<<<<<<< HEAD - - // CheckHeartbeat(); - -======= CheckHeartbeat(); ->>>>>>> avn/ubitvar + sp = GetScenePresence(client.AgentId); // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this @@ -3370,29 +3046,6 @@ namespace OpenSim.Region.Framework.Scenes if (sp == null) { m_log.DebugFormat( -<<<<<<< HEAD - "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", - client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); - - sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); - - // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the - // client is for a root or child agent. - // We must also set this before adding the client to the client manager so that an exception later on - // does not leave a client manager entry without the scene agent set, which will cause other code - // to fail since any entry in the client manager should have a ScenePresence - // - // XXX: This may be better set for a new client before that client is added to the client manager. - // But need to know what happens in the case where a ScenePresence is already present (and if this - // actually occurs). - client.SceneAgent = sp; - - m_clientManager.Add(client); - SubscribeToClientEvents(client); - m_eventManager.TriggerOnNewPresence(sp); - - sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; -======= "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}", client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos, ((TPFlags)aCircuit.teleportFlags).ToString()); @@ -3414,8 +3067,6 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF); */ m_eventManager.TriggerOnNewPresence(sp); - ->>>>>>> avn/ubitvar } else { @@ -3424,7 +3075,7 @@ namespace OpenSim.Region.Framework.Scenes // XXX: This may be better set for a new client before that client is added to the client manager. // But need to know what happens in the case where a ScenePresence is already present (and if this // actually occurs). - client.SceneAgent = sp; + m_log.WarnFormat( "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", @@ -3432,6 +3083,7 @@ namespace OpenSim.Region.Framework.Scenes reallyNew = false; } + client.SceneAgent = sp; // This is currently also being done earlier in NewUserConnection for real users to see if this // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other @@ -3454,15 +3106,6 @@ namespace OpenSim.Region.Framework.Scenes return sp; } - public string GetAgentHomeURI(UUID agentID) - { - AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID); - if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI")) - return circuit.ServiceURLs["HomeURI"].ToString(); - else - return null; - } - /// /// Returns the Home URI of the agent, or null if unknown. /// @@ -3899,16 +3542,14 @@ namespace OpenSim.Region.Framework.Scenes if (target != null && target2 != null) { Vector3 direction = Vector3.Normalize(RayEnd - RayStart); - Vector3 AXOrigin = RayStart; - Vector3 AXdirection = direction; - + pos = target2.AbsolutePosition; //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); // TODO: Raytrace better here //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); - Ray NewRay = new Ray(AXOrigin, AXdirection); + Ray NewRay = new Ray(RayStart,direction); // Ray Trace against target here EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters); @@ -4010,13 +3651,8 @@ namespace OpenSim.Region.Framework.Scenes } // TODO: Can we now remove this lock? -<<<<<<< HEAD - lock (acd) - { -======= lock (m_removeClientPrivLock) { ->>>>>>> avn/ubitvar bool isChildAgent = false; ScenePresence avatar = GetScenePresence(agentID); @@ -4060,13 +3696,8 @@ namespace OpenSim.Region.Framework.Scenes // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI if (closeChildAgents && CapsModule != null) -<<<<<<< HEAD - CapsModule.RemoveCaps(agentID); - -======= CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); ->>>>>>> avn/ubitvar if (closeChildAgents && !isChildAgent) { List regions = avatar.KnownRegionHandles; @@ -4079,12 +3710,8 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager.TriggerClientClosed(agentID, this); // m_log.Debug("[Scene]TriggerClientClosed done"); m_eventManager.TriggerOnRemovePresence(agentID); -<<<<<<< HEAD - -======= // m_log.Debug("[Scene]TriggerOnRemovePresence done"); ->>>>>>> avn/ubitvar if (!isChildAgent) { if (AttachmentsModule != null) @@ -4228,14 +3855,10 @@ namespace OpenSim.Region.Framework.Scenes /// or other applications where a full grid/Hypergrid presence may not be required. /// True if the region accepts this agent. False if it does not. False will /// also return a reason. -<<<<<<< HEAD - public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup) -======= /// private object m_newUserConnLock = new object(); - public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, out string reason, bool requirePresenceLookup) ->>>>>>> avn/ubitvar + public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup) { bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); @@ -4507,13 +4130,7 @@ namespace OpenSim.Region.Framework.Scenes { m_log.DebugFormat( "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", -<<<<<<< HEAD - acd.AgentID, RegionInfo.RegionName); - - sp.AdjustKnownSeeds(); -======= acd.AgentID, RegionInfo.RegionName); ->>>>>>> avn/ubitvar if (CapsModule != null) { @@ -4646,21 +4263,13 @@ namespace OpenSim.Region.Framework.Scenes { if (posX < 0) posX = 0; -<<<<<<< HEAD - else if (posX >= (float)RegionInfo.RegionSizeX) - posX = (float)RegionInfo.RegionSizeX - 0.001f; - if (posY < 0) - posY = 0; - else if (posY >= (float)RegionInfo.RegionSizeY) - posY = (float)RegionInfo.RegionSizeY - 0.001f; -======= + else if (posX >= RegionInfo.RegionSizeX) posX = RegionInfo.RegionSizeX - 0.5f; if (posY < 0) posY = 0; else if (posY >= RegionInfo.RegionSizeY) posY = RegionInfo.RegionSizeY - 0.5f; ->>>>>>> avn/ubitvar reason = String.Empty; if (Permissions.IsGod(agentID)) @@ -5249,15 +4858,11 @@ namespace OpenSim.Region.Framework.Scenes sp.LifecycleState = ScenePresenceState.Removing; } -<<<<<<< HEAD - sp.ControllingClient.Close(force); -======= if (sp != null) { sp.ControllingClient.Close(force, force); return true; } ->>>>>>> avn/ubitvar return true; } @@ -5862,9 +5467,7 @@ namespace OpenSim.Region.Framework.Scenes // 5 = We have seen a new user enter within the past 4 minutes // which can be seen as positive confirmation of sim health // -<<<<<<< HEAD int health = 1; // Start at 1, means we're up -======= flags = 0; message = String.Empty; @@ -5879,9 +5482,6 @@ namespace OpenSim.Region.Framework.Scenes return 0; } - int health=1; // Start at 1, means we're up ->>>>>>> avn/ubitvar - if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) { health+=1; @@ -6176,13 +5776,7 @@ Environment.Exit(1); //Go to the edge, this happens in teleporting to a region with no available parcels Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); -<<<<<<< HEAD - //m_log.Debug("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); - -======= //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); - ->>>>>>> avn/ubitvar return nearestRegionEdgePoint; } @@ -6513,11 +6107,7 @@ Environment.Exit(1); /// /// /// -<<<<<<< HEAD public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List features, out string reason) -======= - public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason) ->>>>>>> avn/ubitvar { reason = string.Empty; @@ -6527,14 +6117,8 @@ Environment.Exit(1); return true; } -<<<<<<< HEAD if (!AllowAvatarCrossing && !viaTeleport) return false; -======= - -// if (!AllowAvatarCrossing && !viaTeleport) -// return false; ->>>>>>> avn/ubitvar // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. // However, the long term fix is to make sure root agent count is always accurate. diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index c4671f0067..f420f69aa5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -1,4 +1,3 @@ -<<<<<<< HEAD /* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. @@ -201,7 +200,7 @@ namespace OpenSim.Region.Framework.Scenes /// If -1 then updates until shutdown. /// /// true if update completed within minimum frame time, false otherwise. - public abstract bool Update(int frames); + public abstract void Update(int frames); #endregion @@ -635,603 +634,3 @@ namespace OpenSim.Region.Framework.Scenes public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep); } } -======= -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Threading; -using OpenMetaverse; -using log4net; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Framework.Console; - -using OpenSim.Region.Framework.Interfaces; -using GridRegion = OpenSim.Services.Interfaces.GridRegion; - -namespace OpenSim.Region.Framework.Scenes -{ - public abstract class SceneBase : IScene - { - protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - protected static readonly string LogHeader = "[SCENE]"; - - #region Events - - public event restart OnRestart; - - #endregion - - #region Fields - - public string Name { get { return RegionInfo.RegionName; } } - - public IConfigSource Config - { - get { return GetConfig(); } - } - - protected virtual IConfigSource GetConfig() - { - return null; - } - - /// - /// All the region modules attached to this scene. - /// - public Dictionary RegionModules - { - get { return m_regionModules; } - } - private Dictionary m_regionModules = new Dictionary(); - - /// - /// The module interfaces available from this scene. - /// - protected Dictionary> ModuleInterfaces = new Dictionary>(); - - protected Dictionary ModuleAPIMethods = new Dictionary(); - - /// - /// The module commanders available from this scene - /// - protected Dictionary m_moduleCommanders = new Dictionary(); - - /// - /// Registered classes that are capable of creating entities. - /// - protected Dictionary m_entityCreators = new Dictionary(); - - /// - /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is - /// dispensed. - /// - protected uint m_lastAllocatedLocalId = 720000; - - private readonly Mutex _primAllocateMutex = new Mutex(false); - - protected readonly ClientManager m_clientManager = new ClientManager(); - - public bool LoginsEnabled - { - get - { - return m_loginsEnabled; - } - - set - { - if (m_loginsEnabled != value) - { - m_loginsEnabled = value; - EventManager.TriggerRegionLoginsStatusChange(this); - } - } - } - private bool m_loginsEnabled; - - public bool Ready - { - get - { - return m_ready; - } - - set - { - if (m_ready != value) - { - m_ready = value; - EventManager.TriggerRegionReadyStatusChange(this); - } - } - } - private bool m_ready; - - public float TimeDilation - { - get { return 1.0f; } - } - - protected ulong m_regionHandle; - protected string m_regionName; - - public ITerrainChannel Heightmap; - - /// - /// Allows retrieval of land information for this scene. - /// - public ILandChannel LandChannel; - - /// - /// Manage events that occur in this scene (avatar movement, script rez, etc.). Commonly used by region modules - /// to subscribe to scene events. - /// - public EventManager EventManager - { - get { return m_eventManager; } - } - protected EventManager m_eventManager; - - protected ScenePermissions m_permissions; - public ScenePermissions Permissions - { - get { return m_permissions; } - } - - protected string m_datastore; - - /* Used by the loadbalancer plugin on GForge */ - protected RegionStatus m_regStatus; - public RegionStatus RegionStatus - { - get { return m_regStatus; } - set { m_regStatus = value; } - } - - #endregion - - public SceneBase(RegionInfo regInfo) - { - RegionInfo = regInfo; - } - - #region Update Methods - - /// - /// Called to update the scene loop by a number of frames and until shutdown. - /// - /// - /// Number of frames to update. Exits on shutdown even if there are frames remaining. - /// If -1 then updates until shutdown. - /// - public abstract void Update(int frames); - - #endregion - - #region Terrain Methods - - /// - /// Loads the World heightmap - /// - public abstract void LoadWorldMap(); - - /// - /// Send the region heightmap to the client - /// - /// Client to send to - public virtual void SendLayerData(IClientAPI RemoteClient) - { -// RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised()); - ITerrainModule terrModule = RequestModuleInterface(); - if (terrModule != null) - { - terrModule.PushTerrain(RemoteClient); - } - } - - #endregion - - #region Add/Remove Agent/Avatar - - public abstract ISceneAgent AddNewAgent(IClientAPI client, PresenceType type); - - public abstract bool CloseAgent(UUID agentID, bool force); - - public bool TryGetScenePresence(UUID agentID, out object scenePresence) - { - scenePresence = null; - ScenePresence sp = null; - if (TryGetScenePresence(agentID, out sp)) - { - scenePresence = sp; - return true; - } - - return false; - } - - /// - /// Try to get a scene presence from the scene - /// - /// - /// null if there is no scene presence with the given agent id - /// true if there was a scene presence with the given id, false otherwise. - public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence); - - #endregion - - /// - /// - /// - /// - public virtual RegionInfo RegionInfo { get; private set; } - - #region admin stuff - - public abstract void OtherRegionUp(GridRegion otherRegion); - - public virtual string GetSimulatorVersion() - { - return "OpenSimulator Server"; - } - - #endregion - - #region Shutdown - - /// - /// Tidy before shutdown - /// - public virtual void Close() - { - try - { - EventManager.TriggerShutdown(); - } - catch (Exception e) - { - m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e)); - } - } - - #endregion - - /// - /// Returns a new unallocated local ID - /// - /// A brand new local ID - public uint AllocateLocalId() - { - uint myID; - - _primAllocateMutex.WaitOne(); - myID = ++m_lastAllocatedLocalId; - _primAllocateMutex.ReleaseMutex(); - - return myID; - } - - public uint AllocatePresenceLocalId() - { - uint myID; - - _primAllocateMutex.WaitOne(); - myID = ++m_lastAllocatedLocalId; - ++m_lastAllocatedLocalId; - _primAllocateMutex.ReleaseMutex(); - - return myID; - } - - #region Module Methods - - /// - /// Add a region-module to this scene. TODO: This will replace AddModule in the future. - /// - /// - /// - public void AddRegionModule(string name, IRegionModuleBase module) - { - if (!RegionModules.ContainsKey(name)) - { - RegionModules.Add(name, module); - } - } - - public void RemoveRegionModule(string name) - { - RegionModules.Remove(name); - } - - /// - /// Register a module commander. - /// - /// - public void RegisterModuleCommander(ICommander commander) - { - lock (m_moduleCommanders) - { - m_moduleCommanders.Add(commander.Name, commander); - } - } - - /// - /// Unregister a module commander and all its commands - /// - /// - public void UnregisterModuleCommander(string name) - { - lock (m_moduleCommanders) - { - ICommander commander; - if (m_moduleCommanders.TryGetValue(name, out commander)) - m_moduleCommanders.Remove(name); - } - } - - /// - /// Get a module commander - /// - /// - /// The module commander, null if no module commander with that name was found - public ICommander GetCommander(string name) - { - lock (m_moduleCommanders) - { - if (m_moduleCommanders.ContainsKey(name)) - return m_moduleCommanders[name]; - } - - return null; - } - - public Dictionary GetCommanders() - { - return m_moduleCommanders; - } - - /// - /// Register an interface to a region module. This allows module methods to be called directly as - /// well as via events. If there is already a module registered for this interface, it is not replaced - /// (is this the best behaviour?) - /// - /// - public void RegisterModuleInterface(M mod) - { -// m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M)); - - List l = null; - if (!ModuleInterfaces.TryGetValue(typeof(M), out l)) - { - l = new List(); - ModuleInterfaces.Add(typeof(M), l); - } - - if (l.Count > 0) - return; - - l.Add(mod); - - if (mod is IEntityCreator) - { - IEntityCreator entityCreator = (IEntityCreator)mod; - foreach (PCode pcode in entityCreator.CreationCapabilities) - { - m_entityCreators[pcode] = entityCreator; - } - } - } - - public void UnregisterModuleInterface(M mod) - { - List l; - if (ModuleInterfaces.TryGetValue(typeof(M), out l)) - { - if (l.Remove(mod)) - { - if (mod is IEntityCreator) - { - IEntityCreator entityCreator = (IEntityCreator)mod; - foreach (PCode pcode in entityCreator.CreationCapabilities) - { - m_entityCreators[pcode] = null; - } - } - } - } - } - - public void StackModuleInterface(M mod) - { - List l; - if (ModuleInterfaces.ContainsKey(typeof(M))) - l = ModuleInterfaces[typeof(M)]; - else - l = new List(); - - if (l.Contains(mod)) - return; - - l.Add(mod); - - if (mod is IEntityCreator) - { - IEntityCreator entityCreator = (IEntityCreator)mod; - foreach (PCode pcode in entityCreator.CreationCapabilities) - { - m_entityCreators[pcode] = entityCreator; - } - } - - ModuleInterfaces[typeof(M)] = l; - } - - /// - /// For the given interface, retrieve the region module which implements it. - /// - /// null if there is no registered module implementing that interface - public T RequestModuleInterface() - { - if (ModuleInterfaces.ContainsKey(typeof(T)) && - (ModuleInterfaces[typeof(T)].Count > 0)) - return (T)ModuleInterfaces[typeof(T)][0]; - else - return default(T); - } - - /// - /// For the given interface, retrieve an array of region modules that implement it. - /// - /// an empty array if there are no registered modules implementing that interface - public T[] RequestModuleInterfaces() - { - if (ModuleInterfaces.ContainsKey(typeof(T))) - { - List ret = new List(); - - foreach (Object o in ModuleInterfaces[typeof(T)]) - ret.Add((T)o); - return ret.ToArray(); - } - else - { - return new T[] {}; - } - } - - #endregion - - /// - /// Call this from a region module to add a command to the OpenSim console. - /// - /// - /// - /// - /// - /// - public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) - { - AddCommand(module, command, shorthelp, longhelp, string.Empty, callback); - } - - /// - /// Call this from a region module to add a command to the OpenSim console. - /// - /// - /// The use of IRegionModuleBase is a cheap trick to get a different method signature, - /// though all new modules should be using interfaces descended from IRegionModuleBase anyway. - /// - /// - /// Category of the command. This is the section under which it will appear when the user asks for help - /// - /// - /// - /// - /// - public void AddCommand( - string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) - { - AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback); - } - - /// - /// Call this from a region module to add a command to the OpenSim console. - /// - /// - /// - /// - /// - /// - /// - public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) - { - string moduleName = ""; - - if (module != null) - moduleName = module.Name; - - AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback); - } - - /// - /// Call this from a region module to add a command to the OpenSim console. - /// - /// - /// Category of the command. This is the section under which it will appear when the user asks for help - /// - /// - /// - /// - /// - /// - /// - public void AddCommand( - string category, IRegionModuleBase module, string command, - string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) - { - if (MainConsole.Instance == null) - return; - - bool shared = false; - - if (module != null) - shared = module is ISharedRegionModule; - - MainConsole.Instance.Commands.AddCommand( - category, shared, command, shorthelp, longhelp, descriptivehelp, callback); - } - - public virtual ISceneObject DeserializeObject(string representation) - { - return null; - } - - public virtual bool AllowScriptCrossings - { - get { return false; } - } - - public virtual void Start() - { - } - - public void Restart() - { - // This has to be here to fire the event - restart handlerPhysicsCrash = OnRestart; - if (handlerPhysicsCrash != null) - handlerPhysicsCrash(RegionInfo); - } - - public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep); - } -} ->>>>>>> avn/ubitvar diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 3f6a7f8390..c9c88d301b 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1928,7 +1928,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroupsByLocalPartID[part.LocalId] = parentGroup; } */ - parentGroup.AdjustChildPrimPermissions(); + parentGroup.AdjustChildPrimPermissions(false); parentGroup.HasGroupChanged = true; parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true); parentGroup.ScheduleGroupForFullUpdate(); @@ -2066,7 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes // return unless the root is deleted. This will remove them // from the database. They will be rewritten immediately, // minus the rows for the unlinked child prims. - g.AdjustChildPrimPermissions(); + g.AdjustChildPrimPermissions(false); m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID); g.TriggerScriptChangedEvent(Changed.LINK); g.HasGroupChanged = true; // Persist @@ -2154,13 +2154,8 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentScene.Permissions.CanDuplicateObject( original.PrimCount, original.UUID, AgentID, original.AbsolutePosition)) { -<<<<<<< HEAD - m_log.WarnFormat( - "[SCENEGRAPH]: Attempt to duplicate nonexistent prim id {0} by {1}", originalPrimID, AgentID); -======= SceneObjectGroup copy = original.Copy(true); copy.AbsolutePosition = copy.AbsolutePosition + offset; ->>>>>>> avn/ubitvar if (original.OwnerID != AgentID) { @@ -2197,63 +2192,12 @@ namespace OpenSim.Region.Framework.Scenes // PROBABLE END OF FIXME -<<<<<<< HEAD - // FIXME: This section needs to be refactored so that it just calls AddSceneObject() - Entities.Add(copy); - - lock (SceneObjectGroupsByFullID) - SceneObjectGroupsByFullID[copy.UUID] = copy; - - SceneObjectPart[] children = copy.Parts; - - lock (SceneObjectGroupsByFullPartID) - { - SceneObjectGroupsByFullPartID[copy.UUID] = copy; - foreach (SceneObjectPart part in children) - SceneObjectGroupsByFullPartID[part.UUID] = copy; - } - - lock (SceneObjectGroupsByLocalPartID) - { - SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; - foreach (SceneObjectPart part in children) - SceneObjectGroupsByLocalPartID[part.LocalId] = copy; - } - // PROBABLE END OF FIXME - - // Since we copy from a source group that is in selected - // state, but the copy is shown deselected in the viewer, - // We need to clear the selection flag here, else that - // prim never gets persisted at all. The client doesn't - // think it's selected, so it will never send a deselect... - copy.IsSelected = false; - - m_numTotalPrim += copy.Parts.Length; - - // Go through all parts (primitives and meshes) of this Scene Object - foreach (SceneObjectPart part in copy.Parts) - { - // Keep track of the total number of meshes or geometric primitives now in the scene; - // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to - // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives - if (part.GetPrimType() == PrimType.SCULPT) - m_numMesh++; - else - m_numPrim++; - } - - if (rot != Quaternion.Identity) - { - copy.UpdateGroupRotationR(rot); - } -======= // Since we copy from a source group that is in selected // state, but the copy is shown deselected in the viewer, // We need to clear the selection flag here, else that // prim never gets persisted at all. The client doesn't // think it's selected, so it will never send a deselect... copy.IsSelected = false; ->>>>>>> avn/ubitvar m_numPrim += copy.Parts.Length; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 79de6c0ff8..98617d196b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -266,15 +266,12 @@ namespace OpenSim.Region.Framework.Scenes for (int i = 0; i < parts.Length; i++) { SceneObjectPart part = parts[i]; -<<<<<<< HEAD -// m_log.DebugFormat("[SCENE OBJECT GROUP INVENTORY]: Effective perms of {0} are {1}", part.Name, (OpenMetaverse.PermissionMask)part.OwnerMask); - ownerMask &= part.OwnerMask; -======= + if (useBase) ownerMask &= part.BaseMask; else ownerMask &= part.OwnerMask; ->>>>>>> avn/ubitvar + perms &= part.Inventory.MaskEffectivePermissions(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a703377de0..5e1801a8ac 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -122,17 +122,12 @@ namespace OpenSim.Region.Framework.Scenes /// since the group's last persistent backup /// private bool m_hasGroupChanged = false; -<<<<<<< HEAD - private long timeFirstChanged; - private long timeLastChanged; -======= private long timeFirstChanged = 0; private long timeLastChanged = 0; private long m_maxPersistTime = 0; private long m_minPersistTime = 0; // private Random m_rand; private List m_linkedAvatars = new List(); ->>>>>>> avn/ubitvar /// /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage @@ -205,7 +200,6 @@ namespace OpenSim.Region.Framework.Scenes /// the prims in the database still use the old SceneGroupID. That's a problem if the group /// is deleted, because we delete groups by searching for prims by their SceneGroupID. /// -<<<<<<< HEAD public bool GroupContainsForeignPrims { private set @@ -218,9 +212,7 @@ namespace OpenSim.Region.Framework.Scenes get { return m_groupContainsForeignPrims; } } -======= public bool HasGroupChangedDueToDelink { get; set; } ->>>>>>> avn/ubitvar private bool isTimeToPersist() { @@ -350,7 +342,6 @@ namespace OpenSim.Region.Framework.Scenes get { return RootPart.VolumeDetectActive; } } -<<<<<<< HEAD private Vector3 lastPhysGroupPos; private Quaternion lastPhysGroupRot; @@ -358,9 +349,8 @@ namespace OpenSim.Region.Framework.Scenes /// Is this entity set to be saved in persistent storage? /// public bool Backup { get; private set; } -======= + private bool m_isBackedUp; ->>>>>>> avn/ubitvar public bool IsBackedUp { @@ -570,146 +560,11 @@ namespace OpenSim.Region.Framework.Scenes && !Scene.LoadingPrims ) { -<<<<<<< HEAD - if ( - !Scene.PositionIsInCurrentRegion(val) - && !IsAttachmentCheckFull() - && (!Scene.LoadingPrims) - ) - { - IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface(); - string version = String.Empty; - Vector3 newpos = Vector3.Zero; - string failureReason = String.Empty; - OpenSim.Services.Interfaces.GridRegion destination = null; - - if (m_rootPart.KeyframeMotion != null) - m_rootPart.KeyframeMotion.StartCrossingCheck(); - - bool canCross = true; - foreach (ScenePresence av in GetSittingAvatars()) - { - // We need to cross these agents. First, let's find - // out if any of them can't cross for some reason. - // We have to deny the crossing entirely if any - // of them are banned. Alternatively, we could - // unsit banned agents.... - - - // We set the avatar position as being the object - // position to get the region to send to - if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out version, out newpos, out failureReason)) == null) - { - canCross = false; - break; - } - - m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); - } - - if (canCross) - { - // We unparent the SP quietly so that it won't - // be made to stand up - - List avsToCross = new List(); - - foreach (ScenePresence av in GetSittingAvatars()) - { - avtocrossInfo avinfo = new avtocrossInfo(); - SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID); - if (parentPart != null) - av.ParentUUID = parentPart.UUID; - - avinfo.av = av; - avinfo.ParentID = av.ParentID; - avsToCross.Add(avinfo); - - av.PrevSitOffset = av.OffsetPosition; - av.ParentID = 0; - } - - m_scene.CrossPrimGroupIntoNewRegion(val, this, true); - - // Normalize - if (val.X >= m_scene.RegionInfo.RegionSizeX) - val.X -= m_scene.RegionInfo.RegionSizeX; - if (val.Y >= m_scene.RegionInfo.RegionSizeY) - val.Y -= m_scene.RegionInfo.RegionSizeY; - if (val.X < 0) - val.X += m_scene.RegionInfo.RegionSizeX; - if (val.Y < 0) - val.Y += m_scene.RegionInfo.RegionSizeY; - - // If it's deleted, crossing was successful - if (IsDeleted) - { - foreach (avtocrossInfo avinfo in avsToCross) - { - ScenePresence av = avinfo.av; - if (!av.IsInTransit) // just in case... - { - m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); - - av.IsInTransit = true; - - // A temporary measure to allow regression tests to work. - // Quite possibly, all BeginInvoke() calls should be replaced by Util.FireAndForget - // or similar since BeginInvoke() always uses the system threadpool to launch - // threads rather than any replace threadpool that we might be using. - if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) - { - entityTransfer.CrossAgentToNewRegionAsync(av, val, destination, av.Flying, version); - CrossAgentToNewRegionCompleted(av); - } - else - { - CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; - d.BeginInvoke( - av, val, destination, av.Flying, version, - ar => CrossAgentToNewRegionCompleted(d.EndInvoke(ar)), null); - } - } - else - { - m_log.DebugFormat("[SCENE OBJECT]: Not crossing avatar {0} to {1} because it's already in transit", av.Name, val); - } - } - - return; - } - else // cross failed, put avas back ?? - { - foreach (avtocrossInfo avinfo in avsToCross) - { - ScenePresence av = avinfo.av; - av.ParentUUID = UUID.Zero; - av.ParentID = avinfo.ParentID; - } - } - } - else - { - if (m_rootPart.KeyframeMotion != null) - m_rootPart.KeyframeMotion.CrossingFailure(); - - if (RootPart.PhysActor != null) - { - RootPart.PhysActor.CrossingFailure(); - } - } - - Vector3 oldp = AbsolutePosition; - val.X = Util.Clamp(oldp.X, 0.5f, (float)m_scene.RegionInfo.RegionSizeX - 0.5f); - val.Y = Util.Clamp(oldp.Y, 0.5f, (float)m_scene.RegionInfo.RegionSizeY - 0.5f); - val.Z = Util.Clamp(oldp.Z, 0.5f, Constants.RegionHeight); -======= if (!inTransit) { inTransit = true; SOGCrossDelegate d = CrossAsync; d.BeginInvoke(this, val, CrossAsyncCompleted, d); ->>>>>>> avn/ubitvar } return; } @@ -1200,7 +1055,7 @@ namespace OpenSim.Region.Framework.Scenes /// No avatar should appear more than once in this list. /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. /// - protected internal List m_sittingAvatars = new List(); + protected internal List m_sittingAvatars = new List(); #endregion @@ -1311,14 +1166,10 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void AttachToBackup() { -<<<<<<< HEAD - if (CanBeBackedUp) -======= if (IsAttachment) return; m_scene.SceneGraph.FireAttachToBackup(this); - if (InSceneBackup) ->>>>>>> avn/ubitvar +// if (InSceneBackup) { // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID); @@ -1431,21 +1282,12 @@ namespace OpenSim.Region.Framework.Scenes /// public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) { -<<<<<<< HEAD - maxX = -256f; - maxY = -256f; - maxZ = -256f; - minX = 10000f; - minY = 10000f; - minZ = 10000f; -======= maxX = float.MinValue; maxY = float.MinValue; maxZ = float.MinValue; minX = float.MaxValue; minY = float.MaxValue; minZ = float.MaxValue; ->>>>>>> avn/ubitvar SceneObjectPart[] parts = m_parts.GetArray(); foreach (SceneObjectPart part in parts) @@ -1843,17 +1685,6 @@ namespace OpenSim.Region.Framework.Scenes } } -<<<<<<< HEAD - - /// - /// - /// - /// - private void SetPartAsNonRoot(SceneObjectPart part) - { - part.ParentID = m_rootPart.LocalId; - part.ClearUndoState(); -======= /// /// Add the avatar to this linkset (avatar is sat). /// @@ -1893,7 +1724,6 @@ namespace OpenSim.Region.Framework.Scenes public List GetLinkedAvatars() { return m_linkedAvatars; ->>>>>>> avn/ubitvar } /// @@ -2197,14 +2027,7 @@ namespace OpenSim.Region.Framework.Scenes if (Scene != null) { -<<<<<<< HEAD - if (!sp.IsChildAgent && sp.ParentID == part.LocalId) - sp.StandUp(); - - if (!silent) -======= Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) ->>>>>>> avn/ubitvar { if (avatar.ParentID == LocalId) avatar.StandUp(); @@ -2504,16 +2327,6 @@ namespace OpenSim.Region.Framework.Scenes /// public SceneObjectGroup Copy(bool userExposed) { -<<<<<<< HEAD - // FIXME: This is dangerous since it's easy to forget to reset some references when necessary and end up - // with bugs that only occur in some circumstances (e.g. crossing between regions on the same simulator - // but not between regions on different simulators). Really, all copying should be done explicitly. - SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); - - dupe.Backup = false; - dupe.m_parts = new MapAndArray(); - dupe.m_sittingAvatars = new List(); -======= m_dupeInProgress = true; SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); dupe.m_isBackedUp = false; @@ -2525,7 +2338,6 @@ namespace OpenSim.Region.Framework.Scenes dupe.m_linkedAvatars = new List(); dupe.m_sittingAvatars = new List(); ->>>>>>> avn/ubitvar dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; @@ -2700,12 +2512,8 @@ namespace OpenSim.Region.Framework.Scenes return RootPart.Torque; } -<<<<<<< HEAD - public void MoveToTarget(Vector3 target, float tau) -======= // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object - public void moveToTarget(Vector3 target, float tau) ->>>>>>> avn/ubitvar + public void MoveToTarget(Vector3 target, float tau) { if (IsAttachment) { @@ -2732,21 +2540,7 @@ namespace OpenSim.Region.Framework.Scenes if (IsAttachment) { ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); -<<<<<<< HEAD - if (avatar != null) - avatar.ResetMoveToTarget(); - } - else - { - PhysicsActor pa = RootPart.PhysActor; - - if (pa != null && pa.PIDActive) - { - pa.PIDActive = false; - - ScheduleGroupForTerseUpdate(); -======= if (avatar != null) { avatar.ResetMoveToTarget(); @@ -2786,7 +2580,6 @@ namespace OpenSim.Region.Framework.Scenes rootpart.PhysActor.APIDDamping = damping; rootpart.PhysActor.APIDActive = true; } ->>>>>>> avn/ubitvar } } } @@ -3484,18 +3277,6 @@ namespace OpenSim.Region.Framework.Scenes linkPart.Rezzed = RootPart.Rezzed; -<<<<<<< HEAD - // We must persist the delinked group to the database immediately, for safety. The problem - // is that although in memory the new group has a new SceneGroupID, in the database it - // still has the parent group's SceneGroupID (until the next backup). This means that if the - // parent group is deleted then the delinked group will also be deleted from the database. - // This problem will disappear if the region remains alive long enough for another backup, - // since at that time the delinked group's new SceneGroupID will be written to the database. - // But if the region crashes before that then the prims will be permanently gone, and this must - // not happen. (We can't use a just-in-time trick like GroupContainsForeignPrims in this case - // because the delinked group doesn't know when the source group is deleted.) - m_scene.ForceSceneObjectBackup(objectGroup); -======= // When we delete a group, we currently have to force persist to the database if the object id has changed // (since delete works by deleting all rows which have a given object id) @@ -3507,7 +3288,6 @@ namespace OpenSim.Region.Framework.Scenes m_rootPart.PhysActor.Building = false; objectGroup.HasGroupChangedDueToDelink = true; ->>>>>>> avn/ubitvar if (sendEvents) linkPart.TriggerScriptChangedEvent(Changed.LINK); @@ -3521,13 +3301,9 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void DetachFromBackup() { -<<<<<<< HEAD - if (Backup && Scene != null) -======= if (m_scene != null) m_scene.SceneGraph.FireDetachFromBackup(this); if (m_isBackedUp && Scene != null) ->>>>>>> avn/ubitvar m_scene.EventManager.OnBackup -= ProcessBackup; Backup = false; @@ -3973,9 +3749,6 @@ namespace OpenSim.Region.Framework.Scenes { RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF); -<<<<<<< HEAD - AdjustChildPrimPermissions(Scene.Permissions.IsGod(AgentID)); -======= bool god = Scene.Permissions.IsGod(AgentID); if (field == 1 && god) @@ -3986,8 +3759,7 @@ namespace OpenSim.Region.Framework.Scenes }); } - AdjustChildPrimPermissions(); ->>>>>>> avn/ubitvar + AdjustChildPrimPermissions(false); if (field == 1 && god) // Base mask was set. Update all child part inventories { @@ -5037,10 +4809,10 @@ namespace OpenSim.Region.Framework.Scenes /// down after it move one place down the list. /// /// A list of the sitting avatars. Returns an empty list if there are no sitting avatars. - public List GetSittingAvatars() + public List GetSittingAvatars() { lock (m_sittingAvatars) - return new List(m_sittingAvatars); + return new List(m_sittingAvatars); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 1cfa8ed62b..c300b9603d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1046,39 +1046,22 @@ namespace OpenSim.Region.Framework.Scenes } set { -<<<<<<< HEAD if (Util.IsNanOrInfinity(value)) m_angularVelocity = Vector3.Zero; else m_angularVelocity = value; - PhysicsActor actor = PhysActor; - if ((actor != null) && actor.IsPhysical) - actor.RotationalVelocity = m_angularVelocity; -======= - m_angularVelocity = value; PhysicsActor actor = PhysActor; if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE) { actor.RotationalVelocity = m_angularVelocity; } ->>>>>>> avn/ubitvar } } /// public Vector3 Acceleration { -<<<<<<< HEAD - get { return m_acceleration; } - set - { - if (Util.IsNanOrInfinity(value)) - m_acceleration = Vector3.Zero; - else - m_acceleration = value; - } -======= get { PhysicsActor actor = PhysActor; @@ -1088,9 +1071,14 @@ namespace OpenSim.Region.Framework.Scenes } return m_acceleration; } - - set { m_acceleration = value; } ->>>>>>> avn/ubitvar + + set + { + if (Util.IsNanOrInfinity(value)) + m_acceleration = Vector3.Zero; + else + m_acceleration = value; + } } public string Description { get; set; } @@ -1431,7 +1419,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// null if there are no sitting avatars. This is to save us create a hashset for every prim in a scene. /// - private HashSet m_sittingAvatars; + private HashSet m_sittingAvatars; public virtual UUID RegionID { @@ -1932,7 +1920,6 @@ namespace OpenSim.Region.Framework.Scenes public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) { -<<<<<<< HEAD byte[] data; if (pTexAnim.Flags == Primitive.TextureAnimMode.ANIM_OFF) @@ -1944,13 +1931,6 @@ namespace OpenSim.Region.Framework.Scenes data = new byte[16]; int pos = 0; -======= - if (((int)pTexAnim.Flags & 1) != 0) // ANIM_ON - { - byte[] data = new byte[16]; - int pos = 0; - ->>>>>>> avn/ubitvar // The flags don't like conversion from uint to byte, so we have to do // it the crappy way. See the above function :( @@ -1962,17 +1942,9 @@ namespace OpenSim.Region.Framework.Scenes Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); -<<<<<<< HEAD - } -======= ->>>>>>> avn/ubitvar - - m_TextureAnimation = data; - } - else - { - m_TextureAnimation = Utils.EmptyBytes; + } + m_TextureAnimation = data; } public void AdjustSoundGain(double volume) @@ -2240,7 +2212,7 @@ namespace OpenSim.Region.Framework.Scenes Array.Copy(Shape.ExtraParams, extraP, extraP.Length); dupe.Shape.ExtraParams = extraP; - dupe.m_sittingAvatars = new HashSet(); + dupe.m_sittingAvatars = new HashSet(); // safeguard actual copy is done in sog.copy dupe.KeyframeMotion = null; @@ -2829,7 +2801,7 @@ namespace OpenSim.Region.Framework.Scenes CollidingMessage = CreateColliderArgs(this, colliders); if (CollidingMessage.Colliders.Count > 0) - DoNotify(notify, LocalId, CollidingMessage); + notify(LocalId, CollidingMessage); if (PassCollisions) sendToRoot = true; @@ -2843,7 +2815,7 @@ namespace OpenSim.Region.Framework.Scenes { CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders); if (CollidingMessage.Colliders.Count > 0) - DoNotify(notify, ParentGroup.RootPart.LocalId, CollidingMessage); + notify(ParentGroup.RootPart.LocalId, CollidingMessage); } } } @@ -2858,35 +2830,6 @@ namespace OpenSim.Region.Framework.Scenes colliding.Add(CreateDetObjectForGround()); LandCollidingMessage.Colliders = colliding; -<<<<<<< HEAD - DoNotify(notify, LocalId, LandCollidingMessage); - } - } - - private void DoNotify(ScriptCollidingNotification notify, uint id, ColliderArgs collargs) - { - if (m_parentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.ShouldUseFireAndForgetForCollisions) - { - // For those learning C#, FireAndForget takes a function, an object to pass - // to that function and an ID string. The "oo => {}" construct is a lambda expression - // for a function with one arguement ('oo'). The 'new Object[] {}" construct creates an Object - // that is an object array and initializes it with three items (the parameters - // being passed). The parameters passed are the function to call ('notify') and - // its two arguements. Finally, once in the function (called later by the FireAndForget - // thread scheduler), the passed object is cast to an object array and then each - // of its items (aoo[0] to aoo[2]) are individually cast to what they are and - // then used in a call of the passed ScriptCollidingNotification function. - Util.FireAndForget(oo => - { - Object[] aoo = (Object[])oo; - ((ScriptCollidingNotification)aoo[0])((uint)aoo[1], (ColliderArgs)aoo[2]); - - }, new Object[] { notify, id, collargs }, "SOP.Collision"); - } - else - { - notify(id, collargs); -======= if (Inventory.ContainsScripts()) { if (!PassCollisions) @@ -2898,7 +2841,6 @@ namespace OpenSim.Region.Framework.Scenes if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot) { notify(ParentGroup.RootPart.LocalId, LandCollidingMessage); ->>>>>>> avn/ubitvar } } @@ -3046,12 +2988,7 @@ namespace OpenSim.Region.Framework.Scenes if (pa != null) { -<<<<<<< HEAD Vector3 newpos = pa.Position; -======= - Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0); - ->>>>>>> avn/ubitvar if (!ParentGroup.Scene.PositionIsInCurrentRegion(newpos)) { // Setting position outside current region will start region crossing @@ -3996,14 +3933,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter public void StopMoveToTarget() { -<<<<<<< HEAD ParentGroup.StopMoveToTarget(); -======= - ParentGroup.stopMoveToTarget(); - -// ParentGroup.ScheduleGroupForTerseUpdate(); - //ParentGroup.ScheduleGroupForFullUpdate(); ->>>>>>> avn/ubitvar } public void StoreUndoState(ObjectChangeType change) @@ -4665,8 +4595,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter public void ClonePermissions(SceneObjectPart source) { - bool update = false; - uint prevOwnerMask = OwnerMask; uint prevGroupMask = GroupMask; uint prevEveryoneMask = EveryoneMask; @@ -4851,12 +4779,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter } else // it already has a physical representation { -<<<<<<< HEAD - pa.SetMaterial(Material); - pa.Position = GetWorldPosition(); - pa.Orientation = GetWorldRotation(); - DoPhysicsPropertyUpdate(UsePhysics, true); -======= + DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. /* moved into DoPhysicsPropertyUpdate if(VolumeDetectActive) @@ -4864,7 +4787,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter else pa.SetVolumeDetect(0); */ ->>>>>>> avn/ubitvar if (pa.Building != building) pa.Building = building; @@ -5621,19 +5543,19 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter /// true if the avatar was not already recorded, false otherwise. /// /// - protected internal bool AddSittingAvatar(ScenePresence sp) + protected internal bool AddSittingAvatar(UUID id) { lock (ParentGroup.m_sittingAvatars) { if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) - SitTargetAvatar = sp.UUID; + SitTargetAvatar = id; if (m_sittingAvatars == null) - m_sittingAvatars = new HashSet(); + m_sittingAvatars = new HashSet(); - if (m_sittingAvatars.Add(sp)) + if (m_sittingAvatars.Add(id)) { - ParentGroup.m_sittingAvatars.Add(sp); + ParentGroup.m_sittingAvatars.Add(id); return true; } @@ -5650,22 +5572,22 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter /// true if the avatar was present and removed, false if it was not present. /// /// - protected internal bool RemoveSittingAvatar(ScenePresence sp) + protected internal bool RemoveSittingAvatar(UUID id) { lock (ParentGroup.m_sittingAvatars) { - if (SitTargetAvatar == sp.UUID) + if (SitTargetAvatar == id) SitTargetAvatar = UUID.Zero; if (m_sittingAvatars == null) return false; - if (m_sittingAvatars.Remove(sp)) + if (m_sittingAvatars.Remove(id)) { if (m_sittingAvatars.Count == 0) m_sittingAvatars = null; - ParentGroup.m_sittingAvatars.Remove(sp); + ParentGroup.m_sittingAvatars.Remove(id); return true; } @@ -5679,14 +5601,14 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter /// /// This applies to all sitting avatars whether there is a sit target set or not. /// A hashset of the sitting avatars. Returns null if there are no sitting avatars. - public HashSet GetSittingAvatars() + public HashSet GetSittingAvatars() { lock (ParentGroup.m_sittingAvatars) { if (m_sittingAvatars == null) return null; else - return new HashSet(m_sittingAvatars); + return new HashSet(m_sittingAvatars); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 7af0b202c0..5811ed93ca 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -892,16 +892,8 @@ namespace OpenSim.Region.Framework.Scenes offsetHeight = 0; return false; } -<<<<<<< HEAD - - Vector3 bbox; - float offsetHeight; - - m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); -======= bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); ->>>>>>> avn/ubitvar for (int i = 0; i < objlist.Count; i++) { @@ -1068,12 +1060,7 @@ namespace OpenSim.Region.Framework.Scenes m_items.LockItemsForRead(false); if (type == 10) // Script { -<<<<<<< HEAD - // route it through here, to handle script cleanup tasks - RemoveScriptInstance(itemID, false); -======= m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); ->>>>>>> avn/ubitvar } m_items.LockItemsForWrite(true); m_items.Remove(itemID); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4bccb7d7bc..022a90d583 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -299,6 +299,7 @@ namespace OpenSim.Region.Framework.Scenes // private int m_lastColCount = -1; //KF: Look for Collision chnages // private int m_updateCount = 0; //KF: Update Anims for a while // private static readonly int UPDATE_COUNT = 10; // how many frames to update for + private List m_lastColliders = new List(); private TeleportFlags m_teleportFlags; public TeleportFlags TeleportFlags @@ -361,6 +362,9 @@ namespace OpenSim.Region.Framework.Scenes //private int m_moveToPositionStateStatus; //***************************************************** + private bool m_collisionEventFlag = false; + private object m_collisionEventLock = new Object(); + private int m_movementAnimationUpdateCounter = 0; public Vector3 PrevSitOffset { get; set; } @@ -377,7 +381,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public bool SentInitialDataToClient { get; private set; } /// /// Copy of the script states while the agent is in transit. This state may @@ -437,12 +440,6 @@ namespace OpenSim.Region.Framework.Scenes /// private object m_originRegionIDAccessLock = new object(); - /// - /// Triggered on entity transfer after to allow CompleteMovement() to proceed after we have received an - /// UpdateAgent from the originating region.ddkjjkj - /// - private AutoResetEvent m_updateAgentReceivedAfterTransferEvent = new AutoResetEvent(false); - /// /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent /// teleport is reusing the connection. @@ -469,11 +466,6 @@ namespace OpenSim.Region.Framework.Scenes /// public uint MovementFlag { get; private set; } - /// - /// Set this if we need to force a movement update on the next received AgentUpdate from the viewer. - /// - private const uint ForceUpdateMovementFlagValue = uint.MaxValue; - /// /// Is the agent stop control flag currently active? /// @@ -653,12 +645,6 @@ namespace OpenSim.Region.Framework.Scenes // in the sim unless the avatar is on a sit target. While // on a sit target, m_pos will contain the desired offset // without the parent rotation applied. -<<<<<<< HEAD - SceneObjectPart sitPart = ParentPart; - - if (sitPart != null) - return sitPart.ParentGroup.AbsolutePosition + (m_pos * sitPart.GetWorldRotation()); -======= if (ParentPart != null) { SceneObjectPart rootPart = ParentPart.ParentGroup.RootPart; @@ -667,7 +653,6 @@ namespace OpenSim.Region.Framework.Scenes if (rootPart != null) return rootPart.AbsolutePosition + (m_pos * rootPart.GetWorldRotation()); } ->>>>>>> avn/ubitvar } return m_pos; @@ -721,11 +706,8 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Velocity of the avatar with respect to its local reference frame. + /// Current velocity of the avatar. /// - /// - /// So when sat on a vehicle this will be 0. To get velocity with respect to the world use GetWorldVelocity() - /// public override Vector3 Velocity { get @@ -738,21 +720,12 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", // m_velocity, Name, Scene.RegionInfo.RegionName); } -// else if (ParentPart != null) -// { -// return ParentPart.ParentGroup.Velocity; -// } return m_velocity; } set { -// Util.PrintCallStack(); -// m_log.DebugFormat( -// "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}", -// Scene.RegionInfo.RegionName, Name, value); - if (PhysicsActor != null) { try @@ -765,7 +738,11 @@ namespace OpenSim.Region.Framework.Scenes } } - m_velocity = value; + m_velocity = value; + +// m_log.DebugFormat( +// "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}", +// Scene.RegionInfo.RegionName, Name, m_velocity); } } @@ -849,15 +826,21 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Get rotation relative to the world. + /// Gets the world rotation of this presence. /// + /// + /// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not. + /// /// public Quaternion GetWorldRotation() { - SceneObjectPart sitPart = ParentPart; + if (IsSatOnObject) + { + SceneObjectPart sitPart = ParentPart; - if (sitPart != null) - return sitPart.GetWorldRotation() * Rotation; + if (sitPart != null) + return sitPart.GetWorldRotation() * Rotation; + } return Rotation; } @@ -924,7 +907,7 @@ no information to check this } private bool m_mouseLook; -// private bool m_leftButtonDown; + private bool m_leftButtonDown; private bool m_inTransit; @@ -991,12 +974,7 @@ no information to check this { get { return Util.GetViewerName(m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode)); } } - - /// - /// Count of how many terse updates we have sent out. It doesn't matter if this overflows. - /// - private int m_terseUpdateCount; - + #endregion #region Constructor(s) @@ -1012,8 +990,7 @@ no information to check this Animator = new ScenePresenceAnimator(this); Overrides = new MovementAnimationOverrides(); PresenceType = type; - // DrawDistance = world.DefaultDrawDistance; - DrawDistance = Constants.RegionSize; + DrawDistance = world.DefaultDrawDistance; RegionHandle = world.RegionInfo.RegionHandle; ControllingClient = client; Firstname = ControllingClient.FirstName; @@ -1021,7 +998,7 @@ no information to check this m_name = String.Format("{0} {1}", Firstname, Lastname); m_scene = world; m_uuid = client.AgentId; - LocalId = m_scene.AllocatePresenceLocalId(); + LocalId = m_scene.AllocateLocalId(); UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); if (account != null) @@ -1103,21 +1080,6 @@ no information to check this private void SetDirectionVectors() { -<<<<<<< HEAD - Dir_Vectors[0] = Vector3.UnitX; //FORWARD - Dir_Vectors[1] = -Vector3.UnitX; //BACK - Dir_Vectors[2] = Vector3.UnitY; //LEFT - Dir_Vectors[3] = -Vector3.UnitY; //RIGHT - Dir_Vectors[4] = Vector3.UnitZ; //UP - Dir_Vectors[5] = -Vector3.UnitZ; //DOWN - Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE - Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE - Dir_Vectors[8] = new Vector3(0f, 0.5f, 0f); //LEFT_NUDGE - Dir_Vectors[9] = new Vector3(0f, -0.5f, 0f); //RIGHT_NUDGE - Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge - } - -======= Dir_Vectors[0] = new Vector3(AgentControlNormalVel,0,0); //FORWARD Dir_Vectors[1] = new Vector3(-AgentControlNormalVel,0,0);; //BACK Dir_Vectors[2] = new Vector3(0,AgentControlNormalVel,0); //LEFT @@ -1131,27 +1093,6 @@ no information to check this Dir_Vectors[10] = new Vector3(0f, 0f, AgentControlNudgeVel); //UP_Nudge Dir_Vectors[11] = new Vector3(0f, 0f, -AgentControlNudgeVel); //DOWN_Nudge } - -/* dont see any use for this - private Vector3[] GetWalkDirectionVectors() - { - Vector3[] vector = new Vector3[12]; - vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD - vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK - vector[2] = Vector3.UnitY; //LEFT - vector[3] = -Vector3.UnitY; //RIGHT - vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP - vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN - vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE - vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE - vector[8] = Vector3.UnitY; //LEFT_NUDGE - vector[9] = -Vector3.UnitY; //RIGHT_NUDGE - vector[10] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP_NUDGE - vector[11] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE - return vector; - } -*/ ->>>>>>> avn/ubitvar #endregion #region Status Methods @@ -1203,14 +1144,9 @@ no information to check this } else { -<<<<<<< HEAD - part.AddSittingAvatar(this); - // ParentPosition = part.GetWorldPosition(); -======= part.ParentGroup.AddAvatar(UUID); if (part.SitTargetPosition != Vector3.Zero) part.SitTargetAvatar = UUID; ->>>>>>> avn/ubitvar ParentID = part.LocalId; ParentPart = part; m_pos = PrevSitOffset; @@ -1222,8 +1158,6 @@ no information to check this { IsLoggingIn = false; } - - IsChildAgent = false; } m_log.DebugFormat("[MakeRootAgent] out lock: {0}ms", Util.EnvironmentTickCountSubtract(ts)); @@ -1237,7 +1171,7 @@ no information to check this if (gm != null) Grouptitle = gm.GetGroupTitle(m_uuid); -<<<<<<< HEAD + AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode); uint teleportFlags = (aCircuit == null) ? 0 : aCircuit.teleportFlags; if ((teleportFlags & (uint)TeleportFlags.ViaHGLogin) != 0) @@ -1246,75 +1180,18 @@ no information to check this // avatar's name to or from the special Hypergrid format ("First.Last @grid.example.com"). // Unfortunately, due to a viewer bug, viewers don't always show the new name. // But we have a trick that can force them to update the name anyway. - ForceViewersUpdateName(); +// ForceViewersUpdateName(); } -======= + m_log.DebugFormat("[MakeRootAgent] Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); ->>>>>>> avn/ubitvar RegionHandle = m_scene.RegionInfo.RegionHandle; m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); m_log.DebugFormat("[MakeRootAgent] TriggerSetRootAgentScene: {0}ms", Util.EnvironmentTickCountSubtract(ts)); -<<<<<<< HEAD - UUID groupUUID = ControllingClient.ActiveGroupId; - string groupName = string.Empty; - ulong groupPowers = 0; - - // ---------------------------------- - // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status - try - { - if (groupUUID != UUID.Zero && gm != null) - { - GroupRecord record = gm.GetGroupRecord(groupUUID); - if (record != null) - groupName = record.GroupName; - - GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); - - if (groupMembershipData != null) - groupPowers = groupMembershipData.GroupPowers; - } - - ControllingClient.SendAgentDataUpdate( - m_uuid, groupUUID, Firstname, Lastname, groupPowers, groupName, Grouptitle); - } - catch (Exception e) - { - m_log.Error("[AGENTUPDATE]: Error ", e); - } - // ------------------------------------ - if (ParentID == 0) { - // Moved this from SendInitialData to ensure that Appearance is initialized - // before the inventory is processed in MakeRootAgent. This fixes a race condition - // related to the handling of attachments - //m_scene.GetAvatarAppearance(ControllingClient, out Appearance); - - /* RA 20140111: Commented out these TestBorderCross's. - * Not sure why this code is here. It is not checking all the borders - * and 'in region' sanity checking is done in CheckAndAdjustLandingPoint and below. - if (m_scene.TestBorderCross(pos, Cardinals.E)) - { - Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); - pos.X = crossedBorder.BorderLine.Z - 1; - } - - if (m_scene.TestBorderCross(pos, Cardinals.N)) - { - Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); - pos.Y = crossedBorder.BorderLine.Z - 1; - } - */ - -======= - - if (ParentID == 0) - { ->>>>>>> avn/ubitvar CheckAndAdjustLandingPoint(ref pos); if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) @@ -1350,30 +1227,18 @@ no information to check this // if (m_teleportFlags == TeleportFlags.Default) { + Vector3 vel = Velocity; AddToPhysicalScene(isFlying); -// -// Console.WriteLine( -// "Set velocity of {0} in {1} to {2} from input velocity of {3} on MakeRootAgent", -// Name, Scene.Name, PhysicsActor.Velocity, vel); -// } + if (PhysicsActor != null) + PhysicsActor.SetMomentum(vel); } else { AddToPhysicalScene(isFlying); -<<<<<<< HEAD - } - // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a - // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it - // since it requires a physics actor to be present. If it is left any later, then physics appears to reset - // the value to a negative position which does not trigger the border cross. - // This may not be the best location for this. - CheckForBorderCrossing(); -======= // reset camera to avatar pos CameraPosition = pos; } ->>>>>>> avn/ubitvar if (ForceFly) { @@ -1383,40 +1248,6 @@ no information to check this { Flying = false; } -<<<<<<< HEAD - } - - // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying - // avatar to return to the standing position in mid-air. On login it looks like this is being sent - // elsewhere anyway - // Animator.SendAnimPack(); - - m_scene.SwapRootAgentCount(false); - - if (Scene.AttachmentsModule != null) - { - // The initial login scene presence is already root when it gets here - // and it has already rezzed the attachments and started their scripts. - // We do the following only for non-login agents, because their scripts - // haven't started yet. - if (PresenceType == PresenceType.Npc || IsRealLogin(m_teleportFlags)) - { - WorkManager.RunJob( - "RezAttachments", - o => Scene.AttachmentsModule.RezAttachments(this), - null, - string.Format("Rez attachments for {0} in {1}", Name, Scene.Name)); - } - else - { - WorkManager.RunJob( - "StartAttachmentScripts", - o => RestartAttachmentScripts(), - null, - string.Format("Start attachment scripts for {0} in {1}", Name, Scene.Name), - true); - } -======= // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it @@ -1427,28 +1258,16 @@ no information to check this // its not // CheckForBorderCrossing(); ->>>>>>> avn/ubitvar } + m_log.DebugFormat("[MakeRootAgent] position and physical: {0}ms", Util.EnvironmentTickCountSubtract(ts)); m_scene.SwapRootAgentCount(false); -<<<<<<< HEAD - SendAvatarDataToAllClients(); - - // send the animations of the other presences to me - m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) - { - if (presence != this) - presence.Animator.SendAnimPackToClient(ControllingClient); - }); -======= ->>>>>>> avn/ubitvar - // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will // stall on the border crossing since the existing child agent will still have the last movement // recorded, which stops the input from being processed. - MovementFlag = ForceUpdateMovementFlagValue; + MovementFlag = 0; m_scene.EventManager.TriggerOnMakeRootAgent(this); m_log.DebugFormat("[MakeRootAgent] TriggerOnMakeRootAgent and done: {0}ms", Util.EnvironmentTickCountSubtract(ts)); @@ -1500,12 +1319,13 @@ no information to check this /// Group Title. So the following trick makes viewers update the avatar's name by briefly changing /// the group title (to "(Loading)"), and then restoring it. /// +/* public void ForceViewersUpdateName() { m_log.DebugFormat("[SCENE PRESENCE]: Forcing viewers to update the avatar name for " + Name); UseFakeGroupTitle = true; - SendAvatarDataToAllClients(false); + Util.FireAndForget(o => { @@ -1519,7 +1339,7 @@ no information to check this SendAvatarDataToAllClients(false); }, null, "Scenepresence.ForceViewersUpdateName"); } - +*/ public int GetStateSource() { AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID); @@ -1557,11 +1377,6 @@ no information to check this lock (m_originRegionIDAccessLock) m_originRegionID = UUID.Zero; - // Reset the m_originRegionID as it has dual use as a flag to signal that the UpdateAgent() call orignating - // from the source simulator has completed on a V2 teleport. - lock (m_originRegionIDAccessLock) - m_originRegionID = UUID.Zero; - // Reset these so that teleporting in and walking out isn't seen // as teleporting back TeleportFlags = TeleportFlags.Default; @@ -1609,9 +1424,10 @@ no information to check this if (PhysicsActor != null) { // PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; - PhysicsActor.UnSubscribeEvents(); + PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; + PhysicsActor.UnSubscribeEvents(); m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); PhysicsActor = null; } @@ -1649,6 +1465,8 @@ no information to check this else PhysicsActor.SetMomentum(vel); } + + SendTerseUpdateToAllClients(); } public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) @@ -1680,6 +1498,7 @@ no information to check this } } } + SendTerseUpdateToAllClients(); } public void StopFlying() @@ -1915,17 +1734,7 @@ no information to check this public void SetSize(Vector3 size, float feetoffset) { if (PhysicsActor != null && !IsChildAgent) -<<<<<<< HEAD - { - // Eventually there will be a physics call that sets avatar size that includes offset info. - // For the moment, just set the size as passed. - PhysicsActor.Size = size; - // PhysicsActor.setAvatarSize(size, feetoffset); - } -======= PhysicsActor.setAvatarSize(size, feetoffset); - ->>>>>>> avn/ubitvar } private bool WaitForUpdateAgent(IClientAPI client) @@ -1934,13 +1743,23 @@ no information to check this // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination, // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero - m_updateAgentReceivedAfterTransferEvent.WaitOne(10000); - +// m_updateAgentReceivedAfterTransferEvent.WaitOne(10000); + int count = 50; UUID originID = UUID.Zero; lock (m_originRegionIDAccessLock) originID = m_originRegionID; + + while (originID.Equals(UUID.Zero) && count-- > 0) + { + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name); + Thread.Sleep(200); + } + if (originID.Equals(UUID.Zero)) { // Movement into region will fail @@ -1970,40 +1789,6 @@ no information to check this m_inTransit = true; -<<<<<<< HEAD - bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); // Get this ahead of time because IsInTransit modifies 'm_AgentControlFlags' - - IsInTransit = true; - try - { - // Make sure it's not a login agent. We don't want to wait for updates during login - if (!(PresenceType == PresenceType.Npc || IsRealLogin(m_teleportFlags))) - { - // Let's wait until UpdateAgent (called by departing region) is done - if (!WaitForUpdateAgent(client)) - // The sending region never sent the UpdateAgent data, we have to refuse - return; - } - - Vector3 look = Velocity; - - // if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) - if ((Math.Abs(look.X) < 0.1) && (Math.Abs(look.Y) < 0.1) && (Math.Abs(look.Z) < 0.1)) - { - look = new Vector3(0.99f, 0.042f, 0); - } - - // Prevent teleporting to an underground location - // (may crash client otherwise) - // - Vector3 pos = AbsolutePosition; - float ground = m_scene.GetGroundHeight(pos.X, pos.Y); - if (pos.Z < ground + 1.5f) - { - pos.Z = ground + 1.5f; - AbsolutePosition = pos; - } -======= try { // Make sure it's not a login agent. We don't want to wait for updates during login @@ -2019,103 +1804,16 @@ no information to check this m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); ->>>>>>> avn/ubitvar if (!MakeRootAgent(AbsolutePosition, flying)) { m_log.DebugFormat( -<<<<<<< HEAD - "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root", -======= "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root", ->>>>>>> avn/ubitvar Name, Scene.Name); return; } -<<<<<<< HEAD - // Tell the client that we're totally ready - ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); - - // Child agents send initial data up in LLUDPServer.HandleUseCircuitCode() - if (!SentInitialDataToClient) - SendInitialDataToClient(); - - // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); - - if (!string.IsNullOrEmpty(m_callbackURI)) - { - // We cannot sleep here since this would hold up the inbound packet processing thread, as - // CompleteMovement() is executed synchronously. However, it might be better to delay the release - // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete - // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this - // region as the current region, meaning that a close sent before then will fail the teleport. - // System.Threading.Thread.Sleep(2000); - - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", - client.Name, client.AgentId, m_callbackURI); - - Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI); - m_callbackURI = null; - } - // else - // { - // m_log.DebugFormat( - // "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}", - // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); - // } - - ValidateAndSendAppearanceAndAgentData(); - - // Create child agents in neighbouring regions - if (openChildAgents && !IsChildAgent) - { - IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); - if (m_agentTransfer != null) - { - // Note: this call can take a while, because it notifies each of the simulator's neighbours. - // It's important that we don't allow the avatar to cross regions meanwhile, as that will - // cause serious errors. We've prevented that from happening by setting IsInTransit=true. - m_agentTransfer.EnableChildAgents(this); - } - - IFriendsModule friendsModule = m_scene.RequestModuleInterface(); - if (friendsModule != null) - friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); - - } - - // XXX: If we force an update after activity has completed, then multiple attachments do appear correctly on a destination region - // If we do it a little bit earlier (e.g. when converting the child to a root agent) then this does not work. - // This may be due to viewer code or it may be something we're not doing properly simulator side. - WorkManager.RunJob( - "ScheduleAttachmentsForFullUpdate", - o => ScheduleAttachmentsForFullUpdate(), - null, - string.Format("Schedule attachments for full update for {0} in {1}", Name, Scene.Name), - true); - - // m_log.DebugFormat( - // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", - // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); - } - finally - { - IsInTransit = false; - } - } - - private void ScheduleAttachmentsForFullUpdate() - { - lock (m_attachments) - { - foreach (SceneObjectGroup sog in m_attachments) - sog.ScheduleGroupForFullUpdate(); - } - } -======= m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); Vector3 look = Lookat; @@ -2134,7 +1832,7 @@ no information to check this if (!IsChildAgent && !isNPC) { - InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (AssetType)46); + InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); if (cof == null) COF = UUID.Zero; else @@ -2197,9 +1895,6 @@ no information to check this // so sequence is clear // verify baked textures and cache ->>>>>>> avn/ubitvar - - bool cachedbaked = false; if (isNPC) @@ -2484,23 +2179,16 @@ no information to check this // When we get to the point of re-computing neighbors everytime this // changes, then start using the agent's drawdistance rather than the // region's draw distance. -<<<<<<< HEAD - DrawDistance = agentData.Far; - // DrawDistance = Scene.DefaultDrawDistance; -======= DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); -// DrawDistance = Scene.DefaultDrawDistance; ->>>>>>> avn/ubitvar - m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; // FIXME: This does not work as intended because the viewer only sends the lbutton down when the button // is first pressed, not whilst it is held down. If this is required in the future then need to look // for an AGENT_CONTROL_LBUTTON_UP event and make sure to handle cases where an initial DOWN is not // received (e.g. on holding LMB down on the avatar in a viewer). -// m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; + m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; #endregion Inputs @@ -2592,14 +2280,6 @@ no information to check this bool update_movementflag = false; - // If we were just made root agent then we must perform movement updates for the first AgentUpdate that - // we get - if (MovementFlag == ForceUpdateMovementFlagValue) - { - MovementFlag = 0; - update_movementflag = true; - } - if (agentData.UseClientAgentPosition) { MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; @@ -2631,8 +2311,6 @@ no information to check this { bool bAllowUpdateMoveToPosition = false; -<<<<<<< HEAD -======= Vector3[] dirVectors; // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying @@ -2642,8 +2320,6 @@ no information to check this // else dirVectors = Dir_Vectors; - ->>>>>>> avn/ubitvar // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) { @@ -2865,12 +2541,8 @@ no information to check this // When we get to the point of re-computing neighbors everytime this // changes, then start using the agent's drawdistance rather than the // region's draw distance. -<<<<<<< HEAD - DrawDistance = agentData.Far; - // DrawDistance = Scene.DefaultDrawDistance; -======= + DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); ->>>>>>> avn/ubitvar // Check if Client has camera in 'follow cam' or 'build' mode. Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); @@ -3064,54 +2736,63 @@ no information to check this || pos.Y < 0 || pos.Y >= regionSize.Y || pos.Z < 0) return; - + Scene targetScene = m_scene; - -// Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2); -// pos += heightAdjust; -// -// // Anti duck-walking measure -// if (Math.Abs(pos.Z - AbsolutePosition.Z) < 0.2f) -// { -//// m_log.DebugFormat("[SCENE PRESENCE]: Adjusting MoveToPosition from {0} to {1}", pos, AbsolutePosition); -// pos.Z = AbsolutePosition.Z; -// } - // Get terrain height for sub-region in a megaregion if necessary -<<<<<<< HEAD -======= - int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); - int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); - GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); - // If X and Y is NaN, target_region will be null - if (target_region == null) - return; - UUID target_regionID = target_region.RegionID; - Scene targetScene = m_scene; ->>>>>>> avn/ubitvar - - //COMMENT: If its only nessesary in a megaregion, why do it on normal region's too? - if (regionCombinerModule != null) { - int x = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); - int y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); - GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, x, y); - -<<<<<<< HEAD + int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); + int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); + GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); // If X and Y is NaN, target_region will be null if (target_region == null) return; - + UUID target_regionID = target_region.RegionID; SceneManager.Instance.TryGetScene(target_region.RegionID, out targetScene); } - float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; -======= + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; // dont try to land underground terrainHeight += Appearance.AvatarHeight / 2; ->>>>>>> avn/ubitvar + pos.Z = Math.Max(terrainHeight, pos.Z); // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is @@ -3120,26 +2801,15 @@ no information to check this if (pos.Z - terrainHeight < 0.2) pos.Z = terrainHeight; -<<<<<<< HEAD -======= // m_log.DebugFormat( // "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", // Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); - ->>>>>>> avn/ubitvar if (noFly) Flying = false; else if (pos.Z > terrainHeight + Appearance.AvatarHeight / 2 || Flying) Flying = true; -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", -// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); - - if (noFly) - Flying = false; - LandAtTarget = landAtTarget; MovingToTarget = true; MoveToPositionTarget = pos; @@ -3214,13 +2884,10 @@ no information to check this } } -<<<<<<< HEAD -======= part.ParentGroup.DeleteAvatar(UUID); Quaternion standRotation = part.ParentGroup.RootPart.RotationOffset; Vector3 sitPartWorldPosition = part.ParentGroup.AbsolutePosition + m_pos * standRotation; ->>>>>>> avn/ubitvar ControllingClient.SendClearFollowCamProperties(part.ParentUUID); ParentID = 0; @@ -3248,25 +2915,9 @@ no information to check this standRotationZ.Z = 0f; } -<<<<<<< HEAD - //Vector3 standPos = ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); - //Vector3 standPos = ParentPosition; - -// Vector3 standPositionAdjustment -// = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f); - Vector3 adjustmentForSitPosition = OffsetPosition * part.ParentGroup.GroupRotation - SIT_TARGET_ADJUSTMENT * part.GetWorldRotation(); - - // XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than - // hardcoding here. - Vector3 adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotation; - - Vector3 standPos = part.ParentGroup.AbsolutePosition + adjustmentForSitPosition + adjustmentForSitPose; -======= Vector3 adjustmentForSitPose = new Vector3(0.75f, 0, m_sitAvatarHeight + .3f) * standRotationZ; Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose; ->>>>>>> avn/ubitvar - m_pos = standPos; } @@ -3277,16 +2928,9 @@ no information to check this if (satOnObject) { -<<<<<<< HEAD - SendAvatarDataToAllClients(); - m_requestedSitTargetID = 0; - part.RemoveSittingAvatar(this); - -======= m_requestedSitTargetID = 0; part.RemoveSittingAvatar(UUID); ->>>>>>> avn/ubitvar part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); SendAvatarDataToAllAgents(); @@ -3386,37 +3030,11 @@ no information to check this Velocity = Vector3.Zero; - part.AddSittingAvatar(this); + part.AddSittingAvatar(UUID); cameraAtOffset = part.GetCameraAtOffset(); - - if (!part.IsRoot && cameraAtOffset == Vector3.Zero) - cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset(); - - bool cameraEyeOffsetFromRootForChild = false; cameraEyeOffset = part.GetCameraEyeOffset(); - - if (!part.IsRoot && cameraEyeOffset == Vector3.Zero) - { - cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset(); - cameraEyeOffsetFromRootForChild = true; - } - - if ((cameraEyeOffset != Vector3.Zero && !cameraEyeOffsetFromRootForChild) || cameraAtOffset != Vector3.Zero) - { - if (!part.IsRoot) - { - cameraEyeOffset = cameraEyeOffset * part.RotationOffset; - cameraAtOffset += part.OffsetPosition; - } - - cameraEyeOffset += part.OffsetPosition; - } - -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Using cameraAtOffset {0}, cameraEyeOffset {1} for sit on {2} by {3} in {4}", -// cameraAtOffset, cameraEyeOffset, part.Name, Name, Scene.Name); - + forceMouselook = part.GetForceMouselook(); if (!part.IsRoot) @@ -3560,7 +3178,7 @@ no information to check this Velocity = Vector3.Zero; m_AngularVelocity = Vector3.Zero; - part.AddSittingAvatar(this); + part.AddSittingAvatar(UUID); Vector3 cameraAtOffset = part.GetCameraAtOffset(); Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); @@ -3596,6 +3214,7 @@ no information to check this m_requestedSitTargetID = 0; + part.ParentGroup.AddAvatar(UUID); ParentPart = part; ParentID = part.LocalId; @@ -3607,9 +3226,6 @@ no information to check this Animator.TrySetMovementAnimation("SIT_GROUND"); else Animator.TrySetMovementAnimation("SIT"); -<<<<<<< HEAD - SendAvatarDataToAllClients(); -======= */ if (status == 3) sitAnimation = "SIT_GROUND"; @@ -3617,8 +3233,6 @@ no information to check this sitAnimation = "SIT"; Animator.SetMovementAnimations("SIT"); ->>>>>>> avn/ubitvar - part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); } @@ -3654,40 +3268,27 @@ no information to check this //Quaternion result = (sitTargetOrient * vq) * nq; - double x, y, z, m1, m2; + double x, y, z, m; Quaternion r = sitTargetOrient; - m1 = r.X * r.X + r.Y * r.Y; - m2 = r.Z * r.Z + r.W * r.W; + m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W; - // Rotate the vector <0, 0, 1> - x = 2 * (r.X * r.Z + r.Y * r.W); - y = 2 * (-r.X * r.W + r.Y * r.Z); - z = m2 - m1; - - // Set m to be the square of the norm of r. - double m = m1 + m2; - - // This constant is emperically determined to be what is used in SL. - // See also http://opensimulator.org/mantis/view.php?id=7096 - double offset = 0.05; - - // Normally m will be ~ 1, but if someone passed a handcrafted quaternion - // to llSitTarget with values so small that squaring them is rounded off - // to zero, then m could be zero. The result of this floating point - // round off error (causing us to skip this impossible normalization) - // is only 5 cm. - if (m > 0.000001) + if (Math.Abs(1.0 - m) > 0.000001) { - offset /= m; + m = 1.0 / Math.Sqrt(m); + r.X *= (float)m; + r.Y *= (float)m; + r.Z *= (float)m; + r.W *= (float)m; } + x = 2 * (r.X * r.Z + r.Y * r.W); + y = 2 * (-r.X * r.W + r.Y * r.Z); + z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W; Vector3 up = new Vector3((float)x, (float)y, (float)z); - Vector3 sitOffset = up * (float)offset; + Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; - // sitOffset is in Avatar Center coordinates: from origin to 'sitTargetPos + SIT_TARGET_ADJUSTMENT'. - // So, we need to _substract_ it to get to the origin of the Avatar Center. - Vector3 newPos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset; + Vector3 newPos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; Quaternion newRot; if (part.IsRoot) @@ -3720,7 +3321,8 @@ no information to check this // Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); } - ParentPart = part; + part.ParentGroup.AddAvatar(UUID); + ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); ParentID = m_requestedSitTargetID; m_AngularVelocity = Vector3.Zero; Velocity = Vector3.Zero; @@ -3733,13 +3335,8 @@ no information to check this { sitAnimation = part.SitAnimation; } -<<<<<<< HEAD - Animator.TrySetMovementAnimation(sitAnimation); - SendAvatarDataToAllClients(); -======= // Animator.TrySetMovementAnimation(sitAnimation); Animator.SetMovementAnimations("SIT"); ->>>>>>> avn/ubitvar TriggerScenePresenceUpdated(); } } @@ -3801,25 +3398,10 @@ no information to check this // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", // vec, Rotation, thisAddSpeedModifier, Name); -<<<<<<< HEAD - Quaternion rot = Rotation; - if (!Flying && PresenceType != PresenceType.Npc) - { - // The only situation in which we care about X and Y is avatar flying. The rest of the time - // these parameters are not relevant for determining avatar movement direction and cause issues such - // as wrong walk speed if the camera is rotated. - rot.X = 0; - rot.Y = 0; - rot.Normalize(); - } - - Vector3 direc = vec * rot; -======= // rotate from avatar coord space to world // for now all controls assume this is only a rotation around Z // if not all checks below need to be done before this rotation Vector3 direc = vec * Rotation; ->>>>>>> avn/ubitvar direc.Normalize(); // mouse look situation ? @@ -3869,6 +3451,10 @@ no information to check this public override void Update() { + const float ROTATION_TOLERANCE = 0.01f; + const float VELOCITY_TOLERANCE = 0.001f; + const float POSITION_TOLERANCE = 0.05f; + if (IsChildAgent == false) { CheckForBorderCrossing(); @@ -3880,21 +3466,11 @@ no information to check this // grab the latest PhysicsActor velocity, whereas m_velocity is often // storing a requested force instead of an actual traveling velocity if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) - SendAvatarDataToAllClients(); + SendAvatarDataToAllAgents(); - // Allow any updates for sitting avatars to that llSetPrimitiveLinkParams() can work for very - // small increments (e.g. sit position adjusters). An alternative may be to eliminate the tolerance - // checks on all updates but the ramifications of this would need careful consideration. - bool updateClients - = IsSatOnObject && (Rotation != m_lastRotation || Velocity != m_lastVelocity || m_pos != m_lastPosition); - - if (!updateClients) - updateClients - = !Rotation.ApproxEquals(m_lastRotation, Scene.RootRotationUpdateTolerance) - || !Velocity.ApproxEquals(m_lastVelocity, Scene.RootVelocityUpdateTolerance) - || !m_pos.ApproxEquals(m_lastPosition, Scene.RootPositionUpdateTolerance); - - if (updateClients) + if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || + !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || + !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) { SendTerseUpdateToAllClients(); @@ -3904,12 +3480,6 @@ no information to check this m_lastVelocity = Velocity; } -<<<<<<< HEAD - if (Scene.AllowAvatarCrossing) - CheckForBorderCrossing(); - -======= ->>>>>>> avn/ubitvar CheckForSignificantMovement(); // sends update to the modules. } } @@ -3918,8 +3488,6 @@ no information to check this #region Update Client(s) -<<<<<<< HEAD -======= public void SendUpdateToAgent(ScenePresence p) { IClientAPI remoteClient = p.ControllingClient; @@ -3949,7 +3517,6 @@ no information to check this ControllingClient.SendAgentTerseUpdate(p); } ->>>>>>> avn/ubitvar /// /// Sends a location update to the client connected to this scenePresence /// via entity updates @@ -3961,29 +3528,6 @@ no information to check this // server. if (remoteClient.IsActive) { - if (Scene.RootTerseUpdatePeriod > 1) - { -// Console.WriteLine( -// "{0} {1} {2} {3} {4} {5} for {6} to {7}", -// remoteClient.AgentId, UUID, remoteClient.SceneAgent.IsChildAgent, m_terseUpdateCount, Scene.RootTerseUpdatePeriod, Velocity.ApproxEquals(Vector3.Zero, 0.001f), Name, remoteClient.Name); - if (remoteClient.AgentId != UUID - && !remoteClient.SceneAgent.IsChildAgent - && m_terseUpdateCount % Scene.RootTerseUpdatePeriod != 0 - && !Velocity.ApproxEquals(Vector3.Zero, 0.001f)) - { -// m_log.DebugFormat("[SCENE PRESENCE]: Discarded update from {0} to {1}, args {2} {3} {4} {5} {6} {7}", -// Name, remoteClient.Name, remoteClient.AgentId, UUID, remoteClient.SceneAgent.IsChildAgent, m_terseUpdateCount, Scene.RootTerseUpdatePeriod, Velocity.ApproxEquals(Vector3.Zero, 0.001f)); - - return; - } - } - - if (Scene.ChildTerseUpdatePeriod > 1 - && remoteClient.SceneAgent.IsChildAgent - && m_terseUpdateCount % Scene.ChildTerseUpdatePeriod != 0 - && !Velocity.ApproxEquals(Vector3.Zero, 0.001f)) - return; - //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); remoteClient.SendEntityUpdate( this, @@ -4054,10 +3598,6 @@ no information to check this float speed = Velocity.Length(); float velocityDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity); -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Delta-v {0}, lastVelocity {1}, Velocity {2} for {3} in {4}", -// velocidyDiff, lastVelocitySentToAllClients, Velocity, Name, Scene.Name); - // assuming 5 ms. worst case precision for timer, use 2x that // for distance error threshold float distanceErrorThreshold = speed * 0.01f; @@ -4066,17 +3606,11 @@ no information to check this || Math.Abs(distanceError) > distanceErrorThreshold || velocityDiff > 0.01f) // did velocity change from last update? { -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Update triggered with speed {0}, distanceError {1}, distanceThreshold {2}, delta-v {3} for {4} in {5}", -// speed, distanceError, distanceErrorThreshold, velocidyDiff, Name, Scene.Name); - lastVelocitySentToAllClients = Velocity; lastTerseUpdateToAllClientsTick = currentTick; lastPositionSentToAllClients = OffsetPosition; - m_terseUpdateCount++; - -// Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); + // Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); // m_scene.ForEachClient(SendTerseUpdateToClient); m_scene.ForEachScenePresence(SendTerseUpdateToAgent); } @@ -4103,24 +3637,14 @@ no information to check this ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); } - public void SendInitialDataToClient() + public void SendInitialDataToMe() { - SentInitialDataToClient = true; - // Send all scene object to the new client - WorkManager.RunJob("SendInitialDataToClient", delegate + Util.FireAndForget(delegate { -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Sending initial data to {0} agent {1} in {2}, tp flags {3}", -// IsChildAgent ? "child" : "root", Name, Scene.Name, m_teleportFlags); - // we created a new ScenePresence (a new child agent) in a fresh region. // Request info about all the (root) agents in this region // Note: This won't send data *to* other clients in that region (children don't send) -<<<<<<< HEAD - SendOtherAgentsAvatarDataToClient(); - SendOtherAgentsAppearanceToClient(); -======= if (m_teleportFlags <= 0) { ILandChannel landch = m_scene.LandChannel; @@ -4129,7 +3653,6 @@ no information to check this landch.sendClientInitialLandInfo(ControllingClient); } } ->>>>>>> avn/ubitvar SendOtherAgentsAvatarFullToMe(); EntityBase[] entities = Scene.Entities.GetEntities(); @@ -4138,13 +3661,9 @@ no information to check this if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); } -<<<<<<< HEAD - }, null, string.Format("SendInitialDataToClient ({0} in {1})", Name, Scene.Name), false, true); -======= }); ->>>>>>> avn/ubitvar } - + /// /// Do everything required once a client completes its movement into a region and becomes /// a root agent. @@ -4171,17 +3690,6 @@ no information to check this if (m_scene.AvatarFactory != null) m_scene.AvatarFactory.QueueAppearanceSave(UUID); } -<<<<<<< HEAD - - // This agent just became root. We are going to tell everyone about it. The process of - // getting other avatars information was initiated elsewhere immediately after the child circuit connected... don't do it - // again here... this comes after the cached appearance check because the avatars - // appearance goes into the avatar update packet - SendAvatarDataToAllClients(); - - // This invocation always shows up in the viewer logs as an error. Is it needed? - SendAppearanceToClient(this); -======= // send avatar object to all viewers so they cross it into region bool newhide = m_currentParcelHide; @@ -4197,7 +3705,6 @@ no information to check this } SendAppearanceToAgent(this); ->>>>>>> avn/ubitvar m_inTransit = false; @@ -4220,13 +3727,6 @@ no information to check this if (p.UUID == UUID) return; -<<<<<<< HEAD - // If the avatars baked textures are all in the cache, then we have a - // complete appearance... send it out, if not, then we'll send it when - // the avatar finishes updating its appearance - SendAppearanceToAllOtherClients(); - } -======= // get the avatar, then a kill if can't see it p.SendInitialAvatarDataToAgent(this); @@ -4240,19 +3740,13 @@ no information to check this }); m_scene.StatsReporter.AddAgentUpdates(count); ->>>>>>> avn/ubitvar - } - - public void SendAvatarDataToAllClients() - { - SendAvatarDataToAllClients(true); } /// /// Send this agent's avatar data to all other root and child agents in the scene /// This agent must be root. This avatar will receive its own update. /// - public void SendAvatarDataToAllClients(bool full) + public void SendAvatarDataToAllAgents() { //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAllAgents: {0} ({1})", Name, UUID); // only send update from root agents to other clients; children are only "listening posts" @@ -4269,47 +3763,18 @@ no information to check this m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) { -<<<<<<< HEAD - if (full) - SendAvatarDataToClient(scenePresence); - else - scenePresence.ControllingClient.SendAvatarDataImmediate(this); -======= SendAvatarDataToAgent(scenePresence); ->>>>>>> avn/ubitvar count++; }); m_scene.StatsReporter.AddAgentUpdates(count); } - -<<<<<<< HEAD - /// - /// Send avatar data for all other root agents to this agent, this agent - /// can be either a child or root - /// - public void SendOtherAgentsAvatarDataToClient() -======= // sends avatar object to all clients so they cross it into region // then sends kills to hide public void SendInitialAvatarDataToAllAgents(List presences) ->>>>>>> avn/ubitvar { m_lastSize = Appearance.AvatarSize; int count = 0; -<<<<<<< HEAD - m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) - { - // only send information about other root agents - if (scenePresence.UUID == UUID) - return; - - scenePresence.SendAvatarDataToClient(this); - count++; - }); -======= ->>>>>>> avn/ubitvar - foreach (ScenePresence p in presences) { p.ControllingClient.SendAvatarDataImmediate(this); @@ -4337,16 +3802,11 @@ no information to check this /// Send avatar data to an agent. /// /// - public void SendAvatarDataToClient(ScenePresence avatar) + public void SendAvatarDataToAgent(ScenePresence avatar) { -<<<<<<< HEAD - //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToClient from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); - -======= //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) return; ->>>>>>> avn/ubitvar avatar.ControllingClient.SendAvatarDataImmediate(this); } @@ -4354,18 +3814,14 @@ no information to check this { avatar.ControllingClient.SendAvatarDataImmediate(this); } - + /// /// Send this agent's appearance to all other root and child agents in the scene /// This agent must be root. /// - public void SendAppearanceToAllOtherClients() + public void SendAppearanceToAllOtherAgents() { -<<<<<<< HEAD -// m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherClients: {0} {1}", Name, UUID); -======= // m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} {1}", Name, UUID); ->>>>>>> avn/ubitvar // only send update from root agents to other clients; children are only "listening posts" if (IsChildAgent) @@ -4379,51 +3835,21 @@ no information to check this int count = 0; m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) - { - // only send information to other root agents - if (scenePresence.UUID == UUID) - return; - - SendAppearanceToClient(scenePresence); - count++; - }); -<<<<<<< HEAD + { + // only send information to other root agents + if (scenePresence.UUID == UUID) + return; + SendAppearanceToAgent(scenePresence); + count++; + }); m_scene.StatsReporter.AddAgentUpdates(count); } - /// - /// Send appearance from all other root agents to this agent. this agent - /// can be either root or child - /// - public void SendOtherAgentsAppearanceToClient() + public void SendAppearanceToAgent(ScenePresence avatar) { -// m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToClient {0} {1}", Name, UUID); - - int count = 0; - m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) - { - // only send information about other root agents - if (scenePresence.UUID == UUID) - return; - - scenePresence.SendAppearanceToClient(this); - count++; - }); - -======= ->>>>>>> avn/ubitvar - m_scene.StatsReporter.AddAgentUpdates(count); - } - - /// - /// Send appearance data to an agent. - /// - /// - public void SendAppearanceToClient(ScenePresence avatar) - { -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); + // m_log.DebugFormat( + // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) return; SendAppearanceToAgentNF(avatar); @@ -4574,81 +4000,6 @@ no information to check this if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero) return; -<<<<<<< HEAD - if (IsInTransit) - return; - - Vector3 pos2 = AbsolutePosition; - Vector3 origPosition = pos2; - Vector3 vel = Velocity; - - // Compute the future avatar position. - // If the avatar will be crossing, we force the crossing to happen now - // in the hope that this will make the avatar movement smoother when crossing. - pos2 += vel * 0.05f; - - if (m_scene.PositionIsInCurrentRegion(pos2)) - return; - - m_log.DebugFormat("{0} CheckForBorderCrossing: position outside region. {1} in {2} at pos {3}", - LogHeader, Name, Scene.Name, pos2); - - // Disconnect from the current region - bool isFlying = Flying; - RemoveFromPhysicalScene(); - - // pos2 is the forcasted position so make that the 'current' position so the crossing - // code will move us into the newly addressed region. - m_pos = pos2; - - if (CrossToNewRegion()) - { - AddToPhysicalScene(isFlying); - } - else - { - // Tried to make crossing happen but it failed. - if (m_requestedSitTargetUUID == UUID.Zero) - { - m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader); - - Velocity = Vector3.Zero; - AbsolutePosition = EnforceSanityOnPosition(origPosition); - - AddToPhysicalScene(isFlying); - } - } - } - - // Given a position, make sure it is within the current region. - // If just outside some border, the returned position will be just inside the border on that side. - private Vector3 EnforceSanityOnPosition(Vector3 origPosition) - { - const float borderFudge = 0.1f; - Vector3 ret = origPosition; - - // Sanity checking on the position to make sure it is in the region we couldn't cross from - float extentX = (float)m_scene.RegionInfo.RegionSizeX; - float extentY = (float)m_scene.RegionInfo.RegionSizeY; - IRegionCombinerModule combiner = m_scene.RequestModuleInterface(); - if (combiner != null) - { - // If a mega-region, the size could be much bigger - Vector2 megaExtent = combiner.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); - extentX = megaExtent.X; - extentY = megaExtent.Y; - } - if (ret.X < 0) - ret.X = borderFudge; - else if (ret.X >= extentX) - ret.X = extentX - borderFudge; - if (ret.Y < 0) - ret.Y = borderFudge; - else if (ret.Y >= extentY) - ret.Y = extentY - borderFudge; - - return ret; -======= Vector3 pos2 = AbsolutePosition; Vector3 vel = Velocity; @@ -4710,8 +4061,6 @@ no information to check this AddToPhysicalScene(isFlying); } - ->>>>>>> avn/ubitvar } /// @@ -4779,16 +4128,6 @@ no information to check this // Don't close the agent on this region yet if (handle != Scene.RegionInfo.RegionHandle) { -<<<<<<< HEAD - uint x, y; - Util.RegionHandleToRegionLoc(handle, out x, out y); - -// m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); -// m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); - float dist = (float)Math.Max(Scene.DefaultDrawDistance, - (float)Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY)); - if (Util.IsOutsideView(dist, x, newRegionX, y, newRegionY)) -======= Util.RegionHandleToRegionLoc(handle, out x, out y); if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) { @@ -4802,7 +4141,6 @@ no information to check this } } else ->>>>>>> avn/ubitvar { if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) @@ -4875,8 +4213,7 @@ no information to check this return; CopyFrom(cAgentData); - - m_updateAgentReceivedAfterTransferEvent.Set(); + } private static Vector3 marker = new Vector3(-1f, -1f, -1f); @@ -4895,23 +4232,11 @@ no information to check this if (!IsChildAgent) return; -<<<<<<< HEAD -// m_log.DebugFormat( -// "[SCENE PRESENCE]: ChildAgentPositionUpdate for {0} in {1}, tRegion {2},{3}, rRegion {4},{5}, pos {6}", -// Name, Scene.Name, tRegionX, tRegionY, rRegionX, rRegionY, cAgentData.Position); - - // Find the distance (in meters) between the two regions - // XXX: We cannot use Util.RegionLocToHandle() here because a negative value will silently overflow the - // uint - int shiftx = (int)(((int)rRegionX - (int)tRegionX) * Constants.RegionSize); - int shifty = (int)(((int)rRegionY - (int)tRegionY) * Constants.RegionSize); -======= RegionHandle = cAgentData.RegionHandle; //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; ->>>>>>> avn/ubitvar Vector3 offset = new Vector3(shiftx, shifty, 0f); @@ -4919,11 +4244,7 @@ no information to check this // changes, then start using the agent's drawdistance rather than the // region's draw distance. DrawDistance = cAgentData.Far; -<<<<<<< HEAD - // DrawDistance = Scene.DefaultDrawDistance; -======= // DrawDistance = Scene.DefaultDrawDistance; ->>>>>>> avn/ubitvar if (cAgentData.Position != marker) // UGH!! m_pos = cAgentData.Position + offset; @@ -5038,10 +4359,6 @@ no information to check this private void CopyFrom(AgentData cAgent) { -<<<<<<< HEAD -======= - ->>>>>>> avn/ubitvar m_callbackURI = cAgent.CallbackURI; // m_log.DebugFormat( // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", @@ -5060,9 +4377,6 @@ no information to check this // changes, then start using the agent's drawdistance rather than the // region's draw distance. DrawDistance = cAgent.Far; -<<<<<<< HEAD - // DrawDistance = Scene.DefaultDrawDistance; -======= //DrawDistance = Scene.DefaultDrawDistance; if (cAgent.ChildrenCapSeeds != null && cAgent.ChildrenCapSeeds.Count > 0) @@ -5073,7 +4387,6 @@ no information to check this } KnownRegions = cAgent.ChildrenCapSeeds; } ->>>>>>> avn/ubitvar if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) ControllingClient.SetChildAgentThrottle(cAgent.Throttles); @@ -5135,35 +4448,10 @@ no information to check this Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; if (Scene.AttachmentsModule != null) -<<<<<<< HEAD - { - // If the JobEngine is running we can schedule this job now and continue rather than waiting for all - // attachments to copy, which might take a long time in the Hypergrid case as the entire inventory - // graph is inspected for each attachments and assets possibly fetched. - // - // We don't need to worry about a race condition as the job to later start the scripts is also - // JobEngine scheduled and so will always occur after this task. - // XXX: This will not be true if JobEngine ever gets more than one thread. - WorkManager.RunJob( - "CopyAttachments", - o => Scene.AttachmentsModule.CopyAttachments(cAgent, this), - null, - string.Format("Copy attachments for {0} entering {1}", Name, Scene.Name), - true); - } - - // This must occur after attachments are copied or scheduled to be copied, as it releases the CompleteMovement() calling thread - // originating from the client completing a teleport. Otherwise, CompleteMovement() code to restart - // script attachments can outrace this thread. - lock (m_originRegionIDAccessLock) - m_originRegionID = cAgent.RegionID; -======= Scene.AttachmentsModule.CopyAttachments(cAgent, this); lock (m_originRegionIDAccessLock) m_originRegionID = cAgent.RegionID; - ->>>>>>> avn/ubitvar } public bool CopyAgent(out IAgentData agent) @@ -5212,22 +4500,13 @@ no information to check this if (Appearance.AvatarHeight == 0) // Appearance.SetHeight(); Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); - -/* - PhysicsActor = scene.AddAvatar( - LocalId, Firstname + "." + Lastname, pVec, - new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); -*/ -<<<<<<< HEAD - PhysicsActor = m_scene.PhysicsScene.AddAvatar( - LocalId, Firstname + "." + Lastname, AbsolutePosition, Velocity, - Appearance.AvatarBoxSize, isFlying); -======= + PhysicsScene scene = m_scene.PhysicsScene; + Vector3 pVec = AbsolutePosition; + PhysicsActor = scene.AddAvatar( LocalId, Firstname + "." + Lastname, pVec, Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying); ->>>>>>> avn/ubitvar //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index dc5de587b9..c8a01a0a8b 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -307,21 +307,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } -<<<<<<< HEAD - -======= ->>>>>>> avn/ubitvar /// /// Modifies a SceneObjectGroup. /// /// The object /// Whether the object was actually modified public delegate bool SceneObjectModifier(SceneObjectGroup sog); -<<<<<<< HEAD - -======= ->>>>>>> avn/ubitvar /// /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing. /// @@ -335,11 +327,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization CoalescedSceneObjects coa = null; string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); -<<<<<<< HEAD - -======= - ->>>>>>> avn/ubitvar if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) { // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); @@ -384,10 +371,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization return data; } -<<<<<<< HEAD - -======= ->>>>>>> avn/ubitvar #region manual serialization @@ -739,44 +722,42 @@ namespace OpenSim.Region.Framework.Scenes.Serialization obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); } -<<<<<<< HEAD - private static void ProcessShape(SceneObjectPart obj, XmlReader reader) -======= - private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlTextReader reader) + private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlReader reader) { obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset")); } - private static void ProcessCameraAtOffset(SceneObjectPart obj, XmlTextReader reader) + private static void ProcessCameraAtOffset(SceneObjectPart obj, XmlReader reader) { obj.SetCameraAtOffset(Util.ReadVector(reader, "CameraAtOffset")); } - private static void ProcessSoundID(SceneObjectPart obj, XmlTextReader reader) + private static void ProcessSoundID(SceneObjectPart obj, XmlReader reader) { obj.Sound = Util.ReadUUID(reader, "SoundID"); } - private static void ProcessSoundGain(SceneObjectPart obj, XmlTextReader reader) + private static void ProcessSoundGain(SceneObjectPart obj, XmlReader reader) { obj.SoundGain = reader.ReadElementContentAsDouble("SoundGain", String.Empty); } - private static void ProcessSoundFlags(SceneObjectPart obj, XmlTextReader reader) + private static void ProcessSoundFlags(SceneObjectPart obj, XmlReader reader) { obj.SoundFlags = (byte)reader.ReadElementContentAsInt("SoundFlags", String.Empty); } - private static void ProcessSoundRadius(SceneObjectPart obj, XmlTextReader reader) + private static void ProcessSoundRadius(SceneObjectPart obj, XmlReader reader) { obj.SoundRadius = reader.ReadElementContentAsDouble("SoundRadius", String.Empty); } - private static void ProcessSoundQueueing(SceneObjectPart obj, XmlTextReader reader) + private static void ProcessSoundQueueing(SceneObjectPart obj, XmlReader reader) { obj.SoundQueueing = Util.ReadBoolean(reader); } - private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader) + + private static void ProcessVehicle(SceneObjectPart obj, XmlReader reader) { SOPVehicle vehicle = SOPVehicle.FromXml2(reader); @@ -793,8 +774,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) ->>>>>>> avn/ubitvar + private static void ProcessShape(SceneObjectPart obj, XmlReader reader) { List errorNodeNames; obj.Shape = ReadShape(reader, "Shape", out errorNodeNames, obj); @@ -968,21 +948,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); } - private static void ProcessBuoyancy(SceneObjectPart obj, XmlTextReader reader) + private static void ProcessBuoyancy(SceneObjectPart obj, XmlReader reader) { obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty); } - private static void ProcessForce(SceneObjectPart obj, XmlTextReader reader) + private static void ProcessForce(SceneObjectPart obj, XmlReader reader) { obj.Force = Util.ReadVector(reader, "Force"); } - private static void ProcessTorque(SceneObjectPart obj, XmlTextReader reader) + private static void ProcessTorque(SceneObjectPart obj, XmlReader reader) { obj.Torque = Util.ReadVector(reader, "Torque"); } - private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlTextReader reader) + private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlReader reader) { obj.VolumeDetectActive = Util.ReadBoolean(reader); } diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 52e3ff14e1..bdddd73740 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -184,11 +184,7 @@ namespace OpenSim.Region.Framework.Scenes // saved last reported value so there is something available for llGetRegionFPS private float lastReportedSimFPS; -<<<<<<< HEAD - private float[] lastReportedSimStats = new float[m_statisticArraySize]; -======= private float[] lastReportedSimStats = new float[23]; ->>>>>>> avn/ubitvar private float m_pfps; /// @@ -208,14 +204,10 @@ namespace OpenSim.Region.Framework.Scenes private int m_physicsMS; private int m_imageMS; private int m_otherMS; -<<<<<<< HEAD - private int m_scriptMS; -======= private int m_sleeptimeMS; //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. //Ckrinke private int m_scriptMS = 0; ->>>>>>> avn/ubitvar private int m_rootAgents; private int m_childAgents; @@ -269,27 +261,10 @@ namespace OpenSim.Region.Framework.Scenes private IEstateModule estateModule; - public SimStatsReporter(Scene scene) - : this(scene, Scene.m_defaultNumberFramesStored) + public SimStatsReporter(Scene scene) { - } - - public SimStatsReporter(Scene scene, int numberOfFrames) - { - // Store the number of frames from the OpenSim.ini configuration file - m_numberFramesStored = numberOfFrames; - - // Initialize the different frame time arrays to the correct sizes - m_totalFrameTimeMilliseconds = new double[m_numberFramesStored]; - m_simulationFrameTimeMilliseconds = new double[m_numberFramesStored]; - m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored]; - m_networkFrameTimeMilliseconds = new double[m_numberFramesStored]; - - // Initialize the current number of users logging into the region - m_usersLoggingIn = 0; - m_scene = scene; - m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps; + m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps; m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); ReportingRegion = scene.RegionInfo; @@ -304,7 +279,7 @@ namespace OpenSim.Region.Framework.Scenes /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit /// longer than ideal (which in itself is a concern). - SlowFramesStatReportThreshold = (int)Math.Ceiling(scene.MinFrameTicks * 1.2); + SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2); SlowFramesStat = new Stat( @@ -319,7 +294,6 @@ namespace OpenSim.Region.Framework.Scenes StatVerbosity.Info); StatsManager.RegisterStat(SlowFramesStat); - } @@ -356,25 +330,10 @@ namespace OpenSim.Region.Framework.Scenes private void statsHeartBeat(object sender, EventArgs e) { - double totalSumFrameTime; - double simulationSumFrameTime; - double physicsSumFrameTime; - double networkSumFrameTime; - float frameDilation; - int currentFrame; - - if (!m_scene.Active) + if (!m_scene.Active) return; -<<<<<<< HEAD - // Create arrays to hold the statistics for this current scene, - // these will be passed to the SimExtraStatsCollector, they are also - // sent to the SimStats class - SimStatsPacket.StatBlock[] sb = new - SimStatsPacket.StatBlock[m_statisticArraySize]; -======= SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; ->>>>>>> avn/ubitvar SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); // Know what's not thread safe in Mono... modifying timers. @@ -409,9 +368,8 @@ namespace OpenSim.Region.Framework.Scenes // ORIGINAL code commented out until we have time to add our own // statistics to the statistics window - //float physfps = ((m_pfps / 1000)); - float physfps = m_numberPhysicsFrames; - + float physfps = ((m_pfps / 1000)); + //if (physfps > 600) //physfps = physfps - (physfps - 600); @@ -465,61 +423,16 @@ namespace OpenSim.Region.Framework.Scenes // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; // m_imageMS m_netMS are not included in m_frameMS -<<<<<<< HEAD - uint thisFrame = m_scene.Frame; - uint numFrames = thisFrame - m_lastUpdateFrame; - float framesUpdated = (float)numFrames * m_reportedFpsCorrectionFactor; - m_lastUpdateFrame = thisFrame; - - // Avoid div-by-zero if somehow we've not updated any frames. - if (framesUpdated == 0) - framesUpdated = 1; - - for (int i = 0; i < m_statisticArraySize; i++) -======= m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; if (m_otherMS < 0) m_otherMS = 0; for (int i = 0; i < 23; i++) ->>>>>>> avn/ubitvar { sb[i] = new SimStatsPacket.StatBlock(); } - // Resetting the sums of the frame times to prevent any errors - // in calculating the moving average for frame time - totalSumFrameTime = 0; - simulationSumFrameTime = 0; - physicsSumFrameTime = 0; - networkSumFrameTime = 0; - - // Loop through all the frames that were stored for the current - // heartbeat to process the moving average of frame times - for (int i = 0; i < m_numberFramesStored; i++) - { - // Sum up each frame time in order to calculate the moving - // average of frame time - totalSumFrameTime += m_totalFrameTimeMilliseconds[i]; - simulationSumFrameTime += - m_simulationFrameTimeMilliseconds[i]; - physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i]; - networkSumFrameTime += m_networkFrameTimeMilliseconds[i]; - } - - // Get the index that represents the current frame based on the next one known; go back - // to the last index if next one is stated to restart at 0 - if (m_nextLocation == 0) - currentFrame = m_numberFramesStored - 1; - else - currentFrame = m_nextLocation - 1; - - // Calculate the frame dilation; which is currently based on the ratio between the sum of the - // physics and simulation rate, and the set minimum time to run a scene's frame - frameDilation = (float)(m_simulationFrameTimeMilliseconds[currentFrame] + - m_physicsFrameTimeMilliseconds[currentFrame]) / m_scene.MinFrameTicks; - - // ORIGINAL code commented out until we have time to add our own + sb[0].StatID = (uint) Stats.TimeDilation; sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); @@ -544,21 +457,7 @@ namespace OpenSim.Region.Framework.Scenes sb[7].StatID = (uint) Stats.ActivePrim; sb[7].StatValue = m_activePrim; - // ORIGINAL code commented out until we have time to add our own - // statistics to the statistics window sb[8].StatID = (uint)Stats.FrameMS; -<<<<<<< HEAD - //sb[8].StatValue = m_frameMS / framesUpdated; - sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored; - - sb[9].StatID = (uint)Stats.NetMS; - //sb[9].StatValue = m_netMS / framesUpdated; - sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored; - - sb[10].StatID = (uint)Stats.PhysicsMS; - //sb[10].StatValue = m_physicsMS / framesUpdated; - sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored; -======= sb[8].StatValue = TotalFrameTime; sb[9].StatID = (uint)Stats.NetMS; @@ -566,18 +465,12 @@ namespace OpenSim.Region.Framework.Scenes sb[10].StatID = (uint)Stats.PhysicsMS; sb[10].StatValue = m_physicsMS * perframe; ->>>>>>> avn/ubitvar sb[11].StatID = (uint)Stats.ImageMS ; sb[11].StatValue = m_imageMS * perframe; sb[12].StatID = (uint)Stats.OtherMS; -<<<<<<< HEAD - //sb[12].StatValue = m_otherMS / framesUpdated; - sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored; -======= sb[12].StatValue = m_otherMS * perframe; ->>>>>>> avn/ubitvar sb[13].StatID = (uint)Stats.InPacketsPerSecond; sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); @@ -609,30 +502,6 @@ namespace OpenSim.Region.Framework.Scenes sb[22].StatID = (uint)Stats.SimSleepMs; sb[22].StatValue = sleeptime; - // Current ratio between the sum of physics and sim rate, and the - // minimum time to run a scene's frame - sb[22].StatID = (uint)Stats.FrameDilation; - sb[22].StatValue = frameDilation; - - // Current number of users currently attemptint to login to region - sb[23].StatID = (uint)Stats.UsersLoggingIn; - sb[23].StatValue = m_usersLoggingIn; - - // Total number of geometric primitives in the scene - sb[24].StatID = (uint)Stats.TotalGeoPrim; - sb[24].StatValue = m_numGeoPrim; - - // Total number of mesh objects in the scene - sb[25].StatID = (uint)Stats.TotalMesh; - sb[25].StatValue = m_numMesh; - - // Current number of threads that XEngine is using - sb[26].StatID = (uint)Stats.ThreadCount; - sb[26].StatValue = m_inUseThreads; - - sb[27].StatID = (uint)Stats.ScriptMS; - sb[27].StatValue = (numFrames <= 0) ? 0 : ((float)m_scriptMS / numFrames); - for (int i = 0; i < m_statisticArraySize; i++) { lastReportedSimStats[i] = sb[i].StatValue; @@ -702,16 +571,11 @@ namespace OpenSim.Region.Framework.Scenes m_physicsMS = 0; m_imageMS = 0; m_otherMS = 0; -<<<<<<< HEAD - m_scriptMS = 0; - m_spareMS = 0; -======= // m_spareMS = 0; m_sleeptimeMS = 0; //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. //Ckrinke m_scriptMS = 0; ->>>>>>> avn/ubitvar } # region methods called from Scene @@ -817,41 +681,9 @@ namespace OpenSim.Region.Framework.Scenes m_otherMS += ms; } -<<<<<<< HEAD - public void AddScriptMS(int ms) - { - m_scriptMS += ms; - } - - public void addPhysicsFrame(int frames) - { - // Add the number of physics frames to the correct total physics - // frames - m_numberPhysicsFrames += frames; - } - - public void addFrameTimeMilliseconds(double total, double simulation, - double physics, double network) - { - // Save the frame times from the current frame into the appropriate - // arrays - m_totalFrameTimeMilliseconds[m_nextLocation] = total; - m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation; - m_physicsFrameTimeMilliseconds[m_nextLocation] = physics; - m_networkFrameTimeMilliseconds[m_nextLocation] = network; - - // Update to the next location in the list - m_nextLocation++; - - // Since the list will begin to overwrite the oldest frame values - // first, the next location needs to loop back to the beginning of the - // list whenever it reaches the end - m_nextLocation = m_nextLocation % m_numberFramesStored; -======= public void addSleepMS(int ms) { m_sleeptimeMS += ms; ->>>>>>> avn/ubitvar } public void AddPendingDownloads(int count) diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index 6fd9096be5..506ad24117 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs @@ -49,7 +49,6 @@ namespace OpenSim.Region.Framework.Scenes { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static string LogHeader = "[TERRAIN CHANNEL]"; -<<<<<<< HEAD protected TerrainData m_terrainData; @@ -58,16 +57,7 @@ namespace OpenSim.Region.Framework.Scenes public int Height { get { return m_terrainData.SizeY; } } // Y dimension public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension -======= - protected TerrainData m_terrainData; - - public int Width { get { return m_terrainData.SizeX; } } // X dimension - // Unfortunately, for historical reasons, in this module 'Width' is X and 'Height' is Y - public int Height { get { return m_terrainData.SizeY; } } // Y dimension - public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension - ->>>>>>> avn/ubitvar // Default, not-often-used builder public TerrainChannel() { @@ -168,15 +158,11 @@ namespace OpenSim.Region.Framework.Scenes { if (Double.IsNaN(value) || Double.IsInfinity(value)) return; -<<<<<<< HEAD - -======= if (value < 0) value = 0; else if (value > 655.35) value = 655.35; ->>>>>>> avn/ubitvar m_terrainData[x, y] = (float)value; } } @@ -382,13 +368,8 @@ namespace OpenSim.Region.Framework.Scenes public int SizeY; public int SizeZ; public float CompressionFactor; -<<<<<<< HEAD - public int[] Map; - public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, int[] pMap) -======= public float[] Map; public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, float[] pMap) ->>>>>>> avn/ubitvar { Version = 1; SizeX = pX; @@ -419,25 +400,13 @@ namespace OpenSim.Region.Framework.Scenes // Fill the heightmap with the center bump terrain private void PinHeadIsland() { -<<<<<<< HEAD -======= float cx = m_terrainData.SizeX * 0.5f; float cy = m_terrainData.SizeY * 0.5f; float h; ->>>>>>> avn/ubitvar for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { -<<<<<<< HEAD - m_terrainData[x, y] = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10; - float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, m_terrainData.SizeX / 2.0, m_terrainData.SizeY / 2.0, 50) * 0.01d); - float spherFacB = (float)(TerrainUtil.SphericalFactor(x, y, m_terrainData.SizeX / 2.0, m_terrainData.SizeY / 2.0, 100) * 0.001d); - if (m_terrainData[x, y]< spherFacA) - m_terrainData[x, y]= spherFacA; - if (m_terrainData[x, y]< spherFacB) - m_terrainData[x, y] = spherFacB; -======= // h = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10; h = 1.0f; float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, cx, cy, 50) * 0.01d); @@ -447,7 +416,6 @@ namespace OpenSim.Region.Framework.Scenes if (h < spherFacB) h = spherFacB; m_terrainData[x, y] = h; ->>>>>>> avn/ubitvar } } } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs index 1d41d3381d..93ac34f69d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs @@ -43,6 +43,7 @@ using OpenSim.Tests.Common; namespace OpenSim.Region.Framework.Scenes.Tests { + /* /// /// Test copying of scene objects. /// @@ -344,4 +345,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests } } } + */ } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index b77517828c..0025e9b7b2 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs @@ -99,9 +99,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); - HashSet sittingAvatars = part.GetSittingAvatars(); + HashSet sittingAvatars = part.GetSittingAvatars(); Assert.That(sittingAvatars.Count, Is.EqualTo(1)); - Assert.That(sittingAvatars.Contains(m_sp)); + Assert.That(sittingAvatars.Contains(m_sp.UUID)); Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); } @@ -211,9 +211,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(m_sp.PhysicsActor, Is.Null); Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); - HashSet sittingAvatars = part.GetSittingAvatars(); + HashSet sittingAvatars = part.GetSittingAvatars(); Assert.That(sittingAvatars.Count, Is.EqualTo(1)); - Assert.That(sittingAvatars.Contains(m_sp)); + Assert.That(sittingAvatars.Contains(m_sp.UUID)); m_sp.StandUp(); diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 25bbd3a9ab..d8928ee53b 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -120,53 +120,12 @@ namespace OpenSim.Region.Framework.Scenes /// UUID. public bool AddForInspection(UUID uuid) { -<<<<<<< HEAD if (m_assetUuidsToInspect.Contains(uuid)) return false; // m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid); m_assetUuidsToInspect.Enqueue(uuid); -======= - try - { - assetUuids[assetUuid] = assetType; - - if ((sbyte)AssetType.Bodypart == assetType || (sbyte)AssetType.Clothing == assetType) - { - GetWearableAssetUuids(assetUuid, assetUuids); - } - else if ((sbyte)AssetType.Gesture == assetType) - { - GetGestureAssetUuids(assetUuid, assetUuids); - } - else if ((sbyte)AssetType.Notecard == assetType) - { - GetTextEmbeddedAssetUuids(assetUuid, assetUuids); - } - else if ((sbyte)AssetType.LSLText == assetType) - { - GetTextEmbeddedAssetUuids(assetUuid, assetUuids); - } - else if ((sbyte)OpenSimAssetType.Material == assetType) - { - GetMaterialAssetUuids(assetUuid, assetUuids); - } - else if ((sbyte)AssetType.Object == assetType) - { - GetSceneObjectAssetUuids(assetUuid, assetUuids); - } - } - catch (Exception) - { - m_log.ErrorFormat( - "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}", - assetUuid, assetType); - throw; - } - } ->>>>>>> avn/ubitvar - return true; } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 0512e4845e..ed1bab4b27 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -1398,7 +1398,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups presence.Grouptitle = Title; if (! presence.IsChildAgent) - presence.SendAvatarDataToAllClients(); + presence.SendAvatarDataToAllAgents(); } } } diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs index d3c46c917e..50a5fae06d 100644 --- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs +++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs @@ -153,14 +153,6 @@ namespace OpenSim.Region.OptionalModules ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); -<<<<<<< HEAD - // newParcel will be null only if it outside of our current region. If this is the case, then the - // receiving permissions will perform the check. - if (newParcel == null) - return true; - - // The prim hasn't crossed a region boundary so we don't need to worry -======= if (newParcel == null) return true; @@ -168,7 +160,6 @@ namespace OpenSim.Region.OptionalModules ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); // The prim hasn't crossed a region boundry so we don't need to worry ->>>>>>> avn/ubitvar // about prim counts here if(oldParcel != null && oldParcel.Equals(newParcel)) { diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index edf51a2dab..e7d461fba6 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs @@ -746,8 +746,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore List objlist; List veclist; - - bool success = host.RootPart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist); + + Vector3 bbox = new Vector3(); + float offsetHeight; + bool success = host.RootPart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist, out bbox, out offsetHeight); if (! success) { GenerateRuntimeError("Failed to create object"); diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index dc1ea953e0..35af6e7fd0 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -61,11 +61,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC private readonly string m_firstname; private readonly string m_lastname; private readonly Vector3 m_startPos; -<<<<<<< HEAD - private readonly UUID m_uuid; -======= private UUID m_uuid = UUID.Random(); ->>>>>>> avn/ubitvar private readonly Scene m_scene; private readonly UUID m_ownerID; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 29771957e2..9dc44899a5 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -457,12 +457,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC /// true if they do, false if they don't. private bool CheckPermissions(NPCAvatar av, UUID callerID) { -<<<<<<< HEAD return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID || av.AgentId == callerID; -======= - return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID || av.AgentId == callerID; ->>>>>>> avn/ubitvar } } } diff --git a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs index a26d145e1f..1102aca7cd 100644 --- a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs +++ b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs @@ -166,7 +166,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments cdl.AddRow("physics", m_scene.PhysicsEnabled); cdl.AddRow("scripting", m_scene.ScriptsEnabled); cdl.AddRow("teleport", m_scene.DebugTeleporting); - cdl.AddRow("update-on-timer", m_scene.UpdateOnTimer); +// cdl.AddRow("update-on-timer", m_scene.UpdateOnTimer); cdl.AddRow("updates", m_scene.DebugUpdates); MainConsole.Instance.OutputFormat("Scene {0} options:", m_scene.Name); @@ -313,7 +313,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments bool enableUpdateOnTimer; if (bool.TryParse(options["update-on-timer"], out enableUpdateOnTimer)) { - m_scene.UpdateOnTimer = enableUpdateOnTimer; +// m_scene.UpdateOnTimer = enableUpdateOnTimer; m_scene.Active = false; while (m_scene.IsRunning) diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs index ec717d73b0..e7a39eb9d2 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs @@ -1288,7 +1288,7 @@ namespace OpenSim.Region.Physics.OdePlugin } public override Vector3 PIDTarget { set { return; } } - public override bool PIDActive { set { return; } } + public override bool PIDActive { get { return m_pidControllerActive; } set { return; } } public override float PIDTau { set { return; } } public override float PIDHoverHeight { set { return; } } diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs index ba24aa7d47..b283152f74 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs @@ -748,7 +748,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_log.Warn("[PHYSICS]: Got NaN PIDTarget from Scene on Object"); } } - public override bool PIDActive { set { m_usePID = value; } } + public override bool PIDActive { get { return m_usePID; } set { m_usePID = value; } } public override float PIDTau { set { m_PIDTau = value; } } // For RotLookAt diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs index 00f51220f3..00baa210b6 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs @@ -1667,6 +1667,11 @@ namespace OpenSim.Region.Physics.OdePlugin #region Add/Remove Entities + public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) + { + return AddAvatar(avName, position, size, isFlying); + } + public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) { Vector3 pos; diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 96ef0a6e1a..eb7e8fc539 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -152,16 +152,16 @@ namespace OpenSim.Region.Physics.Manager /// /// /// -<<<<<<< HEAD + public abstract PhysicsActor AddAvatar( string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying); -======= + public virtual PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) { return null; } ->>>>>>> avn/ubitvar + /// /// Add an avatar /// @@ -177,13 +177,25 @@ namespace OpenSim.Region.Physics.Manager { PhysicsActor ret = AddAvatar(avName, position, velocity, size, isFlying); - if (ret != null) + if (ret != null) ret.LocalID = localID; return ret; } - public virtual PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying) + public virtual PhysicsActor AddAvatar( + uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) + { + PhysicsActor ret = AddAvatar(avName, position, size, isFlying); + + if (ret != null) + ret.LocalID = localID; + + return ret; + } + + public virtual PhysicsActor AddAvatar( + uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying) { PhysicsActor ret = AddAvatar(localID, avName, position, size, isFlying); return ret; diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 9203169d94..05eaf2aa68 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -1251,12 +1251,7 @@ namespace OpenSim.Region.Physics.OdePlugin public override Vector3 PIDTarget { set { return; } } public override bool PIDActive { -<<<<<<< HEAD get { return false; } -======= - // os version - // get { return false; } ->>>>>>> avn/ubitvar set { return; } } public override float PIDTau { set { return; } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 636342238c..0a99e30991 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -2955,14 +2955,8 @@ Console.WriteLine(" JointCreateFixed"); m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); } } -<<<<<<< HEAD - public override bool PIDActive { get; set; } -======= - // os version - //public override bool PIDActive {get { return m_usePID; } set { m_usePID = value; } } - public override bool PIDActive { set { m_usePID = value; } } ->>>>>>> avn/ubitvar + public override bool PIDActive { get; set; } public override float PIDTau { set { m_PIDTau = value; } } public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } @@ -3359,14 +3353,7 @@ Console.WriteLine(" JointCreateFixed"); RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod; if (assetProvider != null) assetProvider(_pbs.SculptTexture, MeshAssetReceived); -<<<<<<< HEAD }, null, "ODEPrim.CheckMeshAsset"); -======= - // os version - //}, null, "ODEPrim.CheckMeshAsset"); - // avn - }); ->>>>>>> avn/ubitvar } } diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 7f4a8090b7..3776ac9140 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -2020,35 +2020,11 @@ namespace OpenSim.Region.Physics.OdePlugin #region Add/Remove Entities -<<<<<<< HEAD public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) { OdeCharacter newAv = new OdeCharacter( avName, this, position, velocity, size, avPIDD, avPIDP, -======= -/* core version - public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) - { - OdeCharacter newAv - = new OdeCharacter( - avName, this, position, velocity, size, avPIDD, avPIDP, - avCapRadius, avStandupTensor, avDensity, - avMovementDivisorWalk, avMovementDivisorRun); - - newAv.Flying = isFlying; - newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset; - newAv.m_avatarplanted = avplanted; - - return newAv; - } -*/ - public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) - { - OdeCharacter newAv - = new OdeCharacter( - avName, this, position, Vector3.Zero, size, avPIDD, avPIDP, ->>>>>>> avn/ubitvar avCapRadius, avStandupTensor, avDensity, avMovementDivisorWalk, avMovementDivisorRun); diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 1c38246d11..0e2cbd2435 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs @@ -1415,7 +1415,7 @@ namespace OpenSim.Region.Physics.OdePlugin } public override Vector3 PIDTarget { set { return; } } - public override bool PIDActive { set { return; } } + public override bool PIDActive {get {return m_pidControllerActive;} set { return; } } public override float PIDTau { set { return; } } public override float PIDHoverHeight { set { return; } } diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index b13f601b0d..8bcdd89e6f 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -716,6 +716,10 @@ namespace OpenSim.Region.Physics.OdePlugin public override bool PIDActive { + get + { + return m_usePID; + } set { AddChange(changes.PIDActive,value); diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index dafd3a310c..26e8e54e3c 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -1222,6 +1222,11 @@ namespace OpenSim.Region.Physics.OdePlugin #region Add/Remove Entities + public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) + { + return AddAvatar(avName, position, size, isFlying); + } + public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying) { Vector3 pos; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index df1bd8b511..84d44a1210 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -387,28 +387,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public static void StateChange(IScriptEngine engine, uint localID, UUID itemID) - { - // Remove a specific script - - // Remove dataserver events - m_Dataserver[engine].RemoveEvents(localID, itemID); - - IWorldComm comms = engine.World.RequestModuleInterface(); - if (comms != null) - comms.DeleteListener(itemID); - - IXMLRPC xmlrpc = engine.World.RequestModuleInterface(); - if (xmlrpc != null) - { - xmlrpc.DeleteChannels(itemID); - xmlrpc.CancelSRDRequests(itemID); - } - - // Remove Sensors - m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); - - } + public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f637a1d7a9..f27a1221be 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -28,13 +28,9 @@ using System; using System.Collections; using System.Collections.Generic; -<<<<<<< HEAD using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; -======= -using System.Diagnostics; //for [DebuggerNonUserCode] ->>>>>>> avn/ubitvar using System.Runtime.Remoting.Lifetime; using System.Text; using System.Threading; @@ -43,11 +39,8 @@ using System.Timers; using Nini.Config; using log4net; using OpenMetaverse; -<<<<<<< HEAD using OpenMetaverse.Assets; -======= using OpenMetaverse.StructuredData; ->>>>>>> avn/ubitvar using OpenMetaverse.Packets; using OpenMetaverse.Rendering; using OpenSim; @@ -133,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected bool m_scriptConsoleChannelEnabled = false; protected bool m_debuggerSafe = false; protected IUrlModule m_UrlModule = null; -<<<<<<< HEAD + protected Dictionary m_userInfoCache = new Dictionary(); protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. protected int m_sleepMsOnSetTexture = 200; @@ -254,11 +247,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected static List m_castRayCalls = new List(); protected bool m_useMeshCacheInCastRay = true; protected static Dictionary m_cachedMeshes = new Dictionary(); -======= - protected Dictionary m_userInfoCache = - new Dictionary(); - protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. - protected ISoundModule m_SoundModule = null; // protected Timer m_ShoutSayTimer; protected int m_SayShoutCount = 0; @@ -288,7 +276,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api {"TURNRIGHT", "Turning Right"}, {"WALK", "Walking"} }; ->>>>>>> avn/ubitvar //An array of HTTP/1.1 headers that are not allowed to be used //as custom headers by llHTTPRequest. @@ -315,12 +302,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine = scriptEngine; m_host = host; m_item = item; -<<<<<<< HEAD -======= m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); - m_coopSleepHandle = coopSleepHandle; ->>>>>>> avn/ubitvar - + LoadConfig(); m_TransferModule = @@ -634,7 +617,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } int actualPrimCount = part.ParentGroup.PrimCount; - List sittingAvatars = part.ParentGroup.GetSittingAvatars(); + List sittingAvatars = part.ParentGroup.GetSittingAvatars(); int adjustedPrimCount = actualPrimCount + sittingAvatars.Count; // Special case for a single prim. In this case the linknum is zero. However, this will not match a single @@ -663,7 +646,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - return sittingAvatars[linknum - actualPrimCount - 1]; + ScenePresence sp = World.GetScenePresence(sittingAvatars[linknum - actualPrimCount - 1]); + if (sp != null) + return sp; + else + return null; } } else @@ -1316,8 +1303,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) - if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) - LSLError(error); + if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)); } public LSL_Integer llListen(int channelID, string name, string ID, string msg) @@ -2373,13 +2359,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); List parts = GetLinkParts(linknumber); -<<<<<<< HEAD - - foreach (SceneObjectPart part in parts) - SetTexture(part, texture, face); - - ScriptSleep(m_sleepMsOnSetLinkTexture); -======= if (parts.Count > 0) { try @@ -2391,8 +2370,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { } } - ScriptSleep(200); ->>>>>>> avn/ubitvar + ScriptSleep(m_sleepMsOnSetLinkTexture); } protected void SetTexture(SceneObjectPart part, string texture, int face) @@ -3038,12 +3016,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup.IsAttachment) { ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); -<<<<<<< HEAD - vel = avatar.GetWorldVelocity(); -======= if (avatar != null) - vel = avatar.Velocity; ->>>>>>> avn/ubitvar + vel = avatar.GetWorldVelocity(); } else { @@ -3463,15 +3437,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string reason; money.ObjectGiveMoney( -<<<<<<< HEAD - m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); - }, null, "LSL_Api.llGiveMoney"); -======= + m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero, out reason); - }); + }, null, "LSL_Api.llGiveMoney"); return 0; ->>>>>>> avn/ubitvar } public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) @@ -3574,12 +3544,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) } -<<<<<<< HEAD + }, null, "LSL_Api.llRezAtRoot"); -======= - return; - }); ->>>>>>> avn/ubitvar //ScriptSleep((int)((groupmass * velmag) / 10)); ScriptSleep(m_sleepMsOnRezAtRoot); @@ -3594,25 +3560,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); -<<<<<<< HEAD - // normalized direction to target - LSL_Vector dir = llVecNorm(target - from); - // use vertical to help compute left axis - LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0); - // find normalized left axis parallel to horizon - LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir)); - // make up orthogonal to left and dir - up = LSL_Vector.Cross(dir, left); - - // compute rotation based on orthogonal axes - LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up); - - // Per discussion with Melanie, for non-physical objects llLookAt appears to simply - // set the rotation of the object, copy that behavior - PhysicsActor pa = m_host.PhysActor; - - if (m_host.ParentGroup.IsAttachment || strength == 0 || pa == null || !pa.IsPhysical) -======= // Get the normalized vector to the target LSL_Vector d1 = llVecNorm(target - llGetPos()); @@ -3629,7 +3576,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Rotation r3 = new LSL_Rotation(0.000000, 0.707107, 0.000000, 0.707107); if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) ->>>>>>> avn/ubitvar { // Do nothing if either value is 0 (this has been checked in SL) if (strength <= 0.0 || damping <= 0.0) @@ -3703,18 +3649,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } -<<<<<<< HEAD - public LSL_Float llGetMassMKS() - { - // this is what the wiki says it does! - // http://wiki.secondlife.com/wiki/LlGetMassMKS - return llGetMass() * 100.0; -======= - public LSL_Float llGetMassMKS() { return 100f * llGetMass(); ->>>>>>> avn/ubitvar } public void llCollisionFilter(string name, string id, int accept) @@ -3863,17 +3800,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llInstantMessage(string user, string message) { + m_host.AddScriptLPS(1); UUID result; if (!UUID.TryParse(user, out result) || result == UUID.Zero) { - ShoutError("An invalid key was passed to llInstantMessage"); + Error("llInstantMessage","An invalid key was passed to llInstantMessage"); ScriptSleep(2000); return; } - - m_host.AddScriptLPS(1); - // We may be able to use ClientView.SendInstantMessage here, but we need a client instance. // InstantMessageModule.OnInstantMessage searches through a list of scenes for a client matching the toAgent, // but I don't think we have a list of scenes available from here. @@ -3883,50 +3818,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // TODO: figure out values for client, fromSession, and imSessionID // client.SendInstantMessage(m_host.UUID, fromSession, message, user, imSessionID, m_host.Name, AgentManager.InstantMessageDialog.MessageFromAgent, (uint)Util.UnixTimeSinceEpoch()); -<<<<<<< HEAD - -======= UUID friendTransactionID = UUID.Random(); //m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); ->>>>>>> avn/ubitvar GridInstantMessage msg = new GridInstantMessage(); msg.fromAgentID = new Guid(m_host.OwnerID.ToString()); // fromAgentID.Guid; msg.toAgentID = new Guid(user); // toAgentID.Guid; msg.imSessionID = new Guid(m_host.UUID.ToString()); // This is the item we're mucking with here -// m_log.Debug("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message); -// m_log.Debug("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString()); -// DateTime dt = DateTime.UtcNow; -// -// // Ticks from UtcNow, but make it look like local. Evil, huh? -// dt = DateTime.SpecifyKind(dt, DateTimeKind.Local); -// -// try -// { -// // Convert that to the PST timezone -// TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles"); -// dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo); -// } -// catch -// { -// // No logging here, as it could be VERY spammy -// } -// -// // And make it look local again to fool the unix time util -// dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc); - msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); + msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName; - //if (client != null) - //{ - msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName; - //} - //else - //{ - // msg.fromAgentName = "(hippos)";// Added for posterity. This means that we can't figure out who sent it - //} - // Cap the message length at 1024. if (message != null && message.Length > 1024) msg.message = message.Substring(0, 1024); else @@ -4237,17 +4139,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | ScriptBaseClass.PERMISSION_CONTROL_CAMERA | ScriptBaseClass.PERMISSION_TRACK_CAMERA | -<<<<<<< HEAD - ScriptBaseClass.PERMISSION_ATTACH; -======= ScriptBaseClass.PERMISSION_ATTACH | ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS; - ->>>>>>> avn/ubitvar } else { - if (m_host.ParentGroup.GetSittingAvatars().SingleOrDefault(sp => sp.UUID == agentID) != null) + if (m_host.ParentGroup.GetSittingAvatars().SingleOrDefault(id => id == agentID) != null) { // When agent is sitting, certain permissions are implicit if requested from sitting agent implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | @@ -4409,14 +4306,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llCreateLink(string target, int parent) { m_host.AddScriptLPS(1); -<<<<<<< HEAD -======= UUID targetID; if (!UUID.TryParse(target, out targetID)) return; ->>>>>>> avn/ubitvar if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 && !m_automaticLinkPermission) @@ -4589,30 +4483,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); -<<<<<<< HEAD - if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 - && !m_automaticLinkPermission) - { - Error("llBreakAllLinks", "PERMISSION_CHANGE_LINKS permission not set"); - return; - } - - BreakAllLinks(); - } - - public void BreakAllLinks() - { -======= TaskInventoryItem item = m_item; if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 && !m_automaticLinkPermission) { - ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); + Error("llBreakAllLinks","Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); return; } + BreakAllLinks(); + } ->>>>>>> avn/ubitvar + public void BreakAllLinks() + { SceneObjectGroup parentPrim = m_host.ParentGroup; if (parentPrim.AttachmentPoint != 0) return; // Fail silently if attached @@ -4643,12 +4526,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { linknum -= (m_host.ParentGroup.PrimCount) + 1; -<<<<<<< HEAD - ISceneEntity entity = GetLinkEntity(m_host, linknum); -======= if (linknum < 0) return UUID.Zero.ToString(); ->>>>>>> avn/ubitvar List avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET); if (avatars.Count > linknum) @@ -4779,14 +4658,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (item == null) { -<<<<<<< HEAD Error("llGiveInventory", "Can't find inventory object '" + inventory + "'"); return; -======= - llSay(0, String.Format("Could not find object '{0}'", inventory)); - return; -// throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); ->>>>>>> avn/ubitvar } UUID objId = item.ItemID; @@ -4845,9 +4718,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence sp; -<<<<<<< HEAD - ScriptSleep(m_sleepMsOnGiveInventory); -======= if (World.TryGetScenePresence(destId, out sp)) { sp.ControllingClient.SendInstantMessage(msg); @@ -4859,8 +4729,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } //This delay should only occur when giving inventory to avatars. - ScriptSleep(3000); ->>>>>>> avn/ubitvar + ScriptSleep(m_sleepMsOnGiveInventory); } } @@ -4919,16 +4788,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); -<<<<<<< HEAD - UUID uuid = (UUID)id; - PresenceInfo pinfo = null; - UserAccount account; - - UserInfoCacheEntry ce; - - lock (m_userInfoCache) - { -======= UUID uuid; if (UUID.TryParse(id, out uuid)) { @@ -4936,7 +4795,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UserAccount account; UserInfoCacheEntry ce; ->>>>>>> avn/ubitvar if (!m_userInfoCache.TryGetValue(uuid, out ce)) { account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); @@ -4945,10 +4803,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_userInfoCache[uuid] = null; // Cache negative return UUID.Zero.ToString(); } -<<<<<<< HEAD -======= - ->>>>>>> avn/ubitvar PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); if (pinfos != null && pinfos.Length > 0) @@ -4961,40 +4815,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } -<<<<<<< HEAD - - ce = new UserInfoCacheEntry(); - ce.time = Util.EnvironmentTickCount(); - ce.account = account; - ce.pinfo = pinfo; - - m_userInfoCache[uuid] = ce; - } - else - { - if (ce == null) - return UUID.Zero.ToString(); - - account = ce.account; - - if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) - >= LlRequestAgentDataCacheTimeoutMs) - { - PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); - if (pinfos != null && pinfos.Length > 0) - { - foreach (PresenceInfo p in pinfos) - { - if (p.RegionID != UUID.Zero) - { - pinfo = p; - } - } - } - else - { - pinfo = null; -======= ce = new UserInfoCacheEntry(); ce.time = Util.EnvironmentTickCount(); @@ -5022,60 +4842,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { pinfo = p; } ->>>>>>> avn/ubitvar } - - ce.time = Util.EnvironmentTickCount(); - ce.pinfo = pinfo; } - else - { - pinfo = ce.pinfo; - } -<<<<<<< HEAD - } - } -======= else pinfo = null; ce.time = Util.EnvironmentTickCount(); ce.pinfo = pinfo; } ->>>>>>> avn/ubitvar string reply = String.Empty; -<<<<<<< HEAD - switch (data) - { - case ScriptBaseClass.DATA_ONLINE: - if (pinfo != null && pinfo.RegionID != UUID.Zero) - reply = "1"; - else - reply = "0"; - break; - case ScriptBaseClass.DATA_NAME: // (First Last) - reply = account.FirstName + " " + account.LastName; - break; - case ScriptBaseClass.DATA_BORN: // (YYYY-MM-DD) - DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0); - born = born.AddSeconds(account.Created); - reply = born.ToString("yyyy-MM-dd"); - break; - case ScriptBaseClass.DATA_RATING: // (0,0,0,0,0,0) - reply = "0,0,0,0,0,0"; - break; - case 7: // DATA_USERLEVEL (integer). This is not available in LL and so has no constant. - reply = account.UserLevel.ToString(); - break; - case ScriptBaseClass.DATA_PAYINFO: // (0|1|2|3) - reply = "0"; - break; - default: - return UUID.Zero.ToString(); // Raise no event - } -======= switch (data) { case 1: // DATA_ONLINE (0|1) @@ -5101,7 +4878,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api default: return UUID.Zero.ToString(); // Raise no event } ->>>>>>> avn/ubitvar UUID rq = UUID.Random(); @@ -5112,19 +4888,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AsyncCommands. DataserverPlugin.DataserverReply(rq.ToString(), reply); -<<<<<<< HEAD - ScriptSleep(m_sleepMsOnRequestAgentData); - return tid.ToString(); -======= - ScriptSleep(100); + ScriptSleep(m_sleepMsOnRequestAgentData); return tid.ToString(); } else { - ShoutError("Invalid UUID passed to llRequestAgentData."); + Error("llRequestAgentData","Invalid UUID passed to llRequestAgentData."); } return ""; ->>>>>>> avn/ubitvar } public LSL_String llRequestInventoryData(string name) @@ -5252,11 +5023,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); UUID agentId = new UUID(); -<<<<<<< HEAD ulong regionHandle = Util.RegionWorldLocToHandle((uint)global_coords.x, (uint)global_coords.y); -======= - ulong regionHandle = Utils.UIntsToLong((uint)(global_coords.x / 256) * 256, (uint)(global_coords.y / 256) * 256); ->>>>>>> avn/ubitvar if (UUID.TryParse(agent, out agentId)) { @@ -6057,13 +5824,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // NOTE: 3rd case is needed because a NULL_KEY comes through as // type 'obj' and wrongly returns "" else if (!(src.Data[index] is LSL_String || -<<<<<<< HEAD src.Data[index] is LSL_Key || src.Data[index].ToString() == "00000000-0000-0000-0000-000000000000")) -======= - src.Data[index] is LSL_Key || - src.Data[index] is String)) ->>>>>>> avn/ubitvar { return ""; } @@ -6443,7 +6205,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); return new LSL_Vector(World.RegionInfo.WorldLocX, World.RegionInfo.WorldLocY, 0); -<<<<<<< HEAD } public LSL_String llGetEnv(LSL_String name) @@ -6509,8 +6270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { return ""; } -======= ->>>>>>> avn/ubitvar + } /// @@ -7153,11 +6913,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (UUID.TryParse(id, out key)) { ScenePresence av = World.GetScenePresence(key); - List sittingAvatars = m_host.ParentGroup.GetSittingAvatars(); + List sittingAvatars = m_host.ParentGroup.GetSittingAvatars(); if (av != null) { - if (sittingAvatars.Contains(av)) + if (sittingAvatars.Contains(key)) { // if the avatar is sitting on this object, then // we can unsit them. We don't want random scripts unsitting random people @@ -8152,16 +7912,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID av = new UUID(); if (!UUID.TryParse(avatar,out av)) { -<<<<<<< HEAD Error("llDialog", "First parameter must be a key"); -======= - //LSLError("First parameter to llDialog needs to be a key"); ->>>>>>> avn/ubitvar return; } if (buttons.Length < 1) { -<<<<<<< HEAD Error("llDialog", "At least 1 button must be shown"); return; } @@ -8169,13 +7924,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { Error("llDialog", "No more than 12 buttons can be shown"); return; -======= - buttons.Add("OK"); - } - if (buttons.Length > 12) - { - ShoutError("button list too long, must be 12 or fewer entries"); ->>>>>>> avn/ubitvar } int length = buttons.Length; if (length > 12) @@ -8186,20 +7934,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (buttons.Data[i].ToString() == String.Empty) { -<<<<<<< HEAD Error("llDialog", "Button label cannot be blank"); -======= - ShoutError("button label cannot be blank"); ->>>>>>> avn/ubitvar return; } if (buttons.Data[i].ToString().Length > 24) { -<<<<<<< HEAD Error("llDialog", "Button label cannot be longer than 24 characters"); -======= - ShoutError("button label cannot be longer than 24 characters"); ->>>>>>> avn/ubitvar return; } buts[i] = buttons.Data[i].ToString(); @@ -8750,7 +8490,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(m_sleepMsOnSetPrimitiveParams); } -<<<<<<< HEAD public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) { m_host.AddScriptLPS(1); @@ -8760,8 +8499,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(m_sleepMsOnSetLinkPrimitiveParams); } -======= ->>>>>>> avn/ubitvar public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) { m_host.AddScriptLPS(1); @@ -8769,13 +8506,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); } -<<<<<<< HEAD - protected void SetLinkPrimParams(int linknumber, LSL_List rules, string originFunc) - { - SetEntityParams(GetLinkEntities(linknumber), rules, originFunc); - } -======= - private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc) + private void SetLinkPrimParams(int linknumber, LSL_List rules, string originFunc) { List parts = new List(); List prims = GetLinkParts(linknumber); @@ -8784,14 +8515,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api parts.Add(p); foreach (ScenePresence p in avatars) parts.Add(p); ->>>>>>> avn/ubitvar + + LSL_List remaining = new LSL_List(); + uint rulesParsed = 0; + + if (parts.Count > 0) + { + foreach (object part in parts) + { + if (part is SceneObjectPart) + remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed); + else + remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed); + } + + while (remaining.Length > 2) + { + linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + parts.Clear(); + prims = GetLinkParts(linknumber); + avatars = GetLinkAvatars(linknumber); + foreach (SceneObjectPart p in prims) + parts.Add(p); + foreach (ScenePresence p in avatars) + parts.Add(p); + + remaining = new LSL_List(); + foreach (object part in parts) + { + if (part is SceneObjectPart) + remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed); + else + remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed); + } + } + } + } protected void SetEntityParams(List entities, LSL_List rules, string originFunc) { LSL_List remaining = new LSL_List(); uint rulesParsed = 0; -<<<<<<< HEAD foreach (ISceneEntity entity in entities) { if (entity is SceneObjectPart) @@ -8826,51 +8592,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llSetKeyframedMotion(LSL_List frames, LSL_List options) - { - SceneObjectGroup group = m_host.ParentGroup; - - if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical) - return; - if (group.IsAttachment) - return; - - if (frames.Data.Length > 0) // We are getting a new motion -======= - if (parts.Count > 0) ->>>>>>> avn/ubitvar - { - foreach (object part in parts) - { - if (part is SceneObjectPart) - remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed); - else - remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed); - } - - while ((object)remaining != null && remaining.Length > 2) - { - linknumber = remaining.GetLSLIntegerItem(0); - rules = remaining.GetSublist(1, -1); - parts.Clear(); - prims = GetLinkParts(linknumber); - avatars = GetLinkAvatars(linknumber); - foreach (SceneObjectPart p in prims) - parts.Add(p); - foreach (ScenePresence p in avatars) - parts.Add(p); - - remaining = null; - foreach (object part in parts) - { - if (part is SceneObjectPart) - remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed); - else - remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed); - } - } - } - } public LSL_List llGetPhysicsMaterial() { @@ -8914,13 +8635,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetPhysicsMaterial(m_host, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier); } - public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) - { - setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams"); - llSetLinkPrimitiveParamsFast(linknumber, rules); - ScriptSleep(200); - } - // vector up using libomv (c&p from sop ) // vector up rotated by r private Vector3 Zrot(Quaternion r) @@ -8947,7 +8661,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules, string originFunc, ref uint rulesParsed) { if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) - return null; + return new LSL_List(); int idx = 0; int idxStart = 0; @@ -8977,26 +8691,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return new LSL_List(); -<<<<<<< HEAD - try - { - v = rules.GetVector3Item(idx++); - } - catch(InvalidCastException) - { - if(code == ScriptBaseClass.PRIM_POSITION) - Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POSITION: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1)); - else - Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POS_LOCAL: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1)); - return new LSL_List(); - } -======= v=rules.GetVector3Item(idx++); if (part.IsRoot && !part.ParentGroup.IsAttachment) currentPosition = GetSetPosTarget(part, v, currentPosition, true); else currentPosition = GetSetPosTarget(part, v, currentPosition, false); ->>>>>>> avn/ubitvar positionChanged = true; break; @@ -10023,12 +9722,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; -<<<<<<< HEAD - case ScriptBaseClass.PRIM_TEMP_ON_REZ: -======= case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: if (remain < 5) - return null; + return new LSL_List(); int material_bits = rules.GetLSLIntegerItem(idx++); float material_density = (float)rules.GetLSLFloatItem(idx++); @@ -10041,7 +9737,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: ->>>>>>> avn/ubitvar if (remain < 1) return new LSL_List(); string temp = rules.Data[idx++].ToString(); @@ -10397,12 +10092,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llXorBase64Strings(string str1, string str2) { -<<<<<<< HEAD - m_host.AddScriptLPS(1); - Deprecated("llXorBase64Strings", "Use llXorBase64 instead"); - ScriptSleep(m_sleepMsOnXorBase64Strings); - return String.Empty; -======= int padding = 0; string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -10501,7 +10190,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api output += "="; return output; ->>>>>>> avn/ubitvar } public void llRemoteDataSetRegion() @@ -10645,173 +10333,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetBoundingBox(string obj) { m_host.AddScriptLPS(1); - - // Get target avatar if non-seated avatar or attachment, or prim and object UUID objID = UUID.Zero; - UUID.TryParse(obj, out objID); - ScenePresence agent = World.GetScenePresence(objID); - if (agent != null) - { - if (agent.ParentPart != null) - { - objID = agent.ParentPart.UUID; - agent = null; - } - } - SceneObjectGroup group = null; - SceneObjectPart target = World.GetSceneObjectPart(objID); - if (target != null) - { - group = target.ParentGroup; - if (group.IsAttachment) { - objID = group.AttachedAvatar; - agent = World.GetScenePresence(objID); - group = null; - target = null; - } - } - - // Initialize but break if no target LSL_List result = new LSL_List(); -<<<<<<< HEAD - int groupCount = 0; - int partCount = 0; - int vertexCount = 0; - if (target == null && agent == null) -======= // If the ID is not valid, return null result if (!UUID.TryParse(obj, out objID)) ->>>>>>> avn/ubitvar { result.Add(new LSL_Vector()); result.Add(new LSL_Vector()); - if (m_addStatsInGetBoundingBox) - result.Add(new LSL_Vector((float)groupCount, (float)partCount, (float)vertexCount)); return result; } -<<<<<<< HEAD - Vector3 minPosition = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue); - Vector3 maxPosition = new Vector3(float.MinValue, float.MinValue, float.MinValue); - - // Try to get a mesher - IRendering primMesher = null; - List renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); - if (renderers.Count > 0) - primMesher = RenderingLoader.LoadRenderer(renderers[0]); - - // Get bounding box of just avatar, seated or not - if (agent != null) - { - bool hasParent = false; - Vector3 lower; - Vector3 upper; - BoundingBoxOfScenePresence(agent, out lower, out upper); - Vector3 offset = Vector3.Zero; - - // Since local bounding box unrotated and untilted, keep it simple - AddBoundingBoxOfSimpleBox(lower, upper, offset, agent.Rotation, hasParent, ref minPosition, ref maxPosition, ref vertexCount); - partCount++; - groupCount++; - - // Return lower and upper bounding box corners - result.Add(new LSL_Vector(minPosition)); - result.Add(new LSL_Vector(maxPosition)); - if (m_addStatsInGetBoundingBox) - result.Add(new LSL_Vector((float)groupCount, (float)partCount, (float)vertexCount)); - return result; - } - // Get bounding box of object including seated avatars - else if (group != null) - { - // Merge bounding boxes of all parts (prims and mesh) - foreach (SceneObjectPart part in group.Parts) - { - bool hasParent = (!part.IsRoot); - // When requested or if no mesher, keep it simple - if (m_useSimpleBoxesInGetBoundingBox || primMesher == null) - { - AddBoundingBoxOfSimpleBox(part.Scale * -0.5f, part.Scale * 0.5f, part.OffsetPosition, part.RotationOffset, hasParent, ref minPosition, ref maxPosition, ref vertexCount); - } - // Do the full mounty - else - { - Primitive omvPrim = part.Shape.ToOmvPrimitive(part.OffsetPosition, part.RotationOffset); - byte[] sculptAsset = null; - if (omvPrim.Sculpt != null) - sculptAsset = World.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString()); - - // When part is mesh - // Quirk: Only imports as incompletely populated faceted mesh object, so needs an own handler. - if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type == SculptType.Mesh && sculptAsset != null) - { - AssetMesh meshAsset = new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset); - FacetedMesh mesh = null; - FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, DetailLevel.Highest, out mesh); - meshAsset = null; - if (mesh != null) - { - AddBoundingBoxOfFacetedMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount); - mesh = null; - } - } - - // When part is sculpt - // Quirk: Generated sculpt mesh is about 2.8% smaller in X and Y than visual sculpt. - else if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type != SculptType.Mesh && sculptAsset != null) - { - IJ2KDecoder imgDecoder = World.RequestModuleInterface(); - if (imgDecoder != null) - { - Image sculpt = imgDecoder.DecodeToImage(sculptAsset); - if (sculpt != null) - { - SimpleMesh mesh = primMesher.GenerateSimpleSculptMesh(omvPrim, (Bitmap)sculpt, DetailLevel.Medium); - sculpt.Dispose(); - if (mesh != null) - { - AddBoundingBoxOfSimpleMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount); - mesh = null; - } - } - } - } - - // When part is prim - else if (omvPrim.Sculpt == null) - { - SimpleMesh mesh = primMesher.GenerateSimpleMesh(omvPrim, DetailLevel.Medium); - if (mesh != null) - { - AddBoundingBoxOfSimpleMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount); - mesh = null; - } - } - - // When all else fails, try fallback to simple box - else - { - AddBoundingBoxOfSimpleBox(part.Scale * -0.5f, part.Scale * 0.5f, part.OffsetPosition, part.RotationOffset, hasParent, ref minPosition, ref maxPosition, ref vertexCount); - } - } - partCount++; - } - } - - // Merge bounding boxes of seated avatars - foreach (ScenePresence sp in group.GetSittingAvatars()) - { - Vector3 lower; - Vector3 upper; - BoundingBoxOfScenePresence(sp, out lower, out upper); - Vector3 offset = sp.OffsetPosition; - - bool hasParent = true; - // When requested or if no mesher, keep it simple - if (m_useSimpleBoxesInGetBoundingBox || primMesher == null) - { - AddBoundingBoxOfSimpleBox(lower, upper, offset, sp.Rotation, hasParent, ref minPosition, ref maxPosition, ref vertexCount); -======= // Check if this is an attached prim. If so, replace // the UUID with the avatar UUID and report it's bounding box @@ -10855,68 +10386,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // This is for ground sitting avatars TODO! lower = new LSL_Vector(-box.X - 0.1125, -box.Y, box.Z * -1.0f); upper = new LSL_Vector(box.X + 0.1125, box.Y, box.Z * -1.0f); ->>>>>>> avn/ubitvar } - // Do the full mounty else { -<<<<<<< HEAD - // Prim shapes don't do center offsets, so add it here. - offset = offset + (lower + upper) * 0.5f * sp.Rotation; - Primitive omvPrim = MakeOpenMetaversePrim(upper - lower, offset, sp.Rotation, ScriptBaseClass.PRIM_TYPE_SPHERE); - SimpleMesh mesh = primMesher.GenerateSimpleMesh(omvPrim, DetailLevel.Medium); - AddBoundingBoxOfSimpleMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount); - mesh = null; - } - partCount++; - } - - groupCount++; - - // Return lower and upper bounding box corners - result.Add(new LSL_Vector(minPosition)); - result.Add(new LSL_Vector(maxPosition)); - if (m_addStatsInGetBoundingBox) - result.Add(new LSL_Vector((float)groupCount, (float)partCount, (float)vertexCount)); - - primMesher = null; - return result; - } - - /// - /// Helper to calculate bounding box of an avatar. - /// - private void BoundingBoxOfScenePresence(ScenePresence sp, out Vector3 lower, out Vector3 upper) - { - // Adjust from OS model - // avatar height = visual height - 0.2, bounding box height = visual height - // to SL model - // avatar height = visual height, bounding box height = visual height + 0.2 - float height = sp.Appearance.AvatarHeight + m_avatarHeightCorrection; - - // According to avatar bounding box in SL 2015-04-18: - // standing = <-0.275,-0.35,-0.1-0.5*h> : <0.275,0.35,0.1+0.5*h> - // groundsitting = <-0.3875,-0.5,-0.05-0.375*h> : <0.3875,0.5,0.5> - // sitting = <-0.5875,-0.35,-0.35-0.375*h> : <0.1875,0.35,-0.25+0.25*h> - - // When avatar is sitting - if (sp.ParentPart != null) - { - lower = new Vector3(m_lABB1SitX0, m_lABB1SitY0, m_lABB1SitZ0 + m_lABB1SitZ1 * height); - upper = new Vector3(m_lABB2SitX0, m_lABB2SitY0, m_lABB2SitZ0 + m_lABB2SitZ1 * height); - } - // When avatar is groundsitting - else if (sp.Animator.Animations.ImplicitDefaultAnimation.AnimID == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) - { - lower = new Vector3(m_lABB1GrsX0, m_lABB1GrsY0, m_lABB1GrsZ0 + m_lABB1GrsZ1 * height); - upper = new Vector3(m_lABB2GrsX0, m_lABB2GrsY0, m_lABB2GrsZ0 + m_lABB2GrsZ1 * height); - } - // When avatar is standing or flying - else - { - lower = new Vector3(m_lABB1StdX0, m_lABB1StdY0, m_lABB1StdZ0 + m_lABB1StdZ1 * height); - upper = new Vector3(m_lABB2StdX0, m_lABB2StdY0, m_lABB2StdZ0 + m_lABB2StdZ1 * height); -======= // This is for standing/flying avatars lower = new LSL_Vector(-box.X, -box.Y, -box.Z); upper = new LSL_Vector(box.X, box.Y, box.Z); @@ -10974,230 +10446,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api result.Add(lower); result.Add(upper); return result; ->>>>>>> avn/ubitvar - } - } - - /// - /// Helper to approximate a part with a simple box. - /// - private void AddBoundingBoxOfSimpleBox(Vector3 corner1, Vector3 corner2, Vector3 offset, Quaternion rotation, bool hasParent, ref Vector3 lower, ref Vector3 upper, ref int count) - { - // Parse the 8 box corners - for (int i = 0; i < 8; i++) - { - // Calculate each box corner - Vector3 position = corner1; - if ((i & 1) != 0) - position.X = corner2.X; - if ((i & 2) != 0) - position.Y = corner2.Y; - if ((i & 4) != 0) - position.Z = corner2.Z; - // Rotate part unless part is root - if (hasParent) - position = position * rotation; - position = position + offset; - // Adjust lower and upper bounding box corners if needed - lower = Vector3.Min(lower, position); - upper = Vector3.Max(upper, position); - count++; - } - } - - /// - /// Helper to parse a meshed prim and needed especially - /// for accuracy with tortured prims and sculpts. - /// - private void AddBoundingBoxOfSimpleMesh(SimpleMesh mesh, Primitive prim, bool hasParent, ref Vector3 lower, ref Vector3 upper, ref int count) - { - // Quirk: A meshed box contains 10 instead of the 8 necessary vertices. - if (mesh != null) - { - // Parse each vertex in mesh - foreach (Vertex vertex in mesh.Vertices) - { - Vector3 position = vertex.Position; - position = position * prim.Scale; - // Rotate part unless part is root - if (hasParent) - position = position * prim.Rotation; - position = position + prim.Position; - // Adjust lower and upper bounding box corners if needed - lower = Vector3.Min(lower, position); - upper = Vector3.Max(upper, position); - count++; - } - } - } - - /// - /// Helper to parse mesh because no method exists - /// to parse mesh assets to SimpleMesh. - /// - private void AddBoundingBoxOfFacetedMesh(FacetedMesh mesh, Primitive prim, bool hasParent, ref Vector3 lower, ref Vector3 upper, ref int count) - { - if (mesh != null) - { - // Parse each face in mesh - // since vertex array isn't populated. - // This parses each unique vertex 3-6 times. - foreach (Face face in mesh.Faces) - { - // Parse each vertex in face - foreach (Vertex vertex in face.Vertices) - { - Vector3 position = vertex.Position; - position = position * prim.Scale; - // Rotate part unless part is root - if (hasParent) - position = position * prim.Rotation; - position = position + prim.Position; - // Adjust lower and upper bounding box corners if needed - lower = Vector3.Min(lower, position); - upper = Vector3.Max(upper, position); - count++; - } - } - } - } - - /// - /// Helper to make up an OpenMetaverse prim - /// needed to create mesh from parts. - /// - private Primitive MakeOpenMetaversePrim(Vector3 scale, Vector3 position, Quaternion rotation, int primType) - { - // Initialize and set common parameters - Primitive prim = new OpenMetaverse.Primitive(); - prim.Scale = scale; - prim.Position = position; - prim.Rotation = rotation; - prim.PrimData.PathShearX = 0.0f; - prim.PrimData.PathShearY = 0.0f; - prim.PrimData.PathBegin = 0.0f; - prim.PrimData.PathEnd = 1.0f; - prim.PrimData.PathScaleX = 1.0f; - prim.PrimData.PathScaleY = 1.0f; - prim.PrimData.PathTaperX = 0.0f; - prim.PrimData.PathTaperY = 0.0f; - prim.PrimData.PathTwistBegin = 0.0f; - prim.PrimData.PathTwist = 0.0f; - prim.PrimData.ProfileBegin = 0.0f; - prim.PrimData.ProfileEnd = 1.0f; - prim.PrimData.ProfileHollow = 0.0f; - prim.PrimData.ProfileCurve = (ProfileCurve)1; - prim.PrimData.ProfileHole = (HoleType)0; - prim.PrimData.PathCurve = (PathCurve)16; - prim.PrimData.PathRadiusOffset = 0.0f; - prim.PrimData.PathRevolutions = 1.0f; - prim.PrimData.PathSkew = 0.0f; - prim.PrimData.PCode = OpenMetaverse.PCode.Prim; - prim.PrimData.State = (byte)0; - - // Set type specific parameters - switch (primType) - { - // Set specific parameters for box - case ScriptBaseClass.PRIM_TYPE_BOX: - prim.PrimData.PathScaleY = 1.0f; - prim.PrimData.ProfileCurve = (ProfileCurve)1; - prim.PrimData.PathCurve = (PathCurve)16; - break; - // Set specific parameters for cylinder - case ScriptBaseClass.PRIM_TYPE_CYLINDER: - prim.PrimData.PathScaleY = 1.0f; - prim.PrimData.ProfileCurve = (ProfileCurve)0; - prim.PrimData.PathCurve = (PathCurve)16; - break; - // Set specific parameters for prism - case ScriptBaseClass.PRIM_TYPE_PRISM: - prim.PrimData.PathScaleY = 1.0f; - prim.PrimData.ProfileCurve = (ProfileCurve)3; - prim.PrimData.PathCurve = (PathCurve)16; - break; - // Set specific parameters for sphere - case ScriptBaseClass.PRIM_TYPE_SPHERE: - prim.PrimData.PathScaleY = 1.0f; - prim.PrimData.ProfileCurve = (ProfileCurve)5; - prim.PrimData.PathCurve = (PathCurve)32; - break; - // Set specific parameters for torus - case ScriptBaseClass.PRIM_TYPE_TORUS: - prim.PrimData.PathScaleY = 0.5f; - prim.PrimData.ProfileCurve = (ProfileCurve)0; - prim.PrimData.PathCurve = (PathCurve)32; - break; - // Set specific parameters for tube - case ScriptBaseClass.PRIM_TYPE_TUBE: - prim.PrimData.PathScaleY = 0.5f; - prim.PrimData.ProfileCurve = (ProfileCurve)1; - prim.PrimData.PathCurve = (PathCurve)32; - break; - // Set specific parameters for ring - case ScriptBaseClass.PRIM_TYPE_RING: - prim.PrimData.PathScaleY = 0.5f; - prim.PrimData.ProfileCurve = (ProfileCurve)3; - prim.PrimData.PathCurve = (PathCurve)32; - break; - // Set specific parameters for sculpt - case ScriptBaseClass.PRIM_TYPE_SCULPT: - prim.PrimData.PathScaleY = 1.0f; - prim.PrimData.ProfileCurve = (ProfileCurve)5; - prim.PrimData.PathCurve = (PathCurve)32; - break; - // Default to specific parameters for box - default: - prim.PrimData.PathScaleY = 1.0f; - prim.PrimData.ProfileCurve = (ProfileCurve)1; - prim.PrimData.PathCurve = (PathCurve)16; - break; } - return prim; + // Not found so return empty values + result.Add(new LSL_Vector()); + result.Add(new LSL_Vector()); + return result; } - /// - /// Implementation of llGetGeometricCenter according to SL 2015-04-30. - /// http://wiki.secondlife.com/wiki/LlGetGeometricCenter - /// Returns the average position offset of all linked parts, - /// including the root prim and seated avatars, - /// relative to the root prim in local coordinates. - /// public LSL_Vector llGetGeometricCenter() { - // Subtract whatever position the root prim has to make it zero - Vector3 offset = m_host.ParentGroup.RootPart.OffsetPosition * -1.0f; - - // Add all prim/part position offsets - foreach (SceneObjectPart part in m_host.ParentGroup.Parts) - offset = offset + part.OffsetPosition; - // Add all avatar/scene presence position offsets - foreach (ScenePresence sp in m_host.ParentGroup.GetSittingAvatars()) - offset = offset + sp.OffsetPosition; - - // Calculate and return the average offset - offset = offset / (float)(m_host.ParentGroup.PrimCount + m_host.ParentGroup.GetSittingAvatarsCount()); - return new LSL_Vector(offset); + return new LSL_Vector(m_host.GetGeometricCenter()); } public LSL_List llGetPrimitiveParams(LSL_List rules) { -<<<<<<< HEAD - LSL_List result = new LSL_List(); - LSL_List remaining; - - while (true) - { -// m_log.DebugFormat( -// "[LSL API]: GetEntityParams has {0} rules with scene entity named {1}", -// rules.Length, entity != null ? entity.Name : "NULL"); - - if (entity == null) - return result; -======= m_host.AddScriptLPS(1); ->>>>>>> avn/ubitvar LSL_List result = new LSL_List(); @@ -11207,13 +10471,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { int linknumber = remaining.GetLSLIntegerItem(0); rules = remaining.GetSublist(1, -1); -<<<<<<< HEAD - entity = GetLinkEntity(m_host, linknumber); - } - } -======= List parts = GetLinkParts(linknumber); ->>>>>>> avn/ubitvar foreach (SceneObjectPart part in parts) remaining = GetPrimParams(part, rules, ref result); @@ -11226,185 +10484,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); -<<<<<<< HEAD - return GetEntityParams(GetLinkEntity(m_host, linknumber), rules); - } -======= // acording to SL wiki this must indicate a single link number or link_root or link_this. // keep other options as before ->>>>>>> avn/ubitvar List parts; List avatars; LSL_List res = new LSL_List(); - LSL_List remaining = null; + LSL_List remaining = new LSL_List(); while (rules.Length > 0) { parts = GetLinkParts(linknumber); avatars = GetLinkAvatars(linknumber); - remaining = null; + remaining = new LSL_List(); foreach (SceneObjectPart part in parts) { -<<<<<<< HEAD - case (int)ScriptBaseClass.PRIM_MATERIAL: - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MATERIAL_FLESH)); - break; - - case (int)ScriptBaseClass.PRIM_PHYSICS: - res.Add(ScriptBaseClass.FALSE); - break; - - case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: - res.Add(ScriptBaseClass.FALSE); - break; - - case (int)ScriptBaseClass.PRIM_PHANTOM: - res.Add(ScriptBaseClass.FALSE); - break; - - case (int)ScriptBaseClass.PRIM_POSITION: - res.Add(new LSL_Vector(sp.AbsolutePosition)); - break; - - case (int)ScriptBaseClass.PRIM_SIZE: - res.Add(GetAgentSize(sp)); - break; - - case (int)ScriptBaseClass.PRIM_ROTATION: - res.Add(sp.GetWorldRotation()); - break; - - case (int)ScriptBaseClass.PRIM_TYPE: - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX)); - res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT)); - res.Add(new LSL_Vector(0, 1, 0)); - res.Add(new LSL_Float(0)); - res.Add(new LSL_Vector(0, 0, 0)); - res.Add(new LSL_Vector(1, 1, 0)); - res.Add(new LSL_Vector(0, 0, 0)); - break; - - case (int)ScriptBaseClass.PRIM_TEXTURE: - if (remain < 1) - return new LSL_List(); - - int face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) - break; - - res.Add(new LSL_String("")); - res.Add(ScriptBaseClass.ZERO_VECTOR); - res.Add(ScriptBaseClass.ZERO_VECTOR); - res.Add(new LSL_Float(0)); - break; - - case (int)ScriptBaseClass.PRIM_COLOR: - if (remain < 1) - return new LSL_List(); - - face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) - break; - - res.Add(ScriptBaseClass.ZERO_VECTOR); - res.Add(new LSL_Float(0)); - break; - - case (int)ScriptBaseClass.PRIM_BUMP_SHINY: - if (remain < 1) - return new LSL_List(); - - face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) - break; - - res.Add(ScriptBaseClass.PRIM_SHINY_NONE); - res.Add(ScriptBaseClass.PRIM_BUMP_NONE); - break; - - case (int)ScriptBaseClass.PRIM_FULLBRIGHT: - if (remain < 1) - return new LSL_List(); - - face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) - break; - - res.Add(ScriptBaseClass.FALSE); - break; - - case (int)ScriptBaseClass.PRIM_FLEXIBLE: - res.Add(ScriptBaseClass.FALSE); - res.Add(new LSL_Integer(0)); - res.Add(new LSL_Float(0)); - res.Add(new LSL_Float(0)); - res.Add(new LSL_Float(0)); - res.Add(new LSL_Float(0)); - res.Add(ScriptBaseClass.ZERO_VECTOR); - break; - - case (int)ScriptBaseClass.PRIM_TEXGEN: - if (remain < 1) - return new LSL_List(); - - face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) - break; - - res.Add(ScriptBaseClass.PRIM_TEXGEN_DEFAULT); - break; - - case (int)ScriptBaseClass.PRIM_POINT_LIGHT: - res.Add(ScriptBaseClass.FALSE); - res.Add(ScriptBaseClass.ZERO_VECTOR); - res.Add(ScriptBaseClass.ZERO_VECTOR); - break; - - case (int)ScriptBaseClass.PRIM_GLOW: - if (remain < 1) - return new LSL_List(); - - face = (int)rules.GetLSLIntegerItem(idx++); - if (face > 21) - break; - - res.Add(new LSL_Float(0)); - break; - - case (int)ScriptBaseClass.PRIM_TEXT: - res.Add(new LSL_String("")); - res.Add(ScriptBaseClass.ZERO_VECTOR); - res.Add(new LSL_Float(1)); - break; - - case (int)ScriptBaseClass.PRIM_ROT_LOCAL: - res.Add(new LSL_Rotation(sp.Rotation)); - break; - - case (int)ScriptBaseClass.PRIM_POS_LOCAL: - res.Add(new LSL_Vector(sp.OffsetPosition)); - break; - - case (int)ScriptBaseClass.PRIM_SLICE: - res.Add(new LSL_Vector(0, 1, 0)); - break; - - case (int)ScriptBaseClass.PRIM_LINK_TARGET: - if(remain < 3) - return new LSL_List(); -======= remaining = GetPrimParams(part, rules, ref res); } foreach (ScenePresence avatar in avatars) { remaining = GetPrimParams(avatar, rules, ref res); } ->>>>>>> avn/ubitvar - if ((object)remaining != null && remaining.Length > 0) + if (remaining.Length > 0) { linknumber = remaining.GetLSLIntegerItem(0); rules = remaining.GetSublist(1, -1); @@ -11413,16 +10517,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; } -<<<<<<< HEAD - return new LSL_List(); -======= return res; ->>>>>>> avn/ubitvar } public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) { - int idx=0; + int idx = 0; while (idx < rules.Length) { int code = (int)rules.GetLSLIntegerItem(idx++); @@ -11470,10 +10570,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api res.Add(GetPartRot(part)); break; - case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: - res.Add(new LSL_Integer((int)part.PhysicsShapeType)); - break; - case (int)ScriptBaseClass.PRIM_TYPE: // implementing box PrimitiveBaseShape Shape = part.Shape; @@ -11567,7 +10663,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Primitive.TextureEntry tex = part.Shape.Textures; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0 ; face < GetNumberOfSides(part); face++) + for (face = 0; face < GetNumberOfSides(part); face++) { Primitive.TextureEntryFace texface = tex.GetFace((uint)face); @@ -11603,13 +10699,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return new LSL_List(); - face=(int)rules.GetLSLIntegerItem(idx++); + face = (int)rules.GetLSLIntegerItem(idx++); tex = part.Shape.Textures; Color4 texcolor; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0 ; face < GetNumberOfSides(part); face++) + for (face = 0; face < GetNumberOfSides(part); face++) { texcolor = tex.GetFace((uint)face).RGBA; res.Add(new LSL_Vector(texcolor.R, @@ -11666,7 +10762,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Shininess shinyness = tex.GetFace((uint)face).Shiny; if (shinyness == Shininess.High) { - shiny = ScriptBaseClass.PRIM_SHINY_HIGH; + shiny = ScriptBaseClass.PRIM_SHINY_HIGH; } else if (shinyness == Shininess.Medium) { @@ -11818,7 +10914,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api res.Add(new LSL_Vector(textColor.R, textColor.G, textColor.B)); - res.Add(new LSL_Float(1.0 - textColor.A)); + res.Add(new LSL_Float(textColor.A)); break; case (int)ScriptBaseClass.PRIM_NAME: @@ -11857,6 +10953,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_List(); } + public LSL_List llGetPrimMediaParams(int face, LSL_List rules) { m_host.AddScriptLPS(1); @@ -13316,16 +12413,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (quick_pay_buttons.Data.Length < 4) { -<<<<<<< HEAD - Error("llSetPayPrice", "List must have at least 4 elements"); - return; -======= int x; for (x=quick_pay_buttons.Data.Length; x<= 4; x++) { quick_pay_buttons.Add(ScriptBaseClass.PAY_HIDE); } ->>>>>>> avn/ubitvar } int[] nPrice = new int[5]; nPrice[0] = price; @@ -13447,12 +12539,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname, pos, lookAt); } -<<<<<<< HEAD ScriptSleep(m_sleepMsOnMapDestination); -======= - - ScriptSleep(1000); ->>>>>>> avn/ubitvar } public void llAddToLandBanList(string avatar, double hours) @@ -13577,7 +12664,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api object[] data = rules.Data; for (int i = 0; i < data.Length; ++i) { -<<<<<<< HEAD int type; try { @@ -13588,9 +12674,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Error("llSetCameraParams", string.Format("Invalid camera param type {0}", data[i - 1])); return; } -======= - int type = Convert.ToInt32(data[i++].ToString()); ->>>>>>> avn/ubitvar if (i >= data.Length) break; // odd number of entries => ignore the last // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3) @@ -14242,12 +13325,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ret.Add(new LSL_Rotation((double)avrot.X, (double)avrot.Y, (double)avrot.Z, (double)avrot.W)); break; case ScriptBaseClass.OBJECT_VELOCITY: -<<<<<<< HEAD - ret.Add(new LSL_Vector(av.GetWorldVelocity())); -======= - Vector3 avvel = av.Velocity; + Vector3 avvel = av.GetWorldVelocity(); ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z)); ->>>>>>> avn/ubitvar break; case ScriptBaseClass.OBJECT_OWNER: ret.Add(new LSL_String(id)); @@ -14724,12 +13803,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { - SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); + SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); + + LSL_List result = new LSL_List(); if (obj != null && obj.OwnerID == m_host.OwnerID) - return GetEntityParams(obj, rules); + { + LSL_List remaining = GetPrimParams(obj, rules, ref result); - return new LSL_List(); + while (remaining.Length > 2) + { + int linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + List parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = GetPrimParams(part, rules, ref result); + } + } + + return result; } public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) @@ -15302,6 +14395,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return list; } + /// + /// Helper to calculate bounding box of an avatar. + /// + private void BoundingBoxOfScenePresence(ScenePresence sp, out Vector3 lower, out Vector3 upper) + { + // Adjust from OS model + // avatar height = visual height - 0.2, bounding box height = visual height + // to SL model + // avatar height = visual height, bounding box height = visual height + 0.2 + float height = sp.Appearance.AvatarHeight + m_avatarHeightCorrection; + + // According to avatar bounding box in SL 2015-04-18: + // standing = <-0.275,-0.35,-0.1-0.5*h> : <0.275,0.35,0.1+0.5*h> + // groundsitting = <-0.3875,-0.5,-0.05-0.375*h> : <0.3875,0.5,0.5> + // sitting = <-0.5875,-0.35,-0.35-0.375*h> : <0.1875,0.35,-0.25+0.25*h> + + // When avatar is sitting + if (sp.ParentPart != null) + { + lower = new Vector3(m_lABB1SitX0, m_lABB1SitY0, m_lABB1SitZ0 + m_lABB1SitZ1 * height); + upper = new Vector3(m_lABB2SitX0, m_lABB2SitY0, m_lABB2SitZ0 + m_lABB2SitZ1 * height); + } + // When avatar is groundsitting + else if (sp.Animator.Animations.ImplicitDefaultAnimation.AnimID == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) + { + lower = new Vector3(m_lABB1GrsX0, m_lABB1GrsY0, m_lABB1GrsZ0 + m_lABB1GrsZ1 * height); + upper = new Vector3(m_lABB2GrsX0, m_lABB2GrsY0, m_lABB2GrsZ0 + m_lABB2GrsZ1 * height); + } + // When avatar is standing or flying + else + { + lower = new Vector3(m_lABB1StdX0, m_lABB1StdY0, m_lABB1StdZ0 + m_lABB1StdZ1 * height); + upper = new Vector3(m_lABB2StdX0, m_lABB2StdY0, m_lABB2StdZ0 + m_lABB2StdZ1 * height); + } + } + + /// /// Implementation of llCastRay similar to SL 2015-04-21. /// http://wiki.secondlife.com/wiki/LlCastRay @@ -16589,7 +15719,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_POS_LOCAL: { if (remain < 1) - return null; + return new LSL_List(); LSL_Vector v; v = rules.GetVector3Item(idx++); @@ -16608,7 +15738,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_ROTATION: { if (remain < 1) - return null; + return new LSL_List(); LSL_Rotation r; r = rules.GetQuaternionItem(idx++); @@ -16628,7 +15758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_NAME: case (int)ScriptBaseClass.PRIM_DESC: if (remain < 1) - return null; + return new LSL_List(); idx++; break; @@ -16636,13 +15766,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_FULLBRIGHT: case (int)ScriptBaseClass.PRIM_TEXGEN: if (remain < 2) - return null; + return new LSL_List(); idx += 2; break; case (int)ScriptBaseClass.PRIM_TYPE: if (remain < 3) - return null; + return new LSL_List(); code = (int)rules.GetLSLIntegerItem(idx++); remain = rules.Length - idx; switch (code) @@ -16651,13 +15781,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: case (int)ScriptBaseClass.PRIM_TYPE_PRISM: if (remain < 6) - return null; + return new LSL_List(); idx += 6; break; case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: if (remain < 5) - return null; + return new LSL_List(); idx += 5; break; @@ -16665,13 +15795,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TYPE_TUBE: case (int)ScriptBaseClass.PRIM_TYPE_RING: if (remain < 11) - return null; + return new LSL_List(); idx += 11; break; case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: if (remain < 2) - return null; + return new LSL_List(); idx += 2; break; } @@ -16682,7 +15812,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_BUMP_SHINY: case (int)ScriptBaseClass.PRIM_OMEGA: if (remain < 3) - return null; + return new LSL_List(); idx += 3; break; @@ -16690,20 +15820,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_POINT_LIGHT: case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: if (remain < 5) - return null; + return new LSL_List(); idx += 5; break; case (int)ScriptBaseClass.PRIM_FLEXIBLE: if (remain < 7) - return null; + return new LSL_List(); idx += 7; break; case (int)ScriptBaseClass.PRIM_LINK_TARGET: if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. - return null; + return new LSL_List(); return rules.GetSublist(idx, -1); } @@ -16711,9 +15841,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } catch (InvalidCastException e) { - ShoutError(string.Format( - "{0} error running rule #{1}: arg #{2} ", - originFunc, rulesParsed, idx - idxStart) + e.Message); + Error(originFunc,string.Format( + " error running rule #{1}: arg #{2} ", + rulesParsed, idx - idxStart) + e.Message); } finally { @@ -16725,7 +15855,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api positionChanged = false; } } - return null; + return new LSL_List(); } public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules, ref LSL_List res) @@ -16794,7 +15924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXTURE: if (remain < 1) - return null; + return new LSL_List(); int face = (int)rules.GetLSLIntegerItem(idx++); if (face == ScriptBaseClass.ALL_SIDES) @@ -16821,7 +15951,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_COLOR: if (remain < 1) - return null; + return new LSL_List(); face = (int)rules.GetLSLIntegerItem(idx++); @@ -16842,7 +15972,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_BUMP_SHINY: if (remain < 1) - return null; + return new LSL_List(); face = (int)rules.GetLSLIntegerItem(idx++); if (face == ScriptBaseClass.ALL_SIDES) @@ -16862,7 +15992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_FULLBRIGHT: if (remain < 1) - return null; + return new LSL_List(); face = (int)rules.GetLSLIntegerItem(idx++); if (face == ScriptBaseClass.ALL_SIDES) @@ -16891,7 +16021,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXGEN: // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) if (remain < 1) - return null; + return new LSL_List(); face = (int)rules.GetLSLIntegerItem(idx++); if (face == ScriptBaseClass.ALL_SIDES) @@ -16917,7 +16047,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_GLOW: if (remain < 1) - return null; + return new LSL_List(); face = (int)rules.GetLSLIntegerItem(idx++); if (face == ScriptBaseClass.ALL_SIDES) @@ -16971,13 +16101,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_LINK_TARGET: if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. - return null; + return new LSL_List(); return rules.GetSublist(idx, -1); } } - return null; + return new LSL_List(); } public void llSetContentType(LSL_Key id, LSL_Integer content_type) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5d8f0f6d7a..a87ee734fb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -829,10 +829,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) { -<<<<<<< HEAD - // ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); -======= ->>>>>>> avn/ubitvar ulong regionHandle = Util.RegionLocToHandle((uint)regionX, (uint)regionY); m_host.AddScriptLPS(1); @@ -3265,15 +3261,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { -<<<<<<< HEAD Scene scene = m_ScriptEngine.World; GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID); - return new LSL_Vector((float)region.RegionSizeX, (float)region.RegionSizeX, Constants.RegionHeight); -======= - return new LSL_Vector((float)World.RegionInfo.RegionSizeX, - (float)World.RegionInfo.RegionSizeY, - (float)World.RegionInfo.RegionSizeZ ); ->>>>>>> avn/ubitvar + return new LSL_Vector(region.RegionSizeX, region.RegionSizeY, Constants.RegionHeight); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 5fdbf9d89c..6e8a96d2ac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -739,11 +739,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase if (Position.y > ((int)Constants.RegionSize - 1)) Position.y = ((int)Constants.RegionSize - 1); */ -<<<<<<< HEAD if (Position.z > Constants.RegionHeight) Position.z = Constants.RegionHeight; -======= ->>>>>>> avn/ubitvar if (Position.x < 0) Position.x = 0; if (Position.y < 0) diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 49df5e7199..2633f305ec 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -654,7 +654,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance if (state == State) return; -<<<<<<< HEAD EventParams lastTimerEv = null; lock (EventQueue) @@ -682,15 +681,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance m_StateChangeInProgress = true; } -======= - PostEvent(new EventParams("state_exit", new Object[0], - new DetectParams[0])); - PostEvent(new EventParams("state", new Object[] { state }, - new DetectParams[0])); - PostEvent(new EventParams("state_entry", new Object[0], - new DetectParams[0])); - ->>>>>>> avn/ubitvar throw new EventAbortException(); } @@ -789,9 +779,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance if (!Running) return 0; + lock (m_Script) + { // m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName); -<<<<<<< HEAD if (Suspended) return 0; @@ -817,14 +808,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance lock (EventQueue) { data = (EventParams)EventQueue.Dequeue(); -======= - if (Suspended) - return 0; - - lock (EventQueue) - { - data = (EventParams) EventQueue.Dequeue(); ->>>>>>> avn/ubitvar if (data == null) // Shouldn't happen { if (EventQueue.Count > 0 && Running && !ShuttingDown) @@ -849,7 +832,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance m_CollisionInQueue = false; } -<<<<<<< HEAD if (DebugLevel >= 2) m_log.DebugFormat( "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", @@ -879,26 +861,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance Part.ParentGroup.UUID, Part.AbsolutePosition, Part.ParentGroup.Scene.Name); -======= - lock(m_Script) - { - -// m_log.DebugFormat("[XEngine]: Processing event {0} for {1}", data.EventName, this); - SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); - - if (DebugLevel >= 2) - m_log.DebugFormat( - "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", - data.EventName, - ScriptName, - part.Name, - part.LocalId, - part.ParentGroup.Name, - part.ParentGroup.UUID, - part.AbsolutePosition, - part.ParentGroup.Scene.Name); ->>>>>>> avn/ubitvar - AsyncCommandManager.StateChange(Engine, LocalID, ItemID); // we are effectively in the new state now, so we can resume queueing @@ -915,35 +877,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}", // PrimName, ScriptName, data.EventName, State); -<<<<<<< HEAD + try -======= - if (DebugLevel >= 1) - m_log.DebugFormat( - "[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", - State, - ScriptName, - part.Name, - part.LocalId, - part.ParentGroup.Name, - part.ParentGroup.UUID, - part.AbsolutePosition, - part.ParentGroup.Scene.Name); - - AsyncCommandManager.RemoveScript(Engine, - LocalID, ItemID); - - if (part != null) - { - part.SetScriptEvents(ItemID, - (int)m_Script.GetStateEventFlags(State)); - } - } - else - { - if (Engine.World.PipeEventsForScript(LocalID) || - data.EventName == "control") // Don't freeze avies! ->>>>>>> avn/ubitvar { m_CurrentEvent = data.EventName; m_EventStart = DateTime.Now; @@ -981,7 +916,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance && !(e.InnerException is ScriptCoopStopException))) && !(e is ThreadAbortException)) { -<<<<<<< HEAD try { // DISPLAY ERROR INWORLD @@ -1004,88 +938,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance Part.AbsolutePosition, Part.ParentGroup.Scene.Name), e); -======= -// m_log.DebugFormat( -// "[SCRIPT] Exception in script {0} {1}: {2}{3}", -// ScriptName, ItemID, e.Message, e.StackTrace); - - m_InEvent = false; - m_CurrentEvent = String.Empty; - - if ((!(e is TargetInvocationException) - || (!(e.InnerException is SelfDeleteException) - && !(e.InnerException is ScriptDeleteException) - && !(e.InnerException is ScriptCoopStopException))) - && !(e is ThreadAbortException)) - { - try - { - // DISPLAY ERROR INWORLD - string text = FormatException(e); - - if (text.Length > 1000) - text = text.Substring(0, 1000); - Engine.World.SimChat(Utils.StringToBytes(text), - ChatTypeEnum.DebugChannel, 2147483647, - part.AbsolutePosition, - part.Name, part.UUID, false); - - - m_log.DebugFormat( - "[SCRIPT INSTANCE]: Runtime error in script {0}, part {1} {2} at {3} in {4}, displayed error {5}, actual exception {6}", - ScriptName, - PrimName, - part.UUID, - part.AbsolutePosition, - part.ParentGroup.Scene.Name, - text.Replace("\n", "\\n"), - e.InnerException); - } - catch (Exception) - { - } - // catch (Exception e2) // LEGIT: User Scripting - // { - // m_log.Error("[SCRIPT]: "+ - // "Error displaying error in-world: " + - // e2.ToString()); - // m_log.Error("[SCRIPT]: " + - // "Errormessage: Error compiling script:\r\n" + - // e.ToString()); - // } - } - else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException)) - { - m_InSelfDelete = true; - if (part != null) - Engine.World.DeleteSceneObject(part.ParentGroup, false); ->>>>>>> avn/ubitvar } catch (Exception) { -<<<<<<< HEAD -======= - m_InSelfDelete = true; - if (part != null) - part.Inventory.RemoveInventoryItem(ItemID); } - else if ((e is TargetInvocationException) && (e.InnerException is ScriptCoopStopException)) - { - if (DebugLevel >= 1) - m_log.DebugFormat( - "[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.", - PrimName, ScriptName, data.EventName, State); ->>>>>>> avn/ubitvar - } - // catch (Exception e2) // LEGIT: User Scripting - // { - // m_log.Error("[SCRIPT]: "+ - // "Error displaying error in-world: " + - // e2.ToString()); - // m_log.Error("[SCRIPT]: " + - // "Errormessage: Error compiling script:\r\n" + - // e.ToString()); - // } } else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException)) { diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 885559aabf..5fce15c356 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -102,31 +102,19 @@ namespace OpenSim.Region.ScriptEngine.Shared public override string ToString() { -<<<<<<< HEAD - string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z); -======= string s = String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}>", x, y, z); ->>>>>>> avn/ubitvar return s; } public static explicit operator LSLString(Vector3 vec) { -<<<<<<< HEAD - string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); -======= string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z); ->>>>>>> avn/ubitvar return new LSLString(s); } public static explicit operator string(Vector3 vec) { -<<<<<<< HEAD - string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); -======= string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z); ->>>>>>> avn/ubitvar return s; } @@ -727,17 +715,10 @@ namespace OpenSim.Region.ScriptEngine.Shared private void ExtendAndAdd(object o) { object[] tmp; -<<<<<<< HEAD tmp = new object[Data.Length + 1]; Data.CopyTo(tmp, 0); tmp.SetValue(o, tmp.Length - 1); Data = tmp; -======= - tmp = new object[m_data.Length + 1]; - m_data.CopyTo(tmp, 0); - tmp.SetValue(o, tmp.Length - 1); - m_data = tmp; ->>>>>>> avn/ubitvar } public static list operator +(list a, LSLString s) diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs index 2ef405861e..07470d6ec9 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs @@ -43,6 +43,7 @@ using OpenSim.Tests.Common; namespace OpenSim.Region.ScriptEngine.Tests { + /* [TestFixture] public class XEnginePersistenceTests : OpenSimTestCase { @@ -149,4 +150,5 @@ namespace OpenSim.Region.ScriptEngine.Tests scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, rezzedSo); } } + */ } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 466c1909ea..78d4ee9d9d 100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -28,7 +28,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Diagnostics; //for [DebuggerNonUserCode] using System.Globalization; using System.IO; using System.Linq; @@ -162,8 +161,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine private Dictionary m_Scripts = new Dictionary(); - private OpenMetaverse.ReaderWriterLockSlim m_scriptsLock = new OpenMetaverse.ReaderWriterLockSlim(); - // Maps the asset ID to the assembly private Dictionary m_Assemblies = @@ -186,71 +183,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine IWorkItemResult m_CurrentCompile = null; private Dictionary m_CompileDict = new Dictionary(); - private void lockScriptsForRead(bool locked) - { - if (locked) - { - if (m_scriptsLock.RecursiveReadCount > 0) - { - m_log.Error("[XEngine.m_Scripts] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); - m_scriptsLock.ExitReadLock(); - } - if (m_scriptsLock.RecursiveWriteCount > 0) - { - m_log.Error("[XEngine.m_Scripts] Recursive write lock requested. This should not happen and means something needs to be fixed."); - m_scriptsLock.ExitWriteLock(); - } - - while (!m_scriptsLock.TryEnterReadLock(60000)) - { - m_log.Error("[XEngine.m_Scripts] Thread lock detected while trying to aquire READ lock of m_scripts in XEngine. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); - if (m_scriptsLock.IsWriteLockHeld) - { - m_scriptsLock = new OpenMetaverse.ReaderWriterLockSlim(); - } - } - } - else - { - if (m_scriptsLock.RecursiveReadCount > 0) - { - m_scriptsLock.ExitReadLock(); - } - } - } - private void lockScriptsForWrite(bool locked) - { - if (locked) - { - if (m_scriptsLock.RecursiveReadCount > 0) - { - m_log.Error("[XEngine.m_Scripts] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); - m_scriptsLock.ExitReadLock(); - } - if (m_scriptsLock.RecursiveWriteCount > 0) - { - m_log.Error("[XEngine.m_Scripts] Recursive write lock requested. This should not happen and means something needs to be fixed."); - m_scriptsLock.ExitWriteLock(); - } - - while (!m_scriptsLock.TryEnterWriteLock(60000)) - { - m_log.Error("[XEngine.m_Scripts] Thread lock detected while trying to aquire WRITE lock of m_scripts in XEngine. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); - if (m_scriptsLock.IsWriteLockHeld) - { - m_scriptsLock = new OpenMetaverse.ReaderWriterLockSlim(); - } - } - } - else - { - if (m_scriptsLock.RecursiveWriteCount > 0) - { - m_scriptsLock.ExitWriteLock(); - } - } - } - private ScriptEngineConsoleCommands m_consoleCommands; public string ScriptEngineName @@ -782,31 +714,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine { if (!m_Enabled) return; - lockScriptsForRead(true); - List instancesToDel = new List(m_Scripts.Values); - -// foreach (IScriptInstance instance in m_Scripts.Values) - foreach (IScriptInstance instance in instancesToDel) + lock (m_Scripts) { - // Force a final state save - // - if (m_Assemblies.ContainsKey(instance.AssetID)) + m_log.InfoFormat( + "[XEngine]: Shutting down {0} scripts in {1}", m_Scripts.Count, m_Scene.RegionInfo.RegionName); + + foreach (IScriptInstance instance in m_Scripts.Values) { -<<<<<<< HEAD // Force a final state save // try { if (instance.StatePersistedHere) instance.SaveState(); -======= - string assembly = m_Assemblies[instance.AssetID]; - - try - { - instance.SaveState(assembly); ->>>>>>> avn/ubitvar } catch (Exception e) { @@ -816,50 +737,36 @@ namespace OpenSim.Region.ScriptEngine.XEngine instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, World.Name) , e); } - } -<<<<<<< HEAD // Clear the event queue and abort the instance thread // instance.Stop(0, true); -======= - // Clear the event queue and abort the instance thread - // - instance.ClearQueue(); - instance.Stop(0); ->>>>>>> avn/ubitvar - // Release events, timer, etc - // - instance.DestroyScriptInstance(); + // Release events, timer, etc + // + instance.DestroyScriptInstance(); - // Unload scripts and app domains - // Must be done explicitly because they have infinite - // lifetime - // -// if (!m_SimulatorShuttingDown) - { - m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); - if (m_DomainScripts[instance.AppDomain].Count == 0) + // Unload scripts and app domains. + // Must be done explicitly because they have infinite + // lifetime. + // However, don't bother to do this if the simulator is shutting + // down since it takes a long time with many scripts. + if (!m_SimulatorShuttingDown) { - m_DomainScripts.Remove(instance.AppDomain); - UnloadAppDomain(instance.AppDomain); + m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); + if (m_DomainScripts[instance.AppDomain].Count == 0) + { + m_DomainScripts.Remove(instance.AppDomain); + UnloadAppDomain(instance.AppDomain); + } } } -// m_Scripts.Clear(); -// m_PrimObjects.Clear(); -// m_Assemblies.Clear(); -// m_DomainScripts.Clear(); + m_Scripts.Clear(); + m_PrimObjects.Clear(); + m_Assemblies.Clear(); + m_DomainScripts.Clear(); } - lockScriptsForRead(false); - lockScriptsForWrite(true); - m_Scripts.Clear(); - lockScriptsForWrite(false); - m_PrimObjects.Clear(); - m_Assemblies.Clear(); - m_DomainScripts.Clear(); - lock (m_ScriptEngines) { m_ScriptEngines.Remove(this); @@ -928,7 +835,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine List instances = new List(); -<<<<<<< HEAD lock (m_Scripts) { foreach (IScriptInstance instance in m_Scripts.Values) @@ -946,23 +852,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine foreach (IScriptInstance i in instances) { -======= - lockScriptsForRead(true); - foreach (IScriptInstance instance in m_Scripts.Values) - instances.Add(instance); - lockScriptsForRead(false); - - foreach (IScriptInstance i in instances) - { - string assembly = String.Empty; - - - if (!m_Assemblies.ContainsKey(i.AssetID)) - continue; - assembly = m_Assemblies[i.AssetID]; - - ->>>>>>> avn/ubitvar try { i.SaveState(); @@ -1393,79 +1282,58 @@ namespace OpenSim.Region.ScriptEngine.XEngine } ScriptInstance instance = null; - // Create the object record - UUID appDomain = assetID; - - - - lockScriptsForRead(true); - if ((!m_Scripts.ContainsKey(itemID)) || - (m_Scripts[itemID].AssetID != assetID)) + lock (m_Scripts) { - lockScriptsForRead(false); - instance = new ScriptInstance(this, part, - item, - startParam, postOnRez, - m_MaxScriptQueue); - - if (part.ParentGroup.IsAttachment) - appDomain = part.ParentGroup.RootPart.UUID; - - if (!m_AppDomains.ContainsKey(appDomain)) + // Create the object record + if ((!m_Scripts.ContainsKey(itemID)) || + (m_Scripts[itemID].AssetID != assetID)) { - try + UUID appDomain = assetID; + + if (part.ParentGroup.IsAttachment) + appDomain = part.ParentGroup.RootPart.UUID; + + if (!m_AppDomains.ContainsKey(appDomain)) { - 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; - if (m_AppDomainLoading) + try { - sandbox = AppDomain.CreateDomain( - m_Scene.RegionInfo.RegionID.ToString(), - evidence, appSetup); - if (m_AppDomains.ContainsKey(appDomain)) + 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; + if (m_AppDomainLoading) { - m_AppDomains[appDomain].AssemblyResolve += + sandbox = AppDomain.CreateDomain( + m_Scene.RegionInfo.RegionID.ToString(), + evidence, appSetup); + sandbox.AssemblyResolve += new ResolveEventHandler( AssemblyResolver.OnAssemblyResolve); - if (m_DomainScripts.ContainsKey(appDomain)) - { - m_DomainScripts[appDomain].Add(itemID); - } - else - { - m_DomainScripts.Add(appDomain, new List()); - m_DomainScripts[appDomain].Add(itemID); - } } else { - m_AppDomains.Add(appDomain, sandbox); - m_AppDomains[appDomain].AssemblyResolve += - new ResolveEventHandler( - AssemblyResolver.OnAssemblyResolve); - if (m_DomainScripts.ContainsKey(appDomain)) - { - m_DomainScripts[appDomain].Add(itemID); - } - else - { - m_DomainScripts.Add(appDomain, new List()); - m_DomainScripts[appDomain].Add(itemID); - } - + sandbox = AppDomain.CurrentDomain; } + + //PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel(); + //AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition(); + //PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet"); + //PolicyStatement sandboxPolicyStatement = new PolicyStatement(sandboxPermissionSet); + //CodeGroup sandboxCodeGroup = new UnionCodeGroup(sandboxMembershipCondition, sandboxPolicyStatement); + //sandboxPolicy.RootCodeGroup = sandboxCodeGroup; + //sandbox.SetAppDomainPolicy(sandboxPolicy); + + m_AppDomains[appDomain] = sandbox; + m_DomainScripts[appDomain] = new List(); } - else + catch (Exception e) { -<<<<<<< HEAD m_log.ErrorFormat("[XEngine] Exception creating app domain:\n {0}", e.ToString()); m_ScriptErrorMessage += "Exception creating app domain:\n"; m_ScriptFailCount++; @@ -1474,12 +1342,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_AddingAssemblies[assemblyPath]--; } return false; -======= - sandbox = AppDomain.CurrentDomain; ->>>>>>> avn/ubitvar } + } + m_DomainScripts[appDomain].Add(itemID); -<<<<<<< HEAD IScript scriptObj = null; EventWaitHandle coopSleepHandle; bool coopTerminationForThisScript; @@ -1611,52 +1477,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine scriptObj, coopSleepHandle, assemblyPath, Path.Combine(ScriptEnginePath, World.RegionInfo.RegionID.ToString()), stateSource, coopTerminationForThisScript)) return false; -======= -// if (!instance.Load(m_AppDomains[appDomain], assembly, stateSource)) -// return false; ->>>>>>> avn/ubitvar - m_AppDomains[appDomain] = sandbox; - - m_DomainScripts[appDomain] = new List(); - } - catch (Exception e) - { - m_log.ErrorFormat("[XEngine] Exception creating app domain:\n {0}", e.ToString()); - m_ScriptErrorMessage += "Exception creating app domain:\n"; - m_ScriptFailCount++; - lock (m_AddingAssemblies) - { - m_AddingAssemblies[assembly]--; - } - return false; - } - } - - - if (!instance.Load(m_AppDomains[appDomain], assembly, stateSource)) - return false; -// m_log.DebugFormat( -// "[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}", -// part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, +// if (DebugLevel >= 1) +// m_log.DebugFormat( +// "[XEngine] Loaded script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}", +// part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID, // part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName); - if (presence != null) - { - ShowScriptSaveResponse(item.OwnerID, - assetID, "Compile successful", true); - } + if (presence != null) + { + ShowScriptSaveResponse(item.OwnerID, + assetID, "Compile successful", true); + } - instance.AppDomain = appDomain; - instance.LineMap = linemap; - lockScriptsForWrite(true); - m_Scripts[itemID] = instance; - lockScriptsForWrite(false); - } - else - { - lockScriptsForRead(false); + instance.AppDomain = appDomain; + instance.LineMap = linemap; + + m_Scripts[itemID] = instance; + } } + lock (m_PrimObjects) { if (!m_PrimObjects.ContainsKey(localID)) @@ -1674,7 +1514,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_AddingAssemblies[assemblyPath]--; } - if (instance!=null) + if (instance != null) instance.Init(); bool runIt; @@ -1697,28 +1537,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_CompileDict.Remove(itemID); } - lockScriptsForRead(true); - // Do we even have it? - if (!m_Scripts.ContainsKey(itemID)) + IScriptInstance instance = null; + + lock (m_Scripts) { - lockScriptsForRead(false); - return; - } + // Do we even have it? + if (!m_Scripts.ContainsKey(itemID)) + return; + + instance = m_Scripts[itemID]; + m_Scripts.Remove(itemID); + } -<<<<<<< HEAD instance.Stop(m_WaitForEventCompletionOnScriptStop, true); -======= - IScriptInstance instance=m_Scripts[itemID]; - lockScriptsForRead(false); - lockScriptsForWrite(true); - m_Scripts.Remove(itemID); - lockScriptsForWrite(false); - instance.ClearQueue(); - - instance.Stop(m_WaitForEventCompletionOnScriptStop); - -// bool objectRemoved = false; ->>>>>>> avn/ubitvar lock (m_PrimObjects) { @@ -1740,26 +1571,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine instance.DestroyScriptInstance(); - if (m_DomainScripts.ContainsKey(instance.AppDomain)) + m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); + if (m_DomainScripts[instance.AppDomain].Count == 0) { - m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); - if (m_DomainScripts[instance.AppDomain].Count == 0) - { - m_DomainScripts.Remove(instance.AppDomain); - UnloadAppDomain(instance.AppDomain); - } + m_DomainScripts.Remove(instance.AppDomain); + UnloadAppDomain(instance.AppDomain); } ObjectRemoved handlerObjectRemoved = OnObjectRemoved; if (handlerObjectRemoved != null) - { - SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); - if (part != null) - handlerObjectRemoved(part.UUID); - } + handlerObjectRemoved(instance.ObjectID); - CleanAssemblies(); - ScriptRemoved handlerScriptRemoved = OnScriptRemoved; if (handlerScriptRemoved != null) handlerScriptRemoved(itemID); @@ -2020,14 +1842,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine private IScriptInstance GetInstance(UUID itemID) { IScriptInstance instance; - lockScriptsForRead(true); - if (!m_Scripts.ContainsKey(itemID)) + lock (m_Scripts) { - lockScriptsForRead(false); - return null; + if (!m_Scripts.ContainsKey(itemID)) + return null; + instance = m_Scripts[itemID]; } - instance = m_Scripts[itemID]; - lockScriptsForRead(false); return instance; } @@ -2049,7 +1869,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine return instance != null && instance.Running; } - [DebuggerNonUserCode] public void ApiResetScript(UUID itemID) { IScriptInstance instance = GetInstance(itemID); @@ -2134,7 +1953,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine return instance != null ? instance.GetDetectID(idx) : UUID.Zero; } - [DebuggerNonUserCode] public void SetState(UUID itemID, string newState) { IScriptInstance instance = GetInstance(itemID); @@ -2155,10 +1973,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine List instances = new List(); - lockScriptsForRead(true); - foreach (IScriptInstance instance in m_Scripts.Values) + lock (m_Scripts) + { + foreach (IScriptInstance instance in m_Scripts.Values) instances.Add(instance); - lockScriptsForRead(false); + } foreach (IScriptInstance i in instances) { diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index a18cdc15d7..42a8c5792a 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -116,20 +116,6 @@ namespace OpenSim.Server.Base { uint https_port = (uint)networkConfig.GetInt("https_port", 0); -<<<<<<< HEAD - string cert_path = networkConfig.GetString("cert_path",String.Empty); - if (cert_path == String.Empty) - { - System.Console.WriteLine("ERROR: Path to X509 certificate is missing, server can't start."); - Environment.Exit(1); - } - - string cert_pass = networkConfig.GetString("cert_pass",String.Empty); - if (cert_pass == String.Empty) - { - System.Console.WriteLine("ERROR: Password for X509 certificate is missing, server can't start."); - Environment.Exit(1); -======= m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external); if (!ssl_external) { @@ -152,7 +138,6 @@ namespace OpenSim.Server.Base { m_log.WarnFormat("[SSL]: SSL port is active but no SSL is used because external SSL was requested."); MainServer.AddHttpServer(new BaseHttpServer(https_port)); ->>>>>>> avn/ubitvar } } } diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs index 502cecf1c4..24f63d9319 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs @@ -45,19 +45,12 @@ namespace OpenSim.Server.Handlers.BakedTextures { public class BakesServerPostHandler : BaseStreamHandler { -<<<<<<< HEAD:OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IBakedTextureService m_BakesService; public BakesServerPostHandler(IBakedTextureService service, IServiceAuth auth) : base("POST", "/bakes", auth) -======= - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public MSSQLAvatarData(string connectionString, string realm) : - base(connectionString, realm, "Avatar") ->>>>>>> avn/ubitvar:OpenSim/Data/MSSQL/MSSQLAvatarData.cs { m_BakesService = service; } diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 083a628998..38dfffc33b 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -118,11 +118,6 @@ namespace OpenSim.Server.Handlers.MapImage httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; return FailureResult("Bad request."); } -<<<<<<< HEAD - uint x = 0, y = 0; - UInt32.TryParse(request["X"].ToString(), out x); - UInt32.TryParse(request["Y"].ToString(), out y); -======= int x = 0, y = 0; // UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); UUID scopeID = UUID.Zero; @@ -130,7 +125,6 @@ namespace OpenSim.Server.Handlers.MapImage Int32.TryParse(request["Y"].ToString(), out y); if (request.ContainsKey("SCOPE")) UUID.TryParse(request["SCOPE"].ToString(), out scopeID); ->>>>>>> avn/ubitvar m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y); @@ -142,11 +136,7 @@ namespace OpenSim.Server.Handlers.MapImage if (m_GridService != null) { System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); -<<<<<<< HEAD - GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y)); -======= GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y)); ->>>>>>> avn/ubitvar if (r != null) { if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) @@ -167,11 +157,8 @@ namespace OpenSim.Server.Handlers.MapImage byte[] data = Convert.FromBase64String(request["DATA"].ToString()); string reason = string.Empty; -<<<<<<< HEAD - bool result = m_MapService.AddMapTile((int)x, (int)y, data, out reason); -======= - bool result = m_MapService.AddMapTile(x, y, data, scopeID, out reason); ->>>>>>> avn/ubitvar + + bool result = m_MapService.AddMapTile((int)x, (int)y, data, scopeID, out reason); if (result) return SuccessResult(); diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs index bc881847d9..cac38f59be 100644 --- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs +++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs @@ -380,7 +380,6 @@ namespace OpenSim.Server.Handlers } #endregion Interests -<<<<<<< HEAD #region User Preferences public bool UserPreferencesRequest(OSDMap json, ref JsonRpcResponse response) { @@ -434,8 +433,7 @@ namespace OpenSim.Server.Handlers } #endregion User Preferences -======= ->>>>>>> avn/ubitvar + #region Utility public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) { diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 8780a49598..30418bef76 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -149,7 +149,6 @@ namespace OpenSim.Server.Handlers.Simulation if (args.ContainsKey("my_version")) theirVersion = args["my_version"].AsString(); -<<<<<<< HEAD List features = new List(); if (args.ContainsKey("features")) @@ -160,18 +159,12 @@ namespace OpenSim.Server.Handlers.Simulation features.Add(new UUID(o.AsString())); } -======= ->>>>>>> avn/ubitvar GridRegion destination = new GridRegion(); destination.RegionID = regionID; string reason; string version; -<<<<<<< HEAD bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, features, out version, out reason); -======= - bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, out version, out reason); ->>>>>>> avn/ubitvar responsedata["int_response_code"] = HttpStatusCode.OK; @@ -269,16 +262,7 @@ namespace OpenSim.Server.Handlers.Simulation httpResponse.KeepAlive = false; Encoding encoding = Encoding.UTF8; -<<<<<<< HEAD if (httpRequest.ContentType != "application/json") -======= - Stream inputStream = null; - if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) - inputStream = new GZipStream(request, CompressionMode.Decompress); - else if (httpRequest.ContentType == "application/json") - inputStream = request; - else // no go ->>>>>>> avn/ubitvar { httpResponse.StatusCode = 406; return encoding.GetBytes("false"); @@ -464,16 +448,13 @@ namespace OpenSim.Server.Handlers.Simulation protected virtual bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) { -<<<<<<< HEAD - return m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); -======= reason = String.Empty; if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0) { Util.FireAndForget(x => { string r; - m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r); + m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out r); m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0}", r); }); @@ -482,12 +463,10 @@ namespace OpenSim.Server.Handlers.Simulation else { - bool ret = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + bool ret = m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason); return ret; } - ->>>>>>> avn/ubitvar } } diff --git a/OpenSim/Services/Base/ServiceBase.cs b/OpenSim/Services/Base/ServiceBase.cs index 09dcbefcc1..c18226bbfc 100644 --- a/OpenSim/Services/Base/ServiceBase.cs +++ b/OpenSim/Services/Base/ServiceBase.cs @@ -47,7 +47,6 @@ namespace OpenSim.Services.Base public T LoadPlugin(string dllName, Object[] args) where T:class { -<<<<<<< HEAD // The path:type separator : is unfortunate because it collides // with Windows paths like C:\... // When the path provided includes the drive, this fails. @@ -55,11 +54,7 @@ namespace OpenSim.Services.Base string pathRoot = Path.GetPathRoot(dllName); string noRoot = dllName.Substring(pathRoot.Length); string[] parts = noRoot.Split(new char[] {':'}); -======= - string pathRoot = Path.GetPathRoot(dllName); - string noRoot = dllName.Substring(pathRoot.Length); - string[] parts = noRoot.Split(new char[] { ':' }); ->>>>>>> avn/ubitvar + dllName = pathRoot + parts[0]; diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 795ca2e58f..24f802e781 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -275,18 +275,11 @@ namespace OpenSim.Services.Connectors return fullAsset.Data; } -<<<<<<< HEAD - using (RestClient rc = new RestClient(m_ServerURI)) + using (RestClient rc = new RestClient(MapServer(id))) { rc.AddResourcePath("assets"); rc.AddResourcePath(id); rc.AddResourcePath("data"); -======= - RestClient rc = new RestClient(MapServer(id)); - rc.AddResourcePath("assets"); - rc.AddResourcePath(id); - rc.AddResourcePath("data"); ->>>>>>> avn/ubitvar rc.RequestMethod = "GET"; @@ -300,20 +293,11 @@ namespace OpenSim.Services.Connectors byte[] ret = new byte[s.Length]; s.Read(ret, 0, (int)s.Length); -<<<<<<< HEAD return ret; } return null; } -======= - s.Close(); - return ret; - } - - s.Close(); - return null; ->>>>>>> avn/ubitvar } private class QueuedAssetRequest @@ -348,24 +332,13 @@ namespace OpenSim.Services.Connectors List handlers; lock (m_AssetHandlers) { -<<<<<<< HEAD - if (a != null && m_Cache != null) - m_Cache.Cache(a); -======= handlers = m_AssetHandlers[id]; m_AssetHandlers.Remove(id); } ->>>>>>> avn/ubitvar Util.FireAndForget(x => { -<<<<<<< HEAD - handlers = m_AssetHandlers[id]; - m_AssetHandlers.Remove(id); - } - handlers.Invoke(a); - }, m_maxAssetRequestConcurrency, m_Auth); -======= + foreach (AssetRetrievedEx h in handlers) { // Util.FireAndForget(x => @@ -382,8 +355,6 @@ namespace OpenSim.Services.Connectors // if (handlers != null) // handlers.Clear(); ->>>>>>> avn/ubitvar - success = true; } } @@ -510,32 +481,6 @@ namespace OpenSim.Services.Connectors string newID; try { -<<<<<<< HEAD - newID = SynchronousRestObjectRequester.MakeRequest("POST", uri, asset, m_Auth); - } - catch (Exception e) - { - m_log.Warn(string.Format("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1} ", asset.ID, e.Message), e); - return string.Empty; - } - - // TEMPORARY: SRAS returns 'null' when it's asked to store existing assets - if (newID == null) - { - m_log.DebugFormat("[ASSET CONNECTOR]: Storing of asset {0} returned null; assuming the asset already exists", asset.ID); - return asset.ID; - } - - if (string.IsNullOrEmpty(newID)) - return string.Empty; - - asset.ID = newID; - - if (m_Cache != null) - m_Cache.Cache(asset); - - return newID; -======= newID = SynchronousRestObjectRequester. MakeRequest("POST", uri, asset, 25); if (newID == null || newID == "") @@ -588,7 +533,6 @@ namespace OpenSim.Services.Connectors } } return asset.ID; ->>>>>>> avn/ubitvar } public bool UpdateContent(string id, byte[] data) diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 10b8d2295c..8abd046780 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -100,14 +100,10 @@ namespace OpenSim.Services.Connectors.Hypergrid m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService"); throw new Exception("UserAgent connector init error"); } -<<<<<<< HEAD m_ServerURL = m_ServerURLHost = serviceURI; if (!m_ServerURL.EndsWith("/")) m_ServerURL += "/"; -======= - m_ServerURL = serviceURI; ->>>>>>> avn/ubitvar //m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0}", m_ServerURL); } diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index e236ec35c3..70f1aee010 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs @@ -153,15 +153,9 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { -<<<<<<< HEAD - m_log.Warn(string.Format( - "[NEIGHBOUR SERVICES CONNECTOR]: Unable to send HelloNeighbour from {0} to {1} (uri {2}). Exception {3} ", - thisRegion.RegionName, region.RegionName, uri, e.Message), e); -======= // m_log.WarnFormat( // "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}", // thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); ->>>>>>> avn/ubitvar return false; } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 6043b704aa..bd35c6f81b 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -423,83 +423,6 @@ namespace OpenSim.Services.Connectors.SimianGrid #endregion IGridService - private void UploadMapTile(IScene scene) - { - string errorMessage = null; - - // Create a PNG map tile and upload it to the AddMapTile API - byte[] pngData = Utils.EmptyBytes; - IMapImageGenerator tileGenerator = scene.RequestModuleInterface(); - if (tileGenerator == null) - { - m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator"); - return; - } - - using (Image mapTile = tileGenerator.CreateMapTile()) - { - using (MemoryStream stream = new MemoryStream()) - { - mapTile.Save(stream, ImageFormat.Png); - pngData = stream.ToArray(); - } - } - - List postParameters = new List() - { - new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()), - new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()), - new MultipartForm.File("Tile", "tile.png", "image/png", pngData) - }; - - // Make the remote storage request - try - { - HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); - - HttpWebResponse response = MultipartForm.Post(request, postParameters); - using (Stream responseStream = response.GetResponseStream()) - { - string responseStr = null; - - try - { - responseStr = responseStream.GetStreamString(); - OSD responseOSD = OSDParser.Deserialize(responseStr); - if (responseOSD.Type == OSDType.Map) - { - OSDMap responseMap = (OSDMap)responseOSD; - if (responseMap["Success"].AsBoolean()) - m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile"); - else - errorMessage = "Upload failed: " + responseMap["Message"].AsString(); - } - else - { - errorMessage = "Response format was invalid:\n" + responseStr; - } - } - catch (Exception ex) - { - if (!String.IsNullOrEmpty(responseStr)) - errorMessage = "Failed to parse the response:\n" + responseStr; - else - errorMessage = "Failed to retrieve the response: " + ex.Message; - } - } - } - catch (WebException ex) - { - errorMessage = ex.Message; - } - - if (!String.IsNullOrEmpty(errorMessage)) - { - m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}", - pngData.Length, scene.RegionInfo.RegionName, errorMessage.Replace('\n', ' ')); - } - } - private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) { NameValueCollection requestArgs = new NameValueCollection diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 08c5c5037d..563a1e7dda 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -191,15 +191,14 @@ namespace OpenSim.Services.Connectors.SimianGrid return accounts; } -<<<<<<< HEAD public void InvalidateCache(UUID userID) { m_accountCache.Remove(userID); -======= + } + public List GetUserAccountsWhere(UUID scopeID, string query) { return null; ->>>>>>> avn/ubitvar } public bool StoreUserAccount(UserAccount data) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 28b6de73df..493d7e03e8 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -283,13 +283,8 @@ namespace OpenSim.Services.Connectors.Simulation } -<<<<<<< HEAD + public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, List featuresAvailable, out string version, out string reason) -======= - /// - /// - public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, out string version, out string reason) ->>>>>>> avn/ubitvar { reason = "Failed to contact destination"; version = "Unknown"; @@ -306,7 +301,6 @@ namespace OpenSim.Services.Connectors.Simulation request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); request.Add("position", OSD.FromString(position.ToString())); request.Add("my_version", OSD.FromString(myversion)); -<<<<<<< HEAD OSDArray features = new OSDArray(); foreach (UUID feature in featuresAvailable) @@ -314,8 +308,6 @@ namespace OpenSim.Services.Connectors.Simulation request.Add("features", features); -======= ->>>>>>> avn/ubitvar if (agentHomeURI != null) request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); @@ -366,8 +358,6 @@ namespace OpenSim.Services.Connectors.Simulation return false; } -<<<<<<< HEAD - featuresAvailable.Clear(); if (result.ContainsKey("features")) @@ -377,12 +367,6 @@ namespace OpenSim.Services.Connectors.Simulation foreach (OSD o in array) featuresAvailable.Add(new UUID(o.AsString())); } -======= - OSDMap resp = (OSDMap)result["_Result"]; - success = resp["success"].AsBoolean(); - reason = resp["reason"].AsString(); ->>>>>>> avn/ubitvar - return success; } catch (Exception e) @@ -467,17 +451,13 @@ namespace OpenSim.Services.Connectors.Simulation args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); -<<<<<<< HEAD + OSDMap result = WebUtil.PostToService(uri, args, 40000, false); if (result == null) return false; bool success = result["success"].AsBoolean(); if (!success) -======= - OSDMap response = WebUtil.PostToService(uri, args, 40000); - if (response["Success"] == "False") ->>>>>>> avn/ubitvar return false; } catch (Exception e) diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index e5fb5a8168..15a9fbe752 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs @@ -191,14 +191,13 @@ namespace OpenSim.Services.Connectors return accounts; } -<<<<<<< HEAD public void InvalidateCache(UUID userID) { -======= + } + public List GetUserAccountsWhere(UUID scopeID, string where) { return null; // Not implemented for regions ->>>>>>> avn/ubitvar } public virtual bool StoreUserAccount(UserAccount data) diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 8293c18ba5..80592753c1 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -57,13 +57,10 @@ namespace OpenSim.Services.GridService protected bool m_AllowDuplicateNames = false; protected bool m_AllowHypergridMapSearch = false; -<<<<<<< HEAD + protected bool m_SuppressVarregionOverlapCheckOnRegistration = false; private static Dictionary m_ExtraFeatures = new Dictionary(); -======= - private static Dictionary m_ExtraFeatures = new Dictionary(); ->>>>>>> avn/ubitvar public GridService(IConfigSource config) : base(config) @@ -159,15 +156,9 @@ namespace OpenSim.Services.GridService if (loginConfig == null || gridConfig == null) return; -<<<<<<< HEAD - - string configVal; - -======= string configVal; ->>>>>>> avn/ubitvar configVal = loginConfig.GetString("SearchURL", string.Empty); if (!string.IsNullOrEmpty(configVal)) m_ExtraFeatures["search-server-url"] = configVal; @@ -211,22 +202,11 @@ namespace OpenSim.Services.GridService if (regionInfos.RegionID == UUID.Zero) return "Invalid RegionID - cannot be zero UUID"; -<<<<<<< HEAD String reason = "Region overlaps another region"; - RegionData region = FindAnyConflictingRegion(regionInfos, scopeID, out reason); - // If there is a conflicting region, if it has the same ID and same coordinates - // then it is a region re-registering (permissions and ownership checked later). - if ((region != null) - && ( (region.coordX != regionInfos.RegionCoordX) - || (region.coordY != regionInfos.RegionCoordY) - || (region.RegionID != regionInfos.RegionID) ) - ) -======= // we should not need to check for overlaps RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); if ((region != null) && (region.RegionID != regionInfos.RegionID)) ->>>>>>> avn/ubitvar { // If not same ID and same coordinates, this new region has conflicts and can't be registered. m_log.WarnFormat("{0} Register region conflict in scope {1}. {2}", LogHeader, scopeID, reason); @@ -508,11 +488,8 @@ namespace OpenSim.Services.GridService if (region != null) { // Not really? Maybe? -<<<<<<< HEAD - // The adjacent regions are presumed to be the same size as the current region -======= + /* this fails wiht var regions. My_sql db should now handle var regions ->>>>>>> avn/ubitvar List rdatas = m_Database.Get( region.posX - region.sizeX - 1, region.posY - region.sizeY - 1, region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID); @@ -898,11 +875,9 @@ namespace OpenSim.Services.GridService return; } -<<<<<<< HEAD + RegionData region = m_Database.Get((int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y), UUID.Zero); -======= - RegionData region = m_Database.Get((int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y), UUID.Zero); ->>>>>>> avn/ubitvar + if (region == null) { MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y); @@ -919,11 +894,7 @@ namespace OpenSim.Services.GridService ConsoleDisplayList dispList = new ConsoleDisplayList(); dispList.AddRow("Region Name", r.RegionName); dispList.AddRow("Region ID", r.RegionID); -<<<<<<< HEAD - dispList.AddRow("Position", string.Format("{0},{1}", r.coordX, r.coordY)); -======= dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); ->>>>>>> avn/ubitvar dispList.AddRow("Size", string.Format("{0}x{1}", r.sizeX, r.sizeY)); dispList.AddRow("URI", r.Data["serverURI"]); dispList.AddRow("Owner ID", r.Data["owner_uuid"]); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b4577b0c0e..5d9931b9a7 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -343,11 +343,7 @@ namespace OpenSim.Services.GridService GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); if (region != null) { -<<<<<<< HEAD - m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates <{0},{1}> are already occupied by region {2} with uuid {3}", -======= m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", ->>>>>>> avn/ubitvar Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY), region.RegionName, region.RegionID); reason = "Coordinates are already in use"; @@ -383,13 +379,8 @@ namespace OpenSim.Services.GridService region = m_GridService.GetRegionByUUID(scopeID, regionID); if (region != null) { -<<<<<<< HEAD - m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates <{0},{1}>", + m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates <{0},{1}>", Util.WorldToRegionLoc((uint)region.RegionLocX), Util.WorldToRegionLoc((uint)region.RegionLocY)); -======= - m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", - Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY)); ->>>>>>> avn/ubitvar regInfo = region; return true; } @@ -545,7 +536,6 @@ namespace OpenSim.Services.GridService MainConsole.Instance.Output(new string('-', 72)); foreach (RegionData r in regions) { -<<<<<<< HEAD MainConsole.Instance.Output( String.Format("{0}\n{2,-32} {1}\n", r.RegionName, r.RegionID, @@ -554,12 +544,6 @@ namespace OpenSim.Services.GridService ) ) ); -======= - MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n", - r.RegionName, r.RegionID, - String.Format("{0},{1} ({2},{3})", r.posX, r.posY, - Util.WorldToRegionLoc((uint)r.posX), Util.WorldToRegionLoc((uint)r.posY))) ); ->>>>>>> avn/ubitvar } return; } @@ -661,13 +645,8 @@ namespace OpenSim.Services.GridService string externalHostName; try { -<<<<<<< HEAD xloc = Convert.ToUInt32(cmdparams[0]); yloc = Convert.ToUInt32(cmdparams[1]); -======= - xloc = (uint)Convert.ToInt32(cmdparams[0]); - yloc = (uint)Convert.ToInt32(cmdparams[1]); ->>>>>>> avn/ubitvar externalPort = Convert.ToUInt32(cmdparams[3]); externalHostName = cmdparams[2]; //internalPort = Convert.ToUInt32(cmdparams[4]); @@ -770,13 +749,8 @@ namespace OpenSim.Services.GridService string externalHostName; uint realXLoc, realYLoc; -<<<<<<< HEAD xloc = Convert.ToUInt32(config.GetString("xloc", "0")); yloc = Convert.ToUInt32(config.GetString("yloc", "0")); -======= - xloc = (uint)Convert.ToInt32(config.GetString("xloc", "0")); - yloc = (uint)Convert.ToInt32(config.GetString("yloc", "0")); ->>>>>>> avn/ubitvar externalPort = Convert.ToUInt32(config.GetString("externalPort", "0")); externalHostName = config.GetString("externalHostName", ""); realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0")); @@ -784,13 +758,8 @@ namespace OpenSim.Services.GridService if (m_enableAutoMapping) { -<<<<<<< HEAD xloc = (xloc % 100) + m_autoMappingX; yloc = (yloc % 100) + m_autoMappingY; -======= - xloc = (uint)((xloc % 100) + m_autoMappingX); - yloc = (uint)((yloc % 100) + m_autoMappingY); ->>>>>>> avn/ubitvar } if (((realXLoc == 0) && (realYLoc == 0)) || diff --git a/OpenSim/Services/Interfaces/IBakedTextureService.cs b/OpenSim/Services/Interfaces/IBakedTextureService.cs index ab88695b88..69df4a0ec5 100644 --- a/OpenSim/Services/Interfaces/IBakedTextureService.cs +++ b/OpenSim/Services/Interfaces/IBakedTextureService.cs @@ -1,4 +1,3 @@ -<<<<<<< HEAD /* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. @@ -26,14 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -======= -//////////////////////////////////////////////////////////////// -// -// (c) 2009, 2010 Careminster Limited and Melanie Thielker -// -// All rights reserved -// ->>>>>>> avn/ubitvar using System; using Nini.Config; diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 7e5597bca5..63c6e5f591 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -159,23 +159,24 @@ namespace OpenSim.Services.Interfaces } } set { -<<<<<<< HEAD - if (value.EndsWith("/")) { -======= if ( value == null) { m_serverURI = String.Empty; return; } - if ( value.EndsWith("/") ) { ->>>>>>> avn/ubitvar + if ( value.EndsWith("/") ) + { + m_serverURI = value; - } else { + } + else + { m_serverURI = value + '/'; } } } + protected string m_serverURI; /// @@ -368,6 +369,13 @@ namespace OpenSim.Services.Interfaces if (kvp.ContainsKey("regionName")) RegionName = (string)kvp["regionName"]; + if (kvp.ContainsKey("access")) + { + byte access = Convert.ToByte((string)kvp["access"]); + Access = access; + Maturity = (int)Util.ConvertAccessLevelToMaturity(access); + } + if (kvp.ContainsKey("flags") && kvp["flags"] != null) RegionFlags = (OpenSim.Framework.RegionFlags?)Convert.ToInt32((string)kvp["flags"]); @@ -404,9 +412,6 @@ namespace OpenSim.Services.Interfaces if (kvp.ContainsKey("parcelMapTexture")) UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); - if (kvp.ContainsKey("access")) - Access = Byte.Parse((string)kvp["access"]); - if (kvp.ContainsKey("regionSecret")) RegionSecret =(string)kvp["regionSecret"]; @@ -539,110 +544,5 @@ namespace OpenSim.Services.Interfaces { get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } } -<<<<<<< HEAD -======= - - public Dictionary ToKeyValuePairs() - { - Dictionary kvp = new Dictionary(); - kvp["uuid"] = RegionID.ToString(); - kvp["locX"] = RegionLocX.ToString(); - kvp["locY"] = RegionLocY.ToString(); - kvp["sizeX"] = RegionSizeX.ToString(); - kvp["sizeY"] = RegionSizeY.ToString(); - kvp["regionName"] = RegionName; - kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); - kvp["serverHttpPort"] = HttpPort.ToString(); - kvp["serverURI"] = ServerURI; - kvp["serverPort"] = InternalEndPoint.Port.ToString(); - kvp["regionMapTexture"] = TerrainImage.ToString(); - kvp["parcelMapTexture"] = ParcelImage.ToString(); - kvp["access"] = Access.ToString(); - kvp["regionSecret"] = RegionSecret; - kvp["owner_uuid"] = EstateOwner.ToString(); - kvp["Token"] = Token.ToString(); - // Maturity doesn't seem to exist in the DB - return kvp; - } - - public GridRegion(Dictionary kvp) - { - if (kvp.ContainsKey("uuid")) - RegionID = new UUID((string)kvp["uuid"]); - - if (kvp.ContainsKey("locX")) - RegionLocX = Convert.ToInt32((string)kvp["locX"]); - - if (kvp.ContainsKey("locY")) - RegionLocY = Convert.ToInt32((string)kvp["locY"]); - - if (kvp.ContainsKey("sizeX")) - RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]); - else - RegionSizeX = (int)Constants.RegionSize; - - if (kvp.ContainsKey("sizeY")) - RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]); - else - RegionSizeY = (int)Constants.RegionSize; - - if (kvp.ContainsKey("regionName")) - RegionName = (string)kvp["regionName"]; - - if (kvp.ContainsKey("access")) - { - byte access = Convert.ToByte((string)kvp["access"]); - Maturity = (int)Util.ConvertAccessLevelToMaturity(access); - } - - if (kvp.ContainsKey("serverIP")) - { - //int port = 0; - //Int32.TryParse((string)kvp["serverPort"], out port); - //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port); - ExternalHostName = (string)kvp["serverIP"]; - } - else - ExternalHostName = "127.0.0.1"; - - if (kvp.ContainsKey("serverPort")) - { - Int32 port = 0; - Int32.TryParse((string)kvp["serverPort"], out port); - InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); - } - - if (kvp.ContainsKey("serverHttpPort")) - { - UInt32 port = 0; - UInt32.TryParse((string)kvp["serverHttpPort"], out port); - HttpPort = port; - } - - if (kvp.ContainsKey("serverURI")) - ServerURI = (string)kvp["serverURI"]; - - if (kvp.ContainsKey("regionMapTexture")) - UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); - - if (kvp.ContainsKey("parcelMapTexture")) - UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); - - if (kvp.ContainsKey("access")) - Access = Byte.Parse((string)kvp["access"]); - - if (kvp.ContainsKey("regionSecret")) - RegionSecret =(string)kvp["regionSecret"]; - - if (kvp.ContainsKey("owner_uuid")) - EstateOwner = new UUID(kvp["owner_uuid"].ToString()); - - if (kvp.ContainsKey("Token")) - Token = kvp["Token"].ToString(); - - // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", - // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); - } ->>>>>>> avn/ubitvar } } diff --git a/OpenSim/Services/Interfaces/IMapImageService.cs b/OpenSim/Services/Interfaces/IMapImageService.cs index 0d1458eaf2..b8d45dd922 100644 --- a/OpenSim/Services/Interfaces/IMapImageService.cs +++ b/OpenSim/Services/Interfaces/IMapImageService.cs @@ -34,14 +34,8 @@ namespace OpenSim.Services.Interfaces public interface IMapImageService { //List GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY); -<<<<<<< HEAD - bool AddMapTile(int x, int y, byte[] imageData, out string reason); - bool RemoveMapTile(int x, int y, out string reason); - byte[] GetMapTile(string fileName, out string format); -======= bool AddMapTile(int x, int y, byte[] imageData, UUID scopeID, out string reason); bool RemoveMapTile(int x, int y, UUID scopeID, out string reason); byte[] GetMapTile(string fileName, UUID scopeID, out string format); ->>>>>>> avn/ubitvar } } diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index ee1e294410..3573bea32c 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs @@ -86,7 +86,7 @@ namespace OpenSim.Services.Interfaces /// The visitor's Home URI. Will be missing (null) in older OpenSims. /// True: via teleport; False: via cross (walking) /// Position in the region -<<<<<<< HEAD + /// /// Version that the requesting simulator is runing. If null then no version check is carried out. /// @@ -94,13 +94,6 @@ namespace OpenSim.Services.Interfaces /// [out] Optional error message /// True: ok; False: not allowed bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, List features, out string version, out string reason); -======= - /// version that the requesting simulator is runing - /// version that the target simulator is running - /// [out] Optional error message - /// True: ok; False: not allowed - bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason); ->>>>>>> avn/ubitvar /// /// Message from receiving region to departing region, telling it got contacted by the client. diff --git a/OpenSim/Services/Interfaces/IUserProfilesService.cs b/OpenSim/Services/Interfaces/IUserProfilesService.cs index 319d3075dd..121baa8b1f 100644 --- a/OpenSim/Services/Interfaces/IUserProfilesService.cs +++ b/OpenSim/Services/Interfaces/IUserProfilesService.cs @@ -57,6 +57,11 @@ namespace OpenSim.Services.Interfaces bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result); bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result); #endregion Profile Properties + + #region User Preferences + bool UserPreferencesRequest(ref UserPreferences pref, ref string result); + bool UserPreferencesUpdate(ref UserPreferences pref, ref string result); + #endregion User Preferences #region Interests bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result); diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 92d93eecef..0f57c2ea3c 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -234,13 +234,9 @@ namespace OpenSim.Services.LLLoginService public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, GridRegion destination, List invSkel, FriendInfo[] friendsList, ILibraryService libService, string where, string startlocation, Vector3 position, Vector3 lookAt, List gestures, string message, -<<<<<<< HEAD - GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL, string currency, - string DSTZone, string destinationsURL, string avatarsURL, string classifiedFee, int maxAgentGroups) -======= + GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency, - string DSTZone, string destinationsURL, string avatarsURL, UUID realID, string classifiedFee) ->>>>>>> avn/ubitvar + string DSTZone, string destinationsURL, string avatarsURL, UUID realID, string classifiedFee,int maxAgentGroups) : this() { FillOutInventoryData(invSkel, libService); diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index ba69e9523d..29199ae64d 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -77,6 +77,8 @@ namespace OpenSim.Services.LLLoginService protected string m_GatekeeperURL; protected bool m_AllowRemoteSetLoginLevel; protected string m_MapTileURL; + protected string m_ProfileURL; + protected string m_OpenIDURL; protected string m_SearchURL; protected string m_Currency; protected string m_ClassifiedFee; @@ -117,6 +119,8 @@ namespace OpenSim.Services.LLLoginService m_GatekeeperURL = Util.GetConfigVarFromSections(config, "GatekeeperURI", new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty); m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); + m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty); + m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty); m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); m_ClassifiedFee = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty); @@ -262,13 +266,11 @@ namespace OpenSim.Services.LLLoginService { bool success = false; UUID session = UUID.Random(); -<<<<<<< HEAD + string processedMessage; -======= + if (clientVersion.Contains("Radegast")) LibOMVclient = false; ->>>>>>> avn/ubitvar - m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}, Possible LibOMVGridProxy: {8} ", firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0, LibOMVclient.ToString()); @@ -522,19 +524,11 @@ namespace OpenSim.Services.LLLoginService processedMessage = processedMessage.Replace("\\n", "\n").Replace("", firstName + " " + lastName); LLLoginResponse response -<<<<<<< HEAD - = new LLLoginResponse( - account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, - where, startLocation, position, lookAt, gestures, processedMessage, home, clientIP, - m_MapTileURL, m_SearchURL, m_Currency, m_DSTZone, - m_DestinationGuide, m_AvatarPicker, m_ClassifiedFee, m_MaxAgentGroups); -======= = new LLLoginResponse( account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone, - m_DestinationGuide, m_AvatarPicker, realID, m_ClassifiedFee); ->>>>>>> avn/ubitvar + m_DestinationGuide, m_AvatarPicker, realID, m_ClassifiedFee,m_MaxAgentGroups); m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); diff --git a/OpenSim/Services/MapImageService/MapImageService.cs b/OpenSim/Services/MapImageService/MapImageService.cs index fcace3a624..6728752122 100644 --- a/OpenSim/Services/MapImageService/MapImageService.cs +++ b/OpenSim/Services/MapImageService/MapImageService.cs @@ -131,16 +131,6 @@ namespace OpenSim.Services.MapImageService return false; } } -<<<<<<< HEAD - - return UpdateMultiResolutionFilesAsync(x, y, out reason); - } - - public bool RemoveMapTile(int x, int y, out string reason) - { - reason = String.Empty; - string fileName = GetFileName(1, x, y); -======= return UpdateMultiResolutionFiles(x, y, scopeID, out reason); } @@ -149,40 +139,25 @@ namespace OpenSim.Services.MapImageService { reason = String.Empty; string fileName = GetFileName(1, x, y, scopeID); ->>>>>>> avn/ubitvar lock (m_Sync) { try -<<<<<<< HEAD { File.Delete(fileName); } catch (Exception e) { -======= - { - File.Delete(fileName); - } - catch (Exception e) - { ->>>>>>> avn/ubitvar + m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to save delete file {0}: {1}", fileName, e); reason = e.Message; return false; } } -<<<<<<< HEAD - - return UpdateMultiResolutionFilesAsync(x, y, out reason); - } - -======= - return UpdateMultiResolutionFiles(x, y, scopeID, out reason); } ->>>>>>> avn/ubitvar + // When large varregions start up, they can send piles of new map tiles. This causes // this multi-resolution routine to be called a zillion times an causes much CPU // time to be spent creating multi-resolution tiles that will be replaced when @@ -191,25 +166,6 @@ namespace OpenSim.Services.MapImageService { public int xx; public int yy; -<<<<<<< HEAD - public mapToMultiRez(int pX, int pY) - { - xx = pX; - yy = pY; - } - }; - private Queue multiRezToBuild = new Queue(); - private bool UpdateMultiResolutionFilesAsync(int x, int y, out string reason) - { - reason = String.Empty; - lock (multiRezToBuild) - { - // m_log.DebugFormat("{0} UpdateMultiResolutionFilesAsync: scheduling update for <{1},{2}>", LogHeader, x, y); - multiRezToBuild.Enqueue(new mapToMultiRez(x, y)); - if (multiRezToBuild.Count == 1) - Util.FireAndForget( - DoUpdateMultiResolutionFilesAsync, null, "MapImageService.DoUpdateMultiResolutionFilesAsync"); -======= public UUID scopeID; public mapToMultiRez(int pX, int pY, UUID pscopeID) { @@ -231,7 +187,6 @@ namespace OpenSim.Services.MapImageService if (multiRezToBuild.Count == 1) Util.FireAndForget( DoUpdateMultiResolutionFilesAsync); ->>>>>>> avn/ubitvar } return true; @@ -239,15 +194,8 @@ namespace OpenSim.Services.MapImageService private void DoUpdateMultiResolutionFilesAsync(object o) { -<<<<<<< HEAD - // This sleep causes the FireAndForget thread to be different than the invocation thread. - // It also allows other tiles to be uploaded so the multi-rez images are more likely - // to be correct. - Thread.Sleep(1 * 1000); -======= // let acumulate large region tiles Thread.Sleep(60 * 1000); // large regions take time to upload tiles ->>>>>>> avn/ubitvar while (multiRezToBuild.Count > 0) { @@ -261,35 +209,23 @@ namespace OpenSim.Services.MapImageService { int x = toMultiRez.xx; int y = toMultiRez.yy; -<<<<<<< HEAD - // m_log.DebugFormat("{0} DoUpdateMultiResolutionFilesAsync: doing build for <{1},{2}>", LogHeader, x, y); - -======= UUID scopeID = toMultiRez.scopeID; // m_log.DebugFormat("{0} DoUpdateMultiResolutionFilesAsync: doing build for <{1},{2}>", LogHeader, x, y); int width = 1; ->>>>>>> avn/ubitvar + // Stitch seven more aggregate tiles together for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++) { // Calculate the width (in full resolution tiles) and bottom-left // corner of the current zoom level -<<<<<<< HEAD - int width = (int)Math.Pow(2, (double)(zoomLevel - 1)); -======= width *= 2; ->>>>>>> avn/ubitvar int x1 = x - (x % width); int y1 = y - (y % width); lock (m_Sync) // must lock the reading and writing of the maptile files { -<<<<<<< HEAD - if (!CreateTile(zoomLevel, x1, y1)) -======= if (!CreateTile(zoomLevel, x1, y1, scopeID)) ->>>>>>> avn/ubitvar { m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0},{1} at zoom level {1}", x, y, zoomLevel); return; @@ -298,10 +234,6 @@ namespace OpenSim.Services.MapImageService } } } -<<<<<<< HEAD - -======= ->>>>>>> avn/ubitvar return; } diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs index 35fe31bf14..9a52e02003 100644 --- a/OpenSim/Services/UserProfilesService/UserProfilesService.cs +++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs @@ -159,7 +159,7 @@ namespace OpenSim.Services.ProfilesService } #endregion Interests - /* + #region User Preferences public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result) { @@ -239,7 +239,7 @@ namespace OpenSim.Services.ProfilesService return true; } #endregion User Preferences - */ + #region Utility public OSD AvatarImageAssetsRequest(UUID avatarId) diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 9ed3eaeb3d..b3688222f6 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -152,22 +152,13 @@ namespace OpenSim.Tests.Common PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); -<<<<<<< HEAD - Vector3 regionExtent = new Vector3( regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ); - PhysicsScene physicsScene -======= Vector3 regionExtent = new Vector3(regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ); PhysicsScene physicsScene ->>>>>>> avn/ubitvar = physicsPluginManager.GetPhysicsScene( "basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent); TestScene testScene = new TestScene( -<<<<<<< HEAD regInfo, m_acm, physicsScene, scs, SimDataService, m_estateDataService, configSource, null); -======= - regInfo, m_acm, physicsScene, scs, m_simDataService, m_estateDataService, configSource, null); ->>>>>>> avn/ubitvar INonSharedRegionModule godsModule = new GodsModule(); godsModule.Initialise(new IniConfigSource()); @@ -210,11 +201,7 @@ namespace OpenSim.Tests.Common testScene.SetModuleInterfaces(); testScene.LandChannel = new TestLandChannel(testScene); -<<<<<<< HEAD - testScene.LoadWorldMap(); -======= testScene.LoadWorldMap(); ->>>>>>> avn/ubitvar testScene.RegionInfo.EstateSettings = new EstateSettings(); testScene.LoginsEnabled = true; diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index e559871a7e..45acf91f38 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -34,10 +34,7 @@ using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Physics.Manager; -<<<<<<< HEAD using OpenSim.Services.Interfaces; -======= ->>>>>>> avn/ubitvar namespace OpenSim.Tests.Common {