aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs (renamed from OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs)21
-rw-r--r--OpenSim/Region/Framework/Interfaces/IXmlRpcRouter.cs1
-rw-r--r--OpenSim/Region/Framework/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs57
-rw-r--r--OpenSim/Region/Framework/Scenes/EntityManager.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs69
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs36
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs464
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs62
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs126
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs50
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs46
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs91
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs119
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs107
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs101
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs83
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs43
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs10
37 files changed, 775 insertions, 782 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
index da39e95..cc7885a 100644
--- a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
@@ -35,8 +35,10 @@ namespace OpenSim.Region.Framework.Interfaces
35 35
36 public interface IJsonStoreModule 36 public interface IJsonStoreModule
37 { 37 {
38 bool AttachObjectStore(UUID objectID);
38 bool CreateStore(string value, ref UUID result); 39 bool CreateStore(string value, ref UUID result);
39 bool DestroyStore(UUID storeID); 40 bool DestroyStore(UUID storeID);
41 bool TestStore(UUID storeID);
40 bool TestPath(UUID storeID, string path, bool useJson); 42 bool TestPath(UUID storeID, string path, bool useJson);
41 bool SetValue(UUID storeID, string path, string value, bool useJson); 43 bool SetValue(UUID storeID, string path, string value, bool useJson);
42 bool RemoveValue(UUID storeID, string path); 44 bool RemoveValue(UUID storeID, string path);
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs
index 812a21c..c5e678b 100644
--- a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs
@@ -9,7 +9,7 @@
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
@@ -25,14 +25,19 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28//TODO: WHERE TO PLACE THIS? 28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes;
29 33
30namespace OpenSim.Region.Framework.Scenes.Scripting 34namespace OpenSim.Region.Framework.Interfaces
31{ 35{
32 public interface ScriptEngineInterface 36 public interface ISceneCommandsModule
33 { 37 {
34 void InitializeEngine(Scene Sceneworld); 38 /// <summary>
35 void Shutdown(); 39 /// Sets the scene debug options.
36// void StartScript(string ScriptID, IScriptHost ObjectID); 40 /// </summary>
41 void SetSceneDebugOptions(Dictionary<string, string> options);
37 } 42 }
38} 43} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IXmlRpcRouter.cs b/OpenSim/Region/Framework/Interfaces/IXmlRpcRouter.cs
index 6db6674..093d3f0 100644
--- a/OpenSim/Region/Framework/Interfaces/IXmlRpcRouter.cs
+++ b/OpenSim/Region/Framework/Interfaces/IXmlRpcRouter.cs
@@ -34,5 +34,6 @@ namespace OpenSim.Region.Framework.Interfaces
34 void RegisterNewReceiver(IScriptModule scriptEngine, UUID channelID, UUID objectID, UUID itemID, string url); 34 void RegisterNewReceiver(IScriptModule scriptEngine, UUID channelID, UUID objectID, UUID itemID, string url);
35 void ScriptRemoved(UUID itemID); 35 void ScriptRemoved(UUID itemID);
36 void ObjectRemoved(UUID objectID); 36 void ObjectRemoved(UUID objectID);
37 void UnRegisterReceiver(string channelID, UUID itemID);
37 } 38 }
38} 39}
diff --git a/OpenSim/Region/Framework/Properties/AssemblyInfo.cs b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs
index 9b504c0..2a5828e 100644
--- a/OpenSim/Region/Framework/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.7.5.*")] 32[assembly: AssemblyVersion("0.7.6.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
index 65ae445..66edfed 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
@@ -87,13 +87,24 @@ namespace OpenSim.Region.Framework.Scenes.Animation
87 return false; 87 return false;
88 } 88 }
89 89
90 public bool Remove(UUID animID) 90 /// <summary>
91 /// Remove the specified animation
92 /// </summary>
93 /// <param name='animID'></param>
94 /// <param name='allowNoDefault'>
95 /// If true, then the default animation can be entirely removed.
96 /// If false, then removing the default animation will reset it to the simulator default (currently STAND).
97 /// </param>
98 public bool Remove(UUID animID, bool allowNoDefault)
91 { 99 {
92 lock (m_animations) 100 lock (m_animations)
93 { 101 {
94 if (m_defaultAnimation.AnimID == animID) 102 if (m_defaultAnimation.AnimID == animID)
95 { 103 {
96 m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero); 104 if (allowNoDefault)
105 m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero);
106 else
107 ResetDefaultAnimation();
97 } 108 }
98 else if (HasAnimation(animID)) 109 else if (HasAnimation(animID))
99 { 110 {
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 9458079..65c279e 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -26,9 +26,10 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Threading;
30using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Linq;
31using System.Reflection; 31using System.Reflection;
32using System.Threading;
32using log4net; 33using log4net;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -86,6 +87,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
86 return; 87 return;
87 88
88 // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); 89 // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
90 if (m_scenePresence.Scene.DebugAnimations)
91 m_log.DebugFormat(
92 "[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}",
93 GetAnimName(animID), animID, m_scenePresence.Name);
89 94
90 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) 95 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
91 SendAnimPack(); 96 SendAnimPack();
@@ -108,12 +113,25 @@ namespace OpenSim.Region.Framework.Scenes.Animation
108 AddAnimation(animID, objectID); 113 AddAnimation(animID, objectID);
109 } 114 }
110 115
111 public void RemoveAnimation(UUID animID) 116 /// <summary>
117 /// Remove the specified animation
118 /// </summary>
119 /// <param name='animID'></param>
120 /// <param name='allowNoDefault'>
121 /// If true, then the default animation can be entirely removed.
122 /// If false, then removing the default animation will reset it to the simulator default (currently STAND).
123 /// </param>
124 public void RemoveAnimation(UUID animID, bool allowNoDefault)
112 { 125 {
113 if (m_scenePresence.IsChildAgent) 126 if (m_scenePresence.IsChildAgent)
114 return; 127 return;
115 128
116 if (m_animations.Remove(animID)) 129 if (m_scenePresence.Scene.DebugAnimations)
130 m_log.DebugFormat(
131 "[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}",
132 GetAnimName(animID), animID, m_scenePresence.Name);
133
134 if (m_animations.Remove(animID, allowNoDefault))
117 SendAnimPack(); 135 SendAnimPack();
118 } 136 }
119 137
@@ -127,7 +145,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
127 if (addRemove) 145 if (addRemove)
128 m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero); 146 m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero);
129 else 147 else
130 m_animations.Remove(animID); 148 m_animations.Remove(animID, true);
131 } 149 }
132 if(sendPack) 150 if(sendPack)
133 SendAnimPack(); 151 SendAnimPack();
@@ -145,14 +163,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
145 if (animID == UUID.Zero) 163 if (animID == UUID.Zero)
146 return; 164 return;
147 165
148 RemoveAnimation(animID); 166 RemoveAnimation(animID, true);
149 } 167 }
150 168
151 public void ResetAnimations() 169 public void ResetAnimations()
152 { 170 {
153// m_log.DebugFormat( 171 if (m_scenePresence.Scene.DebugAnimations)
154// "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}", 172 m_log.DebugFormat(
155// m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName); 173 "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}",
174 m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName);
156 175
157 m_animations.Clear(); 176 m_animations.Clear();
158 } 177 }
@@ -519,6 +538,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation
519 if (m_scenePresence.IsChildAgent) 538 if (m_scenePresence.IsChildAgent)
520 return; 539 return;
521 540
541// m_log.DebugFormat(
542// "[SCENE PRESENCE ANIMATOR]: Sending anim pack with animations '{0}', sequence '{1}', uuids '{2}'",
543// string.Join(",", Array.ConvertAll<UUID, string>(animations, a => a.ToString())),
544// string.Join(",", Array.ConvertAll<int, string>(seqs, s => s.ToString())),
545// string.Join(",", Array.ConvertAll<UUID, string>(objectIDs, o => o.ToString())));
546
522 m_scenePresence.Scene.ForEachClient( 547 m_scenePresence.Scene.ForEachClient(
523 delegate(IClientAPI client) 548 delegate(IClientAPI client)
524 { 549 {
@@ -557,5 +582,21 @@ namespace OpenSim.Region.Framework.Scenes.Animation
557 582
558 SendAnimPack(animIDs, sequenceNums, objectIDs); 583 SendAnimPack(animIDs, sequenceNums, objectIDs);
559 } 584 }
585
586 public string GetAnimName(UUID animId)
587 {
588 string animName;
589
590 if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName))
591 {
592 AssetMetadata amd = m_scenePresence.Scene.AssetService.GetMetadata(animId.ToString());
593 if (amd != null)
594 animName = amd.Name;
595 else
596 animName = "Unknown";
597 }
598
599 return animName;
600 }
560 } 601 }
561} 602}
diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs
index b788a3c..7181313 100644
--- a/OpenSim/Region/Framework/Scenes/EntityManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework;
34 35
35namespace OpenSim.Region.Framework.Scenes 36namespace OpenSim.Region.Framework.Scenes
36{ 37{
@@ -38,7 +39,8 @@ namespace OpenSim.Region.Framework.Scenes
38 { 39 {
39// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 40// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 41
41 private readonly DoubleDictionary<UUID, uint, EntityBase> m_entities = new DoubleDictionary<UUID, uint, EntityBase>(); 42 private readonly DoubleDictionaryThreadAbortSafe<UUID, uint, EntityBase> m_entities
43 = new DoubleDictionaryThreadAbortSafe<UUID, uint, EntityBase>();
42 44
43 public int Count 45 public int Count
44 { 46 {
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 5b1c9f4..052a05e 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -550,6 +550,20 @@ namespace OpenSim.Region.Framework.Scenes
550 /// </remarks> 550 /// </remarks>
551 public event ScriptControlEvent OnScriptControlEvent; 551 public event ScriptControlEvent OnScriptControlEvent;
552 552
553 public delegate void ScriptMovingStartEvent(uint localID);
554
555 /// <summary>
556 /// TODO: Should be triggered when a physics object starts moving.
557 /// </summary>
558 public event ScriptMovingStartEvent OnScriptMovingStartEvent;
559
560 public delegate void ScriptMovingEndEvent(uint localID);
561
562 /// <summary>
563 /// TODO: Should be triggered when a physics object stops moving.
564 /// </summary>
565 public event ScriptMovingEndEvent OnScriptMovingEndEvent;
566
553 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); 567 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
554 568
555 /// <summary> 569 /// <summary>
@@ -755,7 +769,7 @@ namespace OpenSim.Region.Framework.Scenes
755 public event ScriptTimerEvent OnScriptTimerEvent; 769 public event ScriptTimerEvent OnScriptTimerEvent;
756 */ 770 */
757 771
758 public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); 772 public delegate void EstateToolsSunUpdate(ulong regionHandle);
759 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); 773 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
760 774
761 public event EstateToolsSunUpdate OnEstateToolsSunUpdate; 775 public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
@@ -2238,6 +2252,48 @@ namespace OpenSim.Region.Framework.Scenes
2238 } 2252 }
2239 } 2253 }
2240 2254
2255 public void TriggerMovingStartEvent(uint localID)
2256 {
2257 ScriptMovingStartEvent handlerScriptMovingStartEvent = OnScriptMovingStartEvent;
2258 if (handlerScriptMovingStartEvent != null)
2259 {
2260 foreach (ScriptMovingStartEvent d in handlerScriptMovingStartEvent.GetInvocationList())
2261 {
2262 try
2263 {
2264 d(localID);
2265 }
2266 catch (Exception e)
2267 {
2268 m_log.ErrorFormat(
2269 "[EVENT MANAGER]: Delegate for TriggerMovingStartEvent failed - continuing. {0} {1}",
2270 e.Message, e.StackTrace);
2271 }
2272 }
2273 }
2274 }
2275
2276 public void TriggerMovingEndEvent(uint localID)
2277 {
2278 ScriptMovingEndEvent handlerScriptMovingEndEvent = OnScriptMovingEndEvent;
2279 if (handlerScriptMovingEndEvent != null)
2280 {
2281 foreach (ScriptMovingEndEvent d in handlerScriptMovingEndEvent.GetInvocationList())
2282 {
2283 try
2284 {
2285 d(localID);
2286 }
2287 catch (Exception e)
2288 {
2289 m_log.ErrorFormat(
2290 "[EVENT MANAGER]: Delegate for TriggerMovingEndEvent failed - continuing. {0} {1}",
2291 e.Message, e.StackTrace);
2292 }
2293 }
2294 }
2295 }
2296
2241 public void TriggerRequestChangeWaterHeight(float height) 2297 public void TriggerRequestChangeWaterHeight(float height)
2242 { 2298 {
2243 if (height < 0) 2299 if (height < 0)
@@ -2536,13 +2592,10 @@ namespace OpenSim.Region.Framework.Scenes
2536 } 2592 }
2537 2593
2538 /// <summary> 2594 /// <summary>
2539 /// Updates the system as to how the position of the sun should be handled. 2595 /// Called when the sun's position parameters have changed in the Region and/or Estate
2540 /// </summary> 2596 /// </summary>
2541 /// <param name="regionHandle"></param> 2597 /// <param name="regionHandle">The region that changed</param>
2542 /// <param name="FixedTime">True if the Sun Position is fixed</param> 2598 public void TriggerEstateToolsSunUpdate(ulong regionHandle)
2543 /// <param name="useEstateTime">True if the Estate Settings should be used instead of region</param>
2544 /// <param name="FixedSunHour">The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1</param>
2545 public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour)
2546 { 2599 {
2547 EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; 2600 EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate;
2548 if (handlerEstateToolsSunUpdate != null) 2601 if (handlerEstateToolsSunUpdate != null)
@@ -2551,7 +2604,7 @@ namespace OpenSim.Region.Framework.Scenes
2551 { 2604 {
2552 try 2605 try
2553 { 2606 {
2554 d(regionHandle, FixedTime, useEstateTime, FixedSunHour); 2607 d(regionHandle);
2555 } 2608 }
2556 catch (Exception e) 2609 catch (Exception e)
2557 { 2610 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4130029..a9e1fc2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -684,12 +684,10 @@ namespace OpenSim.Region.Framework.Scenes
684 itemCopy.SalePrice = item.SalePrice; 684 itemCopy.SalePrice = item.SalePrice;
685 itemCopy.SaleType = item.SaleType; 685 itemCopy.SaleType = item.SaleType;
686 686
687 if (AddInventoryItem(itemCopy)) 687 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
688 { 688 if (invAccess != null)
689 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); 689 invAccess.TransferInventoryAssets(itemCopy, senderId, recipient);
690 if (invAccess != null) 690 AddInventoryItem(itemCopy);
691 Util.FireAndForget(delegate { invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); });
692 }
693 691
694 if (!Permissions.BypassPermissions()) 692 if (!Permissions.BypassPermissions())
695 { 693 {
@@ -1786,6 +1784,21 @@ namespace OpenSim.Region.Framework.Scenes
1786 /// <returns>The part where the script was rezzed if successful. False otherwise.</returns> 1784 /// <returns>The part where the script was rezzed if successful. False otherwise.</returns>
1787 public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase) 1785 public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase)
1788 { 1786 {
1787 return RezNewScript(
1788 agentID,
1789 itemBase,
1790 "default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}");
1791 }
1792
1793 /// <summary>
1794 /// Rez a new script from nothing with given script text.
1795 /// </summary>
1796 /// <param name="remoteClient"></param>
1797 /// <param name="itemBase">Template item.</param>
1798 /// <param name="scriptText"></param>
1799 /// <returns>The part where the script was rezzed if successful. False otherwise.</returns>
1800 public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase, string scriptText)
1801 {
1789 // The part ID is the folder ID! 1802 // The part ID is the folder ID!
1790 SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); 1803 SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
1791 if (part == null) 1804 if (part == null)
@@ -1805,9 +1818,14 @@ namespace OpenSim.Region.Framework.Scenes
1805 return null; 1818 return null;
1806 } 1819 }
1807 1820
1808 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, 1821 AssetBase asset
1809 Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), 1822 = CreateAsset(
1810 agentID); 1823 itemBase.Name,
1824 itemBase.Description,
1825 (sbyte)itemBase.AssetType,
1826 Encoding.ASCII.GetBytes(scriptText),
1827 agentID);
1828
1811 AssetService.Store(asset); 1829 AssetService.Store(asset);
1812 1830
1813 TaskInventoryItem taskItem = new TaskInventoryItem(); 1831 TaskInventoryItem taskItem = new TaskInventoryItem();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e58aadc..c757147 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -68,14 +68,84 @@ namespace OpenSim.Region.Framework.Scenes
68 public bool EmergencyMonitoring = false; 68 public bool EmergencyMonitoring = false;
69 69
70 /// <summary> 70 /// <summary>
71 /// Show debug information about animations.
72 /// </summary>
73 public bool DebugAnimations { get; set; }
74
75 /// <summary>
71 /// Show debug information about teleports. 76 /// Show debug information about teleports.
72 /// </summary> 77 /// </summary>
73 public bool DebugTeleporting { get; private set; } 78 public bool DebugTeleporting { get; set; }
74 79
75 /// <summary> 80 /// <summary>
76 /// Show debug information about the scene loop. 81 /// Show debug information about the scene loop.
77 /// </summary> 82 /// </summary>
78 public bool DebugUpdates { get; private set; } 83 public bool DebugUpdates { get; set; }
84
85 /// <summary>
86 /// If true then the scene is saved to persistent storage periodically, every m_update_backup frames and
87 /// if objects meet required conditions (m_dontPersistBefore and m_dontPersistAfter).
88 /// </summary>
89 /// <remarks>
90 /// Even if false, the scene will still be saved on clean shutdown.
91 /// FIXME: Currently, setting this to false will mean that objects are not periodically returned from parcels.
92 /// This needs to be fixed.
93 /// </remarks>
94 public bool PeriodicBackup { get; set; }
95
96 /// <summary>
97 /// If false then the scene is never saved to persistence storage even if PeriodicBackup == true and even
98 /// if the scene is being shut down for the final time.
99 /// </summary>
100 public bool UseBackup { get; set; }
101
102 /// <summary>
103 /// If false then physical objects are disabled, though collisions will continue as normal.
104 /// </summary>
105 public bool PhysicsEnabled { get; set; }
106
107 /// <summary>
108 /// If false then scripts are not enabled on the smiulator
109 /// </summary>
110 public bool ScriptsEnabled
111 {
112 get { return m_scripts_enabled; }
113 set
114 {
115 if (m_scripts_enabled != value)
116 {
117 if (!value)
118 {
119 m_log.Info("Stopping all Scripts in Scene");
120
121 EntityBase[] entities = Entities.GetEntities();
122 foreach (EntityBase ent in entities)
123 {
124 if (ent is SceneObjectGroup)
125 ((SceneObjectGroup)ent).RemoveScriptInstances(false);
126 }
127 }
128 else
129 {
130 m_log.Info("Starting all Scripts in Scene");
131
132 EntityBase[] entities = Entities.GetEntities();
133 foreach (EntityBase ent in entities)
134 {
135 if (ent is SceneObjectGroup)
136 {
137 SceneObjectGroup sog = (SceneObjectGroup)ent;
138 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
139 sog.ResumeScripts();
140 }
141 }
142 }
143
144 m_scripts_enabled = value;
145 }
146 }
147 }
148 private bool m_scripts_enabled;
79 149
80 public SynchronizeSceneHandler SynchronizeScene; 150 public SynchronizeSceneHandler SynchronizeScene;
81 151
@@ -284,8 +354,6 @@ namespace OpenSim.Region.Framework.Scenes
284 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); 354 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
285 private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>(); 355 private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>();
286 356
287 private bool m_physics_enabled = true;
288 private bool m_scripts_enabled = true;
289 private string m_defaultScriptEngine; 357 private string m_defaultScriptEngine;
290 358
291 /// <summary> 359 /// <summary>
@@ -348,7 +416,6 @@ namespace OpenSim.Region.Framework.Scenes
348 416
349 private Timer m_mapGenerationTimer = new Timer(); 417 private Timer m_mapGenerationTimer = new Timer();
350 private bool m_generateMaptiles; 418 private bool m_generateMaptiles;
351 private bool m_useBackup = true;
352 419
353 #endregion Fields 420 #endregion Fields
354 421
@@ -614,11 +681,6 @@ namespace OpenSim.Region.Framework.Scenes
614 get { return m_authenticateHandler; } 681 get { return m_authenticateHandler; }
615 } 682 }
616 683
617 public bool UseBackup
618 {
619 get { return m_useBackup; }
620 }
621
622 // an instance to the physics plugin's Scene object. 684 // an instance to the physics plugin's Scene object.
623 public PhysicsScene PhysicsScene 685 public PhysicsScene PhysicsScene
624 { 686 {
@@ -678,7 +740,6 @@ namespace OpenSim.Region.Framework.Scenes
678 public Scene(RegionInfo regInfo, AgentCircuitManager authen, 740 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
679 SceneCommunicationService sceneGridService, 741 SceneCommunicationService sceneGridService,
680 ISimulationDataService simDataService, IEstateDataService estateDataService, 742 ISimulationDataService simDataService, IEstateDataService estateDataService,
681 bool dumpAssetsToFile,
682 IConfigSource config, string simulatorVersion) 743 IConfigSource config, string simulatorVersion)
683 : this(regInfo) 744 : this(regInfo)
684 { 745 {
@@ -762,15 +823,20 @@ namespace OpenSim.Region.Framework.Scenes
762 // 823 //
763 // Out of memory 824 // Out of memory
764 // Operating system has killed the plugin 825 // Operating system has killed the plugin
765 m_sceneGraph.UnRecoverableError += RestartNow; 826 m_sceneGraph.UnRecoverableError
827 += () =>
828 {
829 m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name);
830 RestartNow();
831 };
766 832
767 RegisterDefaultSceneEvents(); 833 RegisterDefaultSceneEvents();
768 834
769 DumpAssetsToFile = dumpAssetsToFile; 835 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled
770 836 // better in the future.
771 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; 837 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
772 838
773 m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; 839 PhysicsEnabled = !RegionInfo.RegionSettings.DisablePhysics;
774 840
775 m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; 841 m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
776 842
@@ -778,141 +844,139 @@ namespace OpenSim.Region.Framework.Scenes
778 844
779 // Region config overrides global config 845 // Region config overrides global config
780 // 846 //
781 try 847 if (m_config.Configs["Startup"] != null)
782 { 848 {
783 if (m_config.Configs["Startup"] != null) 849 IConfig startupConfig = m_config.Configs["Startup"];
784 {
785 IConfig startupConfig = m_config.Configs["Startup"];
786 850
787 StartDisabled = startupConfig.GetBoolean("StartDisabled", false); 851 StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
788 852
789 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); 853 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
790 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); 854 UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
791 if (!m_useBackup) 855 if (!UseBackup)
792 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); 856 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
793 857
794 //Animation states 858 //Animation states
795 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 859 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
796 860
797 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 861 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
798 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 862 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
799 863
800 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); 864 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys);
801 if (RegionInfo.NonphysPrimMin > 0) 865 if (RegionInfo.NonphysPrimMin > 0)
802 { 866 {
803 m_minNonphys = RegionInfo.NonphysPrimMin; 867 m_minNonphys = RegionInfo.NonphysPrimMin;
804 } 868 }
805 869
806 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); 870 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
807 if (RegionInfo.NonphysPrimMax > 0) 871 if (RegionInfo.NonphysPrimMax > 0)
808 { 872 {
809 m_maxNonphys = RegionInfo.NonphysPrimMax; 873 m_maxNonphys = RegionInfo.NonphysPrimMax;
810 } 874 }
811 875
812 m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); 876 m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys);
813 if (RegionInfo.PhysPrimMin > 0) 877 if (RegionInfo.PhysPrimMin > 0)
814 { 878 {
815 m_minPhys = RegionInfo.PhysPrimMin; 879 m_minPhys = RegionInfo.PhysPrimMin;
816 } 880 }
817 881
818 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); 882 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
819 883
820 if (RegionInfo.PhysPrimMax > 0) 884 if (RegionInfo.PhysPrimMax > 0)
821 { 885 {
822 m_maxPhys = RegionInfo.PhysPrimMax; 886 m_maxPhys = RegionInfo.PhysPrimMax;
823 } 887 }
824 888
825 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); 889 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity);
826 if (RegionInfo.LinksetCapacity > 0) 890 if (RegionInfo.LinksetCapacity > 0)
827 { 891 {
828 m_linksetCapacity = RegionInfo.LinksetCapacity; 892 m_linksetCapacity = RegionInfo.LinksetCapacity;
829 } 893 }
830 894
831 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); 895 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
832 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); 896 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
833 897
834 // Here, if clamping is requested in either global or 898 // Here, if clamping is requested in either global or
835 // local config, it will be used 899 // local config, it will be used
836 // 900 //
837 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); 901 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize);
838 if (RegionInfo.ClampPrimSize) 902 if (RegionInfo.ClampPrimSize)
903 {
904 m_clampPrimSize = true;
905 }
906
907 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
908 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
909 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
910 m_dontPersistBefore =
911 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
912 m_dontPersistBefore *= 10000000;
913 m_persistAfter =
914 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
915 m_persistAfter *= 10000000;
916
917 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
918 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
919
920 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
921 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
922 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
923
924 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
925 if (m_generateMaptiles)
926 {
927 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
928 if (maptileRefresh != 0)
839 { 929 {
840 m_clampPrimSize = true; 930 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
931 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
932 m_mapGenerationTimer.AutoReset = true;
933 m_mapGenerationTimer.Start();
841 } 934 }
935 }
936 else
937 {
938 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
939 UUID tileID;
842 940
843 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); 941 if (tile != UUID.Zero.ToString() && UUID.TryParse(tile, out tileID))
844 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
845 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
846 m_dontPersistBefore =
847 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
848 m_dontPersistBefore *= 10000000;
849 m_persistAfter =
850 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
851 m_persistAfter *= 10000000;
852
853 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
854 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
855
856 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
857 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
858 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
859
860 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
861 if (m_generateMaptiles)
862 { 942 {
863 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); 943 RegionInfo.RegionSettings.TerrainImageID = tileID;
864 if (maptileRefresh != 0)
865 {
866 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
867 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
868 m_mapGenerationTimer.AutoReset = true;
869 m_mapGenerationTimer.Start();
870 }
871 } 944 }
872 else 945 else
873 { 946 {
874 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); 947 RegionInfo.RegionSettings.TerrainImageID = RegionInfo.MaptileStaticUUID;
875 UUID tileID; 948 m_log.InfoFormat("[SCENE]: Region {0}, maptile set to {1}", RegionInfo.RegionName, RegionInfo.MaptileStaticUUID.ToString());
876
877 if (UUID.TryParse(tile, out tileID))
878 {
879 RegionInfo.RegionSettings.TerrainImageID = tileID;
880 }
881 } 949 }
950 }
882 951
883 string grant = startupConfig.GetString("AllowedClients", String.Empty); 952 string grant = startupConfig.GetString("AllowedClients", String.Empty);
884 if (grant.Length > 0) 953 if (grant.Length > 0)
954 {
955 foreach (string viewer in grant.Split(','))
885 { 956 {
886 foreach (string viewer in grant.Split(',')) 957 m_AllowedViewers.Add(viewer.Trim().ToLower());
887 {
888 m_AllowedViewers.Add(viewer.Trim().ToLower());
889 }
890 } 958 }
959 }
891 960
892 grant = startupConfig.GetString("BannedClients", String.Empty); 961 grant = startupConfig.GetString("BannedClients", String.Empty);
893 if (grant.Length > 0) 962 if (grant.Length > 0)
963 {
964 foreach (string viewer in grant.Split(','))
894 { 965 {
895 foreach (string viewer in grant.Split(',')) 966 m_BannedViewers.Add(viewer.Trim().ToLower());
896 {
897 m_BannedViewers.Add(viewer.Trim().ToLower());
898 }
899 } 967 }
900
901 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
902 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
903 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
904 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
905 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
906 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
907 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
908 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
909 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
910 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
911 } 968 }
912 } 969
913 catch (Exception e) 970 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
914 { 971 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
915 m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); 972 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
973 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
974 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
975 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
976 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
977 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
978 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
979 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
916 } 980 }
917 981
918 // FIXME: Ultimately this should be in a module. 982 // FIXME: Ultimately this should be in a module.
@@ -965,6 +1029,10 @@ namespace OpenSim.Region.Framework.Scenes
965 { 1029 {
966 PhysicalPrims = true; 1030 PhysicalPrims = true;
967 CollidablePrims = true; 1031 CollidablePrims = true;
1032 PhysicsEnabled = true;
1033
1034 PeriodicBackup = true;
1035 UseBackup = true;
968 1036
969 BordersLocked = true; 1037 BordersLocked = true;
970 Border northBorder = new Border(); 1038 Border northBorder = new Border();
@@ -1207,83 +1275,6 @@ namespace OpenSim.Region.Framework.Scenes
1207 } 1275 }
1208 } 1276 }
1209 1277
1210 public void SetSceneCoreDebug(Dictionary<string, string> options)
1211 {
1212 if (options.ContainsKey("active"))
1213 {
1214 bool active;
1215
1216 if (bool.TryParse(options["active"], out active))
1217 Active = active;
1218 }
1219
1220 if (options.ContainsKey("scripting"))
1221 {
1222 bool enableScripts = true;
1223 if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts)
1224 {
1225 if (!enableScripts)
1226 {
1227 m_log.Info("Stopping all Scripts in Scene");
1228
1229 EntityBase[] entities = Entities.GetEntities();
1230 foreach (EntityBase ent in entities)
1231 {
1232 if (ent is SceneObjectGroup)
1233 ((SceneObjectGroup)ent).RemoveScriptInstances(false);
1234 }
1235 }
1236 else
1237 {
1238 m_log.Info("Starting all Scripts in Scene");
1239
1240 EntityBase[] entities = Entities.GetEntities();
1241 foreach (EntityBase ent in entities)
1242 {
1243 if (ent is SceneObjectGroup)
1244 {
1245 SceneObjectGroup sog = (SceneObjectGroup)ent;
1246 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
1247 sog.ResumeScripts();
1248 }
1249 }
1250 }
1251
1252 m_scripts_enabled = enableScripts;
1253 }
1254 }
1255
1256 if (options.ContainsKey("physics"))
1257 {
1258 bool enablePhysics;
1259 if (bool.TryParse(options["physics"], out enablePhysics))
1260 m_physics_enabled = enablePhysics;
1261 }
1262
1263// if (options.ContainsKey("collisions"))
1264// {
1265// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow
1266// // the avatar themselves to collide with the ground.
1267// }
1268
1269 if (options.ContainsKey("teleport"))
1270 {
1271 bool enableTeleportDebugging;
1272 if (bool.TryParse(options["teleport"], out enableTeleportDebugging))
1273 DebugTeleporting = enableTeleportDebugging;
1274 }
1275
1276 if (options.ContainsKey("updates"))
1277 {
1278 bool enableUpdateDebugging;
1279 if (bool.TryParse(options["updates"], out enableUpdateDebugging))
1280 {
1281 DebugUpdates = enableUpdateDebugging;
1282 GcNotify.Enabled = DebugUpdates;
1283 }
1284 }
1285 }
1286
1287 public int GetInaccurateNeighborCount() 1278 public int GetInaccurateNeighborCount()
1288 { 1279 {
1289 return m_neighbours.Count; 1280 return m_neighbours.Count;
@@ -1332,16 +1323,7 @@ namespace OpenSim.Region.Framework.Scenes
1332 1323
1333 m_log.Debug("[SCENE]: Persisting changed objects"); 1324 m_log.Debug("[SCENE]: Persisting changed objects");
1334 1325
1335 EntityBase[] entities = GetEntities(); 1326 Backup(false);
1336 foreach (EntityBase entity in entities)
1337 {
1338 if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
1339 {
1340 ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false);
1341 }
1342 }
1343
1344 m_log.Debug("[SCENE]: Graph close");
1345 m_sceneGraph.Close(); 1327 m_sceneGraph.Close();
1346 1328
1347 if (!GridService.DeregisterRegion(RegionInfo.RegionID)) 1329 if (!GridService.DeregisterRegion(RegionInfo.RegionID))
@@ -1568,7 +1550,7 @@ namespace OpenSim.Region.Framework.Scenes
1568 } 1550 }
1569 1551
1570 tmpMS = Util.EnvironmentTickCount(); 1552 tmpMS = Util.EnvironmentTickCount();
1571 if ((Frame % m_update_physics == 0) && m_physics_enabled) 1553 if (PhysicsEnabled && Frame % m_update_physics == 0)
1572 m_sceneGraph.UpdatePreparePhysics(); 1554 m_sceneGraph.UpdatePreparePhysics();
1573 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); 1555 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
1574 1556
@@ -1583,7 +1565,7 @@ namespace OpenSim.Region.Framework.Scenes
1583 tmpMS = Util.EnvironmentTickCount(); 1565 tmpMS = Util.EnvironmentTickCount();
1584 if (Frame % m_update_physics == 0) 1566 if (Frame % m_update_physics == 0)
1585 { 1567 {
1586 if (m_physics_enabled) 1568 if (PhysicsEnabled)
1587 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); 1569 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
1588 1570
1589 if (SynchronizeScene != null) 1571 if (SynchronizeScene != null)
@@ -1625,7 +1607,7 @@ namespace OpenSim.Region.Framework.Scenes
1625 eventMS = Util.EnvironmentTickCountSubtract(tmpMS); 1607 eventMS = Util.EnvironmentTickCountSubtract(tmpMS);
1626 } 1608 }
1627 1609
1628 if (Frame % m_update_backup == 0) 1610 if (PeriodicBackup && Frame % m_update_backup == 0)
1629 { 1611 {
1630 tmpMS = Util.EnvironmentTickCount(); 1612 tmpMS = Util.EnvironmentTickCount();
1631 UpdateStorageBackup(); 1613 UpdateStorageBackup();
@@ -4709,19 +4691,6 @@ namespace OpenSim.Region.Framework.Scenes
4709 4691
4710 #region Script Engine 4692 #region Script Engine
4711 4693
4712 private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>();
4713 public bool DumpAssetsToFile;
4714
4715 /// <summary>
4716 ///
4717 /// </summary>
4718 /// <param name="scriptEngine"></param>
4719 public void AddScriptEngine(ScriptEngineInterface scriptEngine)
4720 {
4721 ScriptEngines.Add(scriptEngine);
4722 scriptEngine.InitializeEngine(this);
4723 }
4724
4725 private bool ScriptDanger(SceneObjectPart part,Vector3 pos) 4694 private bool ScriptDanger(SceneObjectPart part,Vector3 pos)
4726 { 4695 {
4727 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); 4696 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
@@ -5628,33 +5597,7 @@ Environment.Exit(1);
5628 5597
5629 public void TriggerEstateSunUpdate() 5598 public void TriggerEstateSunUpdate()
5630 { 5599 {
5631 float sun; 5600 EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle);
5632 if (RegionInfo.RegionSettings.UseEstateSun)
5633 {
5634 sun = (float)RegionInfo.EstateSettings.SunPosition;
5635 if (RegionInfo.EstateSettings.UseGlobalTime)
5636 {
5637 sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f;
5638 }
5639
5640 //
5641 EventManager.TriggerEstateToolsSunUpdate(
5642 RegionInfo.RegionHandle,
5643 RegionInfo.EstateSettings.FixedSun,
5644 RegionInfo.RegionSettings.UseEstateSun,
5645 sun);
5646 }
5647 else
5648 {
5649 // Use the Sun Position from the Region Settings
5650 sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f;
5651
5652 EventManager.TriggerEstateToolsSunUpdate(
5653 RegionInfo.RegionHandle,
5654 RegionInfo.RegionSettings.FixedSun,
5655 RegionInfo.RegionSettings.UseEstateSun,
5656 sun);
5657 }
5658 } 5601 }
5659 5602
5660 private void HandleReloadEstate(string module, string[] cmd) 5603 private void HandleReloadEstate(string module, string[] cmd)
@@ -6050,10 +5993,17 @@ Environment.Exit(1);
6050 GC.Collect(); 5993 GC.Collect();
6051 } 5994 }
6052 5995
6053 // Wrappers to get physics modules retrieve assets. Has to be done this way 5996 /// <summary>
6054 // because we can't assign the asset service to physics directly - at the 5997 /// Wrappers to get physics modules retrieve assets.
6055 // time physics are instantiated it's not registered but it will be by 5998 /// </summary>
6056 // the time the first prim exists. 5999 /// <remarks>
6000 /// Has to be done this way
6001 /// because we can't assign the asset service to physics directly - at the
6002 /// time physics are instantiated it's not registered but it will be by
6003 /// the time the first prim exists.
6004 /// </remarks>
6005 /// <param name="assetID"></param>
6006 /// <param name="callback"></param>
6057 public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback) 6007 public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback)
6058 { 6008 {
6059 AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived); 6009 AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index ed1bbd8..0f5d116 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -101,6 +101,15 @@ namespace OpenSim.Region.Framework.Scenes
101 /// </summary> 101 /// </summary>
102 public partial class SceneObjectGroup : EntityBase, ISceneObject 102 public partial class SceneObjectGroup : EntityBase, ISceneObject
103 { 103 {
104 // Axis selection bitmask used by SetAxisRotation()
105 // Just happen to be the same bits used by llSetStatus() and defined in ScriptBaseClass.
106 public enum axisSelect : int
107 {
108 STATUS_ROTATE_X = 0x002,
109 STATUS_ROTATE_Y = 0x004,
110 STATUS_ROTATE_Z = 0x008,
111 }
112
104 // private PrimCountTaintedDelegate handlerPrimCountTainted = null; 113 // private PrimCountTaintedDelegate handlerPrimCountTainted = null;
105 114
106 /// <summary> 115 /// <summary>
@@ -512,11 +521,19 @@ namespace OpenSim.Region.Framework.Scenes
512 521
513 if (Scene != null) 522 if (Scene != null)
514 { 523 {
515 // if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) 524 if (
516 // || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) 525 // (Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E)
517 // && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) 526 // || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
518 if ((Scene.TestBorderCross(val, Cardinals.E) || Scene.TestBorderCross(val, Cardinals.W) 527 // || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N)
519 || Scene.TestBorderCross(val, Cardinals.N) || Scene.TestBorderCross(val, Cardinals.S)) 528 // || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
529 // Experimental change for better border crossings.
530 // The commented out original lines above would, it seems, trigger
531 // a border crossing a little early or late depending on which
532 // direction the object was moving.
533 (Scene.TestBorderCross(val, Cardinals.E)
534 || Scene.TestBorderCross(val, Cardinals.W)
535 || Scene.TestBorderCross(val, Cardinals.N)
536 || Scene.TestBorderCross(val, Cardinals.S))
520 && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) 537 && !IsAttachmentCheckFull() && (!Scene.LoadingPrims))
521 { 538 {
522 IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 539 IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
@@ -935,6 +952,18 @@ namespace OpenSim.Region.Framework.Scenes
935 /// </remarks> 952 /// </remarks>
936 public UUID FromFolderID { get; set; } 953 public UUID FromFolderID { get; set; }
937 954
955 /// <summary>
956 /// IDs of all avatars sat on this scene object.
957 /// </summary>
958 /// <remarks>
959 /// We need this so that we can maintain a linkset wide ordering of avatars sat on different parts.
960 /// This must be locked before it is read or written.
961 /// SceneObjectPart sitting avatar add/remove code also locks on this object to avoid race conditions.
962 /// No avatar should appear more than once in this list.
963 /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart.
964 /// </remarks>
965 protected internal List<UUID> m_sittingAvatars = new List<UUID>();
966
938 #endregion 967 #endregion
939 968
940// ~SceneObjectGroup() 969// ~SceneObjectGroup()
@@ -4509,17 +4538,28 @@ namespace OpenSim.Region.Framework.Scenes
4509 } 4538 }
4510 4539
4511 /// <summary> 4540 /// <summary>
4541 /// Get a copy of the list of sitting avatars on all prims of this object.
4542 /// </summary>
4543 /// <remarks>
4544 /// This is sorted by the order in which avatars sat down. If an avatar stands up then all avatars that sat
4545 /// down after it move one place down the list.
4546 /// </remarks>
4547 /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns>
4548 public List<UUID> GetSittingAvatars()
4549 {
4550 lock (m_sittingAvatars)
4551 return new List<UUID>(m_sittingAvatars);
4552 }
4553
4554 /// <summary>
4512 /// Gets the number of sitting avatars. 4555 /// Gets the number of sitting avatars.
4513 /// </summary> 4556 /// </summary>
4514 /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> 4557 /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks>
4515 /// <returns></returns> 4558 /// <returns></returns>
4516 public int GetSittingAvatarsCount() 4559 public int GetSittingAvatarsCount()
4517 { 4560 {
4518 int count = 0; 4561 lock (m_sittingAvatars)
4519 4562 return m_sittingAvatars.Count;
4520 Array.ForEach<SceneObjectPart>(m_parts.GetArray(), p => count += p.GetSittingAvatarsCount());
4521
4522 return count;
4523 } 4563 }
4524 4564
4525 public override string ToString() 4565 public override string ToString()
@@ -4528,7 +4568,7 @@ namespace OpenSim.Region.Framework.Scenes
4528 } 4568 }
4529 4569
4530 #region ISceneObject 4570 #region ISceneObject
4531 4571
4532 public virtual ISceneObject CloneForNewScene() 4572 public virtual ISceneObject CloneForNewScene()
4533 { 4573 {
4534 SceneObjectGroup sog = Copy(false); 4574 SceneObjectGroup sog = Copy(false);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0d2da03..415a82b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -37,6 +37,7 @@ using System.Xml.Serialization;
37using log4net; 37using log4net;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenMetaverse.Packets; 39using OpenMetaverse.Packets;
40using OpenMetaverse.StructuredData;
40using OpenSim.Framework; 41using OpenSim.Framework;
41using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes.Scripting; 43using OpenSim.Region.Framework.Scenes.Scripting;
@@ -116,7 +117,7 @@ namespace OpenSim.Region.Framework.Scenes
116 117
117 #endregion Enumerations 118 #endregion Enumerations
118 119
119 public class SceneObjectPart : IScriptHost, ISceneEntity 120 public class SceneObjectPart : ISceneEntity
120 { 121 {
121 /// <value> 122 /// <value>
122 /// Denote all sides of the prim 123 /// Denote all sides of the prim
@@ -136,6 +137,11 @@ namespace OpenSim.Region.Framework.Scenes
136 137
137 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 138 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
138 139
140 /// <summary>
141 /// Dynamic attributes can be created and deleted as required.
142 /// </summary>
143 public DAMap DynAttrs { get; set; }
144
139 /// <value> 145 /// <value>
140 /// Is this a root part? 146 /// Is this a root part?
141 /// </value> 147 /// </value>
@@ -386,6 +392,7 @@ namespace OpenSim.Region.Framework.Scenes
386 m_particleSystem = Utils.EmptyBytes; 392 m_particleSystem = Utils.EmptyBytes;
387 Rezzed = DateTime.UtcNow; 393 Rezzed = DateTime.UtcNow;
388 Description = String.Empty; 394 Description = String.Empty;
395 DynAttrs = new DAMap();
389 396
390 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, 397 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
391 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from 398 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
@@ -1342,7 +1349,7 @@ namespace OpenSim.Region.Framework.Scenes
1342 public UUID SitTargetAvatar { get; set; } 1349 public UUID SitTargetAvatar { get; set; }
1343 1350
1344 /// <summary> 1351 /// <summary>
1345 /// IDs of all avatars start on this object part. 1352 /// IDs of all avatars sat on this part.
1346 /// </summary> 1353 /// </summary>
1347 /// <remarks> 1354 /// <remarks>
1348 /// We need to track this so that we can stop sat upon prims from being attached. 1355 /// We need to track this so that we can stop sat upon prims from being attached.
@@ -2118,6 +2125,8 @@ namespace OpenSim.Region.Framework.Scenes
2118 // safeguard actual copy is done in sog.copy 2125 // safeguard actual copy is done in sog.copy
2119 dupe.KeyframeMotion = null; 2126 dupe.KeyframeMotion = null;
2120 2127
2128 dupe.DynAttrs.CopyFrom(DynAttrs);
2129
2121 if (userExposed) 2130 if (userExposed)
2122 { 2131 {
2123/* 2132/*
@@ -2431,11 +2440,11 @@ namespace OpenSim.Region.Framework.Scenes
2431 public int GetAxisRotation(int axis) 2440 public int GetAxisRotation(int axis)
2432 { 2441 {
2433 //Cannot use ScriptBaseClass constants as no referance to it currently. 2442 //Cannot use ScriptBaseClass constants as no referance to it currently.
2434 if (axis == 2)//STATUS_ROTATE_X 2443 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X)
2435 return STATUS_ROTATE_X; 2444 return STATUS_ROTATE_X;
2436 if (axis == 4)//STATUS_ROTATE_Y 2445 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y)
2437 return STATUS_ROTATE_Y; 2446 return STATUS_ROTATE_Y;
2438 if (axis == 8)//STATUS_ROTATE_Z 2447 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z)
2439 return STATUS_ROTATE_Z; 2448 return STATUS_ROTATE_Z;
2440 2449
2441 return 0; 2450 return 0;
@@ -2470,18 +2479,6 @@ namespace OpenSim.Region.Framework.Scenes
2470 return new Vector3(0, 0, 0); 2479 return new Vector3(0, 0, 0);
2471 2480
2472 return ParentGroup.GetGeometricCenter(); 2481 return ParentGroup.GetGeometricCenter();
2473
2474 /*
2475 PhysicsActor pa = PhysActor;
2476
2477 if (pa != null)
2478 {
2479 Vector3 vtmp = pa.CenterOfMass;
2480 return vtmp;
2481 }
2482 else
2483 return new Vector3(0, 0, 0);
2484 */
2485 } 2482 }
2486 2483
2487 public float GetMass() 2484 public float GetMass()
@@ -2895,11 +2892,14 @@ namespace OpenSim.Region.Framework.Scenes
2895 2892
2896 public void PhysicsOutOfBounds(Vector3 pos) 2893 public void PhysicsOutOfBounds(Vector3 pos)
2897 { 2894 {
2898 m_log.Error("[PHYSICS]: Physical Object went out of bounds."); 2895 // Note: This is only being called on the root prim at this time.
2896
2897 m_log.ErrorFormat(
2898 "[SCENE OBJECT PART]: Physical object {0}, localID {1} went out of bounds at {2} in {3}. Stopping at {4} and making non-physical.",
2899 Name, LocalId, pos, ParentGroup.Scene.Name, AbsolutePosition);
2899 2900
2900 RemFlag(PrimFlags.Physics); 2901 RemFlag(PrimFlags.Physics);
2901 DoPhysicsPropertyUpdate(false, true); 2902 DoPhysicsPropertyUpdate(false, true);
2902 //ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
2903 } 2903 }
2904 2904
2905 public void PhysicsRequestingTerseUpdate() 2905 public void PhysicsRequestingTerseUpdate()
@@ -3322,13 +3322,13 @@ namespace OpenSim.Region.Framework.Scenes
3322 ParentGroup.SetAxisRotation(axis, rotate); 3322 ParentGroup.SetAxisRotation(axis, rotate);
3323 3323
3324 //Cannot use ScriptBaseClass constants as no referance to it currently. 3324 //Cannot use ScriptBaseClass constants as no referance to it currently.
3325 if (axis == 2)//STATUS_ROTATE_X 3325 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0)
3326 STATUS_ROTATE_X = rotate; 3326 STATUS_ROTATE_X = rotate;
3327 3327
3328 if (axis == 4)//STATUS_ROTATE_Y 3328 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0)
3329 STATUS_ROTATE_Y = rotate; 3329 STATUS_ROTATE_Y = rotate;
3330 3330
3331 if (axis == 8)//STATUS_ROTATE_Z 3331 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0)
3332 STATUS_ROTATE_Z = rotate; 3332 STATUS_ROTATE_Z = rotate;
3333 } 3333 }
3334 3334
@@ -4235,6 +4235,7 @@ namespace OpenSim.Region.Framework.Scenes
4235 result.distance = distance2; 4235 result.distance = distance2;
4236 result.HitTF = true; 4236 result.HitTF = true;
4237 result.ipoint = q; 4237 result.ipoint = q;
4238 result.face = i;
4238 //m_log.Info("[FACE]:" + i.ToString()); 4239 //m_log.Info("[FACE]:" + i.ToString());
4239 //m_log.Info("[POINT]: " + q.ToString()); 4240 //m_log.Info("[POINT]: " + q.ToString());
4240 //m_log.Info("[DIST]: " + distance2.ToString()); 4241 //m_log.Info("[DIST]: " + distance2.ToString());
@@ -4558,7 +4559,7 @@ namespace OpenSim.Region.Framework.Scenes
4558 if (ParentGroup.RootPart == this) 4559 if (ParentGroup.RootPart == this)
4559 AngularVelocity = new Vector3(0, 0, 0); 4560 AngularVelocity = new Vector3(0, 0, 0);
4560 } 4561 }
4561 else 4562 else if (SetVD != wasVD)
4562 { 4563 {
4563 if (ParentGroup.Scene.CollidablePrims) 4564 if (ParentGroup.Scene.CollidablePrims)
4564 { 4565 {
@@ -4646,9 +4647,9 @@ namespace OpenSim.Region.Framework.Scenes
4646 PhysicsShapeType, 4647 PhysicsShapeType,
4647 m_localId); 4648 m_localId);
4648 } 4649 }
4649 catch (Exception ex) 4650 catch (Exception e)
4650 { 4651 {
4651 m_log.ErrorFormat("[SCENE]: AddToPhysics object {0} failed: {1}", m_uuid, ex.Message); 4652 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom. e={1}", m_uuid, e);
4652 pa = null; 4653 pa = null;
4653 } 4654 }
4654 4655
@@ -5202,18 +5203,22 @@ namespace OpenSim.Region.Framework.Scenes
5202 /// <param name='avatarId'></param> 5203 /// <param name='avatarId'></param>
5203 protected internal bool AddSittingAvatar(UUID avatarId) 5204 protected internal bool AddSittingAvatar(UUID avatarId)
5204 { 5205 {
5205 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) 5206 lock (ParentGroup.m_sittingAvatars)
5206 SitTargetAvatar = avatarId; 5207 {
5208 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
5209 SitTargetAvatar = avatarId;
5207 5210
5208 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5211 if (m_sittingAvatars == null)
5212 m_sittingAvatars = new HashSet<UUID>();
5209 5213
5210 if (sittingAvatars == null) 5214 if (m_sittingAvatars.Add(avatarId))
5211 sittingAvatars = new HashSet<UUID>(); 5215 {
5216 ParentGroup.m_sittingAvatars.Add(avatarId);
5212 5217
5213 lock (sittingAvatars) 5218 return true;
5214 { 5219 }
5215 m_sittingAvatars = sittingAvatars; 5220
5216 return m_sittingAvatars.Add(avatarId); 5221 return false;
5217 } 5222 }
5218 } 5223 }
5219 5224
@@ -5227,27 +5232,26 @@ namespace OpenSim.Region.Framework.Scenes
5227 /// <param name='avatarId'></param> 5232 /// <param name='avatarId'></param>
5228 protected internal bool RemoveSittingAvatar(UUID avatarId) 5233 protected internal bool RemoveSittingAvatar(UUID avatarId)
5229 { 5234 {
5230 if (SitTargetAvatar == avatarId) 5235 lock (ParentGroup.m_sittingAvatars)
5231 SitTargetAvatar = UUID.Zero; 5236 {
5232 5237 if (SitTargetAvatar == avatarId)
5233 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5238 SitTargetAvatar = UUID.Zero;
5234 5239
5235 // This can occur under a race condition where another thread 5240 if (m_sittingAvatars == null)
5236 if (sittingAvatars == null) 5241 return false;
5237 return false;
5238 5242
5239 lock (sittingAvatars) 5243 if (m_sittingAvatars.Remove(avatarId))
5240 {
5241 if (sittingAvatars.Remove(avatarId))
5242 { 5244 {
5243 if (sittingAvatars.Count == 0) 5245 if (m_sittingAvatars.Count == 0)
5244 m_sittingAvatars = null; 5246 m_sittingAvatars = null;
5245 5247
5248 ParentGroup.m_sittingAvatars.Remove(avatarId);
5249
5246 return true; 5250 return true;
5247 } 5251 }
5248 }
5249 5252
5250 return false; 5253 return false;
5254 }
5251 } 5255 }
5252 5256
5253 /// <summary> 5257 /// <summary>
@@ -5257,16 +5261,12 @@ namespace OpenSim.Region.Framework.Scenes
5257 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> 5261 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
5258 public HashSet<UUID> GetSittingAvatars() 5262 public HashSet<UUID> GetSittingAvatars()
5259 { 5263 {
5260 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5264 lock (ParentGroup.m_sittingAvatars)
5261
5262 if (sittingAvatars == null)
5263 { 5265 {
5264 return null; 5266 if (m_sittingAvatars == null)
5265 } 5267 return null;
5266 else 5268 else
5267 { 5269 return new HashSet<UUID>(m_sittingAvatars);
5268 lock (sittingAvatars)
5269 return new HashSet<UUID>(sittingAvatars);
5270 } 5270 }
5271 } 5271 }
5272 5272
@@ -5277,13 +5277,13 @@ namespace OpenSim.Region.Framework.Scenes
5277 /// <returns></returns> 5277 /// <returns></returns>
5278 public int GetSittingAvatarsCount() 5278 public int GetSittingAvatarsCount()
5279 { 5279 {
5280 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5280 lock (ParentGroup.m_sittingAvatars)
5281 5281 {
5282 if (sittingAvatars == null) 5282 if (m_sittingAvatars == null)
5283 return 0; 5283 return 0;
5284 5284 else
5285 lock (sittingAvatars) 5285 return m_sittingAvatars.Count;
5286 return sittingAvatars.Count; 5286 }
5287 } 5287 }
5288 } 5288 }
5289} 5289}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 91f9c0b..0bcf480 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -221,8 +221,6 @@ namespace OpenSim.Region.Framework.Scenes
221 221
222 private Quaternion m_headrotation = Quaternion.Identity; 222 private Quaternion m_headrotation = Quaternion.Identity;
223 223
224 private string m_nextSitAnimation = String.Empty;
225
226 //PauPaw:Proper PID Controler for autopilot************ 224 //PauPaw:Proper PID Controler for autopilot************
227 public bool MovingToTarget { get; private set; } 225 public bool MovingToTarget { get; private set; }
228 public Vector3 MoveToPositionTarget { get; private set; } 226 public Vector3 MoveToPositionTarget { get; private set; }
@@ -598,18 +596,18 @@ namespace OpenSim.Region.Framework.Scenes
598 set 596 set
599 { 597 {
600 m_bodyRot = value; 598 m_bodyRot = value;
601 // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot);
602 if (PhysicsActor != null) 599 if (PhysicsActor != null)
603 { 600 {
604 try 601 try
605 { 602 {
606 PhysicsActor.Orientation = value; 603 PhysicsActor.Orientation = m_bodyRot;
607 } 604 }
608 catch (Exception e) 605 catch (Exception e)
609 { 606 {
610 m_log.Error("[SCENE PRESENCE]: Orientation " + e.Message); 607 m_log.Error("[SCENE PRESENCE]: Orientation " + e.Message);
611 } 608 }
612 } 609 }
610// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot);
613 } 611 }
614 } 612 }
615 613
@@ -2322,28 +2320,16 @@ namespace OpenSim.Region.Framework.Scenes
2322 2320
2323 if (ParentID != 0) 2321 if (ParentID != 0)
2324 { 2322 {
2323 if (ParentPart.UUID == targetID)
2324 return; // already sitting here, ignore
2325
2325 StandUp(); 2326 StandUp();
2326 } 2327 }
2327 2328
2328// if (!String.IsNullOrEmpty(sitAnimation))
2329// {
2330// m_nextSitAnimation = sitAnimation;
2331// }
2332// else
2333// {
2334 m_nextSitAnimation = "SIT";
2335// }
2336
2337 //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
2338 SceneObjectPart part = FindNextAvailableSitTarget(targetID); 2329 SceneObjectPart part = FindNextAvailableSitTarget(targetID);
2339 2330
2340 if (part != null) 2331 if (part != null)
2341 { 2332 {
2342 if (!String.IsNullOrEmpty(part.SitAnimation))
2343 {
2344 m_nextSitAnimation = part.SitAnimation;
2345 }
2346
2347 m_requestedSitTargetID = part.LocalId; 2333 m_requestedSitTargetID = part.LocalId;
2348 m_requestedSitTargetUUID = targetID; 2334 m_requestedSitTargetUUID = targetID;
2349 2335
@@ -2464,18 +2450,6 @@ namespace OpenSim.Region.Framework.Scenes
2464 2450
2465 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) 2451 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)
2466 { 2452 {
2467 if (!String.IsNullOrEmpty(m_nextSitAnimation))
2468 {
2469 HandleAgentSit(remoteClient, agentID, m_nextSitAnimation);
2470 }
2471 else
2472 {
2473 HandleAgentSit(remoteClient, agentID, "SIT");
2474 }
2475 }
2476
2477 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID, string sitAnimation)
2478 {
2479 SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); 2453 SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2480 2454
2481 if (part != null) 2455 if (part != null)
@@ -2545,10 +2519,15 @@ namespace OpenSim.Region.Framework.Scenes
2545 2519
2546 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); 2520 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2547 ParentID = m_requestedSitTargetID; 2521 ParentID = m_requestedSitTargetID;
2548 2522 m_AngularVelocity = Vector3.Zero;
2549 Velocity = Vector3.Zero; 2523 Velocity = Vector3.Zero;
2550 RemoveFromPhysicalScene(); 2524 RemoveFromPhysicalScene();
2551 2525
2526 String sitAnimation = "SIT";
2527 if (!String.IsNullOrEmpty(part.SitAnimation))
2528 {
2529 sitAnimation = part.SitAnimation;
2530 }
2552 Animator.TrySetMovementAnimation(sitAnimation); 2531 Animator.TrySetMovementAnimation(sitAnimation);
2553 SendAvatarDataToAllAgents(); 2532 SendAvatarDataToAllAgents();
2554 } 2533 }
@@ -2556,7 +2535,8 @@ namespace OpenSim.Region.Framework.Scenes
2556 2535
2557 public void HandleAgentSitOnGround() 2536 public void HandleAgentSitOnGround()
2558 { 2537 {
2559// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. 2538// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick..
2539 m_AngularVelocity = Vector3.Zero;
2560 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); 2540 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
2561 SitGround = true; 2541 SitGround = true;
2562 RemoveFromPhysicalScene(); 2542 RemoveFromPhysicalScene();
@@ -2578,7 +2558,7 @@ namespace OpenSim.Region.Framework.Scenes
2578 2558
2579 public void HandleStopAnim(IClientAPI remoteClient, UUID animID) 2559 public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
2580 { 2560 {
2581 Animator.RemoveAnimation(animID); 2561 Animator.RemoveAnimation(animID, false);
2582 } 2562 }
2583 2563
2584 public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack) 2564 public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack)
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs
deleted file mode 100644
index f3be028..0000000
--- a/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Region.Framework.Scenes.Scripting
31{
32 public interface IScriptHost
33 {
34 string Name { get; set; }
35 string Description { get; set; }
36
37 UUID UUID { get; }
38 UUID OwnerID { get; }
39 UUID CreatorID { get; }
40 Vector3 AbsolutePosition { get; }
41
42 string SitName { get; set; }
43 string TouchName { get; set; }
44 void SetText(string text, Vector3 color, double alpha);
45 }
46}
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs
deleted file mode 100644
index d7198f0..0000000
--- a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30using log4net;
31using System.Reflection;
32using OpenSim.Framework;
33
34namespace OpenSim.Region.Framework.Scenes.Scripting
35{
36 public class NullScriptHost : IScriptHost
37 {
38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
40 private Vector3 m_pos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30);
41
42 public string Name
43 {
44 get { return "Object"; }
45 set { }
46 }
47
48 public string SitName
49 {
50 get { return String.Empty; }
51 set { }
52 }
53
54 public string TouchName
55 {
56 get { return String.Empty; }
57 set { }
58 }
59
60 public string Description
61 {
62 get { return String.Empty; }
63 set { }
64 }
65
66 public UUID UUID
67 {
68 get { return UUID.Zero; }
69 }
70
71 public UUID OwnerID
72 {
73 get { return UUID.Zero; }
74 }
75
76 public UUID CreatorID
77 {
78 get { return UUID.Zero; }
79 }
80
81 public Vector3 AbsolutePosition
82 {
83 get { return m_pos; }
84 }
85
86 public void SetText(string text, Vector3 color, double alpha)
87 {
88 m_log.Warn("Tried to SetText "+text+" on NullScriptHost");
89 }
90 }
91}
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs
deleted file mode 100644
index c58ccc5..0000000
--- a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30using System.IO;
31using System.Reflection;
32using log4net;
33
34namespace OpenSim.Region.Framework.Scenes.Scripting
35{
36 public class ScriptEngineLoader
37 {
38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
40 public ScriptEngineInterface LoadScriptEngine(string EngineName)
41 {
42 ScriptEngineInterface ret = null;
43 try
44 {
45 ret =
46 LoadAndInitAssembly(
47 Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
48 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
49 }
50 catch (Exception e)
51 {
52 m_log.Error("[ScriptEngine]: " +
53 "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
54 e.StackTrace.ToString());
55 }
56 return ret;
57 }
58
59 /// <summary>
60 /// Does actual loading and initialization of script Assembly
61 /// </summary>
62 /// <param name="FreeAppDomain">AppDomain to load script into</param>
63 /// <param name="FileName">FileName of script assembly (.dll)</param>
64 /// <returns></returns>
65 private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace)
66 {
67 //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName);
68 // Load .Net Assembly (.dll)
69 // Initialize and return it
70
71 // TODO: Add error handling
72
73 Assembly a;
74 //try
75 //{
76
77
78 // Load to default appdomain (temporary)
79 a = Assembly.LoadFrom(FileName);
80 // Load to specified appdomain
81 // TODO: Insert security
82 //a = FreeAppDomain.Load(FileName);
83 //}
84 //catch (Exception e)
85 //{
86 // m_log.Error("[ScriptEngine]: Error loading assembly \String.Empty + FileName + "\": " + e.ToString());
87 //}
88
89
90 //m_log.Debug("Loading: " + FileName);
91 //foreach (Type _t in a.GetTypes())
92 //{
93 // m_log.Debug("Type: " + _t.ToString());
94 //}
95
96 Type t;
97 //try
98 //{
99 t = a.GetType(NameSpace, true);
100 //}
101 //catch (Exception e)
102 //{
103 // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString());
104 //}
105
106 ScriptEngineInterface ret;
107 //try
108 //{
109 ret = (ScriptEngineInterface) Activator.CreateInstance(t);
110 //}
111 //catch (Exception e)
112 //{
113 // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString());
114 //}
115
116 return ret;
117 }
118 }
119}
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs
new file mode 100644
index 0000000..f08ba59
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs
@@ -0,0 +1,107 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Region.Framework.Scenes.Scripting
34{
35 /// <summary>
36 /// Utility functions for use by scripts manipulating the scene.
37 /// </summary>
38 public static class ScriptUtils
39 {
40 /// <summary>
41 /// Get an asset id given an item name and an item type.
42 /// </summary>
43 /// <returns>UUID.Zero if the name and type did not match any item.</returns>
44 /// <param name='part'></param>
45 /// <param name='name'></param>
46 /// <param name='type'></param>
47 public static UUID GetAssetIdFromItemName(SceneObjectPart part, string name, int type)
48 {
49 TaskInventoryItem item = part.Inventory.GetInventoryItem(name);
50
51 if (item != null && item.Type == type)
52 return item.AssetID;
53 else
54 return UUID.Zero;
55 }
56
57 /// <summary>
58 /// accepts a valid UUID, -or- a name of an inventory item.
59 /// Returns a valid UUID or UUID.Zero if key invalid and item not found
60 /// in prim inventory.
61 /// </summary>
62 /// <param name="part">Scene object part to search for inventory item</param>
63 /// <param name="key"></param>
64 /// <returns></returns>
65 public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier)
66 {
67 UUID key;
68
69 // if we can parse the string as a key, use it.
70 // else try to locate the name in inventory of object. found returns key,
71 // not found returns UUID.Zero
72 if (!UUID.TryParse(identifier, out key))
73 {
74 TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
75
76 if (item != null)
77 key = item.AssetID;
78 else
79 key = UUID.Zero;
80 }
81
82 return key;
83 }
84
85 /// <summary>
86 /// Return the UUID of the asset matching the specified key or name
87 /// and asset type.
88 /// </summary>
89 /// <param name="part">Scene object part to search for inventory item</param>
90 /// <param name="identifier"></param>
91 /// <param name="type"></param>
92 /// <returns></returns>
93 public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier, AssetType type)
94 {
95 UUID key;
96
97 if (!UUID.TryParse(identifier, out key))
98 {
99 TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
100 if (item != null && item.Type == (int)type)
101 key = item.AssetID;
102 }
103
104 return key;
105 }
106 }
107} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 2984782..ce4fb40 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -365,6 +365,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
365 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); 365 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound);
366 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); 366 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume);
367 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); 367 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
368 m_SOPXmlProcessors.Add("DynAttrs", ProcessDynAttrs);
368 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); 369 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
369 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); 370 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
370 m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0); 371 m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0);
@@ -797,6 +798,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
797 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); 798 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
798 } 799 }
799 800
801 private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader)
802 {
803 obj.DynAttrs.ReadXml(reader);
804 }
805
800 private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader) 806 private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader)
801 { 807 {
802 obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); 808 obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty));
@@ -1339,6 +1345,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1339 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1345 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
1340 if (sop.MediaUrl != null) 1346 if (sop.MediaUrl != null)
1341 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); 1347 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1348
1349 if (sop.DynAttrs.Count > 0)
1350 {
1351 writer.WriteStartElement("DynAttrs");
1352 sop.DynAttrs.WriteXml(writer);
1353 writer.WriteEndElement();
1354 }
1355
1342 WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); 1356 WriteBytes(writer, "TextureAnimation", sop.TextureAnimation);
1343 WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); 1357 WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
1344 writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString()); 1358 writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString());
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
index 4a21dc9..e209221 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
@@ -37,7 +37,7 @@ using OpenSim.Tests.Common;
37namespace OpenSim.Region.Framework.Scenes.Tests 37namespace OpenSim.Region.Framework.Scenes.Tests
38{ 38{
39 [TestFixture] 39 [TestFixture]
40 public class BorderTests 40 public class BorderTests : OpenSimTestCase
41 { 41 {
42 [Test] 42 [Test]
43 public void TestCross() 43 public void TestCross()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index ea9fc93..766ce83 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -41,7 +41,7 @@ using OpenSim.Tests.Common;
41namespace OpenSim.Region.Framework.Scenes.Tests 41namespace OpenSim.Region.Framework.Scenes.Tests
42{ 42{
43 [TestFixture, LongRunning] 43 [TestFixture, LongRunning]
44 public class EntityManagerTests 44 public class EntityManagerTests : OpenSimTestCase
45 { 45 {
46 static public Random random; 46 static public Random random;
47 SceneObjectGroup found; 47 SceneObjectGroup found;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index d23c965..575a081 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -40,7 +40,7 @@ using OpenSim.Tests.Common.Mock;
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 [TestFixture] 42 [TestFixture]
43 public class SceneGraphTests 43 public class SceneGraphTests : OpenSimTestCase
44 { 44 {
45 [Test] 45 [Test]
46 public void TestDuplicateObject() 46 public void TestDuplicateObject()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
index ab56f4e..2d831fa 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
@@ -41,7 +41,7 @@ using OpenSim.Tests.Common.Mock;
41namespace OpenSim.Region.Framework.Scenes.Tests 41namespace OpenSim.Region.Framework.Scenes.Tests
42{ 42{
43 [TestFixture] 43 [TestFixture]
44 public class SceneManagerTests 44 public class SceneManagerTests : OpenSimTestCase
45 { 45 {
46 [Test] 46 [Test]
47 public void TestClose() 47 public void TestClose()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 5b334c6..a07d64c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Threading; 31using System.Threading;
32using Nini.Config;
32using NUnit.Framework; 33using NUnit.Framework;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -182,6 +183,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
182 /// <summary> 183 /// <summary>
183 /// Test deleting an object from a scene. 184 /// Test deleting an object from a scene.
184 /// </summary> 185 /// </summary>
186 /// <remarks>
187 /// This is the most basic form of delete. For all more sophisticated forms of derez (done asynchrnously
188 /// and where object can be taken to user inventory, etc.), see SceneObjectDeRezTests.
189 /// </remarks>
185 [Test] 190 [Test]
186 public void TestDeleteSceneObject() 191 public void TestDeleteSceneObject()
187 { 192 {
@@ -201,100 +206,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
201 } 206 }
202 207
203 /// <summary> 208 /// <summary>
204 /// Test deleting an object asynchronously
205 /// </summary>
206 [Test]
207 public void TestDeleteSceneObjectAsync()
208 {
209 TestHelpers.InMethod();
210 //log4net.Config.XmlConfigurator.Configure();
211
212 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
213
214 TestScene scene = new SceneHelpers().SetupScene();
215
216 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
217 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
218 sogd.Enabled = false;
219
220 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene);
221
222 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
223 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
224
225 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
226
227 Assert.That(retrievedPart, Is.Not.Null);
228
229 Assert.That(so.IsDeleted, Is.False);
230
231 sogd.InventoryDeQueueAndDelete();
232
233 Assert.That(so.IsDeleted, Is.True);
234
235 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
236 Assert.That(retrievedPart2, Is.Null);
237 }
238
239 /// <summary>
240 /// Test deleting an object asynchronously to user inventory.
241 /// </summary>
242// [Test]
243 public void TestDeleteSceneObjectAsyncToUserInventory()
244 {
245 TestHelpers.InMethod();
246 TestHelpers.EnableLogging();
247
248 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
249 string myObjectName = "Fred";
250
251 TestScene scene = new SceneHelpers().SetupScene();
252
253 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
254 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
255 sogd.Enabled = false;
256
257 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
258
259// Assert.That(
260// scene.CommsManager.UserAdminService.AddUser(
261// "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
262// Is.EqualTo(agentId));
263
264 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
265 InventoryFolderBase folder1
266 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1");
267
268 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
269 scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
270
271 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
272
273 Assert.That(retrievedPart, Is.Not.Null);
274 Assert.That(so.IsDeleted, Is.False);
275
276 sogd.InventoryDeQueueAndDelete();
277
278 Assert.That(so.IsDeleted, Is.True);
279
280 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
281 Assert.That(retrievedPart2, Is.Null);
282
283// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
284
285 InventoryItemBase retrievedItem
286 = UserInventoryHelpers.GetInventoryItem(
287 scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName);
288
289 // Check that we now have the taken part in our inventory
290 Assert.That(retrievedItem, Is.Not.Null);
291
292 // Check that the taken part has actually disappeared
293// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
294// Assert.That(retrievedPart, Is.Null);
295 }
296
297 /// <summary>
298 /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not 209 /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not
299 /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by 210 /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by
300 /// OpenSim. 211 /// OpenSim.
@@ -329,4 +240,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
329 Assert.That(sog.Parts.Length, Is.EqualTo(2)); 240 Assert.That(sog.Parts.Length, Is.EqualTo(2));
330 } 241 }
331 } 242 }
332} 243} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 0076f41..c1522e7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -33,22 +33,24 @@ using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Framework.InventoryAccess;
36using OpenSim.Region.CoreModules.World.Permissions; 37using OpenSim.Region.CoreModules.World.Permissions;
37using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces;
38using OpenSim.Tests.Common; 40using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock; 41using OpenSim.Tests.Common.Mock;
40 42
41namespace OpenSim.Region.Framework.Scenes.Tests 43namespace OpenSim.Region.Framework.Scenes.Tests
42{ 44{
43 /// <summary> 45 /// <summary>
44 /// Tests derez of scene objects by users. 46 /// Tests derez of scene objects.
45 /// </summary> 47 /// </summary>
46 /// <remarks> 48 /// <remarks>
47 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. 49 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
48 /// TODO: These tests are very incomplete - they only test for a few conditions. 50 /// TODO: These tests are incomplete - need to test more kinds of derez (e.g. return object).
49 /// </remarks> 51 /// </remarks>
50 [TestFixture] 52 [TestFixture]
51 public class SceneObjectDeRezTests 53 public class SceneObjectDeRezTests : OpenSimTestCase
52 { 54 {
53 /// <summary> 55 /// <summary>
54 /// Test deleting an object from a scene. 56 /// Test deleting an object from a scene.
@@ -76,14 +78,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests
76 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); 78 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
77 part.Name = "obj1"; 79 part.Name = "obj1";
78 scene.AddNewSceneObject(new SceneObjectGroup(part), false); 80 scene.AddNewSceneObject(new SceneObjectGroup(part), false);
81
79 List<uint> localIds = new List<uint>(); 82 List<uint> localIds = new List<uint>();
80 localIds.Add(part.LocalId); 83 localIds.Add(part.LocalId);
81
82 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); 84 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
85
86 // Check that object isn't deleted until we crank the sogd handle.
87 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
88 Assert.That(retrievedPart, Is.Not.Null);
89 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
90
83 sogd.InventoryDeQueueAndDelete(); 91 sogd.InventoryDeQueueAndDelete();
84 92
85 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 93 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
86 Assert.That(retrievedPart, Is.Null); 94 Assert.That(retrievedPart2, Is.Null);
87 } 95 }
88 96
89 /// <summary> 97 /// <summary>
@@ -124,6 +132,67 @@ namespace OpenSim.Region.Framework.Scenes.Tests
124 // Object should still be in the scene. 132 // Object should still be in the scene.
125 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 133 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
126 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); 134 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
127 } 135 }
136
137 /// <summary>
138 /// Test deleting an object asynchronously to user inventory.
139 /// </summary>
140 [Test]
141 public void TestDeleteSceneObjectAsyncToUserInventory()
142 {
143 TestHelpers.InMethod();
144// TestHelpers.EnableLogging();
145
146 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
147 string myObjectName = "Fred";
148
149 TestScene scene = new SceneHelpers().SetupScene();
150
151 IConfigSource configSource = new IniConfigSource();
152 IConfig config = configSource.AddConfig("Modules");
153 config.Set("InventoryAccessModule", "BasicInventoryAccessModule");
154 SceneHelpers.SetupSceneModules(
155 scene, configSource, new object[] { new BasicInventoryAccessModule() });
156
157 SceneHelpers.SetupSceneModules(scene, new object[] { });
158
159 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
160 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
161 sogd.Enabled = false;
162
163 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
164
165 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
166 InventoryFolderBase folder1
167 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1");
168
169 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
170 scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
171
172 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
173
174 Assert.That(retrievedPart, Is.Not.Null);
175 Assert.That(so.IsDeleted, Is.False);
176
177 sogd.InventoryDeQueueAndDelete();
178
179 Assert.That(so.IsDeleted, Is.True);
180
181 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
182 Assert.That(retrievedPart2, Is.Null);
183
184// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
185
186 InventoryItemBase retrievedItem
187 = UserInventoryHelpers.GetInventoryItem(
188 scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName);
189
190 // Check that we now have the taken part in our inventory
191 Assert.That(retrievedItem, Is.Not.Null);
192
193 // Check that the taken part has actually disappeared
194// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
195// Assert.That(retrievedPart, Is.Null);
196 }
128 } 197 }
129} \ No newline at end of file 198} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 0e525c9..9378e20 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -40,7 +40,7 @@ using log4net;
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 [TestFixture] 42 [TestFixture]
43 public class SceneObjectLinkingTests 43 public class SceneObjectLinkingTests : OpenSimTestCase
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
index e931859..1182c96 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
41 /// Basic scene object resize tests 41 /// Basic scene object resize tests
42 /// </summary> 42 /// </summary>
43 [TestFixture] 43 [TestFixture]
44 public class SceneObjectResizeTests 44 public class SceneObjectResizeTests : OpenSimTestCase
45 { 45 {
46 /// <summary> 46 /// <summary>
47 /// Test resizing an object 47 /// Test resizing an object
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
index d2361f8..a58e735 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
@@ -40,7 +40,7 @@ using OpenSim.Tests.Common.Mock;
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 [TestFixture] 42 [TestFixture]
43 public class SceneObjectScriptTests 43 public class SceneObjectScriptTests : OpenSimTestCase
44 { 44 {
45 [Test] 45 [Test]
46 public void TestAddScript() 46 public void TestAddScript()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
index 6d255aa..abaa1d1 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
@@ -42,14 +42,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
42 /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.) 42 /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.)
43 /// </summary> 43 /// </summary>
44 [TestFixture] 44 [TestFixture]
45 public class SceneObjectSpatialTests 45 public class SceneObjectSpatialTests : OpenSimTestCase
46 { 46 {
47 TestScene m_scene; 47 TestScene m_scene;
48 UUID m_ownerId = TestHelpers.ParseTail(0x1); 48 UUID m_ownerId = TestHelpers.ParseTail(0x1);
49 49
50 [SetUp] 50 [SetUp]
51 public void SetUp() 51 public override void SetUp()
52 { 52 {
53 base.SetUp();
54
53 m_scene = new SceneHelpers().SetupScene(); 55 m_scene = new SceneHelpers().SetupScene();
54 } 56 }
55 57
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 742c769..8eb3191 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
42 /// Basic scene object status tests 42 /// Basic scene object status tests
43 /// </summary> 43 /// </summary>
44 [TestFixture] 44 [TestFixture]
45 public class SceneObjectStatusTests 45 public class SceneObjectStatusTests : OpenSimTestCase
46 { 46 {
47 private TestScene m_scene; 47 private TestScene m_scene;
48 private UUID m_ownerId = TestHelpers.ParseTail(0x1); 48 private UUID m_ownerId = TestHelpers.ParseTail(0x1);
@@ -78,6 +78,26 @@ namespace OpenSim.Region.Framework.Scenes.Tests
78 } 78 }
79 79
80 [Test] 80 [Test]
81 public void TestSetNonPhysicsVolumeDetectSinglePrim()
82 {
83 TestHelpers.InMethod();
84
85 m_scene.AddSceneObject(m_so1);
86
87 SceneObjectPart rootPart = m_so1.RootPart;
88 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
89
90 m_so1.ScriptSetVolumeDetect(true);
91
92// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
93 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
94
95 m_so1.ScriptSetVolumeDetect(false);
96
97 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
98 }
99
100 [Test]
81 public void TestSetPhysicsSinglePrim() 101 public void TestSetPhysicsSinglePrim()
82 { 102 {
83 TestHelpers.InMethod(); 103 TestHelpers.InMethod();
@@ -89,13 +109,32 @@ namespace OpenSim.Region.Framework.Scenes.Tests
89 109
90 m_so1.ScriptSetPhysicsStatus(true); 110 m_so1.ScriptSetPhysicsStatus(true);
91 111
92// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
93 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics)); 112 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
94 113
95 m_so1.ScriptSetPhysicsStatus(false); 114 m_so1.ScriptSetPhysicsStatus(false);
96 115
97 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); 116 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
98 } 117 }
118
119 [Test]
120 public void TestSetPhysicsVolumeDetectSinglePrim()
121 {
122 TestHelpers.InMethod();
123
124 m_scene.AddSceneObject(m_so1);
125
126 SceneObjectPart rootPart = m_so1.RootPart;
127 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
128
129 m_so1.ScriptSetPhysicsStatus(true);
130 m_so1.ScriptSetVolumeDetect(true);
131
132 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom | PrimFlags.Physics));
133
134 m_so1.ScriptSetVolumeDetect(false);
135
136 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
137 }
99 138
100 [Test] 139 [Test]
101 public void TestSetPhysicsLinkset() 140 public void TestSetPhysicsLinkset()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
index 646e5fa..1cd8ae9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
51 /// Scene presence animation tests 51 /// Scene presence animation tests
52 /// </summary> 52 /// </summary>
53 [TestFixture] 53 [TestFixture]
54 public class ScenePresenceAnimationTests 54 public class ScenePresenceAnimationTests : OpenSimTestCase
55 { 55 {
56 [Test] 56 [Test]
57 public void TestFlyingAnimation() 57 public void TestFlyingAnimation()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
index 1d1ff88..d80afd3 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
@@ -42,7 +42,7 @@ using OpenSim.Tests.Common.Mock;
42namespace OpenSim.Region.Framework.Scenes.Tests 42namespace OpenSim.Region.Framework.Scenes.Tests
43{ 43{
44 [TestFixture] 44 [TestFixture]
45 public class ScenePresenceAutopilotTests 45 public class ScenePresenceAutopilotTests : OpenSimTestCase
46 { 46 {
47 private TestScene m_scene; 47 private TestScene m_scene;
48 48
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
index 493ab70..acaeb90 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
@@ -43,7 +43,7 @@ using System.Threading;
43namespace OpenSim.Region.Framework.Scenes.Tests 43namespace OpenSim.Region.Framework.Scenes.Tests
44{ 44{
45 [TestFixture] 45 [TestFixture]
46 public class ScenePresenceSitTests 46 public class ScenePresenceSitTests : OpenSimTestCase
47 { 47 {
48 private TestScene m_scene; 48 private TestScene m_scene;
49 private ScenePresence m_sp; 49 private ScenePresence m_sp;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 37b5184..8dd1f3d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
49 /// Teleport tests in a standalone OpenSim 49 /// Teleport tests in a standalone OpenSim
50 /// </summary> 50 /// </summary>
51 [TestFixture] 51 [TestFixture]
52 public class ScenePresenceTeleportTests 52 public class ScenePresenceTeleportTests : OpenSimTestCase
53 { 53 {
54 [TestFixtureSetUp] 54 [TestFixtureSetUp]
55 public void FixtureInit() 55 public void FixtureInit()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index ac3da1e..9d8eb0b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
50 /// Scene presence tests 50 /// Scene presence tests
51 /// </summary> 51 /// </summary>
52 [TestFixture] 52 [TestFixture]
53 public class SceneTests 53 public class SceneTests : OpenSimTestCase
54 { 54 {
55 /// <summary> 55 /// <summary>
56 /// Very basic scene update test. Should become more elaborate with time. 56 /// Very basic scene update test. Should become more elaborate with time.
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index a51e4e3..0b461f5 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -50,7 +50,7 @@ using OpenSim.Tests.Common.Mock;
50namespace OpenSim.Region.Framework.Tests 50namespace OpenSim.Region.Framework.Tests
51{ 51{
52 [TestFixture] 52 [TestFixture]
53 public class TaskInventoryTests 53 public class TaskInventoryTests : OpenSimTestCase
54 { 54 {
55 [Test] 55 [Test]
56 public void TestAddTaskInventoryItem() 56 public void TestAddTaskInventoryItem()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 198e487..dd27294 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -38,7 +38,7 @@ using OpenSim.Tests.Common.Mock;
38namespace OpenSim.Region.Framework.Scenes.Tests 38namespace OpenSim.Region.Framework.Scenes.Tests
39{ 39{
40 [TestFixture] 40 [TestFixture]
41 public class UuidGathererTests 41 public class UuidGathererTests : OpenSimTestCase
42 { 42 {
43 protected IAssetService m_assetService; 43 protected IAssetService m_assetService;
44 protected UuidGatherer m_uuidGatherer; 44 protected UuidGatherer m_uuidGatherer;
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 2279e62..b09ae39 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -127,7 +127,10 @@ namespace OpenSim.Region.Framework.Scenes
127 /// within this object). 127 /// within this object).
128 /// </remarks> 128 /// </remarks>
129 /// <param name="sceneObject">The scene object for which to gather assets</param> 129 /// <param name="sceneObject">The scene object for which to gather assets</param>
130 /// <param name="assetUuids">The assets gathered</param> 130 /// <param name="assetUuids">
131 /// A dictionary which is populated with the asset UUIDs gathered and the type of that asset.
132 /// For assets where the type is not clear (e.g. UUIDs extracted from LSL and notecards), the type is Unknown.
133 /// </param>
131 public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, AssetType> assetUuids) 134 public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, AssetType> assetUuids)
132 { 135 {
133// m_log.DebugFormat( 136// m_log.DebugFormat(
@@ -257,8 +260,9 @@ namespace OpenSim.Region.Framework.Scenes
257 UUID uuid = new UUID(uuidMatch.Value); 260 UUID uuid = new UUID(uuidMatch.Value);
258// m_log.DebugFormat("[ARCHIVER]: Recording {0} in text", uuid); 261// m_log.DebugFormat("[ARCHIVER]: Recording {0} in text", uuid);
259 262
260 // Assume AssetIDs embedded are textures. 263 // Embedded asset references (if not false positives) could be for many types of asset, so we will
261 assetUuids[uuid] = AssetType.Texture; 264 // label these as unknown.
265 assetUuids[uuid] = AssetType.Unknown;
262 } 266 }
263 } 267 }
264 } 268 }