From 7f996448647e2703b82ea750bd38196fe5cea838 Mon Sep 17 00:00:00 2001
From: MW
Date: Sun, 18 Nov 2007 11:11:44 +0000
Subject: Attempt to get World Map working in Grid mode, will need to be using
the grid asset server for it to work correctly and has only been quickly
tested in a three region grid. Moved PermissionManager creation out of the
Scene constructor and instead a PermissionManager is passed to the
constructor as a param. So that we could create and use custom
permissionsManagers. Added AllowMovement property to ScenePresence which can
be used to stop movement of avatars (for example in a custom region that
wanted avatars always in one place). Added PermissionManager call when
copying objects, although currently the call will always return true so that
it allows copying in places like Wright Plaza. A few other changes/fixes.
---
OpenSim/Region/Application/OpenSimMain.cs | 3 +-
.../Environment/Modules/TextureDownloadModule.cs | 2 +-
OpenSim/Region/Environment/PermissionManager.cs | 14 ++++
OpenSim/Region/Environment/Scenes/InnerScene.cs | 30 ++++----
OpenSim/Region/Environment/Scenes/Scene.cs | 19 +++--
OpenSim/Region/Environment/Scenes/ScenePresence.cs | 88 ++++++++++++----------
OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 4 +-
OpenSim/Region/Examples/SimpleApp/Program.cs | 3 +-
8 files changed, 99 insertions(+), 64 deletions(-)
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index c1df86c..ce2b856 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -366,9 +366,10 @@ namespace OpenSim
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager)
{
+ PermissionManager permissionManager = new PermissionManager();
SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
return
- new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer,
+ new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer,
m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim);
}
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 01a55fb..87d6231 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -36,7 +36,7 @@ using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
- //this is first attempt to start breaking the mess thats called the assetcache up.
+ //this is a first attempt, to start breaking the mess thats called the assetcache up.
// basically this should be the texture sending (to clients) code moved out of assetcache
//and some small clean up
// but on first tests it didn't seem to work very well so is currently not in use.
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 560ecf3..412c6e7 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -48,12 +48,20 @@ namespace OpenSim.Region.Environment
set { m_bypassPermissions = value; }
}
+ public PermissionManager()
+ {
+ }
public PermissionManager(Scene scene)
{
m_scene = scene;
}
+ public void Initialise(Scene scene)
+ {
+ m_scene = scene;
+ }
+
protected virtual void SendPermissionError(LLUUID user, string reason)
{
m_scene.EventManager.TriggerPermissionError(user, reason);
@@ -188,6 +196,12 @@ namespace OpenSim.Region.Environment
return GenericObjectPermission(user, obj);
}
+ public virtual bool CanCopyObject(LLUUID user, LLUUID obj)
+ {
+ return true;
+ // return GenericObjectPermission(user, obj);
+ }
+
#endregion
#region Communication Permissions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 1625e80..1f3bc95 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (((SceneObjectGroup)obj).LocalId == localID)
{
- m_parentScene.RemoveEntity((SceneObjectGroup)obj);
+ m_parentScene.RemoveEntity((SceneObjectGroup)obj);
return;
}
}
@@ -553,7 +553,7 @@ namespace OpenSim.Region.Environment.Scenes
parenPrim.LinkToGroup(sceneObj);
}
}
-
+
///
/// Delink a linkset
///
@@ -568,7 +568,7 @@ namespace OpenSim.Region.Environment.Scenes
// XXX I'm anticipating that building this dictionary once is more efficient than
// repeated scanning of the Entity.Values for a large number of primIds. However, it might
// be more efficient yet to keep this dictionary permanently on hand.
- Dictionary sceneObjects = new Dictionary();
+ Dictionary sceneObjects = new Dictionary();
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
@@ -576,17 +576,17 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup obj = (SceneObjectGroup)ent;
sceneObjects.Add(obj.LocalId, obj);
}
- }
-
+ }
+
// Find the root prim among the prim ids we've been given
for (int i = 0; i < primIds.Count; i++)
- {
+ {
if (sceneObjects.ContainsKey(primIds[i]))
{
parenPrim = sceneObjects[primIds[i]];
primIds.RemoveAt(i);
break;
- }
+ }
}
if (parenPrim != null)
@@ -594,7 +594,7 @@ namespace OpenSim.Region.Environment.Scenes
foreach (uint childPrimId in primIds)
{
parenPrim.DelinkFromGroup(childPrimId);
- }
+ }
}
else
{
@@ -627,19 +627,21 @@ namespace OpenSim.Region.Environment.Scenes
if (originPrim != null)
{
- SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
- copy.AbsolutePosition = copy.AbsolutePosition + offset;
- Entities.Add(copy.UUID, copy);
-
- copy.ScheduleGroupForFullUpdate();
+ if (PermissionsMngr.CanCopyObject(AgentID, originPrim.UUID))
+ {
+ SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
+ copy.AbsolutePosition = copy.AbsolutePosition + offset;
+ Entities.Add(copy.UUID, copy);
+ copy.ScheduleGroupForFullUpdate();
+ }
}
else
{
MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
}
- }
+ }
#endregion
}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 2c765a3..1400e60 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -195,7 +195,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Constructors
- public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
+ public Scene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim)
{
@@ -217,15 +217,14 @@ namespace OpenSim.Region.Environment.Scenes
m_LandManager = new LandManager(this, m_regInfo);
m_estateManager = new EstateManager(this, m_regInfo);
m_eventManager = new EventManager();
- m_permissionManager = new PermissionManager(this);
+
+ m_permissionManager = permissionManager;
+ m_permissionManager.Initialise(this);
m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager);
m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo);
- m_eventManager.OnParcelPrimCountAdd +=
- m_LandManager.addPrimToLandPrimCounts;
-
- m_eventManager.OnPermissionError += SendPermissionAlert;
+ RegisterDefaultSceneEvents();
MainLog.Instance.Verbose("Creating new entitities instance");
Entities = new Dictionary();
@@ -244,6 +243,13 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region Startup / Close Methods
+
+ protected virtual void RegisterDefaultSceneEvents()
+ {
+ m_eventManager.OnParcelPrimCountAdd += m_LandManager.addPrimToLandPrimCounts;
+ m_eventManager.OnPermissionError += SendPermissionAlert;
+ }
+
public override void Close()
{
ForEachScenePresence(delegate(ScenePresence avatar)
@@ -504,6 +510,7 @@ namespace OpenSim.Region.Environment.Scenes
}
CreateTerrainTexture();
+ CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map
}
catch (Exception e)
{
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 67b375a..b6daad6 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -147,6 +147,13 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_lastname; }
}
+ protected bool m_allowMovement = true;
+ public bool AllowMovement
+ {
+ get { return m_allowMovement; }
+ set { m_allowMovement = value; }
+ }
+
private readonly IClientAPI m_controllingClient;
protected PhysicsActor m_physicsActor;
@@ -528,58 +535,61 @@ namespace OpenSim.Region.Environment.Scenes
// Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!");
return;
}
-
- int i = 0;
- bool update_movementflag = false;
- bool update_rotation = false;
- bool DCFlagKeyPressed = false;
- Vector3 agent_control_v3 = new Vector3(0, 0, 0);
- Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
- bool oldflying = PhysicsActor.Flying;
-
- PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
- if (PhysicsActor.Flying != oldflying)
+ if (m_allowMovement)
{
- update_movementflag = true;
- }
+ int i = 0;
+ bool update_movementflag = false;
+ bool update_rotation = false;
+ bool DCFlagKeyPressed = false;
+ Vector3 agent_control_v3 = new Vector3(0, 0, 0);
+ Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
+ bool oldflying = PhysicsActor.Flying;
- if (q != m_bodyRot)
- {
- m_bodyRot = q;
- update_rotation = true;
- }
- if (m_parentID == 0)
- {
- foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
+ PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
+ if (PhysicsActor.Flying != oldflying)
{
- if ((flags & (uint) DCF) != 0)
+ update_movementflag = true;
+ }
+
+ if (q != m_bodyRot)
+ {
+ m_bodyRot = q;
+ update_rotation = true;
+ }
+
+ if (m_parentID == 0)
+ {
+ foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
{
- DCFlagKeyPressed = true;
- agent_control_v3 += Dir_Vectors[i];
- if ((m_movementflag & (uint) DCF) == 0)
+ if ((flags & (uint)DCF) != 0)
{
- m_movementflag += (byte) (uint) DCF;
- update_movementflag = true;
+ DCFlagKeyPressed = true;
+ agent_control_v3 += Dir_Vectors[i];
+ if ((m_movementflag & (uint)DCF) == 0)
+ {
+ m_movementflag += (byte)(uint)DCF;
+ update_movementflag = true;
+ }
}
- }
- else
- {
- if ((m_movementflag & (uint) DCF) != 0)
+ else
{
- m_movementflag -= (byte) (uint) DCF;
- update_movementflag = true;
+ if ((m_movementflag & (uint)DCF) != 0)
+ {
+ m_movementflag -= (byte)(uint)DCF;
+ update_movementflag = true;
+ }
}
+ i++;
}
- i++;
}
- }
- if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
- {
- AddNewMovement(agent_control_v3, q);
- UpdateMovementAnimations(update_movementflag);
+ if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
+ {
+ AddNewMovement(agent_control_v3, q);
+ UpdateMovementAnimations(update_movementflag);
+ }
}
}
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
index ae2f5ad..8cfbf27 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
@@ -42,10 +42,10 @@ namespace SimpleApp
{
private List m_avatars;
- public MyWorld(RegionInfo regionInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
+ public MyWorld(RegionInfo regionInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer,
ModuleLoader moduleLoader, bool physicalPrim)
- : base(regionInfo, authen, commsMan, sceneGridService, assetCach, storeMan, httpServer, moduleLoader, false, true)
+ : base(regionInfo, authen, permissionManager, commsMan, sceneGridService, assetCach, storeMan, httpServer, moduleLoader, false, true)
{
m_avatars = new List();
}
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index bd88e61..10b6258 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -169,9 +169,10 @@ namespace SimpleApp
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager)
{
+ PermissionManager permissionManager = new PermissionManager();
SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
return
- new MyWorld(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer,
+ new MyWorld(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer,
new ModuleLoader(m_log, m_config), true);
}
--
cgit v1.1