Merge branch 'master' into httptests
commit
e5383604cb
|
@ -524,7 +524,6 @@ namespace OpenSim.Data.MySQL
|
||||||
query += "SELECT `notes` FROM usernotes WHERE ";
|
query += "SELECT `notes` FROM usernotes WHERE ";
|
||||||
query += "useruuid = ?Id AND ";
|
query += "useruuid = ?Id AND ";
|
||||||
query += "targetuuid = ?TargetId";
|
query += "targetuuid = ?TargetId";
|
||||||
OSDArray data = new OSDArray();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -904,8 +903,6 @@ namespace OpenSim.Data.MySQL
|
||||||
query += "usersettings WHERE ";
|
query += "usersettings WHERE ";
|
||||||
query += "useruuid = ?Id";
|
query += "useruuid = ?Id";
|
||||||
|
|
||||||
OSDArray data = new OSDArray();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
|
||||||
|
|
|
@ -1354,7 +1354,7 @@ namespace OpenSim.Data.SQLite
|
||||||
createCol(land, "Name", typeof(String));
|
createCol(land, "Name", typeof(String));
|
||||||
createCol(land, "Desc", typeof(String));
|
createCol(land, "Desc", typeof(String));
|
||||||
createCol(land, "OwnerUUID", typeof(String));
|
createCol(land, "OwnerUUID", typeof(String));
|
||||||
createCol(land, "IsGroupOwned", typeof(Boolean));
|
createCol(land, "IsGroupOwned", typeof(String));
|
||||||
createCol(land, "Area", typeof(Int32));
|
createCol(land, "Area", typeof(Int32));
|
||||||
createCol(land, "AuctionID", typeof(Int32)); //Unemplemented
|
createCol(land, "AuctionID", typeof(Int32)); //Unemplemented
|
||||||
createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory
|
createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory
|
||||||
|
@ -1387,6 +1387,9 @@ namespace OpenSim.Data.SQLite
|
||||||
createCol(land, "MediaLoop", typeof(Boolean));
|
createCol(land, "MediaLoop", typeof(Boolean));
|
||||||
createCol(land, "ObscureMedia", typeof(Boolean));
|
createCol(land, "ObscureMedia", typeof(Boolean));
|
||||||
createCol(land, "ObscureMusic", typeof(Boolean));
|
createCol(land, "ObscureMusic", typeof(Boolean));
|
||||||
|
createCol(land, "SeeAVs", typeof(Boolean));
|
||||||
|
createCol(land, "AnyAVSounds", typeof(Boolean));
|
||||||
|
createCol(land, "GroupAVSounds", typeof(Boolean));
|
||||||
|
|
||||||
land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] };
|
land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] };
|
||||||
|
|
||||||
|
@ -1829,7 +1832,7 @@ namespace OpenSim.Data.SQLite
|
||||||
newData.Name = (String)row["Name"];
|
newData.Name = (String)row["Name"];
|
||||||
newData.Description = (String)row["Desc"];
|
newData.Description = (String)row["Desc"];
|
||||||
newData.OwnerID = (UUID)(String)row["OwnerUUID"];
|
newData.OwnerID = (UUID)(String)row["OwnerUUID"];
|
||||||
newData.IsGroupOwned = (Boolean)row["IsGroupOwned"];
|
newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
|
||||||
newData.Area = Convert.ToInt32(row["Area"]);
|
newData.Area = Convert.ToInt32(row["Area"]);
|
||||||
newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
|
newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
|
||||||
newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]);
|
newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]);
|
||||||
|
@ -2245,7 +2248,7 @@ namespace OpenSim.Data.SQLite
|
||||||
row["Name"] = land.Name;
|
row["Name"] = land.Name;
|
||||||
row["Desc"] = land.Description;
|
row["Desc"] = land.Description;
|
||||||
row["OwnerUUID"] = land.OwnerID.ToString();
|
row["OwnerUUID"] = land.OwnerID.ToString();
|
||||||
row["IsGroupOwned"] = land.IsGroupOwned;
|
row["IsGroupOwned"] = land.IsGroupOwned.ToString();
|
||||||
row["Area"] = land.Area;
|
row["Area"] = land.Area;
|
||||||
row["AuctionID"] = land.AuctionID; //Unemplemented
|
row["AuctionID"] = land.AuctionID; //Unemplemented
|
||||||
row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory
|
row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory
|
||||||
|
@ -2939,6 +2942,9 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
return DbType.Binary;
|
return DbType.Binary;
|
||||||
}
|
}
|
||||||
|
else if (type == typeof(Boolean)) {
|
||||||
|
return DbType.Boolean;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return DbType.String;
|
return DbType.String;
|
||||||
|
|
|
@ -6108,7 +6108,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes);
|
AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes);
|
||||||
AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard);
|
AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard);
|
||||||
AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags);
|
AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags);
|
||||||
|
AddLocalPacketHandler(PacketType.RevokePermissions, HandleRevokePermissions);
|
||||||
AddGenericPacketHandler("autopilot", HandleAutopilot);
|
AddGenericPacketHandler("autopilot", HandleAutopilot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10997,6 +10997,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private bool HandleInventoryDescendents(IClientAPI sender, Packet Pack)
|
private bool HandleInventoryDescendents(IClientAPI sender, Packet Pack)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -12371,6 +12372,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool HandleRevokePermissions(IClientAPI sender, Packet Pack)
|
||||||
|
{
|
||||||
|
RevokePermissionsPacket pkt = (RevokePermissionsPacket)Pack;
|
||||||
|
if (pkt.AgentData.SessionID != SessionId ||
|
||||||
|
pkt .AgentData.AgentID != AgentId)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// don't use multidelegate "event"
|
||||||
|
ScenePresence sp = (ScenePresence)SceneAgent;
|
||||||
|
if(sp != null && !sp.IsDeleted && !sp.IsInTransit)
|
||||||
|
{
|
||||||
|
UUID objectID = pkt.Data.ObjectID;
|
||||||
|
uint permissions = pkt.Data.ObjectPermissions;
|
||||||
|
|
||||||
|
sp.HandleRevokePermissions(objectID , permissions);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
private bool HandlePlacesQuery(IClientAPI sender, Packet Pack)
|
private bool HandlePlacesQuery(IClientAPI sender, Packet Pack)
|
||||||
{
|
{
|
||||||
PlacesQueryPacket placesQueryPacket =
|
PlacesQueryPacket placesQueryPacket =
|
||||||
|
|
|
@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message);
|
m_log.Error("[EMAIL]: DefaultEmailModule not configured: " + e.Message);
|
||||||
m_Enabled = false;
|
m_Enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Info("[EMAIL] Activated DefaultEmailModule");
|
m_log.Info("[EMAIL]: Activated DefaultEmailModule");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
|
@ -268,12 +268,12 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
bool isEMailStrictMatch = EMailreStrict.IsMatch(address);
|
bool isEMailStrictMatch = EMailreStrict.IsMatch(address);
|
||||||
if (!isEMailStrictMatch)
|
if (!isEMailStrictMatch)
|
||||||
{
|
{
|
||||||
m_log.Error("[EMAIL] REGEX Problem in EMail Address: "+address);
|
m_log.Error("[EMAIL]: REGEX Problem in EMail Address: "+address);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((subject.Length + body.Length) > m_MaxEmailSize)
|
if ((subject.Length + body.Length) > m_MaxEmailSize)
|
||||||
{
|
{
|
||||||
m_log.Error("[EMAIL] subject + body larger than limit of " + m_MaxEmailSize + " bytes");
|
m_log.Error("[EMAIL]: subject + body larger than limit of " + m_MaxEmailSize + " bytes");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,11 +318,11 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
emailMessage.Send(smtpServer);
|
emailMessage.Send(smtpServer);
|
||||||
|
|
||||||
//Log
|
//Log
|
||||||
m_log.Info("[EMAIL] EMail sent to: " + address + " from object: " + objectID.ToString() + "@" + m_HostName);
|
m_log.Info("[EMAIL]: EMail sent to: " + address + " from object: " + objectID.ToString() + "@" + m_HostName);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[EMAIL] DefaultEmailModule Exception: " + e.Message);
|
m_log.Error("[EMAIL]: DefaultEmailModule Exception: " + e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
private IGridService m_GridService;
|
private IGridService m_GridService;
|
||||||
private RegionInfoCache m_RegionInfoCache;
|
private RegionInfoCache m_RegionInfoCache;
|
||||||
|
private HashSet<Scene> m_scenes = new HashSet<Scene>();
|
||||||
|
|
||||||
private bool m_Enabled;
|
private bool m_Enabled;
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
public LocalGridServicesConnector(IConfigSource source, RegionInfoCache regionInfoCache)
|
public LocalGridServicesConnector(IConfigSource source, RegionInfoCache regionInfoCache)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("{0} LocalGridServicesConnector instantiated directly witj cache.", LogHeader);
|
m_log.DebugFormat("{0} LocalGridServicesConnector instantiated directly with cache.", LogHeader);
|
||||||
InitialiseService(source, regionInfoCache);
|
InitialiseService(source, regionInfoCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,11 +138,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
// FIXME: We will still add this command even if we aren't enabled since RemoteGridServiceConnector
|
|
||||||
// will have instantiated us directly.
|
|
||||||
MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours",
|
|
||||||
"show neighbours",
|
|
||||||
"Shows the local regions' neighbours", HandleShowNeighboursCommand);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -153,6 +149,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
lock(m_scenes)
|
||||||
|
{
|
||||||
|
if(!m_scenes.Contains(scene))
|
||||||
|
m_scenes.Add(scene);
|
||||||
|
}
|
||||||
scene.RegisterModuleInterface<IGridService>(this);
|
scene.RegisterModuleInterface<IGridService>(this);
|
||||||
|
|
||||||
GridRegion r = new GridRegion(scene.RegionInfo);
|
GridRegion r = new GridRegion(scene.RegionInfo);
|
||||||
|
@ -166,6 +167,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
lock(m_scenes)
|
||||||
|
{
|
||||||
|
if(m_scenes.Contains(scene))
|
||||||
|
m_scenes.Remove(scene);
|
||||||
|
}
|
||||||
|
|
||||||
m_RegionInfoCache.Remove(scene.RegionInfo.ScopeID, scene.RegionInfo.RegionHandle);
|
m_RegionInfoCache.Remove(scene.RegionInfo.ScopeID, scene.RegionInfo.RegionHandle);
|
||||||
scene.EventManager.OnRegionUp -= OnRegionUp;
|
scene.EventManager.OnRegionUp -= OnRegionUp;
|
||||||
}
|
}
|
||||||
|
@ -221,14 +228,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
|
public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
|
||||||
{
|
{
|
||||||
|
|
||||||
// try in cache by handler first
|
|
||||||
// ulong regionHandle = Util.RegionWorldLocToHandle((uint)x, (uint)y);
|
|
||||||
|
|
||||||
bool inCache = false;
|
bool inCache = false;
|
||||||
// GridRegion rinfo = m_RegionInfoCache.Get(scopeID, regionHandle, out inCache);
|
|
||||||
// if (inCache)
|
|
||||||
// return rinfo;
|
|
||||||
|
|
||||||
GridRegion rinfo = m_RegionInfoCache.Get(scopeID, (uint)x, (uint)y, out inCache);
|
GridRegion rinfo = m_RegionInfoCache.Get(scopeID, (uint)x, (uint)y, out inCache);
|
||||||
if (inCache)
|
if (inCache)
|
||||||
return rinfo;
|
return rinfo;
|
||||||
|
@ -295,24 +295,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void HandleShowNeighboursCommand(string module, string[] cmdparams)
|
|
||||||
{
|
|
||||||
System.Text.StringBuilder caps = new System.Text.StringBuilder();
|
|
||||||
/* temporary broken
|
|
||||||
lock (m_LocalCache)
|
|
||||||
{
|
|
||||||
foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache)
|
|
||||||
{
|
|
||||||
caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key);
|
|
||||||
List<GridRegion> regions = kvp.Value.GetNeighbours();
|
|
||||||
foreach (GridRegion r in regions)
|
|
||||||
caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MainConsole.Instance.Output(caps.ToString());
|
|
||||||
*/
|
|
||||||
MainConsole.Instance.Output("Neighbours list not avaiable in this version\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("{0} Upload maptile for {1}", LogHeader, scene.Name);
|
|
||||||
|
|
||||||
// mapTile.Save( // DEBUG DEBUG
|
// mapTile.Save( // DEBUG DEBUG
|
||||||
// String.Format("maptiles/raw-{0}-{1}-{2}.jpg", regionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY),
|
// String.Format("maptiles/raw-{0}-{1}-{2}.jpg", regionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY),
|
||||||
|
@ -218,12 +217,17 @@ 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 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)
|
if (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("{0} Upload maptile for {1}", LogHeader, scene.Name);
|
||||||
ConvertAndUploadMaptile(scene, mapTile,
|
ConvertAndUploadMaptile(scene, mapTile,
|
||||||
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
|
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
|
||||||
scene.RegionInfo.RegionName);
|
scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("{0} Upload {1} maptiles for {2}", LogHeader,
|
||||||
|
(mapTile.Width * mapTile.Height) / (Constants.RegionSize * Constants.RegionSize),
|
||||||
|
scene.Name);
|
||||||
|
|
||||||
// For larger regions (varregion) we must cut the region image into legacy sized
|
// For larger regions (varregion) we must cut the region image into legacy sized
|
||||||
// pieces since that is how the maptile system works.
|
// pieces since that is how the maptile system works.
|
||||||
// Note the assumption that varregions are always a multiple of legacy size.
|
// Note the assumption that varregions are always a multiple of legacy size.
|
||||||
|
|
|
@ -1435,6 +1435,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
land.LandData.IsGroupOwned = false;
|
land.LandData.IsGroupOwned = false;
|
||||||
land.LandData.SalePrice = 0;
|
land.LandData.SalePrice = 0;
|
||||||
land.LandData.AuthBuyerID = UUID.Zero;
|
land.LandData.AuthBuyerID = UUID.Zero;
|
||||||
|
land.LandData.SeeAVs = true;
|
||||||
|
land.LandData.AnyAVSounds = true;
|
||||||
|
land.LandData.GroupAVSounds = true;
|
||||||
land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
|
land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
|
||||||
m_scene.ForEachClient(SendParcelOverlay);
|
m_scene.ForEachClient(SendParcelOverlay);
|
||||||
land.SendLandUpdateToClient(true, remote_client);
|
land.SendLandUpdateToClient(true, remote_client);
|
||||||
|
|
|
@ -40,6 +40,7 @@ using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Monitoring;
|
using OpenSim.Framework.Monitoring;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
||||||
{
|
{
|
||||||
|
@ -107,6 +108,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
||||||
+ "max-agent-limit <int> - Maximum root agent limit. agent-limit cannot exceed this."
|
+ "max-agent-limit <int> - Maximum root agent limit. agent-limit cannot exceed this."
|
||||||
+ " This is not persisted over restart - to set it every time you must add a MaxAgents entry to your regions file.",
|
+ " This is not persisted over restart - to set it every time you must add a MaxAgents entry to your regions file.",
|
||||||
HandleRegionSet);
|
HandleRegionSet);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand("Regions", false, "show neighbours",
|
||||||
|
"show neighbours",
|
||||||
|
"Shows the local region neighbours", HandleShowNeighboursCommand);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand("Regions", false, "show regionsinview",
|
||||||
|
"show regionsinview",
|
||||||
|
"Shows regions that can be seen from a region", HandleShowRegionsInViewCommand);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
|
@ -309,5 +319,60 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
||||||
|
|
||||||
MainConsole.Instance.Output(sb.ToString());
|
MainConsole.Instance.Output(sb.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void HandleShowNeighboursCommand(string module, string[] cmdparams)
|
||||||
|
{
|
||||||
|
if(m_scene == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
|
||||||
|
return;
|
||||||
|
|
||||||
|
System.Text.StringBuilder caps = new System.Text.StringBuilder();
|
||||||
|
|
||||||
|
RegionInfo sr = m_scene.RegionInfo;
|
||||||
|
caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", sr.RegionName, sr.RegionID);
|
||||||
|
List<GridRegion> regions = m_scene.GridService.GetNeighbours(sr.ScopeID, sr.RegionID);
|
||||||
|
foreach (GridRegion r in regions)
|
||||||
|
caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY));
|
||||||
|
|
||||||
|
MainConsole.Instance.Output(caps.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HandleShowRegionsInViewCommand(string module, string[] cmdparams)
|
||||||
|
{
|
||||||
|
if(m_scene == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
|
||||||
|
return;
|
||||||
|
|
||||||
|
System.Text.StringBuilder caps = new System.Text.StringBuilder();
|
||||||
|
int maxview = (int)m_scene.MaxRegionViewDistance;
|
||||||
|
RegionInfo sr = m_scene.RegionInfo;
|
||||||
|
caps.AppendFormat("*** Regions that can be seen from {0} ({1}) (MaxRegionViewDistance {2}m) ***\n", sr.RegionName, sr.RegionID, maxview);
|
||||||
|
int startX = (int)sr.WorldLocX;
|
||||||
|
int endX = startX + (int)sr.RegionSizeX;
|
||||||
|
int startY = (int)sr.WorldLocY;
|
||||||
|
int endY = startY + (int)sr.RegionSizeY;
|
||||||
|
startX -= maxview;
|
||||||
|
if(startX < 0 )
|
||||||
|
startX = 0;
|
||||||
|
startY -= maxview;
|
||||||
|
if(startY < 0)
|
||||||
|
startY = 0;
|
||||||
|
endX += maxview;
|
||||||
|
endY += maxview;
|
||||||
|
|
||||||
|
List<GridRegion> regions = m_scene.GridService.GetRegionRange(sr.ScopeID, startX, endX, startY, endY);
|
||||||
|
foreach (GridRegion r in regions)
|
||||||
|
{
|
||||||
|
if(r.RegionHandle == sr.RegionHandle)
|
||||||
|
continue;
|
||||||
|
caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY));
|
||||||
|
}
|
||||||
|
|
||||||
|
MainConsole.Instance.Output(caps.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1122,8 +1122,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int[] xPieces = new int[toSend.Count];
|
|
||||||
int[] yPieces = new int[toSend.Count];
|
|
||||||
float[] patchPieces = new float[toSend.Count * 2];
|
float[] patchPieces = new float[toSend.Count * 2];
|
||||||
int pieceIndex = 0;
|
int pieceIndex = 0;
|
||||||
foreach (PatchesToSend pts in toSend)
|
foreach (PatchesToSend pts in toSend)
|
||||||
|
|
|
@ -66,7 +66,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
|
|
||||||
private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg";
|
private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg";
|
||||||
private static readonly UUID STOP_UUID = UUID.Random();
|
private static readonly UUID STOP_UUID = UUID.Random();
|
||||||
private static readonly string m_mapLayerPath = "0001/";
|
|
||||||
|
|
||||||
private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>();
|
private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>();
|
||||||
|
|
||||||
|
@ -177,6 +176,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
regionimage = regionimage.Replace("-", "");
|
regionimage = regionimage.Replace("-", "");
|
||||||
m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "index.php?method=" + regionimage);
|
m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "index.php?method=" + regionimage);
|
||||||
|
|
||||||
|
/*
|
||||||
MainServer.Instance.AddHTTPHandler(regionimage,
|
MainServer.Instance.AddHTTPHandler(regionimage,
|
||||||
new GenericHTTPDOSProtector(OnHTTPGetMapImage, OnHTTPThrottled, new BasicDosProtectorOptions()
|
new GenericHTTPDOSProtector(OnHTTPGetMapImage, OnHTTPThrottled, new BasicDosProtectorOptions()
|
||||||
{
|
{
|
||||||
|
@ -187,6 +187,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
RequestTimeSpan = TimeSpan.FromSeconds(10),
|
RequestTimeSpan = TimeSpan.FromSeconds(10),
|
||||||
ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod
|
ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod
|
||||||
}).Process);
|
}).Process);
|
||||||
|
*/
|
||||||
|
|
||||||
|
MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage);
|
||||||
MainServer.Instance.AddLLSDHandler(
|
MainServer.Instance.AddLLSDHandler(
|
||||||
"/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(), HandleRemoteMapItemRequest);
|
"/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(), HandleRemoteMapItemRequest);
|
||||||
|
|
||||||
|
@ -222,12 +225,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
public void OnRegisterCaps(UUID agentID, Caps caps)
|
public void OnRegisterCaps(UUID agentID, Caps caps)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[WORLD MAP]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
//m_log.DebugFormat("[WORLD MAP]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
||||||
string capsBase = "/CAPS/" + caps.CapsObjectPath;
|
string capspath = "/CAPS/" + UUID.Random();
|
||||||
caps.RegisterHandler(
|
caps.RegisterHandler(
|
||||||
"MapLayer",
|
"MapLayer",
|
||||||
new RestStreamHandler(
|
new RestStreamHandler(
|
||||||
"POST",
|
"POST",
|
||||||
capsBase + m_mapLayerPath,
|
capspath,
|
||||||
(request, path, param, httpRequest, httpResponse)
|
(request, path, param, httpRequest, httpResponse)
|
||||||
=> MapLayerRequest(request, path, param, agentID, caps),
|
=> MapLayerRequest(request, path, param, agentID, caps),
|
||||||
"MapLayer",
|
"MapLayer",
|
||||||
|
@ -1142,10 +1145,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
|
|
||||||
protected void MapBlockSendThread()
|
protected void MapBlockSendThread()
|
||||||
{
|
{
|
||||||
|
List<MapBlockRequestData> thisRunData = new List<MapBlockRequestData>();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
List<MapBlockRequestData> thisRunData = new List<MapBlockRequestData>();
|
|
||||||
|
|
||||||
m_mapBlockRequestEvent.WaitOne();
|
m_mapBlockRequestEvent.WaitOne();
|
||||||
lock (m_mapBlockRequestEvent)
|
lock (m_mapBlockRequestEvent)
|
||||||
{
|
{
|
||||||
|
@ -1162,6 +1164,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
m_mapBlockRequestEvent.Reset();
|
m_mapBlockRequestEvent.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(thisRunData.Count > 0)
|
||||||
|
{
|
||||||
foreach (MapBlockRequestData req in thisRunData)
|
foreach (MapBlockRequestData req in thisRunData)
|
||||||
{
|
{
|
||||||
// Null client stops thread
|
// Null client stops thread
|
||||||
|
@ -1171,6 +1175,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
GetAndSendBlocksInternal(req.client, req.minX, req.minY, req.maxX, req.maxY, req.flags);
|
GetAndSendBlocksInternal(req.client, req.minX, req.minY, req.maxX, req.maxY, req.flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thisRunData.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
Thread.Sleep(50);
|
Thread.Sleep(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1590,6 +1597,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
{
|
{
|
||||||
m_scene.AssetService.Delete(lastID.ToString());
|
m_scene.AssetService.Delete(lastID.ToString());
|
||||||
m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Zero;
|
m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Zero;
|
||||||
|
myMapImageJPEG = new byte[0];
|
||||||
needRegionSave = true;
|
needRegionSave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1648,7 +1656,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
asset.Flags = AssetFlags.Maptile;
|
asset.Flags = AssetFlags.Maptile;
|
||||||
|
|
||||||
// Store the new one
|
// Store the new one
|
||||||
m_log.DebugFormat("[WORLD MAP]: Storing map tile {0} for {1}", asset.ID, m_scene.RegionInfo.RegionName);
|
m_log.DebugFormat("[WORLD MAP]: Storing map image {0} for {1}", asset.ID, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
m_scene.AssetService.Store(asset);
|
m_scene.AssetService.Store(asset);
|
||||||
|
|
||||||
|
|
|
@ -1881,7 +1881,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
|
"[EVENT MANAGER]: Delegate for TriggerGroupMove failed - continuing. {0} {1}",
|
||||||
e.Message, e.StackTrace);
|
e.Message, e.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,13 +340,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
|
obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
|
||||||
|
|
||||||
// If the touched prim handles touches, deliver it
|
// If the touched prim handles touches, deliver it
|
||||||
// If not, deliver to root prim
|
|
||||||
if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
|
if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
|
||||||
EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
|
EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
|
||||||
|
|
||||||
// Deliver to the root prim if the touched prim doesn't handle touches
|
// Deliver to the root prim if the touched prim doesn't handle touches
|
||||||
// or if we're meant to pass on touches anyway. Don't send to root prim
|
// or if we're meant to pass on touches anyway.
|
||||||
// if prim touched is the root prim as we just did it
|
|
||||||
if (((part.ScriptEvents & scriptEvents.touch_start) == 0) ||
|
if (((part.ScriptEvents & scriptEvents.touch_start) == 0) ||
|
||||||
(part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
|
(part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
|
||||||
{
|
{
|
||||||
|
@ -381,12 +379,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
surfaceArg = surfaceArgs[0];
|
surfaceArg = surfaceArgs[0];
|
||||||
|
|
||||||
// If the touched prim handles touches, deliver it
|
// If the touched prim handles touches, deliver it
|
||||||
// If not, deliver to root prim
|
|
||||||
if ((part.ScriptEvents & scriptEvents.touch) != 0)
|
if ((part.ScriptEvents & scriptEvents.touch) != 0)
|
||||||
EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
|
EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
|
||||||
// Deliver to the root prim if the touched prim doesn't handle touches
|
// Deliver to the root prim if the touched prim doesn't handle touches
|
||||||
// or if we're meant to pass on touches anyway. Don't send to root prim
|
// or if we're meant to pass on touches anyway.
|
||||||
// if prim touched is the root prim as we just did it
|
|
||||||
if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
|
if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
|
||||||
(part.PassTouches && (part.LocalId != group.RootPart.LocalId)))
|
(part.PassTouches && (part.LocalId != group.RootPart.LocalId)))
|
||||||
{
|
{
|
||||||
|
@ -400,18 +396,77 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (part == null)
|
if (part == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SceneObjectGroup obj = part.ParentGroup;
|
SceneObjectGroup grp = part.ParentGroup;
|
||||||
|
|
||||||
SurfaceTouchEventArgs surfaceArg = null;
|
SurfaceTouchEventArgs surfaceArg = null;
|
||||||
if (surfaceArgs != null && surfaceArgs.Count > 0)
|
if (surfaceArgs != null && surfaceArgs.Count > 0)
|
||||||
surfaceArg = surfaceArgs[0];
|
surfaceArg = surfaceArgs[0];
|
||||||
|
|
||||||
// If the touched prim handles touches, deliver it
|
// If the touched prim handles touches, deliver it
|
||||||
// If not, deliver to root prim
|
|
||||||
if ((part.ScriptEvents & scriptEvents.touch_end) != 0)
|
if ((part.ScriptEvents & scriptEvents.touch_end) != 0)
|
||||||
EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg);
|
EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg);
|
||||||
else
|
// if not or PassTouchs, send it also to root.
|
||||||
EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg);
|
if (((part.ScriptEvents & scriptEvents.touch_end) == 0) ||
|
||||||
|
(part.PassTouches && (part.LocalId != grp.RootPart.LocalId)))
|
||||||
|
{
|
||||||
|
EventManager.TriggerObjectDeGrab(grp.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Start spinning the given object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objectID"></param>
|
||||||
|
/// <param name="rotation"></param>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
public virtual void ProcessSpinStart(UUID objectID, IClientAPI remoteClient)
|
||||||
|
{
|
||||||
|
SceneObjectGroup group = GetGroupByPrim(objectID);
|
||||||
|
if (group != null)
|
||||||
|
{
|
||||||
|
if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
|
||||||
|
{
|
||||||
|
group.SpinStart(remoteClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Spin the given object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objectID"></param>
|
||||||
|
/// <param name="rotation"></param>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
public virtual void ProcessSpinObject(UUID objectID, Quaternion rotation, IClientAPI remoteClient)
|
||||||
|
{
|
||||||
|
SceneObjectGroup group = GetGroupByPrim(objectID);
|
||||||
|
if (group != null)
|
||||||
|
{
|
||||||
|
if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
|
||||||
|
{
|
||||||
|
group.SpinMovement(rotation, remoteClient);
|
||||||
|
}
|
||||||
|
// This is outside the above permissions condition
|
||||||
|
// so that if the object is locked the client moving the object
|
||||||
|
// get's it's position on the simulator even if it was the same as before
|
||||||
|
// This keeps the moving user's client in sync with the rest of the world.
|
||||||
|
group.SendGroupTerseUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void ProcessSpinObjectStop(UUID objectID, IClientAPI remoteClient)
|
||||||
|
{
|
||||||
|
/* no op for now
|
||||||
|
SceneObjectGroup group = GetGroupByPrim(objectID);
|
||||||
|
if (group != null)
|
||||||
|
{
|
||||||
|
if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
|
||||||
|
{
|
||||||
|
// group.SpinMovement(rotation, remoteClient);
|
||||||
|
}
|
||||||
|
group.SendGroupTerseUpdate();
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID,
|
public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID,
|
||||||
|
|
|
@ -3329,8 +3329,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
client.OnObjectRequest += RequestPrim;
|
client.OnObjectRequest += RequestPrim;
|
||||||
client.OnObjectSelect += SelectPrim;
|
client.OnObjectSelect += SelectPrim;
|
||||||
client.OnObjectDeselect += DeselectPrim;
|
client.OnObjectDeselect += DeselectPrim;
|
||||||
client.OnSpinStart += m_sceneGraph.SpinStart;
|
|
||||||
client.OnSpinUpdate += m_sceneGraph.SpinObject;
|
|
||||||
client.OnDeRezObject += DeRezObjects;
|
client.OnDeRezObject += DeRezObjects;
|
||||||
|
|
||||||
client.OnObjectName += m_sceneGraph.PrimName;
|
client.OnObjectName += m_sceneGraph.PrimName;
|
||||||
|
@ -3346,6 +3344,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
client.OnGrabObject += ProcessObjectGrab;
|
client.OnGrabObject += ProcessObjectGrab;
|
||||||
client.OnGrabUpdate += ProcessObjectGrabUpdate;
|
client.OnGrabUpdate += ProcessObjectGrabUpdate;
|
||||||
client.OnDeGrabObject += ProcessObjectDeGrab;
|
client.OnDeGrabObject += ProcessObjectDeGrab;
|
||||||
|
client.OnSpinStart += ProcessSpinStart;
|
||||||
|
client.OnSpinUpdate += ProcessSpinObject;
|
||||||
|
client.OnSpinStop += ProcessSpinObjectStop;
|
||||||
client.OnUndo += m_sceneGraph.HandleUndo;
|
client.OnUndo += m_sceneGraph.HandleUndo;
|
||||||
client.OnRedo += m_sceneGraph.HandleRedo;
|
client.OnRedo += m_sceneGraph.HandleRedo;
|
||||||
client.OnObjectDescription += m_sceneGraph.PrimDescription;
|
client.OnObjectDescription += m_sceneGraph.PrimDescription;
|
||||||
|
@ -3456,8 +3457,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
client.OnObjectRequest -= RequestPrim;
|
client.OnObjectRequest -= RequestPrim;
|
||||||
client.OnObjectSelect -= SelectPrim;
|
client.OnObjectSelect -= SelectPrim;
|
||||||
client.OnObjectDeselect -= DeselectPrim;
|
client.OnObjectDeselect -= DeselectPrim;
|
||||||
client.OnSpinStart -= m_sceneGraph.SpinStart;
|
|
||||||
client.OnSpinUpdate -= m_sceneGraph.SpinObject;
|
|
||||||
client.OnDeRezObject -= DeRezObjects;
|
client.OnDeRezObject -= DeRezObjects;
|
||||||
client.OnObjectName -= m_sceneGraph.PrimName;
|
client.OnObjectName -= m_sceneGraph.PrimName;
|
||||||
client.OnObjectClickAction -= m_sceneGraph.PrimClickAction;
|
client.OnObjectClickAction -= m_sceneGraph.PrimClickAction;
|
||||||
|
@ -3472,6 +3471,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
client.OnGrabObject -= ProcessObjectGrab;
|
client.OnGrabObject -= ProcessObjectGrab;
|
||||||
client.OnGrabUpdate -= ProcessObjectGrabUpdate;
|
client.OnGrabUpdate -= ProcessObjectGrabUpdate;
|
||||||
client.OnDeGrabObject -= ProcessObjectDeGrab;
|
client.OnDeGrabObject -= ProcessObjectDeGrab;
|
||||||
|
client.OnSpinStart -= ProcessSpinStart;
|
||||||
|
client.OnSpinUpdate -= ProcessSpinObject;
|
||||||
|
client.OnSpinStop -= ProcessSpinObjectStop;
|
||||||
client.OnUndo -= m_sceneGraph.HandleUndo;
|
client.OnUndo -= m_sceneGraph.HandleUndo;
|
||||||
client.OnRedo -= m_sceneGraph.HandleRedo;
|
client.OnRedo -= m_sceneGraph.HandleRedo;
|
||||||
client.OnObjectDescription -= m_sceneGraph.PrimDescription;
|
client.OnObjectDescription -= m_sceneGraph.PrimDescription;
|
||||||
|
|
|
@ -1674,72 +1674,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* moved to scene ProcessObjectGrabUpdate
|
|
||||||
/// <summary>
|
|
||||||
/// Move the given object
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="objectID"></param>
|
|
||||||
/// <param name="offset"></param>
|
|
||||||
/// <param name="pos"></param>
|
|
||||||
/// <param name="remoteClient"></param>
|
|
||||||
protected internal void MoveObject(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
|
|
||||||
{
|
|
||||||
SceneObjectGroup group = GetGroupByPrim(objectID);
|
|
||||||
if (group != null)
|
|
||||||
{
|
|
||||||
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
|
|
||||||
{
|
|
||||||
group.GrabMovement(objectID, offset, pos, remoteClient);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is outside the above permissions condition
|
|
||||||
// so that if the object is locked the client moving the object
|
|
||||||
// get's it's position on the simulator even if it was the same as before
|
|
||||||
// This keeps the moving user's client in sync with the rest of the world.
|
|
||||||
group.SendGroupTerseUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/// <summary>
|
|
||||||
/// Start spinning the given object
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="objectID"></param>
|
|
||||||
/// <param name="rotation"></param>
|
|
||||||
/// <param name="remoteClient"></param>
|
|
||||||
protected internal void SpinStart(UUID objectID, IClientAPI remoteClient)
|
|
||||||
{
|
|
||||||
SceneObjectGroup group = GetGroupByPrim(objectID);
|
|
||||||
if (group != null)
|
|
||||||
{
|
|
||||||
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
|
|
||||||
{
|
|
||||||
group.SpinStart(remoteClient);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Spin the given object
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="objectID"></param>
|
|
||||||
/// <param name="rotation"></param>
|
|
||||||
/// <param name="remoteClient"></param>
|
|
||||||
protected internal void SpinObject(UUID objectID, Quaternion rotation, IClientAPI remoteClient)
|
|
||||||
{
|
|
||||||
SceneObjectGroup group = GetGroupByPrim(objectID);
|
|
||||||
if (group != null)
|
|
||||||
{
|
|
||||||
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
|
|
||||||
{
|
|
||||||
group.SpinMovement(rotation, remoteClient);
|
|
||||||
}
|
|
||||||
// This is outside the above permissions condition
|
|
||||||
// so that if the object is locked the client moving the object
|
|
||||||
// get's it's position on the simulator even if it was the same as before
|
|
||||||
// This keeps the moving user's client in sync with the rest of the world.
|
|
||||||
group.SendGroupTerseUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
|
@ -79,7 +79,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
touch_end = 536870912,
|
touch_end = 536870912,
|
||||||
touch_start = 2097152,
|
touch_start = 2097152,
|
||||||
transaction_result = 33554432,
|
transaction_result = 33554432,
|
||||||
object_rez = 4194304
|
object_rez = 4194304,
|
||||||
|
anytouch = touch | touch_end | touch_start
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct scriptPosTarget
|
public struct scriptPosTarget
|
||||||
|
@ -3497,35 +3498,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
|
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
|
||||||
{
|
{
|
||||||
|
if (BlockGrabOverride)
|
||||||
|
return;
|
||||||
|
|
||||||
SceneObjectPart part = GetPart(partID);
|
SceneObjectPart part = GetPart(partID);
|
||||||
|
|
||||||
if (part == null)
|
if (part == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (part.BlockGrab)
|
||||||
|
return;
|
||||||
|
|
||||||
PhysicsActor pa = m_rootPart.PhysActor;
|
PhysicsActor pa = m_rootPart.PhysActor;
|
||||||
|
|
||||||
if (pa != null)
|
if (pa != null && pa.IsPhysical)
|
||||||
{
|
{
|
||||||
if (pa.IsPhysical)
|
|
||||||
{
|
|
||||||
if (!BlockGrabOverride && !part.BlockGrab)
|
|
||||||
{
|
|
||||||
/* Vector3 llmoveforce = pos - AbsolutePosition;
|
|
||||||
Vector3 grabforce = llmoveforce;
|
|
||||||
grabforce = (grabforce / 10) * pa.Mass;
|
|
||||||
*/
|
|
||||||
// empirically convert distance diference to a impulse
|
// empirically convert distance diference to a impulse
|
||||||
Vector3 grabforce = pos - AbsolutePosition;
|
Vector3 grabforce = pos - AbsolutePosition;
|
||||||
grabforce = grabforce * (pa.Mass/ 10.0f);
|
grabforce = grabforce * (pa.Mass * 0.1f);
|
||||||
pa.AddForce(grabforce, false);
|
pa.AddForce(grabforce, false);
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NonPhysicalGrabMovement(pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NonPhysicalGrabMovement(pos);
|
NonPhysicalGrabMovement(pos);
|
||||||
|
@ -3553,6 +3546,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
public void SpinStart(IClientAPI remoteClient)
|
public void SpinStart(IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
|
if (BlockGrabOverride || m_rootPart.BlockGrab)
|
||||||
|
return;
|
||||||
if (m_scene.EventManager.TriggerGroupSpinStart(UUID))
|
if (m_scene.EventManager.TriggerGroupSpinStart(UUID))
|
||||||
{
|
{
|
||||||
PhysicsActor pa = m_rootPart.PhysActor;
|
PhysicsActor pa = m_rootPart.PhysActor;
|
||||||
|
@ -3600,13 +3595,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// but it will result in over-shoot or under-shoot of the target orientation.
|
// but it will result in over-shoot or under-shoot of the target orientation.
|
||||||
// For the end user, this means that ctrl+shift+drag can be used for relative,
|
// For the end user, this means that ctrl+shift+drag can be used for relative,
|
||||||
// but not absolute, adjustments of orientation for physical prims.
|
// but not absolute, adjustments of orientation for physical prims.
|
||||||
|
|
||||||
|
if (BlockGrabOverride || m_rootPart.BlockGrab)
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation))
|
if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation))
|
||||||
{
|
{
|
||||||
PhysicsActor pa = m_rootPart.PhysActor;
|
PhysicsActor pa = m_rootPart.PhysActor;
|
||||||
|
|
||||||
if (pa != null)
|
if (pa != null && pa.IsPhysical)
|
||||||
{
|
|
||||||
if (pa.IsPhysical)
|
|
||||||
{
|
{
|
||||||
if (m_rootPart.IsWaitingForFirstSpinUpdatePacket)
|
if (m_rootPart.IsWaitingForFirstSpinUpdatePacket)
|
||||||
{
|
{
|
||||||
|
@ -3623,16 +3620,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//m_log.Error("[SCENE OBJECT GROUP]: Incoming new orientation is " + newOrientation);
|
//m_log.Error("[SCENE OBJECT GROUP]: Incoming new orientation is " + newOrientation);
|
||||||
|
|
||||||
// compute difference between previous old rotation and new incoming rotation
|
// compute difference between previous old rotation and new incoming rotation
|
||||||
Quaternion minimalRotationFromQ1ToQ2 = Quaternion.Inverse(old) * newOrientation;
|
Quaternion minimalRotationFromQ1ToQ2 = newOrientation * Quaternion.Inverse(old);
|
||||||
|
|
||||||
float rotationAngle;
|
float rotationAngle;
|
||||||
Vector3 rotationAxis;
|
Vector3 spinforce;
|
||||||
minimalRotationFromQ1ToQ2.GetAxisAngle(out rotationAxis, out rotationAngle);
|
minimalRotationFromQ1ToQ2.GetAxisAngle(out spinforce, out rotationAngle);
|
||||||
rotationAxis.Normalize();
|
if(Math.Abs(rotationAngle)< 0.001)
|
||||||
|
return;
|
||||||
|
|
||||||
|
spinforce.Normalize();
|
||||||
|
|
||||||
//m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
|
//m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
|
||||||
Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
|
if(rotationAngle > 0)
|
||||||
spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor
|
spinforce = spinforce * pa.Mass * 0.1f; // 0.1 is an arbitrary torque scaling factor
|
||||||
|
else
|
||||||
|
spinforce = spinforce * pa.Mass * -0.1f; // 0.1 is an arbitrary torque scaling
|
||||||
pa.AddAngularForce(spinforce,true);
|
pa.AddAngularForce(spinforce,true);
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||||
}
|
}
|
||||||
|
@ -3642,11 +3644,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
NonPhysicalSpinMovement(newOrientation);
|
NonPhysicalSpinMovement(newOrientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
NonPhysicalSpinMovement(newOrientation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -3335,11 +3335,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
m_AngularVelocity = Vector3.Zero;
|
m_AngularVelocity = Vector3.Zero;
|
||||||
|
|
||||||
|
m_requestedSitTargetID = 0;
|
||||||
|
part.AddSittingAvatar(this);
|
||||||
|
|
||||||
|
ParentPart = part;
|
||||||
|
ParentID = part.LocalId;
|
||||||
|
|
||||||
Vector3 cameraAtOffset = part.GetCameraAtOffset();
|
Vector3 cameraAtOffset = part.GetCameraAtOffset();
|
||||||
Vector3 cameraEyeOffset = part.GetCameraEyeOffset();
|
Vector3 cameraEyeOffset = part.GetCameraEyeOffset();
|
||||||
bool forceMouselook = part.GetForceMouselook();
|
bool forceMouselook = part.GetForceMouselook();
|
||||||
|
|
||||||
|
|
||||||
if (!part.IsRoot)
|
if (!part.IsRoot)
|
||||||
{
|
{
|
||||||
Orientation = part.RotationOffset * Orientation;
|
Orientation = part.RotationOffset * Orientation;
|
||||||
|
@ -3367,12 +3372,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.ParentGroup.UUID, offset, Orientation, true, cameraAtOffset, cameraEyeOffset, forceMouselook);
|
part.ParentGroup.UUID, offset, Orientation, true, cameraAtOffset, cameraEyeOffset, forceMouselook);
|
||||||
|
|
||||||
|
|
||||||
m_requestedSitTargetID = 0;
|
|
||||||
part.AddSittingAvatar(this);
|
|
||||||
|
|
||||||
ParentPart = part;
|
|
||||||
ParentID = part.LocalId;
|
|
||||||
|
|
||||||
SendAvatarDataToAllAgents();
|
SendAvatarDataToAllAgents();
|
||||||
|
|
||||||
if (status == 3)
|
if (status == 3)
|
||||||
|
@ -5560,6 +5559,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void HandleForceReleaseControls(IClientAPI remoteClient, UUID agentID)
|
public void HandleForceReleaseControls(IClientAPI remoteClient, UUID agentID)
|
||||||
{
|
{
|
||||||
|
foreach (ScriptControllers c in scriptedcontrols.Values)
|
||||||
|
{
|
||||||
|
SceneObjectGroup sog = m_scene.GetSceneObjectGroup(c.objectID);
|
||||||
|
if(sog != null && !sog.IsDeleted && sog.RootPart.PhysActor != null)
|
||||||
|
sog.RootPart.PhysActor.OnPhysicsRequestingCameraData -= physActor_OnPhysicsRequestingCameraData;
|
||||||
|
}
|
||||||
|
|
||||||
IgnoredControls = ScriptControlled.CONTROL_ZERO;
|
IgnoredControls = ScriptControlled.CONTROL_ZERO;
|
||||||
lock (scriptedcontrols)
|
lock (scriptedcontrols)
|
||||||
{
|
{
|
||||||
|
@ -5568,6 +5574,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ControllingClient.SendTakeControls(int.MaxValue, false, false);
|
ControllingClient.SendTakeControls(int.MaxValue, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void HandleRevokePermissions(UUID objectID, uint permissions )
|
||||||
|
{
|
||||||
|
|
||||||
|
// still skeleton code
|
||||||
|
if((permissions & (16 | 0x8000 )) == 0) //PERMISSION_TRIGGER_ANIMATION | PERMISSION_OVERRIDE_ANIMATIONS
|
||||||
|
return;
|
||||||
|
if(objectID == m_scene.RegionInfo.RegionID) // for all objects
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
|
||||||
|
if(part != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ClearControls()
|
public void ClearControls()
|
||||||
{
|
{
|
||||||
IgnoredControls = ScriptControlled.CONTROL_ZERO;
|
IgnoredControls = ScriptControlled.CONTROL_ZERO;
|
||||||
|
|
|
@ -63,11 +63,16 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
|
|
||||||
public Type ReplaceableInterface { get { return null; } }
|
public Type ReplaceableInterface { get { return null; } }
|
||||||
|
|
||||||
|
IImprovedAssetCache m_cache;
|
||||||
private Scene m_scene = null;
|
private Scene m_scene = null;
|
||||||
private bool m_enabled = false;
|
private bool m_enabled = false;
|
||||||
private int m_maxMaterialsPerTransaction = 50;
|
private int m_maxMaterialsPerTransaction = 50;
|
||||||
|
|
||||||
public Dictionary<UUID, OSDMap> m_regionMaterials = new Dictionary<UUID, OSDMap>();
|
public Dictionary<UUID, OSDMap> m_Materials = new Dictionary<UUID, OSDMap>();
|
||||||
|
public Dictionary<UUID, int> m_MaterialsRefCount = new Dictionary<UUID, int>();
|
||||||
|
|
||||||
|
private Dictionary<ulong, AssetBase> m_changes = new Dictionary<ulong, AssetBase>();
|
||||||
|
private Dictionary<ulong, double> m_changesTime = new Dictionary<ulong, double>();
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
|
@ -98,6 +103,56 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
||||||
m_scene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene;
|
m_scene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene;
|
||||||
|
m_scene.EventManager.OnBackup += EventManager_OnBackup;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EventManager_OnBackup(ISimulationDataService datastore, bool forcedBackup)
|
||||||
|
{
|
||||||
|
List<AssetBase> toStore;
|
||||||
|
List<ulong> hashlist;
|
||||||
|
|
||||||
|
|
||||||
|
lock (m_Materials)
|
||||||
|
{
|
||||||
|
if(m_changes.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(forcedBackup)
|
||||||
|
{
|
||||||
|
toStore = new List<AssetBase>(m_changes.Values);
|
||||||
|
m_changes.Clear();
|
||||||
|
m_changesTime.Clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toStore = new List<AssetBase>();
|
||||||
|
hashlist = new List<ulong>();
|
||||||
|
double storetime = Util.GetTimeStampMS() - 60000;
|
||||||
|
foreach(KeyValuePair<ulong,double> kvp in m_changesTime)
|
||||||
|
{
|
||||||
|
if(kvp.Value < storetime)
|
||||||
|
{
|
||||||
|
toStore.Add(m_changes[kvp.Key]);
|
||||||
|
hashlist.Add(kvp.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach(ulong u in hashlist)
|
||||||
|
{
|
||||||
|
m_changesTime.Remove(u);
|
||||||
|
m_changes.Remove(u);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(toStore.Count > 0)
|
||||||
|
Util.FireAndForget(delegate
|
||||||
|
{
|
||||||
|
foreach(AssetBase a in toStore)
|
||||||
|
{
|
||||||
|
a.Local = false;
|
||||||
|
m_scene.AssetService.Store(a);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj)
|
private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj)
|
||||||
|
@ -133,7 +188,7 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
IRequestHandler renderMaterialsPutHandler
|
IRequestHandler renderMaterialsPutHandler
|
||||||
= new RestStreamHandler("PUT", capsBase + "/",
|
= new RestStreamHandler("PUT", capsBase + "/",
|
||||||
(request, path, param, httpRequest, httpResponse)
|
(request, path, param, httpRequest, httpResponse)
|
||||||
=> RenderMaterialsPostCap(request, agentID),
|
=> RenderMaterialsPutCap(request, agentID),
|
||||||
"RenderMaterials", null);
|
"RenderMaterials", null);
|
||||||
MainServer.Instance.AddStreamHandler(renderMaterialsPutHandler);
|
MainServer.Instance.AddStreamHandler(renderMaterialsPutHandler);
|
||||||
}
|
}
|
||||||
|
@ -145,12 +200,14 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
|
|
||||||
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
|
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
|
||||||
m_scene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene;
|
m_scene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene;
|
||||||
|
m_scene.EventManager.OnBackup -= EventManager_OnBackup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_enabled) return;
|
if (!m_enabled) return;
|
||||||
|
|
||||||
|
m_cache = scene.RequestModuleInterface<IImprovedAssetCache>();
|
||||||
ISimulatorFeaturesModule featuresModule = scene.RequestModuleInterface<ISimulatorFeaturesModule>();
|
ISimulatorFeaturesModule featuresModule = scene.RequestModuleInterface<ISimulatorFeaturesModule>();
|
||||||
if (featuresModule != null)
|
if (featuresModule != null)
|
||||||
featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
|
featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
|
||||||
|
@ -203,8 +260,17 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lock (m_regionMaterials)
|
lock (m_Materials)
|
||||||
m_regionMaterials[matMap["ID"].AsUUID()] = (OSDMap)matMap["Material"];
|
{
|
||||||
|
UUID id = matMap["ID"].AsUUID();
|
||||||
|
if(m_Materials.ContainsKey(id))
|
||||||
|
m_MaterialsRefCount[id]++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_Materials[id] = (OSDMap)matMap["Material"];
|
||||||
|
m_MaterialsRefCount[id] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -252,18 +318,22 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
if (id == UUID.Zero)
|
if (id == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (m_regionMaterials)
|
lock (m_Materials)
|
||||||
{
|
{
|
||||||
if (m_regionMaterials.ContainsKey(id))
|
if (m_Materials.ContainsKey(id))
|
||||||
|
{
|
||||||
|
m_MaterialsRefCount[id]++;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
byte[] data = m_scene.AssetService.GetData(id.ToString());
|
AssetBase matAsset = m_scene.AssetService.Get(id.ToString());
|
||||||
if (data == null)
|
if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 )
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
|
m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte[] data = matAsset.Data;
|
||||||
OSDMap mat;
|
OSDMap mat;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -275,7 +345,8 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_regionMaterials[id] = mat;
|
m_Materials[id] = mat;
|
||||||
|
m_MaterialsRefCount[id] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,8 +355,6 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||||
OSDMap resp = new OSDMap();
|
OSDMap resp = new OSDMap();
|
||||||
|
|
||||||
OSDMap materialsFromViewer = null;
|
|
||||||
|
|
||||||
OSDArray respArr = new OSDArray();
|
OSDArray respArr = new OSDArray();
|
||||||
|
|
||||||
if (req.ContainsKey("Zipped"))
|
if (req.ContainsKey("Zipped"))
|
||||||
|
@ -298,9 +367,7 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
{
|
{
|
||||||
osd = ZDecompressBytesToOsd(inBytes);
|
osd = ZDecompressBytesToOsd(inBytes);
|
||||||
|
|
||||||
if (osd != null)
|
if (osd != null && osd is OSDArray)
|
||||||
{
|
|
||||||
if (osd is OSDArray) // assume array of MaterialIDs designating requested material entries
|
|
||||||
{
|
{
|
||||||
foreach (OSD elem in (OSDArray)osd)
|
foreach (OSD elem in (OSDArray)osd)
|
||||||
{
|
{
|
||||||
|
@ -308,13 +375,13 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
{
|
{
|
||||||
UUID id = new UUID(elem.AsBinary(), 0);
|
UUID id = new UUID(elem.AsBinary(), 0);
|
||||||
|
|
||||||
lock (m_regionMaterials)
|
lock (m_Materials)
|
||||||
{
|
{
|
||||||
if (m_regionMaterials.ContainsKey(id))
|
if (m_Materials.ContainsKey(id))
|
||||||
{
|
{
|
||||||
OSDMap matMap = new OSDMap();
|
OSDMap matMap = new OSDMap();
|
||||||
matMap["ID"] = OSD.FromBinary(id.GetBytes());
|
matMap["ID"] = OSD.FromBinary(id.GetBytes());
|
||||||
matMap["Material"] = m_regionMaterials[id];
|
matMap["Material"] = m_Materials[id];
|
||||||
respArr.Add(matMap);
|
respArr.Add(matMap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -335,7 +402,44 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (osd is OSDMap) // request to assign a material
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Warn("[Materials]: exception decoding zipped CAP payload ", e);
|
||||||
|
//return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resp["Zipped"] = ZCompressOSD(respArr, false);
|
||||||
|
string response = OSDParser.SerializeLLSDXmlString(resp);
|
||||||
|
|
||||||
|
//m_log.Debug("[Materials]: cap request: " + request);
|
||||||
|
//m_log.Debug("[Materials]: cap request (zipped portion): " + ZippedOsdBytesToString(req["Zipped"].AsBinary()));
|
||||||
|
//m_log.Debug("[Materials]: cap response: " + response);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string RenderMaterialsPutCap(string request, UUID agentID)
|
||||||
|
{
|
||||||
|
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||||
|
OSDMap resp = new OSDMap();
|
||||||
|
|
||||||
|
OSDMap materialsFromViewer = null;
|
||||||
|
|
||||||
|
OSDArray respArr = new OSDArray();
|
||||||
|
|
||||||
|
HashSet<SceneObjectPart> parts = new HashSet<SceneObjectPart>();
|
||||||
|
if (req.ContainsKey("Zipped"))
|
||||||
|
{
|
||||||
|
OSD osd = null;
|
||||||
|
|
||||||
|
byte[] inBytes = req["Zipped"].AsBinary();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
osd = ZDecompressBytesToOsd(inBytes);
|
||||||
|
|
||||||
|
if (osd != null && osd is OSDMap)
|
||||||
{
|
{
|
||||||
materialsFromViewer = osd as OSDMap;
|
materialsFromViewer = osd as OSDMap;
|
||||||
|
|
||||||
|
@ -359,17 +463,6 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSDMap mat = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mat = matsMap["Material"] as OSDMap;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Warn("[Materials]: cannot decode \"Material\" from matsMap: " + e.Message);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
SceneObjectPart sop = m_scene.GetSceneObjectPart(primLocalID);
|
SceneObjectPart sop = m_scene.GetSceneObjectPart(primLocalID);
|
||||||
if (sop == null)
|
if (sop == null)
|
||||||
{
|
{
|
||||||
|
@ -383,6 +476,17 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OSDMap mat = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mat = matsMap["Material"] as OSDMap;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Warn("[Materials]: cannot decode \"Material\" from matsMap: " + e.Message);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Primitive.TextureEntry te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length);
|
Primitive.TextureEntry te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length);
|
||||||
if (te == null)
|
if (te == null)
|
||||||
{
|
{
|
||||||
|
@ -390,7 +494,6 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UUID id;
|
UUID id;
|
||||||
if (mat == null)
|
if (mat == null)
|
||||||
{
|
{
|
||||||
|
@ -399,16 +502,16 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
id = StoreMaterialAsAsset(agentID, mat, sop);
|
id = getNewID(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int face = -1;
|
int face = -1;
|
||||||
|
UUID oldid = UUID.Zero;
|
||||||
if (matsMap.ContainsKey("Face"))
|
if (matsMap.ContainsKey("Face"))
|
||||||
{
|
{
|
||||||
face = matsMap["Face"].AsInteger();
|
face = matsMap["Face"].AsInteger();
|
||||||
Primitive.TextureEntryFace faceEntry = te.CreateFace((uint)face);
|
Primitive.TextureEntryFace faceEntry = te.CreateFace((uint)face);
|
||||||
|
oldid = faceEntry.MaterialID;
|
||||||
faceEntry.MaterialID = id;
|
faceEntry.MaterialID = id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -416,20 +519,58 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
if (te.DefaultTexture == null)
|
if (te.DefaultTexture == null)
|
||||||
m_log.WarnFormat("[Materials]: TextureEntry.DefaultTexture is null in {0} {1}", sop.Name, sop.UUID);
|
m_log.WarnFormat("[Materials]: TextureEntry.DefaultTexture is null in {0} {1}", sop.Name, sop.UUID);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
oldid = te.DefaultTexture.MaterialID;
|
||||||
te.DefaultTexture.MaterialID = id;
|
te.DefaultTexture.MaterialID = id;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//m_log.DebugFormat("[Materials]: in \"{0}\" {1}, setting material ID for face {2} to {3}", sop.Name, sop.UUID, face, id);
|
//m_log.DebugFormat("[Materials]: in \"{0}\" {1}, setting material ID for face {2} to {3}", sop.Name, sop.UUID, face, id);
|
||||||
|
|
||||||
// We can't use sop.UpdateTextureEntry(te) because it filters, so do it manually
|
// We can't use sop.UpdateTextureEntry(te) because it filters, so do it manually
|
||||||
sop.Shape.TextureEntry = te.GetBytes();
|
sop.Shape.TextureEntry = te.GetBytes();
|
||||||
|
|
||||||
if (sop.ParentGroup != null)
|
lock(m_Materials)
|
||||||
|
{
|
||||||
|
if(oldid != UUID.Zero)
|
||||||
|
{
|
||||||
|
m_MaterialsRefCount[oldid]--;
|
||||||
|
if(m_MaterialsRefCount[oldid] <= 0)
|
||||||
|
{
|
||||||
|
m_Materials.Remove(oldid);
|
||||||
|
m_MaterialsRefCount.Remove(oldid);
|
||||||
|
m_cache.Expire(oldid.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(id != UUID.Zero)
|
||||||
|
{
|
||||||
|
AssetBase asset = CacheMaterialAsAsset(id, agentID, mat, sop);
|
||||||
|
if(asset != null)
|
||||||
|
{
|
||||||
|
ulong materialHash = (ulong)primLocalID << 32;
|
||||||
|
if(face < 0)
|
||||||
|
materialHash += 0xffffffff;
|
||||||
|
else
|
||||||
|
materialHash +=(ulong)face;
|
||||||
|
|
||||||
|
m_changes[materialHash] = asset;
|
||||||
|
m_changesTime[materialHash] = Util.GetTimeStampMS();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!parts.Contains(sop))
|
||||||
|
parts.Add(sop);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(SceneObjectPart sop in parts)
|
||||||
|
{
|
||||||
|
if (sop.ParentGroup != null && !sop.ParentGroup.IsDeleted)
|
||||||
{
|
{
|
||||||
sop.TriggerScriptChangedEvent(Changed.TEXTURE);
|
sop.TriggerScriptChangedEvent(Changed.TEXTURE);
|
||||||
sop.UpdateFlag = UpdateRequired.FULL;
|
|
||||||
sop.ParentGroup.HasGroupChanged = true;
|
|
||||||
sop.ScheduleFullUpdate();
|
sop.ScheduleFullUpdate();
|
||||||
|
sop.ParentGroup.HasGroupChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,8 +582,6 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[Materials]: exception decoding zipped CAP payload ", e);
|
m_log.Warn("[Materials]: exception decoding zipped CAP payload ", e);
|
||||||
|
@ -450,7 +589,6 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
resp["Zipped"] = ZCompressOSD(respArr, false);
|
resp["Zipped"] = ZCompressOSD(respArr, false);
|
||||||
string response = OSDParser.SerializeLLSDXmlString(resp);
|
string response = OSDParser.SerializeLLSDXmlString(resp);
|
||||||
|
|
||||||
|
@ -460,6 +598,40 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private UUID getNewID(OSDMap mat)
|
||||||
|
{
|
||||||
|
// ugly and done twice but keep compatibility for now
|
||||||
|
Byte[] data = System.Text.Encoding.ASCII.GetBytes(OSDParser.SerializeLLSDXmlString(mat));
|
||||||
|
using (var md5 = MD5.Create())
|
||||||
|
return new UUID(md5.ComputeHash(data), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AssetBase CacheMaterialAsAsset(UUID id, UUID agentID, OSDMap mat, SceneObjectPart sop)
|
||||||
|
{
|
||||||
|
AssetBase asset = null;
|
||||||
|
lock (m_Materials)
|
||||||
|
{
|
||||||
|
if (!m_Materials.ContainsKey(id))
|
||||||
|
{
|
||||||
|
m_Materials[id] = mat;
|
||||||
|
m_MaterialsRefCount[id] = 1;
|
||||||
|
|
||||||
|
byte[] data = System.Text.Encoding.ASCII.GetBytes(OSDParser.SerializeLLSDXmlString(mat));
|
||||||
|
|
||||||
|
// This asset might exist already, but it's ok to try to store it again
|
||||||
|
string name = "Material " + ChooseMaterialName(mat, sop);
|
||||||
|
name = name.Substring(0, Math.Min(64, name.Length)).Trim();
|
||||||
|
asset = new AssetBase(id, name, (sbyte)OpenSimAssetType.Material, agentID.ToString());
|
||||||
|
asset.Data = data;
|
||||||
|
asset.Local = true;
|
||||||
|
m_cache.Cache(asset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_MaterialsRefCount[id]++;
|
||||||
|
}
|
||||||
|
return asset;
|
||||||
|
}
|
||||||
|
|
||||||
private UUID StoreMaterialAsAsset(UUID agentID, OSDMap mat, SceneObjectPart sop)
|
private UUID StoreMaterialAsAsset(UUID agentID, OSDMap mat, SceneObjectPart sop)
|
||||||
{
|
{
|
||||||
UUID id;
|
UUID id;
|
||||||
|
@ -469,11 +641,12 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
using (var md5 = MD5.Create())
|
using (var md5 = MD5.Create())
|
||||||
id = new UUID(md5.ComputeHash(data), 0);
|
id = new UUID(md5.ComputeHash(data), 0);
|
||||||
|
|
||||||
lock (m_regionMaterials)
|
lock (m_Materials)
|
||||||
{
|
{
|
||||||
if (!m_regionMaterials.ContainsKey(id))
|
if (!m_Materials.ContainsKey(id))
|
||||||
{
|
{
|
||||||
m_regionMaterials[id] = mat;
|
m_Materials[id] = mat;
|
||||||
|
m_MaterialsRefCount[id] = 1;
|
||||||
|
|
||||||
// This asset might exist already, but it's ok to try to store it again
|
// This asset might exist already, but it's ok to try to store it again
|
||||||
string name = "Material " + ChooseMaterialName(mat, sop);
|
string name = "Material " + ChooseMaterialName(mat, sop);
|
||||||
|
@ -482,6 +655,8 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
asset.Data = data;
|
asset.Data = data;
|
||||||
m_scene.AssetService.Store(asset);
|
m_scene.AssetService.Store(asset);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
m_MaterialsRefCount[id]++;
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -523,9 +698,9 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||||
int matsCount = 0;
|
int matsCount = 0;
|
||||||
OSDArray allOsd = new OSDArray();
|
OSDArray allOsd = new OSDArray();
|
||||||
|
|
||||||
lock (m_regionMaterials)
|
lock (m_Materials)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<UUID, OSDMap> kvp in m_regionMaterials)
|
foreach (KeyValuePair<UUID, OSDMap> kvp in m_Materials)
|
||||||
{
|
{
|
||||||
OSDMap matMap = new OSDMap();
|
OSDMap matMap = new OSDMap();
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
private bool _zeroFlag = false;
|
private bool _zeroFlag = false;
|
||||||
private bool m_haveLastFallVel = false;
|
private bool m_haveLastFallVel = false;
|
||||||
|
|
||||||
|
|
||||||
private uint m_localID = 0;
|
private uint m_localID = 0;
|
||||||
public bool m_returnCollisions = false;
|
public bool m_returnCollisions = false;
|
||||||
// taints and their non-tainted counterparts
|
// taints and their non-tainted counterparts
|
||||||
|
@ -149,7 +148,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
public int m_eventsubscription = 0;
|
public int m_eventsubscription = 0;
|
||||||
private int m_cureventsubscription = 0;
|
private int m_cureventsubscription = 0;
|
||||||
private CollisionEventUpdate CollisionEventsThisFrame = null;
|
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||||
private bool SentEmptyCollisionsEvent;
|
private bool SentEmptyCollisionsEvent;
|
||||||
|
|
||||||
// unique UUID of this character object
|
// unique UUID of this character object
|
||||||
|
@ -1556,31 +1555,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
public override float APIDDamping { set { return; } }
|
public override float APIDDamping { set { return; } }
|
||||||
|
|
||||||
|
|
||||||
public override void SubscribeEvents(int ms)
|
public override void SubscribeEvents(int ms)
|
||||||
{
|
{
|
||||||
m_eventsubscription = ms;
|
m_eventsubscription = ms;
|
||||||
m_cureventsubscription = 0;
|
m_cureventsubscription = 0;
|
||||||
if (CollisionEventsThisFrame == null)
|
CollisionEventsThisFrame.Clear();
|
||||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
|
||||||
SentEmptyCollisionsEvent = false;
|
SentEmptyCollisionsEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UnSubscribeEvents()
|
public override void UnSubscribeEvents()
|
||||||
{
|
{
|
||||||
if (CollisionEventsThisFrame != null)
|
|
||||||
{
|
|
||||||
CollisionEventsThisFrame.Clear();
|
|
||||||
CollisionEventsThisFrame = null;
|
|
||||||
}
|
|
||||||
m_eventsubscription = 0;
|
m_eventsubscription = 0;
|
||||||
_parent_scene.RemoveCollisionEventReporting(this);
|
_parent_scene.RemoveCollisionEventReporting(this);
|
||||||
|
lock(CollisionEventsThisFrame)
|
||||||
|
CollisionEventsThisFrame.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
|
public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
|
||||||
{
|
{
|
||||||
if (CollisionEventsThisFrame == null)
|
lock(CollisionEventsThisFrame)
|
||||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
|
||||||
CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
|
CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
|
||||||
_parent_scene.AddCollisionEventReporting(this);
|
_parent_scene.AddCollisionEventReporting(this);
|
||||||
}
|
}
|
||||||
|
@ -1590,12 +1583,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
if (m_cureventsubscription < 50000)
|
if (m_cureventsubscription < 50000)
|
||||||
m_cureventsubscription += timestep;
|
m_cureventsubscription += timestep;
|
||||||
|
|
||||||
if (CollisionEventsThisFrame == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_cureventsubscription < m_eventsubscription)
|
if (m_cureventsubscription < m_eventsubscription)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
lock(CollisionEventsThisFrame)
|
||||||
|
{
|
||||||
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
|
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
|
||||||
|
|
||||||
if (!SentEmptyCollisionsEvent || ncolisions > 0)
|
if (!SentEmptyCollisionsEvent || ncolisions > 0)
|
||||||
|
@ -1606,7 +1598,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
if (ncolisions == 0)
|
if (ncolisions == 0)
|
||||||
{
|
{
|
||||||
SentEmptyCollisionsEvent = true;
|
SentEmptyCollisionsEvent = true;
|
||||||
// _parent_scene.RemoveCollisionEventReporting(this);
|
// _parent_scene.RemoveCollisionEventReporting(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1615,6 +1607,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override bool SubscribedEvents()
|
public override bool SubscribedEvents()
|
||||||
{
|
{
|
||||||
|
|
|
@ -588,9 +588,9 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
Mesh mesh = new Mesh();
|
Mesh mesh = new Mesh();
|
||||||
mesh.releaseBuildingMeshData();
|
mesh.releaseBuildingMeshData();
|
||||||
|
|
||||||
BinaryReader br = new BinaryReader(st);
|
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
using(BinaryReader br = new BinaryReader(st))
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mesh.m_vertexCount = br.ReadInt32();
|
mesh.m_vertexCount = br.ReadInt32();
|
||||||
|
@ -617,8 +617,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
br.Close();
|
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
public object diskLock = new object();
|
public static object diskLock = new object();
|
||||||
|
|
||||||
public bool doMeshFileCache = true;
|
public bool doMeshFileCache = true;
|
||||||
|
|
||||||
|
@ -1426,13 +1426,13 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
{
|
{
|
||||||
if (File.Exists(filename))
|
if (File.Exists(filename))
|
||||||
{
|
{
|
||||||
FileStream stream = null;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
|
using(FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||||
BinaryFormatter bformatter = new BinaryFormatter();
|
{
|
||||||
|
// BinaryFormatter bformatter = new BinaryFormatter();
|
||||||
mesh = Mesh.FromStream(stream, key);
|
mesh = Mesh.FromStream(stream,key);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -1443,14 +1443,18 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
filename, e.Message, e.StackTrace);
|
filename, e.Message, e.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream != null)
|
try
|
||||||
stream.Close();
|
{
|
||||||
|
|
||||||
if (mesh == null || !ok)
|
if (mesh == null || !ok)
|
||||||
File.Delete(filename);
|
File.Delete(filename);
|
||||||
else
|
else
|
||||||
File.SetLastAccessTimeUtc(filename, DateTime.UtcNow);
|
File.SetLastAccessTimeUtc(filename, DateTime.UtcNow);
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
|
@ -1458,7 +1462,6 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
|
|
||||||
private void StoreToFileCache(AMeshKey key, Mesh mesh)
|
private void StoreToFileCache(AMeshKey key, Mesh mesh)
|
||||||
{
|
{
|
||||||
Stream stream = null;
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
// Make sure the target cache directory exists
|
// Make sure the target cache directory exists
|
||||||
|
@ -1476,7 +1479,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
Directory.CreateDirectory(dir);
|
Directory.CreateDirectory(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = File.Open(filename, FileMode.Create);
|
using(Stream stream = File.Open(filename, FileMode.Create))
|
||||||
ok = mesh.ToStream(stream);
|
ok = mesh.ToStream(stream);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
|
@ -1487,16 +1490,18 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream != null)
|
if (!ok && File.Exists(filename))
|
||||||
stream.Close();
|
{
|
||||||
|
try
|
||||||
if (File.Exists(filename))
|
|
||||||
{
|
{
|
||||||
if (ok)
|
|
||||||
File.SetLastAccessTimeUtc(filename, DateTime.UtcNow);
|
|
||||||
else
|
|
||||||
File.Delete(filename);
|
File.Delete(filename);
|
||||||
}
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[MESH CACHE]: Failed to delete file {0}",filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -588,6 +588,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
|
List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
|
||||||
if (defaults != null && defaults.Count > 0)
|
if (defaults != null && defaults.Count > 0)
|
||||||
{
|
{
|
||||||
|
flags |= TeleportFlags.ViaRegionID;
|
||||||
region = defaults[0];
|
region = defaults[0];
|
||||||
where = "safe";
|
where = "safe";
|
||||||
}
|
}
|
||||||
|
@ -597,9 +598,12 @@ namespace OpenSim.Services.LLLoginService
|
||||||
account.FirstName, account.LastName);
|
account.FirstName, account.LastName);
|
||||||
region = FindAlternativeRegion(scopeID);
|
region = FindAlternativeRegion(scopeID);
|
||||||
if (region != null)
|
if (region != null)
|
||||||
|
{
|
||||||
|
flags |= TeleportFlags.ViaRegionID;
|
||||||
where = "safe";
|
where = "safe";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
@ -618,6 +622,7 @@ namespace OpenSim.Services.LLLoginService
|
||||||
List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
|
List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
|
||||||
if (defaults != null && defaults.Count > 0)
|
if (defaults != null && defaults.Count > 0)
|
||||||
{
|
{
|
||||||
|
flags |= TeleportFlags.ViaRegionID;
|
||||||
region = defaults[0];
|
region = defaults[0];
|
||||||
where = "safe";
|
where = "safe";
|
||||||
}
|
}
|
||||||
|
@ -626,8 +631,11 @@ namespace OpenSim.Services.LLLoginService
|
||||||
m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region");
|
m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region");
|
||||||
region = FindAlternativeRegion(scopeID);
|
region = FindAlternativeRegion(scopeID);
|
||||||
if (region != null)
|
if (region != null)
|
||||||
|
{
|
||||||
|
flags |= TeleportFlags.ViaRegionID;
|
||||||
where = "safe";
|
where = "safe";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue