aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs137
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs86
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs79
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs109
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs32
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs36
11 files changed, 445 insertions, 60 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index eee5960..e257b57 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -47,30 +47,75 @@ namespace OpenSim.Region.Framework.Scenes
47 47
48 public delegate void OnFrameDelegate(); 48 public delegate void OnFrameDelegate();
49 49
50 /// <summary>
51 /// Triggered on each sim frame.
52 /// </summary>
53 /// <remarks>
54 /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.Update"/>
55 /// Core uses it for things like Sun, Wind & Clouds
56 /// The MRM module also uses it.
57 /// </remarks>
50 public event OnFrameDelegate OnFrame; 58 public event OnFrameDelegate OnFrame;
51 59
52 public delegate void ClientMovement(ScenePresence client); 60 public delegate void ClientMovement(ScenePresence client);
53 61
62 /// <summary>
63 /// Trigerred when an agent moves.
64 /// </summary>
65 /// <remarks>
66 /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.ScenePresence.HandleAgentUpdate"/>
67 /// prior to <see cref="OpenSim.Region.Framework.Scenes.ScenePresence.TriggerScenePresenceUpdated"/>
68 /// </remarks>
54 public event ClientMovement OnClientMovement; 69 public event ClientMovement OnClientMovement;
55 70
56 public delegate void OnTerrainTaintedDelegate(); 71 public delegate void OnTerrainTaintedDelegate();
57 72
73 /// <summary>
74 /// Triggered if the terrain has been edited
75 /// </summary>
76 /// <remarks>
77 /// This gets triggered in <see cref="OpenSim.Region.CoreModules.World.Terrain.CheckForTerrainUpdates"/>
78 /// after it determines that an update has been made.
79 /// </remarks>
58 public event OnTerrainTaintedDelegate OnTerrainTainted; 80 public event OnTerrainTaintedDelegate OnTerrainTainted;
59 81
60 public delegate void OnTerrainTickDelegate(); 82 public delegate void OnTerrainTickDelegate();
61 83
62 public delegate void OnTerrainUpdateDelegate(); 84 /// <summary>
63 85 /// Triggered if the terrain has been edited
86 /// </summary>
87 /// <remarks>
88 /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.UpdateTerrain"/>
89 /// but is used by core solely to update the physics engine.
90 /// </remarks>
64 public event OnTerrainTickDelegate OnTerrainTick; 91 public event OnTerrainTickDelegate OnTerrainTick;
65 92
93 public delegate void OnTerrainUpdateDelegate();
94
66 public event OnTerrainUpdateDelegate OnTerrainUpdate; 95 public event OnTerrainUpdateDelegate OnTerrainUpdate;
67 96
68 public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup); 97 public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup);
69 98
99 /// <summary>
100 /// Triggered when a region is backed up/persisted to storage
101 /// </summary>
102 /// <remarks>
103 /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.Backup"/>
104 /// and is fired before the persistence occurs.
105 /// </remarks>
70 public event OnBackupDelegate OnBackup; 106 public event OnBackupDelegate OnBackup;
71 107
72 public delegate void OnClientConnectCoreDelegate(IClientCore client); 108 public delegate void OnClientConnectCoreDelegate(IClientCore client);
73 109
110 /// <summary>
111 /// Triggered when a new client connects to the scene.
112 /// </summary>
113 /// <remarks>
114 /// This gets triggered in <see cref="TriggerOnNewClient"/>,
115 /// which checks if an instance of <see cref="OpenSim.Framework.IClientAPI"/>
116 /// also implements <see cref="OpenSim.Framework.Client.IClientCore"/> and as such,
117 /// is not triggered by <see cref="OpenSim.Region.OptionalModules.World.NPC">NPCs</see>.
118 /// </remarks>
74 public event OnClientConnectCoreDelegate OnClientConnect; 119 public event OnClientConnectCoreDelegate OnClientConnect;
75 120
76 public delegate void OnNewClientDelegate(IClientAPI client); 121 public delegate void OnNewClientDelegate(IClientAPI client);
@@ -91,18 +136,54 @@ namespace OpenSim.Region.Framework.Scenes
91 136
92 public delegate void OnNewPresenceDelegate(ScenePresence presence); 137 public delegate void OnNewPresenceDelegate(ScenePresence presence);
93 138
139 /// <summary>
140 /// Triggered when a new presence is added to the scene
141 /// </summary>
142 /// <remarks>
143 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both
144 /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
145 /// </remarks>
94 public event OnNewPresenceDelegate OnNewPresence; 146 public event OnNewPresenceDelegate OnNewPresence;
95 147
96 public delegate void OnRemovePresenceDelegate(UUID agentId); 148 public delegate void OnRemovePresenceDelegate(UUID agentId);
97 149
150 /// <summary>
151 /// Triggered when a presence is removed from the scene
152 /// </summary>
153 /// <remarks>
154 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both
155 /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
156 /// </remarks>
98 public event OnRemovePresenceDelegate OnRemovePresence; 157 public event OnRemovePresenceDelegate OnRemovePresence;
99 158
100 public delegate void OnParcelPrimCountUpdateDelegate(); 159 public delegate void OnParcelPrimCountUpdateDelegate();
101 160
161 /// <summary>
162 /// Triggered whenever the prim count may have been altered, or prior
163 /// to an action that requires the current prim count to be accurate.
164 /// </summary>
165 /// <remarks>
166 /// Triggered by <see cref="TriggerParcelPrimCountUpdate"/> in
167 /// <see cref="OpenSim.OpenSimBase.CreateRegion"/>,
168 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.EventManagerOnRequestParcelPrimCountUpdate"/>,
169 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ClientOnParcelObjectOwnerRequest"/>,
170 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.GetPrimsFree"/>,
171 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.UpdateLandSold"/>,
172 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.DeedToGroup"/>,
173 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.SendLandUpdateToClient"/>
174 /// </remarks>
102 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; 175 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
103 176
104 public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj); 177 public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
105 178
179 /// <summary>
180 /// Triggered in response to <see cref="OnParcelPrimCountUpdate"/> for
181 /// objects that actually contribute to parcel prim count.
182 /// </summary>
183 /// <remarks>
184 /// Triggered by <see cref="TriggerParcelPrimCountAdd"/> in
185 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.EventManagerOnParcelPrimCountUpdate"/>
186 /// </remarks>
106 public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd; 187 public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
107 188
108 public delegate void OnPluginConsoleDelegate(string[] args); 189 public delegate void OnPluginConsoleDelegate(string[] args);
@@ -123,6 +204,14 @@ namespace OpenSim.Region.Framework.Scenes
123 204
124 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; 205 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
125 206
207 /// <summary>
208 /// Triggered after parcel properties have been updated.
209 /// </summary>
210 /// <remarks>
211 /// Triggered by <see cref="TriggerOnParcelPropertiesUpdateRequest"/> in
212 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ClientOnParcelPropertiesUpdateRequest"/>,
213 /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ProcessPropertiesUpdate"/>
214 /// </remarks>
126 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 215 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
127 216
128 /// <summary> 217 /// <summary>
@@ -373,6 +462,20 @@ namespace OpenSim.Region.Framework.Scenes
373 public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate; 462 public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate;
374 463
375 public delegate void ParcelPrimCountTainted(); 464 public delegate void ParcelPrimCountTainted();
465
466 /// <summary>
467 /// Triggered when the parcel prim count has been altered.
468 /// </summary>
469 /// <remarks>
470 /// Triggered by <see cref="TriggerParcelPrimCountTainted"/> in
471 /// <see cref="OpenSim.Region.CoreModules.Avatar.Attachments.AttachmentsModule.DetachSingleAttachmentToGround"/>,
472 /// <see cref="OpenSim.Region.CoreModules.Avatar.Attachments.AttachmentsModule.AttachToAgent"/>,
473 /// <see cref="Scene.DeleteSceneObject"/>,
474 /// <see cref="Scene.SelectPrim"/>,
475 /// <see cref="Scene.DeselectPrim"/>,
476 /// <see cref="SceneObjectGroup.UpdatePrimFlags"/>,
477 /// <see cref="SceneObjectGroup.AbsolutePosition"/>
478 /// </remarks>
376 public event ParcelPrimCountTainted OnParcelPrimCountTainted; 479 public event ParcelPrimCountTainted OnParcelPrimCountTainted;
377 public event GetScriptRunning OnGetScriptRunning; 480 public event GetScriptRunning OnGetScriptRunning;
378 481
@@ -432,7 +535,7 @@ namespace OpenSim.Region.Framework.Scenes
432 /// the scripts may not have started yet 535 /// the scripts may not have started yet
433 /// Message is non empty string if there were problems loading the oar file 536 /// Message is non empty string if there were problems loading the oar file
434 /// </summary> 537 /// </summary>
435 public delegate void OarFileLoaded(Guid guid, string message); 538 public delegate void OarFileLoaded(Guid guid, List<UUID> loadedScenes, string message);
436 public event OarFileLoaded OnOarFileLoaded; 539 public event OarFileLoaded OnOarFileLoaded;
437 540
438 /// <summary> 541 /// <summary>
@@ -485,6 +588,9 @@ namespace OpenSim.Region.Framework.Scenes
485 /// <param name="copy"></param> 588 /// <param name="copy"></param>
486 /// <param name="original"></param> 589 /// <param name="original"></param>
487 /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> 590 /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
591 /// <remarks>
592 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.SceneObjectPart.Copy"/>
593 /// </remarks>
488 public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; 594 public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
489 public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); 595 public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
490 596
@@ -593,8 +699,29 @@ namespace OpenSim.Region.Framework.Scenes
593 699
594 public delegate void LandBuy(Object sender, LandBuyArgs e); 700 public delegate void LandBuy(Object sender, LandBuyArgs e);
595 701
702 /// <summary>
703 /// Triggered when an attempt to transfer grid currency occurs
704 /// </summary>
705 /// <remarks>
706 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessMoneyTransferRequest"/>
707 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientGridEvents"/>
708 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientEvents"/>
709 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/>
710 /// </remarks>
596 public event MoneyTransferEvent OnMoneyTransfer; 711 public event MoneyTransferEvent OnMoneyTransfer;
712
713 /// <summary>
714 /// Triggered after after <see cref="OnValidateLandBuy"/>
715 /// </summary>
597 public event LandBuy OnLandBuy; 716 public event LandBuy OnLandBuy;
717
718 /// <summary>
719 /// Triggered to allow or prevent a real estate transaction
720 /// </summary>
721 /// <remarks>
722 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessParcelBuy"/>
723 /// <seealso cref="OpenSim.Region.OptionalModules.World.MoneyModule.SampleMoneyModule.ValidateLandBuy"/>
724 /// </remarks>
598 public event LandBuy OnValidateLandBuy; 725 public event LandBuy OnValidateLandBuy;
599 726
600 public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) 727 public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
@@ -2093,7 +2220,7 @@ namespace OpenSim.Region.Framework.Scenes
2093 return 6; 2220 return 6;
2094 } 2221 }
2095 2222
2096 public void TriggerOarFileLoaded(Guid requestId, string message) 2223 public void TriggerOarFileLoaded(Guid requestId, List<UUID> loadedScenes, string message)
2097 { 2224 {
2098 OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded; 2225 OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded;
2099 if (handlerOarFileLoaded != null) 2226 if (handlerOarFileLoaded != null)
@@ -2102,7 +2229,7 @@ namespace OpenSim.Region.Framework.Scenes
2102 { 2229 {
2103 try 2230 try
2104 { 2231 {
2105 d(requestId, message); 2232 d(requestId, loadedScenes, message);
2106 } 2233 }
2107 catch (Exception e) 2234 catch (Exception e)
2108 { 2235 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 2d9a035..3d68081 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes
93 /// </summary> 93 /// </summary>
94 public void StartScripts() 94 public void StartScripts()
95 { 95 {
96 m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName); 96// m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName);
97 97
98 IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>(); 98 IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
99 99
@@ -1986,6 +1986,9 @@ namespace OpenSim.Region.Framework.Scenes
1986 // If child prims have invalid perms, fix them 1986 // If child prims have invalid perms, fix them
1987 grp.AdjustChildPrimPermissions(); 1987 grp.AdjustChildPrimPermissions();
1988 1988
1989 // If child prims have invalid perms, fix them
1990 grp.AdjustChildPrimPermissions();
1991
1989 if (remoteClient == null) 1992 if (remoteClient == null)
1990 { 1993 {
1991 // Autoreturn has a null client. Nothing else does. So 1994 // Autoreturn has a null client. Nothing else does. So
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index e970543..16c0d25 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -543,7 +543,7 @@ namespace OpenSim.Region.Framework.Scenes
543 if (!InventoryService.AddFolder(folder)) 543 if (!InventoryService.AddFolder(folder))
544 { 544 {
545 m_log.WarnFormat( 545 m_log.WarnFormat(
546 "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", 546 "[AGENT INVENTORY]: Failed to create folder for user {0} {1}",
547 remoteClient.Name, remoteClient.AgentId); 547 remoteClient.Name, remoteClient.AgentId);
548 } 548 }
549 } 549 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9b9ad80..a5fcf4d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -103,8 +103,31 @@ namespace OpenSim.Region.Framework.Scenes
103 /// </summary> 103 /// </summary>
104 public bool CollidablePrims { get; private set; } 104 public bool CollidablePrims { get; private set; }
105 105
106 /// <summary>
107 /// Minimum value of the size of a non-physical prim in each axis
108 /// </summary>
109 public float m_minNonphys = 0.01f;
110
111 /// <summary>
112 /// Maximum value of the size of a non-physical prim in each axis
113 /// </summary>
106 public float m_maxNonphys = 256; 114 public float m_maxNonphys = 256;
115
116 /// <summary>
117 /// Minimum value of the size of a physical prim in each axis
118 /// </summary>
119 public float m_minPhys = 0.01f;
120
121 /// <summary>
122 /// Maximum value of the size of a physical prim in each axis
123 /// </summary>
107 public float m_maxPhys = 10; 124 public float m_maxPhys = 10;
125
126 /// <summary>
127 /// Max prims an object will hold
128 /// </summary>
129 public int m_linksetCapacity = 0;
130
108 public bool m_clampPrimSize; 131 public bool m_clampPrimSize;
109 public bool m_trustBinaries; 132 public bool m_trustBinaries;
110 public bool m_allowScriptCrossings; 133 public bool m_allowScriptCrossings;
@@ -746,12 +769,24 @@ namespace OpenSim.Region.Framework.Scenes
746 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 769 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
747 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 770 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
748 771
772 m_minNonphys = startupConfig.GetFloat("NonphysicalPrimMin", m_minNonphys);
773 if (RegionInfo.NonphysPrimMin > 0)
774 {
775 m_minNonphys = RegionInfo.NonphysPrimMin;
776 }
777
749 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); 778 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
750 if (RegionInfo.NonphysPrimMax > 0) 779 if (RegionInfo.NonphysPrimMax > 0)
751 { 780 {
752 m_maxNonphys = RegionInfo.NonphysPrimMax; 781 m_maxNonphys = RegionInfo.NonphysPrimMax;
753 } 782 }
754 783
784 m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys);
785 if (RegionInfo.PhysPrimMin > 0)
786 {
787 m_minPhys = RegionInfo.PhysPrimMin;
788 }
789
755 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); 790 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
756 791
757 if (RegionInfo.PhysPrimMax > 0) 792 if (RegionInfo.PhysPrimMax > 0)
@@ -759,6 +794,12 @@ namespace OpenSim.Region.Framework.Scenes
759 m_maxPhys = RegionInfo.PhysPrimMax; 794 m_maxPhys = RegionInfo.PhysPrimMax;
760 } 795 }
761 796
797 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity);
798 if (RegionInfo.LinksetCapacity > 0)
799 {
800 m_linksetCapacity = RegionInfo.LinksetCapacity;
801 }
802
762 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); 803 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
763 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); 804 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
764 805
@@ -3715,7 +3756,7 @@ namespace OpenSim.Region.Framework.Scenes
3715 "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", 3756 "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.",
3716 sp.Name, sp.UUID, RegionInfo.RegionName); 3757 sp.Name, sp.UUID, RegionInfo.RegionName);
3717 3758
3718 sp.ControllingClient.Close(); 3759 sp.ControllingClient.Close(true, true);
3719 sp = null; 3760 sp = null;
3720 } 3761 }
3721 3762
@@ -4318,15 +4359,18 @@ namespace OpenSim.Region.Framework.Scenes
4318 /// Tell a single agent to disconnect from the region. 4359 /// Tell a single agent to disconnect from the region.
4319 /// </summary> 4360 /// </summary>
4320 /// <param name="agentID"></param> 4361 /// <param name="agentID"></param>
4321 /// <param name="childOnly"></param> 4362 /// <param name="force">
4322 public bool IncomingCloseAgent(UUID agentID, bool childOnly) 4363 /// Force the agent to close even if it might be in the middle of some other operation. You do not want to
4364 /// force unless you are absolutely sure that the agent is dead and a normal close is not working.
4365 /// </param>
4366 public bool IncomingCloseAgent(UUID agentID, bool force)
4323 { 4367 {
4324 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 4368 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
4325 4369
4326 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); 4370 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
4327 if (presence != null) 4371 if (presence != null)
4328 { 4372 {
4329 presence.ControllingClient.Close(); 4373 presence.ControllingClient.Close(true, force);
4330 return true; 4374 return true;
4331 } 4375 }
4332 4376
@@ -4532,6 +4576,16 @@ namespace OpenSim.Region.Framework.Scenes
4532 return LandChannel.GetLandObject(x, y).LandData; 4576 return LandChannel.GetLandObject(x, y).LandData;
4533 } 4577 }
4534 4578
4579 /// <summary>
4580 /// Get LandData by position.
4581 /// </summary>
4582 /// <param name="pos"></param>
4583 /// <returns></returns>
4584 public LandData GetLandData(Vector3 pos)
4585 {
4586 return GetLandData(pos.X, pos.Y);
4587 }
4588
4535 public LandData GetLandData(uint x, uint y) 4589 public LandData GetLandData(uint x, uint y)
4536 { 4590 {
4537 m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y); 4591 m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y);
@@ -4780,6 +4834,18 @@ namespace OpenSim.Region.Framework.Scenes
4780 } 4834 }
4781 4835
4782 /// <summary> 4836 /// <summary>
4837 /// Attempt to get the SOG via its UUID
4838 /// </summary>
4839 /// <param name="fullID"></param>
4840 /// <param name="sog"></param>
4841 /// <returns></returns>
4842 public bool TryGetSceneObjectGroup(UUID fullID, out SceneObjectGroup sog)
4843 {
4844 sog = GetSceneObjectGroup(fullID);
4845 return sog != null;
4846 }
4847
4848 /// <summary>
4783 /// Get a prim by name from the scene (will return the first 4849 /// Get a prim by name from the scene (will return the first
4784 /// found, if there are more than one prim with the same name) 4850 /// found, if there are more than one prim with the same name)
4785 /// </summary> 4851 /// </summary>
@@ -4811,6 +4877,18 @@ namespace OpenSim.Region.Framework.Scenes
4811 } 4877 }
4812 4878
4813 /// <summary> 4879 /// <summary>
4880 /// Attempt to get a prim via its UUID
4881 /// </summary>
4882 /// <param name="fullID"></param>
4883 /// <param name="sop"></param>
4884 /// <returns></returns>
4885 public bool TryGetSceneObjectPart(UUID fullID, out SceneObjectPart sop)
4886 {
4887 sop = GetSceneObjectPart(fullID);
4888 return sop != null;
4889 }
4890
4891 /// <summary>
4814 /// Get a scene object group that contains the prim with the given local id 4892 /// Get a scene object group that contains the prim with the given local id
4815 /// </summary> 4893 /// </summary>
4816 /// <param name="localID"></param> 4894 /// <param name="localID"></param>
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index e29b2c1..c4b7b27 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -342,7 +342,7 @@ namespace OpenSim.Region.Framework.Scenes
342 public bool AddNewSceneObject( 342 public bool AddNewSceneObject(
343 SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) 343 SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel)
344 { 344 {
345 AddNewSceneObject(sceneObject, true, false); 345 AddNewSceneObject(sceneObject, attachToBackup, false);
346 346
347 if (pos != null) 347 if (pos != null)
348 sceneObject.AbsolutePosition = (Vector3)pos; 348 sceneObject.AbsolutePosition = (Vector3)pos;
@@ -421,12 +421,9 @@ namespace OpenSim.Region.Framework.Scenes
421 { 421 {
422 Vector3 scale = part.Shape.Scale; 422 Vector3 scale = part.Shape.Scale;
423 423
424 if (scale.X > m_parentScene.m_maxNonphys) 424 scale.X = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.X));
425 scale.X = m_parentScene.m_maxNonphys; 425 scale.Y = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Y));
426 if (scale.Y > m_parentScene.m_maxNonphys) 426 scale.Z = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Z));
427 scale.Y = m_parentScene.m_maxNonphys;
428 if (scale.Z > m_parentScene.m_maxNonphys)
429 scale.Z = m_parentScene.m_maxNonphys;
430 427
431 part.Shape.Scale = scale; 428 part.Shape.Scale = scale;
432 } 429 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index f1b09ca..dba3a61 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -92,7 +92,11 @@ namespace OpenSim.Region.Framework.Scenes
92 private static SceneManager m_instance = null; 92 private static SceneManager m_instance = null;
93 public static SceneManager Instance 93 public static SceneManager Instance
94 { 94 {
95 get { return m_instance; } 95 get {
96 if (m_instance == null)
97 m_instance = new SceneManager();
98 return m_instance;
99 }
96 } 100 }
97 101
98 private readonly DoubleDictionary<UUID, string, Scene> m_localScenes = new DoubleDictionary<UUID, string, Scene>(); 102 private readonly DoubleDictionary<UUID, string, Scene> m_localScenes = new DoubleDictionary<UUID, string, Scene>();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4798481..f1df6d6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2742,6 +2742,25 @@ namespace OpenSim.Region.Framework.Scenes
2742 if (objectGroup == this) 2742 if (objectGroup == this)
2743 return; 2743 return;
2744 2744
2745 // If the configured linkset capacity is greater than zero,
2746 // and the new linkset would have a prim count higher than this
2747 // value, do not link it.
2748 if (m_scene.m_linksetCapacity > 0 &&
2749 (PrimCount + objectGroup.PrimCount) >
2750 m_scene.m_linksetCapacity)
2751 {
2752 m_log.DebugFormat(
2753 "[SCENE OBJECT GROUP]: Cannot link group with root" +
2754 " part {0}, {1} ({2} prims) to group with root part" +
2755 " {3}, {4} ({5} prims) because the new linkset" +
2756 " would exceed the configured maximum of {6}",
2757 objectGroup.RootPart.Name, objectGroup.RootPart.UUID,
2758 objectGroup.PrimCount, RootPart.Name, RootPart.UUID,
2759 PrimCount, m_scene.m_linksetCapacity);
2760
2761 return;
2762 }
2763
2745 // 'linkPart' == the root of the group being linked into this group 2764 // 'linkPart' == the root of the group being linked into this group
2746 SceneObjectPart linkPart = objectGroup.m_rootPart; 2765 SceneObjectPart linkPart = objectGroup.m_rootPart;
2747 2766
@@ -3464,17 +3483,17 @@ namespace OpenSim.Region.Framework.Scenes
3464 /// <param name="scale"></param> 3483 /// <param name="scale"></param>
3465 public void GroupResize(Vector3 scale) 3484 public void GroupResize(Vector3 scale)
3466 { 3485 {
3467 scale.X = Math.Min(scale.X, Scene.m_maxNonphys); 3486 scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X));
3468 scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); 3487 scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y));
3469 scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); 3488 scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z));
3470 3489
3471 PhysicsActor pa = m_rootPart.PhysActor; 3490 PhysicsActor pa = m_rootPart.PhysActor;
3472 3491
3473 if (pa != null && pa.IsPhysical) 3492 if (pa != null && pa.IsPhysical)
3474 { 3493 {
3475 scale.X = Math.Min(scale.X, Scene.m_maxPhys); 3494 scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X));
3476 scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); 3495 scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y));
3477 scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); 3496 scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z));
3478 } 3497 }
3479 3498
3480 float x = (scale.X / RootPart.Scale.X); 3499 float x = (scale.X / RootPart.Scale.X);
@@ -3505,6 +3524,14 @@ namespace OpenSim.Region.Framework.Scenes
3505 y *= a; 3524 y *= a;
3506 z *= a; 3525 z *= a;
3507 } 3526 }
3527 else if (oldSize.X * x < m_scene.m_minPhys)
3528 {
3529 f = m_scene.m_minPhys / oldSize.X;
3530 a = f / x;
3531 x *= a;
3532 y *= a;
3533 z *= a;
3534 }
3508 3535
3509 if (oldSize.Y * y > m_scene.m_maxPhys) 3536 if (oldSize.Y * y > m_scene.m_maxPhys)
3510 { 3537 {
@@ -3514,6 +3541,14 @@ namespace OpenSim.Region.Framework.Scenes
3514 y *= a; 3541 y *= a;
3515 z *= a; 3542 z *= a;
3516 } 3543 }
3544 else if (oldSize.Y * y < m_scene.m_minPhys)
3545 {
3546 f = m_scene.m_minPhys / oldSize.Y;
3547 a = f / y;
3548 x *= a;
3549 y *= a;
3550 z *= a;
3551 }
3517 3552
3518 if (oldSize.Z * z > m_scene.m_maxPhys) 3553 if (oldSize.Z * z > m_scene.m_maxPhys)
3519 { 3554 {
@@ -3523,6 +3558,14 @@ namespace OpenSim.Region.Framework.Scenes
3523 y *= a; 3558 y *= a;
3524 z *= a; 3559 z *= a;
3525 } 3560 }
3561 else if (oldSize.Z * z < m_scene.m_minPhys)
3562 {
3563 f = m_scene.m_minPhys / oldSize.Z;
3564 a = f / z;
3565 x *= a;
3566 y *= a;
3567 z *= a;
3568 }
3526 } 3569 }
3527 else 3570 else
3528 { 3571 {
@@ -3534,6 +3577,14 @@ namespace OpenSim.Region.Framework.Scenes
3534 y *= a; 3577 y *= a;
3535 z *= a; 3578 z *= a;
3536 } 3579 }
3580 else if (oldSize.X * x < m_scene.m_minNonphys)
3581 {
3582 f = m_scene.m_minNonphys / oldSize.X;
3583 a = f / x;
3584 x *= a;
3585 y *= a;
3586 z *= a;
3587 }
3537 3588
3538 if (oldSize.Y * y > m_scene.m_maxNonphys) 3589 if (oldSize.Y * y > m_scene.m_maxNonphys)
3539 { 3590 {
@@ -3543,6 +3594,14 @@ namespace OpenSim.Region.Framework.Scenes
3543 y *= a; 3594 y *= a;
3544 z *= a; 3595 z *= a;
3545 } 3596 }
3597 else if (oldSize.Y * y < m_scene.m_minNonphys)
3598 {
3599 f = m_scene.m_minNonphys / oldSize.Y;
3600 a = f / y;
3601 x *= a;
3602 y *= a;
3603 z *= a;
3604 }
3546 3605
3547 if (oldSize.Z * z > m_scene.m_maxNonphys) 3606 if (oldSize.Z * z > m_scene.m_maxNonphys)
3548 { 3607 {
@@ -3552,6 +3611,14 @@ namespace OpenSim.Region.Framework.Scenes
3552 y *= a; 3611 y *= a;
3553 z *= a; 3612 z *= a;
3554 } 3613 }
3614 else if (oldSize.Z * z < m_scene.m_minNonphys)
3615 {
3616 f = m_scene.m_minNonphys / oldSize.Z;
3617 a = f / z;
3618 x *= a;
3619 y *= a;
3620 z *= a;
3621 }
3555 } 3622 }
3556 } 3623 }
3557 } 3624 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 56d289f..4af508e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -790,7 +790,7 @@ namespace OpenSim.Region.Framework.Scenes
790 } 790 }
791 catch (Exception e) 791 catch (Exception e)
792 { 792 {
793 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); 793 m_log.ErrorFormat("[SCENEOBJECTPART]: GROUP POSITION. {0}", e);
794 } 794 }
795 } 795 }
796 } 796 }
@@ -2972,17 +2972,16 @@ namespace OpenSim.Region.Framework.Scenes
2972 /// <param name="scale"></param> 2972 /// <param name="scale"></param>
2973 public void Resize(Vector3 scale) 2973 public void Resize(Vector3 scale)
2974 { 2974 {
2975 scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys); 2975 scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X));
2976 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); 2976 scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y));
2977 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); 2977 scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z));
2978 2978
2979 PhysicsActor pa = PhysActor; 2979 PhysicsActor pa = PhysActor;
2980
2981 if (pa != null && pa.IsPhysical) 2980 if (pa != null && pa.IsPhysical)
2982 { 2981 {
2983 scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); 2982 scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X));
2984 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); 2983 scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y));
2985 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); 2984 scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z));
2986 } 2985 }
2987 2986
2988// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); 2987// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
@@ -3567,23 +3566,32 @@ namespace OpenSim.Region.Framework.Scenes
3567 } 3566 }
3568 3567
3569 /// <summary> 3568 /// <summary>
3570 /// Set the color of prim faces 3569 /// Set the color & alpha of prim faces
3571 /// </summary> 3570 /// </summary>
3572 /// <param name="color"></param>
3573 /// <param name="face"></param> 3571 /// <param name="face"></param>
3574 public void SetFaceColor(Vector3 color, int face) 3572 /// <param name="color"></param>
3573 /// <param name="alpha"></param>
3574 public void SetFaceColorAlpha(int face, Vector3 color, double ?alpha)
3575 { 3575 {
3576 Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f);
3577 float clippedAlpha = alpha.HasValue ?
3578 Util.Clip((float)alpha.Value, 0.0f, 1.0f) : 0;
3579
3576 // The only way to get a deep copy/ If we don't do this, we can 3580 // The only way to get a deep copy/ If we don't do this, we can
3577 // mever detect color changes further down. 3581 // never detect color changes further down.
3578 Byte[] buf = Shape.Textures.GetBytes(); 3582 Byte[] buf = Shape.Textures.GetBytes();
3579 Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); 3583 Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length);
3580 Color4 texcolor; 3584 Color4 texcolor;
3581 if (face >= 0 && face < GetNumberOfSides()) 3585 if (face >= 0 && face < GetNumberOfSides())
3582 { 3586 {
3583 texcolor = tex.CreateFace((uint)face).RGBA; 3587 texcolor = tex.CreateFace((uint)face).RGBA;
3584 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); 3588 texcolor.R = clippedColor.X;
3585 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); 3589 texcolor.G = clippedColor.Y;
3586 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3590 texcolor.B = clippedColor.Z;
3591 if (alpha.HasValue)
3592 {
3593 texcolor.A = clippedAlpha;
3594 }
3587 tex.FaceTextures[face].RGBA = texcolor; 3595 tex.FaceTextures[face].RGBA = texcolor;
3588 UpdateTextureEntry(tex.GetBytes()); 3596 UpdateTextureEntry(tex.GetBytes());
3589 return; 3597 return;
@@ -3595,15 +3603,23 @@ namespace OpenSim.Region.Framework.Scenes
3595 if (tex.FaceTextures[i] != null) 3603 if (tex.FaceTextures[i] != null)
3596 { 3604 {
3597 texcolor = tex.FaceTextures[i].RGBA; 3605 texcolor = tex.FaceTextures[i].RGBA;
3598 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); 3606 texcolor.R = clippedColor.X;
3599 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); 3607 texcolor.G = clippedColor.Y;
3600 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3608 texcolor.B = clippedColor.Z;
3609 if (alpha.HasValue)
3610 {
3611 texcolor.A = clippedAlpha;
3612 }
3601 tex.FaceTextures[i].RGBA = texcolor; 3613 tex.FaceTextures[i].RGBA = texcolor;
3602 } 3614 }
3603 texcolor = tex.DefaultTexture.RGBA; 3615 texcolor = tex.DefaultTexture.RGBA;
3604 texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); 3616 texcolor.R = clippedColor.X;
3605 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); 3617 texcolor.G = clippedColor.Y;
3606 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3618 texcolor.B = clippedColor.Z;
3619 if (alpha.HasValue)
3620 {
3621 texcolor.A = clippedAlpha;
3622 }
3607 tex.DefaultTexture.RGBA = texcolor; 3623 tex.DefaultTexture.RGBA = texcolor;
3608 } 3624 }
3609 UpdateTextureEntry(tex.GetBytes()); 3625 UpdateTextureEntry(tex.GetBytes());
@@ -4891,6 +4907,57 @@ namespace OpenSim.Region.Framework.Scenes
4891 ScheduleFullUpdate(); 4907 ScheduleFullUpdate();
4892 } 4908 }
4893 4909
4910 public void UpdateSlice(float begin, float end)
4911 {
4912 if (end < begin)
4913 {
4914 float temp = begin;
4915 begin = end;
4916 end = temp;
4917 }
4918 end = Math.Min(1f, Math.Max(0f, end));
4919 begin = Math.Min(Math.Min(1f, Math.Max(0f, begin)), end - 0.02f);
4920 if (begin < 0.02f && end < 0.02f)
4921 {
4922 begin = 0f;
4923 end = 0.02f;
4924 }
4925
4926 ushort uBegin = (ushort)(50000.0 * begin);
4927 ushort uEnd = (ushort)(50000.0 * (1f - end));
4928 bool updatePossiblyNeeded = false;
4929 PrimType primType = GetPrimType();
4930 if (primType == PrimType.SPHERE || primType == PrimType.TORUS || primType == PrimType.TUBE || primType == PrimType.RING)
4931 {
4932 if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd)
4933 {
4934 m_shape.ProfileBegin = uBegin;
4935 m_shape.ProfileEnd = uEnd;
4936 updatePossiblyNeeded = true;
4937 }
4938 }
4939 else if (m_shape.PathBegin != uBegin || m_shape.PathEnd != uEnd)
4940 {
4941 m_shape.PathBegin = uBegin;
4942 m_shape.PathEnd = uEnd;
4943 updatePossiblyNeeded = true;
4944 }
4945
4946 if (updatePossiblyNeeded && ParentGroup != null)
4947 {
4948 ParentGroup.HasGroupChanged = true;
4949 }
4950 if (updatePossiblyNeeded && PhysActor != null)
4951 {
4952 PhysActor.Shape = m_shape;
4953 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
4954 }
4955 if (updatePossiblyNeeded)
4956 {
4957 ScheduleFullUpdate();
4958 }
4959 }
4960
4894 /// <summary> 4961 /// <summary>
4895 /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics 4962 /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics
4896 /// engine can use it. 4963 /// engine can use it.
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a8aa551..adb3d38 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -974,7 +974,9 @@ namespace OpenSim.Region.Framework.Scenes
974 { 974 {
975 if (wasChild && HasAttachments()) 975 if (wasChild && HasAttachments())
976 { 976 {
977 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); 977 m_log.DebugFormat(
978 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
979
978 // Resume scripts 980 // Resume scripts
979 Util.FireAndForget(delegate(object x) { 981 Util.FireAndForget(delegate(object x) {
980 foreach (SceneObjectGroup sog in m_attachments) 982 foreach (SceneObjectGroup sog in m_attachments)
@@ -1530,17 +1532,22 @@ namespace OpenSim.Region.Framework.Scenes
1530 bool DCFlagKeyPressed = false; 1532 bool DCFlagKeyPressed = false;
1531 Vector3 agent_control_v3 = Vector3.Zero; 1533 Vector3 agent_control_v3 = Vector3.Zero;
1532 1534
1533 bool oldflying = Flying; 1535 bool newFlying = actor.Flying;
1534 1536
1535 if (ForceFly) 1537 if (ForceFly)
1536 actor.Flying = true; 1538 newFlying = true;
1537 else if (FlyDisabled) 1539 else if (FlyDisabled)
1538 actor.Flying = false; 1540 newFlying = false;
1539 else 1541 else
1540 actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1542 newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1541 1543
1542 if (actor.Flying != oldflying) 1544 if (actor.Flying != newFlying)
1545 {
1546 // Note: ScenePresence.Flying is actually fetched from the physical actor
1547 // so setting PhysActor.Flying here also sets the ScenePresence's value.
1548 actor.Flying = newFlying;
1543 update_movementflag = true; 1549 update_movementflag = true;
1550 }
1544 1551
1545 if (ParentID == 0) 1552 if (ParentID == 0)
1546 { 1553 {
@@ -3627,13 +3634,16 @@ namespace OpenSim.Region.Framework.Scenes
3627 public List<SceneObjectGroup> GetAttachments(uint attachmentPoint) 3634 public List<SceneObjectGroup> GetAttachments(uint attachmentPoint)
3628 { 3635 {
3629 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(); 3636 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();
3630 3637
3631 lock (m_attachments) 3638 if (attachmentPoint >= 0)
3632 { 3639 {
3633 foreach (SceneObjectGroup so in m_attachments) 3640 lock (m_attachments)
3634 { 3641 {
3635 if (attachmentPoint == so.AttachmentPoint) 3642 foreach (SceneObjectGroup so in m_attachments)
3636 attachments.Add(so); 3643 {
3644 if (attachmentPoint == so.AttachmentPoint)
3645 attachments.Add(so);
3646 }
3637 } 3647 }
3638 } 3648 }
3639 3649
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 5758869..5faf131 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -141,7 +141,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
141 TestScene scene = new SceneHelpers().SetupScene(); 141 TestScene scene = new SceneHelpers().SetupScene();
142 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 142 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
143 143
144 scene.IncomingCloseAgent(sp.UUID); 144 scene.IncomingCloseAgent(sp.UUID, false);
145 145
146 Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); 146 Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
147 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); 147 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
index 44d2d45..9457ebb 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
@@ -50,9 +50,41 @@ using OpenSim.Tests.Common.Mock;
50namespace OpenSim.Region.Framework.Tests 50namespace OpenSim.Region.Framework.Tests
51{ 51{
52 [TestFixture] 52 [TestFixture]
53 public class UserInventoryTests 53 public class UserInventoryTests : OpenSimTestCase
54 { 54 {
55 [Test] 55 [Test]
56 public void TestCreateInventoryFolders()
57 {
58 TestHelpers.InMethod();
59// TestHelpers.EnableLogging();
60
61 // For this test both folders will have the same name which is legal in SL user inventories.
62 string foldersName = "f1";
63
64 Scene scene = new SceneHelpers().SetupScene();
65 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
66
67 UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName);
68
69 List<InventoryFolderBase> oneFolder
70 = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName);
71
72 Assert.That(oneFolder.Count, Is.EqualTo(1));
73 InventoryFolderBase firstRetrievedFolder = oneFolder[0];
74 Assert.That(firstRetrievedFolder.Name, Is.EqualTo(foldersName));
75
76 UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName);
77
78 List<InventoryFolderBase> twoFolders
79 = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName);
80
81 Assert.That(twoFolders.Count, Is.EqualTo(2));
82 Assert.That(twoFolders[0].Name, Is.EqualTo(foldersName));
83 Assert.That(twoFolders[1].Name, Is.EqualTo(foldersName));
84 Assert.That(twoFolders[0].ID, Is.Not.EqualTo(twoFolders[1].ID));
85 }
86
87 [Test]
56 public void TestGiveInventoryItem() 88 public void TestGiveInventoryItem()
57 { 89 {
58 TestHelpers.InMethod(); 90 TestHelpers.InMethod();
@@ -83,7 +115,7 @@ namespace OpenSim.Region.Framework.Tests
83 public void TestGiveInventoryFolder() 115 public void TestGiveInventoryFolder()
84 { 116 {
85 TestHelpers.InMethod(); 117 TestHelpers.InMethod();
86// log4net.Config.XmlConfigurator.Configure(); 118// TestHelpers.EnableLogging();
87 119
88 Scene scene = new SceneHelpers().SetupScene(); 120 Scene scene = new SceneHelpers().SetupScene();
89 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); 121 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));