aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2007-11-18 11:11:44 +0000
committerMW2007-11-18 11:11:44 +0000
commit7f996448647e2703b82ea750bd38196fe5cea838 (patch)
tree2a44306e80f955d3381562b49d121413b53b8512 /OpenSim
parentFor every problem there's a solution that is simple, neat and wrong. (diff)
downloadopensim-SC-7f996448647e2703b82ea750bd38196fe5cea838.zip
opensim-SC-7f996448647e2703b82ea750bd38196fe5cea838.tar.gz
opensim-SC-7f996448647e2703b82ea750bd38196fe5cea838.tar.bz2
opensim-SC-7f996448647e2703b82ea750bd38196fe5cea838.tar.xz
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.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs3
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs2
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs30
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs19
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs88
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyWorld.cs4
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs3
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
366 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, 366 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
367 AgentCircuitManager circuitManager) 367 AgentCircuitManager circuitManager)
368 { 368 {
369 PermissionManager permissionManager = new PermissionManager();
369 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); 370 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
370 return 371 return
371 new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer, 372 new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer,
372 m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim); 373 m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim);
373 } 374 }
374 375
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;
36 36
37namespace OpenSim.Region.Environment.Modules 37namespace OpenSim.Region.Environment.Modules
38{ 38{
39 //this is first attempt to start breaking the mess thats called the assetcache up. 39 //this is a first attempt, to start breaking the mess thats called the assetcache up.
40 // basically this should be the texture sending (to clients) code moved out of assetcache 40 // basically this should be the texture sending (to clients) code moved out of assetcache
41 //and some small clean up 41 //and some small clean up
42 // but on first tests it didn't seem to work very well so is currently not in use. 42 // 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
48 set { m_bypassPermissions = value; } 48 set { m_bypassPermissions = value; }
49 } 49 }
50 50
51 public PermissionManager()
52 {
53 }
51 54
52 public PermissionManager(Scene scene) 55 public PermissionManager(Scene scene)
53 { 56 {
54 m_scene = scene; 57 m_scene = scene;
55 } 58 }
56 59
60 public void Initialise(Scene scene)
61 {
62 m_scene = scene;
63 }
64
57 protected virtual void SendPermissionError(LLUUID user, string reason) 65 protected virtual void SendPermissionError(LLUUID user, string reason)
58 { 66 {
59 m_scene.EventManager.TriggerPermissionError(user, reason); 67 m_scene.EventManager.TriggerPermissionError(user, reason);
@@ -188,6 +196,12 @@ namespace OpenSim.Region.Environment
188 return GenericObjectPermission(user, obj); 196 return GenericObjectPermission(user, obj);
189 } 197 }
190 198
199 public virtual bool CanCopyObject(LLUUID user, LLUUID obj)
200 {
201 return true;
202 // return GenericObjectPermission(user, obj);
203 }
204
191 #endregion 205 #endregion
192 206
193 #region Communication Permissions 207 #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
119 { 119 {
120 if (((SceneObjectGroup)obj).LocalId == localID) 120 if (((SceneObjectGroup)obj).LocalId == localID)
121 { 121 {
122 m_parentScene.RemoveEntity((SceneObjectGroup)obj); 122 m_parentScene.RemoveEntity((SceneObjectGroup)obj);
123 return; 123 return;
124 } 124 }
125 } 125 }
@@ -553,7 +553,7 @@ namespace OpenSim.Region.Environment.Scenes
553 parenPrim.LinkToGroup(sceneObj); 553 parenPrim.LinkToGroup(sceneObj);
554 } 554 }
555 } 555 }
556 556
557 /// <summary> 557 /// <summary>
558 /// Delink a linkset 558 /// Delink a linkset
559 /// </summary> 559 /// </summary>
@@ -568,7 +568,7 @@ namespace OpenSim.Region.Environment.Scenes
568 // XXX I'm anticipating that building this dictionary once is more efficient than 568 // XXX I'm anticipating that building this dictionary once is more efficient than
569 // repeated scanning of the Entity.Values for a large number of primIds. However, it might 569 // repeated scanning of the Entity.Values for a large number of primIds. However, it might
570 // be more efficient yet to keep this dictionary permanently on hand. 570 // be more efficient yet to keep this dictionary permanently on hand.
571 Dictionary<uint, SceneObjectGroup> sceneObjects = new Dictionary<uint, SceneObjectGroup>(); 571 Dictionary<uint, SceneObjectGroup> sceneObjects = new Dictionary<uint, SceneObjectGroup>();
572 foreach (EntityBase ent in Entities.Values) 572 foreach (EntityBase ent in Entities.Values)
573 { 573 {
574 if (ent is SceneObjectGroup) 574 if (ent is SceneObjectGroup)
@@ -576,17 +576,17 @@ namespace OpenSim.Region.Environment.Scenes
576 SceneObjectGroup obj = (SceneObjectGroup)ent; 576 SceneObjectGroup obj = (SceneObjectGroup)ent;
577 sceneObjects.Add(obj.LocalId, obj); 577 sceneObjects.Add(obj.LocalId, obj);
578 } 578 }
579 } 579 }
580 580
581 // Find the root prim among the prim ids we've been given 581 // Find the root prim among the prim ids we've been given
582 for (int i = 0; i < primIds.Count; i++) 582 for (int i = 0; i < primIds.Count; i++)
583 { 583 {
584 if (sceneObjects.ContainsKey(primIds[i])) 584 if (sceneObjects.ContainsKey(primIds[i]))
585 { 585 {
586 parenPrim = sceneObjects[primIds[i]]; 586 parenPrim = sceneObjects[primIds[i]];
587 primIds.RemoveAt(i); 587 primIds.RemoveAt(i);
588 break; 588 break;
589 } 589 }
590 } 590 }
591 591
592 if (parenPrim != null) 592 if (parenPrim != null)
@@ -594,7 +594,7 @@ namespace OpenSim.Region.Environment.Scenes
594 foreach (uint childPrimId in primIds) 594 foreach (uint childPrimId in primIds)
595 { 595 {
596 parenPrim.DelinkFromGroup(childPrimId); 596 parenPrim.DelinkFromGroup(childPrimId);
597 } 597 }
598 } 598 }
599 else 599 else
600 { 600 {
@@ -627,19 +627,21 @@ namespace OpenSim.Region.Environment.Scenes
627 627
628 if (originPrim != null) 628 if (originPrim != null)
629 { 629 {
630 SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); 630 if (PermissionsMngr.CanCopyObject(AgentID, originPrim.UUID))
631 copy.AbsolutePosition = copy.AbsolutePosition + offset; 631 {
632 Entities.Add(copy.UUID, copy); 632 SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
633 633 copy.AbsolutePosition = copy.AbsolutePosition + offset;
634 copy.ScheduleGroupForFullUpdate(); 634 Entities.Add(copy.UUID, copy);
635 635
636 copy.ScheduleGroupForFullUpdate();
637 }
636 } 638 }
637 else 639 else
638 { 640 {
639 MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim"); 641 MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
640 } 642 }
641 }
642 643
644 }
643 645
644 #endregion 646 #endregion
645 } 647 }
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
195 195
196 #region Constructors 196 #region Constructors
197 197
198 public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, 198 public Scene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
199 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, 199 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
200 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim) 200 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim)
201 { 201 {
@@ -217,15 +217,14 @@ namespace OpenSim.Region.Environment.Scenes
217 m_LandManager = new LandManager(this, m_regInfo); 217 m_LandManager = new LandManager(this, m_regInfo);
218 m_estateManager = new EstateManager(this, m_regInfo); 218 m_estateManager = new EstateManager(this, m_regInfo);
219 m_eventManager = new EventManager(); 219 m_eventManager = new EventManager();
220 m_permissionManager = new PermissionManager(this); 220
221 m_permissionManager = permissionManager;
222 m_permissionManager.Initialise(this);
221 223
222 m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager); 224 m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager);
223 m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo); 225 m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo);
224 226
225 m_eventManager.OnParcelPrimCountAdd += 227 RegisterDefaultSceneEvents();
226 m_LandManager.addPrimToLandPrimCounts;
227
228 m_eventManager.OnPermissionError += SendPermissionAlert;
229 228
230 MainLog.Instance.Verbose("Creating new entitities instance"); 229 MainLog.Instance.Verbose("Creating new entitities instance");
231 Entities = new Dictionary<LLUUID, EntityBase>(); 230 Entities = new Dictionary<LLUUID, EntityBase>();
@@ -244,6 +243,13 @@ namespace OpenSim.Region.Environment.Scenes
244 #endregion 243 #endregion
245 244
246 #region Startup / Close Methods 245 #region Startup / Close Methods
246
247 protected virtual void RegisterDefaultSceneEvents()
248 {
249 m_eventManager.OnParcelPrimCountAdd += m_LandManager.addPrimToLandPrimCounts;
250 m_eventManager.OnPermissionError += SendPermissionAlert;
251 }
252
247 public override void Close() 253 public override void Close()
248 { 254 {
249 ForEachScenePresence(delegate(ScenePresence avatar) 255 ForEachScenePresence(delegate(ScenePresence avatar)
@@ -504,6 +510,7 @@ namespace OpenSim.Region.Environment.Scenes
504 } 510 }
505 511
506 CreateTerrainTexture(); 512 CreateTerrainTexture();
513 CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map
507 } 514 }
508 catch (Exception e) 515 catch (Exception e)
509 { 516 {
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
147 get { return m_lastname; } 147 get { return m_lastname; }
148 } 148 }
149 149
150 protected bool m_allowMovement = true;
151 public bool AllowMovement
152 {
153 get { return m_allowMovement; }
154 set { m_allowMovement = value; }
155 }
156
150 private readonly IClientAPI m_controllingClient; 157 private readonly IClientAPI m_controllingClient;
151 protected PhysicsActor m_physicsActor; 158 protected PhysicsActor m_physicsActor;
152 159
@@ -528,58 +535,61 @@ namespace OpenSim.Region.Environment.Scenes
528 // Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!"); 535 // Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!");
529 return; 536 return;
530 } 537 }
531
532 int i = 0;
533 bool update_movementflag = false;
534 bool update_rotation = false;
535 bool DCFlagKeyPressed = false;
536 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
537 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
538 bool oldflying = PhysicsActor.Flying;
539
540 538
541 PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); 539 if (m_allowMovement)
542 if (PhysicsActor.Flying != oldflying)
543 { 540 {
544 update_movementflag = true; 541 int i = 0;
545 } 542 bool update_movementflag = false;
543 bool update_rotation = false;
544 bool DCFlagKeyPressed = false;
545 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
546 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
547 bool oldflying = PhysicsActor.Flying;
546 548
547 if (q != m_bodyRot)
548 {
549 m_bodyRot = q;
550 update_rotation = true;
551 }
552 549
553 if (m_parentID == 0) 550 PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
554 { 551 if (PhysicsActor.Flying != oldflying)
555 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
556 { 552 {
557 if ((flags & (uint) DCF) != 0) 553 update_movementflag = true;
554 }
555
556 if (q != m_bodyRot)
557 {
558 m_bodyRot = q;
559 update_rotation = true;
560 }
561
562 if (m_parentID == 0)
563 {
564 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
558 { 565 {
559 DCFlagKeyPressed = true; 566 if ((flags & (uint)DCF) != 0)
560 agent_control_v3 += Dir_Vectors[i];
561 if ((m_movementflag & (uint) DCF) == 0)
562 { 567 {
563 m_movementflag += (byte) (uint) DCF; 568 DCFlagKeyPressed = true;
564 update_movementflag = true; 569 agent_control_v3 += Dir_Vectors[i];
570 if ((m_movementflag & (uint)DCF) == 0)
571 {
572 m_movementflag += (byte)(uint)DCF;
573 update_movementflag = true;
574 }
565 } 575 }
566 } 576 else
567 else
568 {
569 if ((m_movementflag & (uint) DCF) != 0)
570 { 577 {
571 m_movementflag -= (byte) (uint) DCF; 578 if ((m_movementflag & (uint)DCF) != 0)
572 update_movementflag = true; 579 {
580 m_movementflag -= (byte)(uint)DCF;
581 update_movementflag = true;
582 }
573 } 583 }
584 i++;
574 } 585 }
575 i++;
576 } 586 }
577 }
578 587
579 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) 588 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
580 { 589 {
581 AddNewMovement(agent_control_v3, q); 590 AddNewMovement(agent_control_v3, q);
582 UpdateMovementAnimations(update_movementflag); 591 UpdateMovementAnimations(update_movementflag);
592 }
583 } 593 }
584 594
585 } 595 }
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
42 { 42 {
43 private List<ScenePresence> m_avatars; 43 private List<ScenePresence> m_avatars;
44 44
45 public MyWorld(RegionInfo regionInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, 45 public MyWorld(RegionInfo regionInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
46 AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer, 46 AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer,
47 ModuleLoader moduleLoader, bool physicalPrim) 47 ModuleLoader moduleLoader, bool physicalPrim)
48 : base(regionInfo, authen, commsMan, sceneGridService, assetCach, storeMan, httpServer, moduleLoader, false, true) 48 : base(regionInfo, authen, permissionManager, commsMan, sceneGridService, assetCach, storeMan, httpServer, moduleLoader, false, true)
49 { 49 {
50 m_avatars = new List<Avatar>(); 50 m_avatars = new List<Avatar>();
51 } 51 }
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
169 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, 169 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
170 AgentCircuitManager circuitManager) 170 AgentCircuitManager circuitManager)
171 { 171 {
172 PermissionManager permissionManager = new PermissionManager();
172 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); 173 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
173 return 174 return
174 new MyWorld(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer, 175 new MyWorld(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer,
175 new ModuleLoader(m_log, m_config), true); 176 new ModuleLoader(m_log, m_config), true);
176 } 177 }
177 178