mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 20:55:43 +08:00
Merge branch 'master' into careminster-presence-refactor
This commit is contained in:
@@ -60,6 +60,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||
|
||||
#region IRegionModule
|
||||
|
||||
private bool m_useCSJ2K = true;
|
||||
|
||||
public string Name { get { return "J2KDecoderModule"; } }
|
||||
public bool IsSharedModule { get { return true; } }
|
||||
|
||||
@@ -73,6 +75,12 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||
m_scene = scene;
|
||||
|
||||
scene.RegisterModuleInterface<IJ2KDecoder>(this);
|
||||
|
||||
IConfig startupConfig = source.Configs["Startup"];
|
||||
if (startupConfig != null)
|
||||
{
|
||||
m_useCSJ2K = startupConfig.GetBoolean("UseCSJ2K", m_useCSJ2K);
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
@@ -144,41 +152,52 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||
/// <param name="j2kData">JPEG2000 data</param>
|
||||
private void DoJ2KDecode(UUID assetID, byte[] j2kData)
|
||||
{
|
||||
// int DecodeTime = 0;
|
||||
// DecodeTime = Environment.TickCount;
|
||||
//int DecodeTime = 0;
|
||||
//DecodeTime = Environment.TickCount;
|
||||
OpenJPEG.J2KLayerInfo[] layers;
|
||||
|
||||
if (!TryLoadCacheForAsset(assetID, out layers))
|
||||
{
|
||||
try
|
||||
if (m_useCSJ2K)
|
||||
{
|
||||
List<int> layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(new MemoryStream(j2kData));
|
||||
|
||||
if (layerStarts != null && layerStarts.Count > 0)
|
||||
try
|
||||
{
|
||||
layers = new OpenJPEG.J2KLayerInfo[layerStarts.Count];
|
||||
List<int> layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(new MemoryStream(j2kData));
|
||||
|
||||
for (int i = 0; i < layerStarts.Count; i++)
|
||||
if (layerStarts != null && layerStarts.Count > 0)
|
||||
{
|
||||
OpenJPEG.J2KLayerInfo layer = new OpenJPEG.J2KLayerInfo();
|
||||
layers = new OpenJPEG.J2KLayerInfo[layerStarts.Count];
|
||||
|
||||
if (i == 0)
|
||||
layer.Start = 0;
|
||||
else
|
||||
layer.Start = layerStarts[i];
|
||||
for (int i = 0; i < layerStarts.Count; i++)
|
||||
{
|
||||
OpenJPEG.J2KLayerInfo layer = new OpenJPEG.J2KLayerInfo();
|
||||
|
||||
if (i == layerStarts.Count - 1)
|
||||
layer.End = j2kData.Length;
|
||||
else
|
||||
layer.End = layerStarts[i + 1] - 1;
|
||||
if (i == 0)
|
||||
layer.Start = 0;
|
||||
else
|
||||
layer.Start = layerStarts[i];
|
||||
|
||||
layers[i] = layer;
|
||||
if (i == layerStarts.Count - 1)
|
||||
layer.End = j2kData.Length;
|
||||
else
|
||||
layer.End = layerStarts[i + 1] - 1;
|
||||
|
||||
layers[i] = layer;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
else
|
||||
{
|
||||
m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message);
|
||||
int components;
|
||||
if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components))
|
||||
{
|
||||
m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID);
|
||||
}
|
||||
}
|
||||
|
||||
if (layers == null || layers.Length == 0)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
@@ -151,7 +152,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||
// region as the sending avatar.
|
||||
SendNotificationToUsersInRegion(fromAvatarID, fromAvatarName, message);
|
||||
}
|
||||
|
||||
|
||||
public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid)
|
||||
{
|
||||
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid);
|
||||
string ownerFirstName, ownerLastName;
|
||||
if (account != null)
|
||||
{
|
||||
ownerFirstName = account.FirstName;
|
||||
ownerLastName = account.LastName;
|
||||
}
|
||||
else
|
||||
{
|
||||
ownerFirstName = "(unknown";
|
||||
ownerLastName = "user)";
|
||||
}
|
||||
|
||||
|
||||
ScenePresence sp = m_scene.GetScenePresence(avatarid);
|
||||
|
||||
if (sp != null) {
|
||||
sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendNotificationToUsersInRegion(
|
||||
UUID fromAvatarID, string fromAvatarName, string message)
|
||||
{
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||
IConfig assetConfig = source.Configs["AssetService"];
|
||||
if (assetConfig == null)
|
||||
{
|
||||
m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpanSim.ini");
|
||||
m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar
|
||||
IConfig userConfig = source.Configs["AvatarService"];
|
||||
if (userConfig == null)
|
||||
{
|
||||
m_log.Error("[AVATAR CONNECTOR]: AvatarService missing from OpanSim.ini");
|
||||
m_log.Error("[AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,23 +77,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||
|
||||
public void OnNewClient(IClientAPI client)
|
||||
{
|
||||
client.OnLogout += OnLogout;
|
||||
client.OnConnectionClosed += OnConnectionClose;
|
||||
}
|
||||
|
||||
public void OnLogout(IClientAPI client)
|
||||
public void OnConnectionClose(IClientAPI client)
|
||||
{
|
||||
client.OnLogout -= OnLogout;
|
||||
|
||||
ScenePresence sp = null;
|
||||
Vector3 position = new Vector3(128, 128, 0);
|
||||
Vector3 lookat = new Vector3(0, 1, 0);
|
||||
|
||||
if (m_aScene.TryGetAvatar(client.AgentId, out sp))
|
||||
if (client.IsLoggingOut)
|
||||
{
|
||||
position = sp.AbsolutePosition;
|
||||
lookat = sp.Lookat;
|
||||
object sp = null;
|
||||
Vector3 position = new Vector3(128, 128, 0);
|
||||
Vector3 lookat = new Vector3(0, 1, 0);
|
||||
|
||||
if (client.Scene.TryGetAvatar(client.AgentId, out sp))
|
||||
{
|
||||
if (sp is ScenePresence)
|
||||
{
|
||||
position = ((ScenePresence)sp).AbsolutePosition;
|
||||
lookat = ((ScenePresence)sp).Lookat;
|
||||
}
|
||||
}
|
||||
|
||||
m_PresenceService.LogoutAgent(client.SessionId, position, lookat);
|
||||
}
|
||||
m_PresenceService.LogoutAgent(client.SessionId, position, lookat);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
//IConfig userConfig = config.Configs["SimulationService"];
|
||||
//if (userConfig == null)
|
||||
//{
|
||||
// m_log.Error("[AVATAR CONNECTOR]: SimulationService missing from OpanSim.ini");
|
||||
// m_log.Error("[AVATAR CONNECTOR]: SimulationService missing from OpenSim.ini");
|
||||
// return;
|
||||
//}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
//IConfig userConfig = config.Configs["SimulationService"];
|
||||
//if (userConfig == null)
|
||||
//{
|
||||
// m_log.Error("[AVATAR CONNECTOR]: SimulationService missing from OpanSim.ini");
|
||||
// m_log.Error("[AVATAR CONNECTOR]: SimulationService missing from OpenSim.ini");
|
||||
// return;
|
||||
//}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
|
||||
IConfig userConfig = source.Configs["UserAccountService"];
|
||||
if (userConfig == null)
|
||||
{
|
||||
m_log.Error("[USER CONNECTOR]: UserAccountService missing from OpanSim.ini");
|
||||
m_log.Error("[USER CONNECTOR]: UserAccountService missing from OpenSim.ini");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -609,16 +609,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
if (IsFriendWithPerms(user, objectOwner))
|
||||
return objectOwnerMask;
|
||||
|
||||
// Estate users should be able to edit anything in the sim
|
||||
if (IsEstateManager(user) && m_RegionOwnerIsGod && (!IsAdministrator(objectOwner)) || objectOwner == user)
|
||||
// Estate users should be able to edit anything in the sim if RegionOwnerIsGod is set
|
||||
if (IsEstateManager(user) && m_RegionOwnerIsGod)
|
||||
return objectOwnerMask;
|
||||
|
||||
// Admin should be able to edit anything in the sim (including admin objects)
|
||||
if (IsAdministrator(user))
|
||||
return objectOwnerMask;
|
||||
|
||||
|
||||
// Users should be able to edit what is over their land.
|
||||
ILandObject parcel = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
|
||||
Vector3 taskPos = task.AbsolutePosition;
|
||||
ILandObject parcel = m_scene.LandChannel.GetLandObject(taskPos.X, taskPos.Y);
|
||||
if (parcel != null && parcel.LandData.OwnerID == user && m_ParcelOwnerIsGod)
|
||||
{
|
||||
// Admin objects should not be editable by the above
|
||||
|
||||
Reference in New Issue
Block a user