diff options
Diffstat (limited to 'OpenSim/Region/Framework')
41 files changed, 940 insertions, 813 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs index da39e95..345f01b 100644 --- a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs | |||
@@ -31,18 +31,34 @@ using OpenMetaverse; | |||
31 | 31 | ||
32 | namespace OpenSim.Region.Framework.Interfaces | 32 | namespace OpenSim.Region.Framework.Interfaces |
33 | { | 33 | { |
34 | // these could be expanded at some point to provide more type information | ||
35 | // for now value accounts for all base types | ||
36 | public enum JsonStoreNodeType | ||
37 | { | ||
38 | Undefined = 0, | ||
39 | Object = 1, | ||
40 | Array = 2, | ||
41 | Value = 3 | ||
42 | } | ||
43 | |||
34 | public delegate void TakeValueCallback(string s); | 44 | public delegate void TakeValueCallback(string s); |
35 | 45 | ||
36 | public interface IJsonStoreModule | 46 | public interface IJsonStoreModule |
37 | { | 47 | { |
48 | bool AttachObjectStore(UUID objectID); | ||
38 | bool CreateStore(string value, ref UUID result); | 49 | bool CreateStore(string value, ref UUID result); |
39 | bool DestroyStore(UUID storeID); | 50 | bool DestroyStore(UUID storeID); |
40 | bool TestPath(UUID storeID, string path, bool useJson); | 51 | |
52 | JsonStoreNodeType GetPathType(UUID storeID, string path); | ||
53 | bool TestStore(UUID storeID); | ||
54 | |||
41 | bool SetValue(UUID storeID, string path, string value, bool useJson); | 55 | bool SetValue(UUID storeID, string path, string value, bool useJson); |
42 | bool RemoveValue(UUID storeID, string path); | 56 | bool RemoveValue(UUID storeID, string path); |
43 | bool GetValue(UUID storeID, string path, bool useJson, out string value); | 57 | bool GetValue(UUID storeID, string path, bool useJson, out string value); |
44 | 58 | ||
45 | void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); | 59 | void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); |
46 | void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); | 60 | void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); |
61 | |||
62 | int GetArrayLength(UUID storeID, string path); | ||
47 | } | 63 | } |
48 | } | 64 | } |
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? | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
29 | 33 | ||
30 | namespace OpenSim.Region.Framework.Scenes.Scripting | 34 | namespace 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/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 143af48..ced4e91 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -52,7 +52,18 @@ namespace OpenSim.Region.Framework.Interfaces | |||
52 | string GetXMLState(UUID itemID); | 52 | string GetXMLState(UUID itemID); |
53 | bool SetXMLState(UUID itemID, string xml); | 53 | bool SetXMLState(UUID itemID, string xml); |
54 | 54 | ||
55 | /// <summary> | ||
56 | /// Post a script event to a single script. | ||
57 | /// </summary> | ||
58 | /// <returns>true if the post suceeded, false if it did not</returns> | ||
59 | /// <param name='itemID'>The item ID of the script.</param> | ||
60 | /// <param name='name'>The name of the event.</param> | ||
61 | /// <param name='args'> | ||
62 | /// The arguments of the event. These are in the order in which they appear. | ||
63 | /// e.g. for http_request this will be an object array of key request_id, string method, string body | ||
64 | /// </param> | ||
55 | bool PostScriptEvent(UUID itemID, string name, Object[] args); | 65 | bool PostScriptEvent(UUID itemID, string name, Object[] args); |
66 | |||
56 | bool PostObjectEvent(UUID itemID, string name, Object[] args); | 67 | bool PostObjectEvent(UUID itemID, string name, Object[] args); |
57 | 68 | ||
58 | /// <summary> | 69 | /// <summary> |
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..167c248 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 | |
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 | ||
28 | using System; | 28 | using System; |
29 | using System.Threading; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | ||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | ||
32 | using log4net; | 33 | using log4net; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using 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; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.Framework.Scenes | 36 | namespace 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..4733547 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; |
@@ -778,6 +792,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
778 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); | 792 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); |
779 | 793 | ||
780 | /// <summary> | 794 | /// <summary> |
795 | /// Triggered when an object is placed into the physical scene (PhysicsActor created). | ||
796 | /// </summary> | ||
797 | public event Action<SceneObjectPart> OnObjectAddedToPhysicalScene; | ||
798 | /// <summary> | ||
799 | /// Triggered when an object is removed from the physical scene (PhysicsActor destroyed). | ||
800 | /// </summary> | ||
801 | /// <remarks> | ||
802 | /// Note: this is triggered just before the PhysicsActor is removed from the | ||
803 | /// physics engine so the receiver can do any necessary cleanup before its destruction. | ||
804 | /// </remarks> | ||
805 | public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene; | ||
806 | |||
807 | /// <summary> | ||
781 | /// Triggered when an object is removed from the scene. | 808 | /// Triggered when an object is removed from the scene. |
782 | /// </summary> | 809 | /// </summary> |
783 | /// <remarks> | 810 | /// <remarks> |
@@ -1527,6 +1554,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
1527 | } | 1554 | } |
1528 | } | 1555 | } |
1529 | 1556 | ||
1557 | public void TriggerObjectAddedToPhysicalScene(SceneObjectPart obj) | ||
1558 | { | ||
1559 | Action<SceneObjectPart> handler = OnObjectAddedToPhysicalScene; | ||
1560 | if (handler != null) | ||
1561 | { | ||
1562 | foreach (Action<SceneObjectPart> d in handler.GetInvocationList()) | ||
1563 | { | ||
1564 | try | ||
1565 | { | ||
1566 | d(obj); | ||
1567 | } | ||
1568 | catch (Exception e) | ||
1569 | { | ||
1570 | m_log.ErrorFormat( | ||
1571 | "[EVENT MANAGER]: Delegate for TriggerObjectAddedToPhysicalScene failed - continuing. {0} {1}", | ||
1572 | e.Message, e.StackTrace); | ||
1573 | } | ||
1574 | } | ||
1575 | } | ||
1576 | } | ||
1577 | |||
1578 | public void TriggerObjectRemovedFromPhysicalScene(SceneObjectPart obj) | ||
1579 | { | ||
1580 | Action<SceneObjectPart> handler = OnObjectRemovedFromPhysicalScene; | ||
1581 | if (handler != null) | ||
1582 | { | ||
1583 | foreach (Action<SceneObjectPart> d in handler.GetInvocationList()) | ||
1584 | { | ||
1585 | try | ||
1586 | { | ||
1587 | d(obj); | ||
1588 | } | ||
1589 | catch (Exception e) | ||
1590 | { | ||
1591 | m_log.ErrorFormat( | ||
1592 | "[EVENT MANAGER]: Delegate for TriggerObjectRemovedFromPhysicalScene failed - continuing. {0} {1}", | ||
1593 | e.Message, e.StackTrace); | ||
1594 | } | ||
1595 | } | ||
1596 | } | ||
1597 | } | ||
1598 | |||
1530 | public void TriggerShutdown() | 1599 | public void TriggerShutdown() |
1531 | { | 1600 | { |
1532 | Action handlerShutdown = OnShutdown; | 1601 | Action handlerShutdown = OnShutdown; |
@@ -2238,6 +2307,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
2238 | } | 2307 | } |
2239 | } | 2308 | } |
2240 | 2309 | ||
2310 | public void TriggerMovingStartEvent(uint localID) | ||
2311 | { | ||
2312 | ScriptMovingStartEvent handlerScriptMovingStartEvent = OnScriptMovingStartEvent; | ||
2313 | if (handlerScriptMovingStartEvent != null) | ||
2314 | { | ||
2315 | foreach (ScriptMovingStartEvent d in handlerScriptMovingStartEvent.GetInvocationList()) | ||
2316 | { | ||
2317 | try | ||
2318 | { | ||
2319 | d(localID); | ||
2320 | } | ||
2321 | catch (Exception e) | ||
2322 | { | ||
2323 | m_log.ErrorFormat( | ||
2324 | "[EVENT MANAGER]: Delegate for TriggerMovingStartEvent failed - continuing. {0} {1}", | ||
2325 | e.Message, e.StackTrace); | ||
2326 | } | ||
2327 | } | ||
2328 | } | ||
2329 | } | ||
2330 | |||
2331 | public void TriggerMovingEndEvent(uint localID) | ||
2332 | { | ||
2333 | ScriptMovingEndEvent handlerScriptMovingEndEvent = OnScriptMovingEndEvent; | ||
2334 | if (handlerScriptMovingEndEvent != null) | ||
2335 | { | ||
2336 | foreach (ScriptMovingEndEvent d in handlerScriptMovingEndEvent.GetInvocationList()) | ||
2337 | { | ||
2338 | try | ||
2339 | { | ||
2340 | d(localID); | ||
2341 | } | ||
2342 | catch (Exception e) | ||
2343 | { | ||
2344 | m_log.ErrorFormat( | ||
2345 | "[EVENT MANAGER]: Delegate for TriggerMovingEndEvent failed - continuing. {0} {1}", | ||
2346 | e.Message, e.StackTrace); | ||
2347 | } | ||
2348 | } | ||
2349 | } | ||
2350 | } | ||
2351 | |||
2241 | public void TriggerRequestChangeWaterHeight(float height) | 2352 | public void TriggerRequestChangeWaterHeight(float height) |
2242 | { | 2353 | { |
2243 | if (height < 0) | 2354 | if (height < 0) |
@@ -2536,13 +2647,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2536 | } | 2647 | } |
2537 | 2648 | ||
2538 | /// <summary> | 2649 | /// <summary> |
2539 | /// Updates the system as to how the position of the sun should be handled. | 2650 | /// Called when the sun's position parameters have changed in the Region and/or Estate |
2540 | /// </summary> | 2651 | /// </summary> |
2541 | /// <param name="regionHandle"></param> | 2652 | /// <param name="regionHandle">The region that changed</param> |
2542 | /// <param name="FixedTime">True if the Sun Position is fixed</param> | 2653 | 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 | { | 2654 | { |
2547 | EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; | 2655 | EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; |
2548 | if (handlerEstateToolsSunUpdate != null) | 2656 | if (handlerEstateToolsSunUpdate != null) |
@@ -2551,7 +2659,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2551 | { | 2659 | { |
2552 | try | 2660 | try |
2553 | { | 2661 | { |
2554 | d(regionHandle, FixedTime, useEstateTime, FixedSunHour); | 2662 | d(regionHandle); |
2555 | } | 2663 | } |
2556 | catch (Exception e) | 2664 | catch (Exception e) |
2557 | { | 2665 | { |
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 2e64819..92d0aff 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,154 @@ 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"]; |
850 | |||
851 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | ||
852 | |||
853 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); | ||
854 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | ||
855 | if (!UseBackup) | ||
856 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | ||
857 | |||
858 | //Animation states | ||
859 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
860 | |||
861 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); | ||
862 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); | ||
863 | |||
864 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | ||
865 | if (RegionInfo.NonphysPrimMin > 0) | ||
784 | { | 866 | { |
785 | IConfig startupConfig = m_config.Configs["Startup"]; | 867 | m_minNonphys = RegionInfo.NonphysPrimMin; |
868 | } | ||
786 | 869 | ||
787 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | 870 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
871 | if (RegionInfo.NonphysPrimMax > 0) | ||
872 | { | ||
873 | m_maxNonphys = RegionInfo.NonphysPrimMax; | ||
874 | } | ||
788 | 875 | ||
789 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); | 876 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); |
790 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); | 877 | if (RegionInfo.PhysPrimMin > 0) |
791 | if (!m_useBackup) | 878 | { |
792 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 879 | m_minPhys = RegionInfo.PhysPrimMin; |
793 | 880 | } | |
794 | //Animation states | ||
795 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
796 | 881 | ||
797 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); | 882 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
798 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); | ||
799 | 883 | ||
800 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | 884 | if (RegionInfo.PhysPrimMax > 0) |
801 | if (RegionInfo.NonphysPrimMin > 0) | 885 | { |
802 | { | 886 | m_maxPhys = RegionInfo.PhysPrimMax; |
803 | m_minNonphys = RegionInfo.NonphysPrimMin; | 887 | } |
804 | } | ||
805 | 888 | ||
806 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 889 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); |
807 | if (RegionInfo.NonphysPrimMax > 0) | 890 | if (RegionInfo.LinksetCapacity > 0) |
808 | { | 891 | { |
809 | m_maxNonphys = RegionInfo.NonphysPrimMax; | 892 | m_linksetCapacity = RegionInfo.LinksetCapacity; |
810 | } | 893 | } |
811 | 894 | ||
812 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); | 895 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); |
813 | if (RegionInfo.PhysPrimMin > 0) | 896 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); |
814 | { | ||
815 | m_minPhys = RegionInfo.PhysPrimMin; | ||
816 | } | ||
817 | 897 | ||
818 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 898 | // Here, if clamping is requested in either global or |
899 | // local config, it will be used | ||
900 | // | ||
901 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | ||
902 | if (RegionInfo.ClampPrimSize) | ||
903 | { | ||
904 | m_clampPrimSize = true; | ||
905 | } | ||
819 | 906 | ||
820 | if (RegionInfo.PhysPrimMax > 0) | 907 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
821 | { | 908 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
822 | m_maxPhys = RegionInfo.PhysPrimMax; | 909 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
823 | } | 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; | ||
824 | 916 | ||
825 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 917 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
826 | if (RegionInfo.LinksetCapacity > 0) | 918 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); |
827 | { | ||
828 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
829 | } | ||
830 | 919 | ||
831 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | 920 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
832 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | 921 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); |
922 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
833 | 923 | ||
834 | // Here, if clamping is requested in either global or | 924 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; |
835 | // local config, it will be used | 925 | |
836 | // | 926 | m_generateMaptiles |
837 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | 927 | = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); |
838 | if (RegionInfo.ClampPrimSize) | 928 | |
929 | if (m_generateMaptiles) | ||
930 | { | ||
931 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | ||
932 | if (maptileRefresh != 0) | ||
839 | { | 933 | { |
840 | m_clampPrimSize = true; | 934 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; |
935 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
936 | m_mapGenerationTimer.AutoReset = true; | ||
937 | m_mapGenerationTimer.Start(); | ||
841 | } | 938 | } |
939 | } | ||
940 | else | ||
941 | { | ||
942 | string tile | ||
943 | = Util.GetConfigVarFromSections<string>( | ||
944 | config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); | ||
842 | 945 | ||
843 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); | 946 | UUID tileID; |
844 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 947 | |
845 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 948 | if (tile != UUID.Zero.ToString() && UUID.TryParse(tile, out tileID)) |
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 | { | 949 | { |
863 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | 950 | 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 | } | 951 | } |
872 | else | 952 | else |
873 | { | 953 | { |
874 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | 954 | RegionInfo.RegionSettings.TerrainImageID = RegionInfo.MaptileStaticUUID; |
875 | UUID tileID; | 955 | 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 | } | 956 | } |
957 | } | ||
958 | |||
959 | string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; | ||
960 | |||
961 | string grant | ||
962 | = Util.GetConfigVarFromSections<string>( | ||
963 | config, "AllowedClients", possibleAccessControlConfigSections, ""); | ||
882 | 964 | ||
883 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | 965 | if (grant.Length > 0) |
884 | if (grant.Length > 0) | 966 | { |
967 | foreach (string viewer in grant.Split(',')) | ||
885 | { | 968 | { |
886 | foreach (string viewer in grant.Split(',')) | 969 | m_AllowedViewers.Add(viewer.Trim().ToLower()); |
887 | { | ||
888 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | ||
889 | } | ||
890 | } | 970 | } |
971 | } | ||
972 | |||
973 | grant | ||
974 | = Util.GetConfigVarFromSections<string>( | ||
975 | config, "BannedClients", possibleAccessControlConfigSections, ""); | ||
891 | 976 | ||
892 | grant = startupConfig.GetString("BannedClients", String.Empty); | 977 | if (grant.Length > 0) |
893 | if (grant.Length > 0) | 978 | { |
979 | foreach (string viewer in grant.Split(',')) | ||
894 | { | 980 | { |
895 | foreach (string viewer in grant.Split(',')) | 981 | m_BannedViewers.Add(viewer.Trim().ToLower()); |
896 | { | ||
897 | m_BannedViewers.Add(viewer.Trim().ToLower()); | ||
898 | } | ||
899 | } | 982 | } |
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 | } | 983 | } |
912 | } | 984 | |
913 | catch (Exception e) | 985 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); |
914 | { | 986 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); |
915 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | 987 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
988 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | ||
989 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | ||
990 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | ||
991 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | ||
992 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | ||
993 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | ||
994 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | ||
916 | } | 995 | } |
917 | 996 | ||
918 | // FIXME: Ultimately this should be in a module. | 997 | // FIXME: Ultimately this should be in a module. |
@@ -965,6 +1044,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
965 | { | 1044 | { |
966 | PhysicalPrims = true; | 1045 | PhysicalPrims = true; |
967 | CollidablePrims = true; | 1046 | CollidablePrims = true; |
1047 | PhysicsEnabled = true; | ||
1048 | |||
1049 | PeriodicBackup = true; | ||
1050 | UseBackup = true; | ||
968 | 1051 | ||
969 | BordersLocked = true; | 1052 | BordersLocked = true; |
970 | Border northBorder = new Border(); | 1053 | Border northBorder = new Border(); |
@@ -1207,83 +1290,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1207 | } | 1290 | } |
1208 | } | 1291 | } |
1209 | 1292 | ||
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() | 1293 | public int GetInaccurateNeighborCount() |
1288 | { | 1294 | { |
1289 | return m_neighbours.Count; | 1295 | return m_neighbours.Count; |
@@ -1332,16 +1338,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1332 | 1338 | ||
1333 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1339 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1334 | 1340 | ||
1335 | EntityBase[] entities = GetEntities(); | 1341 | 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(); | 1342 | m_sceneGraph.Close(); |
1346 | 1343 | ||
1347 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | 1344 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) |
@@ -1568,7 +1565,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1568 | } | 1565 | } |
1569 | 1566 | ||
1570 | tmpMS = Util.EnvironmentTickCount(); | 1567 | tmpMS = Util.EnvironmentTickCount(); |
1571 | if ((Frame % m_update_physics == 0) && m_physics_enabled) | 1568 | if (PhysicsEnabled && Frame % m_update_physics == 0) |
1572 | m_sceneGraph.UpdatePreparePhysics(); | 1569 | m_sceneGraph.UpdatePreparePhysics(); |
1573 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); | 1570 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); |
1574 | 1571 | ||
@@ -1583,7 +1580,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1583 | tmpMS = Util.EnvironmentTickCount(); | 1580 | tmpMS = Util.EnvironmentTickCount(); |
1584 | if (Frame % m_update_physics == 0) | 1581 | if (Frame % m_update_physics == 0) |
1585 | { | 1582 | { |
1586 | if (m_physics_enabled) | 1583 | if (PhysicsEnabled) |
1587 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); | 1584 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); |
1588 | 1585 | ||
1589 | if (SynchronizeScene != null) | 1586 | if (SynchronizeScene != null) |
@@ -1625,7 +1622,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1625 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1622 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1626 | } | 1623 | } |
1627 | 1624 | ||
1628 | if (Frame % m_update_backup == 0) | 1625 | if (PeriodicBackup && Frame % m_update_backup == 0) |
1629 | { | 1626 | { |
1630 | tmpMS = Util.EnvironmentTickCount(); | 1627 | tmpMS = Util.EnvironmentTickCount(); |
1631 | UpdateStorageBackup(); | 1628 | UpdateStorageBackup(); |
@@ -4728,19 +4725,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4728 | 4725 | ||
4729 | #region Script Engine | 4726 | #region Script Engine |
4730 | 4727 | ||
4731 | private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>(); | ||
4732 | public bool DumpAssetsToFile; | ||
4733 | |||
4734 | /// <summary> | ||
4735 | /// | ||
4736 | /// </summary> | ||
4737 | /// <param name="scriptEngine"></param> | ||
4738 | public void AddScriptEngine(ScriptEngineInterface scriptEngine) | ||
4739 | { | ||
4740 | ScriptEngines.Add(scriptEngine); | ||
4741 | scriptEngine.InitializeEngine(this); | ||
4742 | } | ||
4743 | |||
4744 | private bool ScriptDanger(SceneObjectPart part,Vector3 pos) | 4728 | private bool ScriptDanger(SceneObjectPart part,Vector3 pos) |
4745 | { | 4729 | { |
4746 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); | 4730 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); |
@@ -5647,33 +5631,7 @@ Environment.Exit(1); | |||
5647 | 5631 | ||
5648 | public void TriggerEstateSunUpdate() | 5632 | public void TriggerEstateSunUpdate() |
5649 | { | 5633 | { |
5650 | float sun; | 5634 | EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle); |
5651 | if (RegionInfo.RegionSettings.UseEstateSun) | ||
5652 | { | ||
5653 | sun = (float)RegionInfo.EstateSettings.SunPosition; | ||
5654 | if (RegionInfo.EstateSettings.UseGlobalTime) | ||
5655 | { | ||
5656 | sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f; | ||
5657 | } | ||
5658 | |||
5659 | // | ||
5660 | EventManager.TriggerEstateToolsSunUpdate( | ||
5661 | RegionInfo.RegionHandle, | ||
5662 | RegionInfo.EstateSettings.FixedSun, | ||
5663 | RegionInfo.RegionSettings.UseEstateSun, | ||
5664 | sun); | ||
5665 | } | ||
5666 | else | ||
5667 | { | ||
5668 | // Use the Sun Position from the Region Settings | ||
5669 | sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f; | ||
5670 | |||
5671 | EventManager.TriggerEstateToolsSunUpdate( | ||
5672 | RegionInfo.RegionHandle, | ||
5673 | RegionInfo.RegionSettings.FixedSun, | ||
5674 | RegionInfo.RegionSettings.UseEstateSun, | ||
5675 | sun); | ||
5676 | } | ||
5677 | } | 5635 | } |
5678 | 5636 | ||
5679 | private void HandleReloadEstate(string module, string[] cmd) | 5637 | private void HandleReloadEstate(string module, string[] cmd) |
@@ -5941,8 +5899,13 @@ Environment.Exit(1); | |||
5941 | 5899 | ||
5942 | if (banned) | 5900 | if (banned) |
5943 | { | 5901 | { |
5944 | reason = "No suitable landing point found"; | 5902 | if(Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) |
5945 | return false; | 5903 | { |
5904 | reason = "No suitable landing point found"; | ||
5905 | return false; | ||
5906 | } | ||
5907 | reason = "Administrative access only"; | ||
5908 | return true; | ||
5946 | } | 5909 | } |
5947 | } | 5910 | } |
5948 | } | 5911 | } |
@@ -6069,10 +6032,17 @@ Environment.Exit(1); | |||
6069 | GC.Collect(); | 6032 | GC.Collect(); |
6070 | } | 6033 | } |
6071 | 6034 | ||
6072 | // Wrappers to get physics modules retrieve assets. Has to be done this way | 6035 | /// <summary> |
6073 | // because we can't assign the asset service to physics directly - at the | 6036 | /// Wrappers to get physics modules retrieve assets. |
6074 | // time physics are instantiated it's not registered but it will be by | 6037 | /// </summary> |
6075 | // the time the first prim exists. | 6038 | /// <remarks> |
6039 | /// Has to be done this way | ||
6040 | /// because we can't assign the asset service to physics directly - at the | ||
6041 | /// time physics are instantiated it's not registered but it will be by | ||
6042 | /// the time the first prim exists. | ||
6043 | /// </remarks> | ||
6044 | /// <param name="assetID"></param> | ||
6045 | /// <param name="callback"></param> | ||
6076 | public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback) | 6046 | public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback) |
6077 | { | 6047 | { |
6078 | AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived); | 6048 | AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 0e0b6c3..c307f7a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -313,35 +313,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
313 | 313 | ||
314 | public void SendCommandToPluginModules(string[] cmdparams) | 314 | public void SendCommandToPluginModules(string[] cmdparams) |
315 | { | 315 | { |
316 | ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); | 316 | ForEachSelectedScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); |
317 | } | 317 | } |
318 | 318 | ||
319 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) | 319 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) |
320 | { | 320 | { |
321 | ForEachCurrentScene(delegate(Scene scene) { scene.Permissions.SetBypassPermissions(bypassPermissions); }); | 321 | ForEachSelectedScene(delegate(Scene scene) { scene.Permissions.SetBypassPermissions(bypassPermissions); }); |
322 | } | 322 | } |
323 | 323 | ||
324 | private void ForEachCurrentScene(Action<Scene> func) | 324 | public void ForEachSelectedScene(Action<Scene> func) |
325 | { | 325 | { |
326 | if (CurrentScene == null) | 326 | if (CurrentScene == null) |
327 | { | 327 | ForEachScene(func); |
328 | List<Scene> sceneList = Scenes; | ||
329 | sceneList.ForEach(func); | ||
330 | } | ||
331 | else | 328 | else |
332 | { | ||
333 | func(CurrentScene); | 329 | func(CurrentScene); |
334 | } | ||
335 | } | 330 | } |
336 | 331 | ||
337 | public void RestartCurrentScene() | 332 | public void RestartCurrentScene() |
338 | { | 333 | { |
339 | ForEachCurrentScene(delegate(Scene scene) { scene.RestartNow(); }); | 334 | ForEachSelectedScene(delegate(Scene scene) { scene.RestartNow(); }); |
340 | } | 335 | } |
341 | 336 | ||
342 | public void BackupCurrentScene() | 337 | public void BackupCurrentScene() |
343 | { | 338 | { |
344 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(true); }); | 339 | ForEachSelectedScene(delegate(Scene scene) { scene.Backup(true); }); |
345 | } | 340 | } |
346 | 341 | ||
347 | public bool TrySetCurrentScene(string regionName) | 342 | public bool TrySetCurrentScene(string regionName) |
@@ -434,7 +429,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
434 | /// <param name="name">Name of avatar to debug</param> | 429 | /// <param name="name">Name of avatar to debug</param> |
435 | public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) | 430 | public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) |
436 | { | 431 | { |
437 | ForEachCurrentScene(scene => | 432 | ForEachSelectedScene(scene => |
438 | scene.ForEachScenePresence(sp => | 433 | scene.ForEachScenePresence(sp => |
439 | { | 434 | { |
440 | if (name == null || sp.Name == name) | 435 | if (name == null || sp.Name == name) |
@@ -453,7 +448,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
453 | { | 448 | { |
454 | List<ScenePresence> avatars = new List<ScenePresence>(); | 449 | List<ScenePresence> avatars = new List<ScenePresence>(); |
455 | 450 | ||
456 | ForEachCurrentScene( | 451 | ForEachSelectedScene( |
457 | delegate(Scene scene) | 452 | delegate(Scene scene) |
458 | { | 453 | { |
459 | scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) | 454 | scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) |
@@ -470,7 +465,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
470 | { | 465 | { |
471 | List<ScenePresence> presences = new List<ScenePresence>(); | 466 | List<ScenePresence> presences = new List<ScenePresence>(); |
472 | 467 | ||
473 | ForEachCurrentScene(delegate(Scene scene) | 468 | ForEachSelectedScene(delegate(Scene scene) |
474 | { | 469 | { |
475 | scene.ForEachScenePresence(delegate(ScenePresence sp) | 470 | scene.ForEachScenePresence(delegate(ScenePresence sp) |
476 | { | 471 | { |
@@ -494,12 +489,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
494 | 489 | ||
495 | public void ForceCurrentSceneClientUpdate() | 490 | public void ForceCurrentSceneClientUpdate() |
496 | { | 491 | { |
497 | ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); | 492 | ForEachSelectedScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); |
498 | } | 493 | } |
499 | 494 | ||
500 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) | 495 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) |
501 | { | 496 | { |
502 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); | 497 | ForEachSelectedScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); |
503 | } | 498 | } |
504 | 499 | ||
505 | public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) | 500 | public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) |
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 20a6626..7cab841 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -37,6 +37,7 @@ using System.Xml.Serialization; | |||
37 | using log4net; | 37 | using log4net; |
38 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | using OpenMetaverse.Packets; | 39 | using OpenMetaverse.Packets; |
40 | using OpenMetaverse.StructuredData; | ||
40 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
41 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes.Scripting; | 43 | using 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. |
@@ -2133,6 +2140,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2133 | // safeguard actual copy is done in sog.copy | 2140 | // safeguard actual copy is done in sog.copy |
2134 | dupe.KeyframeMotion = null; | 2141 | dupe.KeyframeMotion = null; |
2135 | 2142 | ||
2143 | dupe.DynAttrs.CopyFrom(DynAttrs); | ||
2144 | |||
2136 | if (userExposed) | 2145 | if (userExposed) |
2137 | { | 2146 | { |
2138 | /* | 2147 | /* |
@@ -2446,11 +2455,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2446 | public int GetAxisRotation(int axis) | 2455 | public int GetAxisRotation(int axis) |
2447 | { | 2456 | { |
2448 | //Cannot use ScriptBaseClass constants as no referance to it currently. | 2457 | //Cannot use ScriptBaseClass constants as no referance to it currently. |
2449 | if (axis == 2)//STATUS_ROTATE_X | 2458 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) |
2450 | return STATUS_ROTATE_X; | 2459 | return STATUS_ROTATE_X; |
2451 | if (axis == 4)//STATUS_ROTATE_Y | 2460 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) |
2452 | return STATUS_ROTATE_Y; | 2461 | return STATUS_ROTATE_Y; |
2453 | if (axis == 8)//STATUS_ROTATE_Z | 2462 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) |
2454 | return STATUS_ROTATE_Z; | 2463 | return STATUS_ROTATE_Z; |
2455 | 2464 | ||
2456 | return 0; | 2465 | return 0; |
@@ -2485,18 +2494,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2485 | return new Vector3(0, 0, 0); | 2494 | return new Vector3(0, 0, 0); |
2486 | 2495 | ||
2487 | return ParentGroup.GetGeometricCenter(); | 2496 | return ParentGroup.GetGeometricCenter(); |
2488 | |||
2489 | /* | ||
2490 | PhysicsActor pa = PhysActor; | ||
2491 | |||
2492 | if (pa != null) | ||
2493 | { | ||
2494 | Vector3 vtmp = pa.CenterOfMass; | ||
2495 | return vtmp; | ||
2496 | } | ||
2497 | else | ||
2498 | return new Vector3(0, 0, 0); | ||
2499 | */ | ||
2500 | } | 2497 | } |
2501 | 2498 | ||
2502 | public float GetMass() | 2499 | public float GetMass() |
@@ -2910,11 +2907,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2910 | 2907 | ||
2911 | public void PhysicsOutOfBounds(Vector3 pos) | 2908 | public void PhysicsOutOfBounds(Vector3 pos) |
2912 | { | 2909 | { |
2913 | m_log.Error("[PHYSICS]: Physical Object went out of bounds."); | 2910 | // Note: This is only being called on the root prim at this time. |
2911 | |||
2912 | m_log.ErrorFormat( | ||
2913 | "[SCENE OBJECT PART]: Physical object {0}, localID {1} went out of bounds at {2} in {3}. Stopping at {4} and making non-physical.", | ||
2914 | Name, LocalId, pos, ParentGroup.Scene.Name, AbsolutePosition); | ||
2914 | 2915 | ||
2915 | RemFlag(PrimFlags.Physics); | 2916 | RemFlag(PrimFlags.Physics); |
2916 | DoPhysicsPropertyUpdate(false, true); | 2917 | DoPhysicsPropertyUpdate(false, true); |
2917 | //ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
2918 | } | 2918 | } |
2919 | 2919 | ||
2920 | public void PhysicsRequestingTerseUpdate() | 2920 | public void PhysicsRequestingTerseUpdate() |
@@ -3337,13 +3337,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3337 | ParentGroup.SetAxisRotation(axis, rotate); | 3337 | ParentGroup.SetAxisRotation(axis, rotate); |
3338 | 3338 | ||
3339 | //Cannot use ScriptBaseClass constants as no referance to it currently. | 3339 | //Cannot use ScriptBaseClass constants as no referance to it currently. |
3340 | if (axis == 2)//STATUS_ROTATE_X | 3340 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0) |
3341 | STATUS_ROTATE_X = rotate; | 3341 | STATUS_ROTATE_X = rotate; |
3342 | 3342 | ||
3343 | if (axis == 4)//STATUS_ROTATE_Y | 3343 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0) |
3344 | STATUS_ROTATE_Y = rotate; | 3344 | STATUS_ROTATE_Y = rotate; |
3345 | 3345 | ||
3346 | if (axis == 8)//STATUS_ROTATE_Z | 3346 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0) |
3347 | STATUS_ROTATE_Z = rotate; | 3347 | STATUS_ROTATE_Z = rotate; |
3348 | } | 3348 | } |
3349 | 3349 | ||
@@ -4250,6 +4250,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4250 | result.distance = distance2; | 4250 | result.distance = distance2; |
4251 | result.HitTF = true; | 4251 | result.HitTF = true; |
4252 | result.ipoint = q; | 4252 | result.ipoint = q; |
4253 | result.face = i; | ||
4253 | //m_log.Info("[FACE]:" + i.ToString()); | 4254 | //m_log.Info("[FACE]:" + i.ToString()); |
4254 | //m_log.Info("[POINT]: " + q.ToString()); | 4255 | //m_log.Info("[POINT]: " + q.ToString()); |
4255 | //m_log.Info("[DIST]: " + distance2.ToString()); | 4256 | //m_log.Info("[DIST]: " + distance2.ToString()); |
@@ -4573,7 +4574,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4573 | if (ParentGroup.RootPart == this) | 4574 | if (ParentGroup.RootPart == this) |
4574 | AngularVelocity = new Vector3(0, 0, 0); | 4575 | AngularVelocity = new Vector3(0, 0, 0); |
4575 | } | 4576 | } |
4576 | else | 4577 | else if (SetVD != wasVD) |
4577 | { | 4578 | { |
4578 | if (ParentGroup.Scene.CollidablePrims) | 4579 | if (ParentGroup.Scene.CollidablePrims) |
4579 | { | 4580 | { |
@@ -4661,9 +4662,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4661 | PhysicsShapeType, | 4662 | PhysicsShapeType, |
4662 | m_localId); | 4663 | m_localId); |
4663 | } | 4664 | } |
4664 | catch (Exception ex) | 4665 | catch (Exception e) |
4665 | { | 4666 | { |
4666 | m_log.ErrorFormat("[SCENE]: AddToPhysics object {0} failed: {1}", m_uuid, ex.Message); | 4667 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom. e={1}", m_uuid, e); |
4667 | pa = null; | 4668 | pa = null; |
4668 | } | 4669 | } |
4669 | 4670 | ||
@@ -4737,7 +4738,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4737 | } | 4738 | } |
4738 | 4739 | ||
4739 | PhysActor = pa; | 4740 | PhysActor = pa; |
4740 | } | 4741 | |
4742 | ParentGroup.Scene.EventManager.TriggerObjectAddedToPhysicalScene(this); | ||
4743 | } | ||
4741 | 4744 | ||
4742 | /// <summary> | 4745 | /// <summary> |
4743 | /// This removes the part from the physics scene. | 4746 | /// This removes the part from the physics scene. |
@@ -4756,6 +4759,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4756 | pa.OnOutOfBounds -= PhysicsOutOfBounds; | 4759 | pa.OnOutOfBounds -= PhysicsOutOfBounds; |
4757 | 4760 | ||
4758 | ParentGroup.Scene.PhysicsScene.RemovePrim(pa); | 4761 | ParentGroup.Scene.PhysicsScene.RemovePrim(pa); |
4762 | |||
4763 | ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this); | ||
4759 | } | 4764 | } |
4760 | PhysActor = null; | 4765 | PhysActor = null; |
4761 | } | 4766 | } |
@@ -5222,18 +5227,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
5222 | /// <param name='avatarId'></param> | 5227 | /// <param name='avatarId'></param> |
5223 | protected internal bool AddSittingAvatar(UUID avatarId) | 5228 | protected internal bool AddSittingAvatar(UUID avatarId) |
5224 | { | 5229 | { |
5225 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | 5230 | lock (ParentGroup.m_sittingAvatars) |
5226 | SitTargetAvatar = avatarId; | 5231 | { |
5232 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | ||
5233 | SitTargetAvatar = avatarId; | ||
5227 | 5234 | ||
5228 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5235 | if (m_sittingAvatars == null) |
5236 | m_sittingAvatars = new HashSet<UUID>(); | ||
5229 | 5237 | ||
5230 | if (sittingAvatars == null) | 5238 | if (m_sittingAvatars.Add(avatarId)) |
5231 | sittingAvatars = new HashSet<UUID>(); | 5239 | { |
5240 | ParentGroup.m_sittingAvatars.Add(avatarId); | ||
5232 | 5241 | ||
5233 | lock (sittingAvatars) | 5242 | return true; |
5234 | { | 5243 | } |
5235 | m_sittingAvatars = sittingAvatars; | 5244 | |
5236 | return m_sittingAvatars.Add(avatarId); | 5245 | return false; |
5237 | } | 5246 | } |
5238 | } | 5247 | } |
5239 | 5248 | ||
@@ -5247,27 +5256,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
5247 | /// <param name='avatarId'></param> | 5256 | /// <param name='avatarId'></param> |
5248 | protected internal bool RemoveSittingAvatar(UUID avatarId) | 5257 | protected internal bool RemoveSittingAvatar(UUID avatarId) |
5249 | { | 5258 | { |
5250 | if (SitTargetAvatar == avatarId) | 5259 | lock (ParentGroup.m_sittingAvatars) |
5251 | SitTargetAvatar = UUID.Zero; | 5260 | { |
5252 | 5261 | if (SitTargetAvatar == avatarId) | |
5253 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5262 | SitTargetAvatar = UUID.Zero; |
5254 | 5263 | ||
5255 | // This can occur under a race condition where another thread | 5264 | if (m_sittingAvatars == null) |
5256 | if (sittingAvatars == null) | 5265 | return false; |
5257 | return false; | ||
5258 | 5266 | ||
5259 | lock (sittingAvatars) | 5267 | if (m_sittingAvatars.Remove(avatarId)) |
5260 | { | ||
5261 | if (sittingAvatars.Remove(avatarId)) | ||
5262 | { | 5268 | { |
5263 | if (sittingAvatars.Count == 0) | 5269 | if (m_sittingAvatars.Count == 0) |
5264 | m_sittingAvatars = null; | 5270 | m_sittingAvatars = null; |
5265 | 5271 | ||
5272 | ParentGroup.m_sittingAvatars.Remove(avatarId); | ||
5273 | |||
5266 | return true; | 5274 | return true; |
5267 | } | 5275 | } |
5268 | } | ||
5269 | 5276 | ||
5270 | return false; | 5277 | return false; |
5278 | } | ||
5271 | } | 5279 | } |
5272 | 5280 | ||
5273 | /// <summary> | 5281 | /// <summary> |
@@ -5277,16 +5285,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5277 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> | 5285 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> |
5278 | public HashSet<UUID> GetSittingAvatars() | 5286 | public HashSet<UUID> GetSittingAvatars() |
5279 | { | 5287 | { |
5280 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5288 | lock (ParentGroup.m_sittingAvatars) |
5281 | |||
5282 | if (sittingAvatars == null) | ||
5283 | { | 5289 | { |
5284 | return null; | 5290 | if (m_sittingAvatars == null) |
5285 | } | 5291 | return null; |
5286 | else | 5292 | else |
5287 | { | 5293 | return new HashSet<UUID>(m_sittingAvatars); |
5288 | lock (sittingAvatars) | ||
5289 | return new HashSet<UUID>(sittingAvatars); | ||
5290 | } | 5294 | } |
5291 | } | 5295 | } |
5292 | 5296 | ||
@@ -5297,13 +5301,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
5297 | /// <returns></returns> | 5301 | /// <returns></returns> |
5298 | public int GetSittingAvatarsCount() | 5302 | public int GetSittingAvatarsCount() |
5299 | { | 5303 | { |
5300 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5304 | lock (ParentGroup.m_sittingAvatars) |
5301 | 5305 | { | |
5302 | if (sittingAvatars == null) | 5306 | if (m_sittingAvatars == null) |
5303 | return 0; | 5307 | return 0; |
5304 | 5308 | else | |
5305 | lock (sittingAvatars) | 5309 | return m_sittingAvatars.Count; |
5306 | return sittingAvatars.Count; | 5310 | } |
5307 | } | 5311 | } |
5308 | } | 5312 | } |
5309 | } | 5313 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 91f9c0b..f2aa0c5 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 | ||
@@ -705,6 +703,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
705 | 703 | ||
706 | private bool m_inTransit; | 704 | private bool m_inTransit; |
707 | 705 | ||
706 | /// <summary> | ||
707 | /// This signals whether the presence is in transit between neighbouring regions. | ||
708 | /// </summary> | ||
709 | /// <remarks> | ||
710 | /// It is not set when the presence is teleporting or logging in/out directly to a region. | ||
711 | /// </remarks> | ||
708 | public bool IsInTransit | 712 | public bool IsInTransit |
709 | { | 713 | { |
710 | get { return m_inTransit; } | 714 | get { return m_inTransit; } |
@@ -2077,7 +2081,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2077 | // Get terrain height for sub-region in a megaregion if necessary | 2081 | // Get terrain height for sub-region in a megaregion if necessary |
2078 | int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); | 2082 | int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); |
2079 | int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); | 2083 | int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); |
2080 | UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID; | 2084 | GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); |
2085 | // If X and Y is NaN, target_region will be null | ||
2086 | if (target_region == null) | ||
2087 | return; | ||
2088 | UUID target_regionID = target_region.RegionID; | ||
2081 | Scene targetScene = m_scene; | 2089 | Scene targetScene = m_scene; |
2082 | 2090 | ||
2083 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) | 2091 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) |
@@ -2322,28 +2330,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2322 | 2330 | ||
2323 | if (ParentID != 0) | 2331 | if (ParentID != 0) |
2324 | { | 2332 | { |
2333 | if (ParentPart.UUID == targetID) | ||
2334 | return; // already sitting here, ignore | ||
2335 | |||
2325 | StandUp(); | 2336 | StandUp(); |
2326 | } | 2337 | } |
2327 | 2338 | ||
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); | 2339 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); |
2339 | 2340 | ||
2340 | if (part != null) | 2341 | if (part != null) |
2341 | { | 2342 | { |
2342 | if (!String.IsNullOrEmpty(part.SitAnimation)) | ||
2343 | { | ||
2344 | m_nextSitAnimation = part.SitAnimation; | ||
2345 | } | ||
2346 | |||
2347 | m_requestedSitTargetID = part.LocalId; | 2343 | m_requestedSitTargetID = part.LocalId; |
2348 | m_requestedSitTargetUUID = targetID; | 2344 | m_requestedSitTargetUUID = targetID; |
2349 | 2345 | ||
@@ -2464,18 +2460,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2464 | 2460 | ||
2465 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) | 2461 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) |
2466 | { | 2462 | { |
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); | 2463 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); |
2480 | 2464 | ||
2481 | if (part != null) | 2465 | if (part != null) |
@@ -2545,10 +2529,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2545 | 2529 | ||
2546 | ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); | 2530 | ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); |
2547 | ParentID = m_requestedSitTargetID; | 2531 | ParentID = m_requestedSitTargetID; |
2548 | 2532 | m_AngularVelocity = Vector3.Zero; | |
2549 | Velocity = Vector3.Zero; | 2533 | Velocity = Vector3.Zero; |
2550 | RemoveFromPhysicalScene(); | 2534 | RemoveFromPhysicalScene(); |
2551 | 2535 | ||
2536 | String sitAnimation = "SIT"; | ||
2537 | if (!String.IsNullOrEmpty(part.SitAnimation)) | ||
2538 | { | ||
2539 | sitAnimation = part.SitAnimation; | ||
2540 | } | ||
2552 | Animator.TrySetMovementAnimation(sitAnimation); | 2541 | Animator.TrySetMovementAnimation(sitAnimation); |
2553 | SendAvatarDataToAllAgents(); | 2542 | SendAvatarDataToAllAgents(); |
2554 | } | 2543 | } |
@@ -2556,7 +2545,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2556 | 2545 | ||
2557 | public void HandleAgentSitOnGround() | 2546 | public void HandleAgentSitOnGround() |
2558 | { | 2547 | { |
2559 | // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. | 2548 | // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. |
2549 | m_AngularVelocity = Vector3.Zero; | ||
2560 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | 2550 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); |
2561 | SitGround = true; | 2551 | SitGround = true; |
2562 | RemoveFromPhysicalScene(); | 2552 | RemoveFromPhysicalScene(); |
@@ -2578,7 +2568,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2578 | 2568 | ||
2579 | public void HandleStopAnim(IClientAPI remoteClient, UUID animID) | 2569 | public void HandleStopAnim(IClientAPI remoteClient, UUID animID) |
2580 | { | 2570 | { |
2581 | Animator.RemoveAnimation(animID); | 2571 | Animator.RemoveAnimation(animID, false); |
2582 | } | 2572 | } |
2583 | 2573 | ||
2584 | public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack) | 2574 | public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack) |
@@ -4289,6 +4279,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4289 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | 4279 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || |
4290 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) | 4280 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) |
4291 | { | 4281 | { |
4282 | |||
4292 | if (GodLevel < 200 && | 4283 | if (GodLevel < 200 && |
4293 | ((!m_scene.Permissions.IsGod(m_uuid) && | 4284 | ((!m_scene.Permissions.IsGod(m_uuid) && |
4294 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || | 4285 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || |
@@ -4297,7 +4288,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4297 | { | 4288 | { |
4298 | SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); | 4289 | SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); |
4299 | if (spawnPoints.Length == 0) | 4290 | if (spawnPoints.Length == 0) |
4291 | { | ||
4292 | if(m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) | ||
4293 | { | ||
4294 | pos.X = 128.0f; | ||
4295 | pos.Y = 128.0f; | ||
4296 | } | ||
4300 | return; | 4297 | return; |
4298 | } | ||
4301 | 4299 | ||
4302 | int index; | 4300 | int index; |
4303 | bool selected = false; | 4301 | bool selected = false; |
@@ -4306,6 +4304,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4306 | { | 4304 | { |
4307 | case "random": | 4305 | case "random": |
4308 | 4306 | ||
4307 | if (spawnPoints.Length == 0) | ||
4308 | return; | ||
4309 | do | 4309 | do |
4310 | { | 4310 | { |
4311 | index = Util.RandomClass.Next(spawnPoints.Length - 1); | 4311 | index = Util.RandomClass.Next(spawnPoints.Length - 1); |
@@ -4317,6 +4317,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4317 | // SpawnPoint sp = spawnPoints[index]; | 4317 | // SpawnPoint sp = spawnPoints[index]; |
4318 | 4318 | ||
4319 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | 4319 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); |
4320 | |||
4320 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | 4321 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) |
4321 | selected = false; | 4322 | selected = false; |
4322 | else | 4323 | else |
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 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace 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 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using log4net; | ||
31 | using System.Reflection; | ||
32 | using OpenSim.Framework; | ||
33 | |||
34 | namespace 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 */ | ||
29 | using System; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | |||
34 | namespace 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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | |||
33 | namespace 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/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index a4f730d..5cb271d 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs | |||
@@ -42,9 +42,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
42 | /// <summary> | 42 | /// <summary> |
43 | /// Serialize and deserialize coalesced scene objects. | 43 | /// Serialize and deserialize coalesced scene objects. |
44 | /// </summary> | 44 | /// </summary> |
45 | /// <remarks> | ||
46 | /// Deserialization not yet here. | ||
47 | /// </remarks> | ||
48 | public class CoalescedSceneObjectsSerializer | 45 | public class CoalescedSceneObjectsSerializer |
49 | { | 46 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -128,6 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
128 | // m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); | 125 | // m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); |
129 | 126 | ||
130 | coa = null; | 127 | coa = null; |
128 | int i = 0; | ||
131 | 129 | ||
132 | using (StringReader sr = new StringReader(xml)) | 130 | using (StringReader sr = new StringReader(xml)) |
133 | { | 131 | { |
@@ -153,7 +151,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
153 | if (reader.Name == "SceneObjectGroup") | 151 | if (reader.Name == "SceneObjectGroup") |
154 | { | 152 | { |
155 | string soXml = reader.ReadOuterXml(); | 153 | string soXml = reader.ReadOuterXml(); |
156 | coa.Add(SceneObjectSerializer.FromOriginalXmlFormat(soXml)); | 154 | |
155 | SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(soXml); | ||
156 | |||
157 | if (so != null) | ||
158 | { | ||
159 | coa.Add(so); | ||
160 | } | ||
161 | else | ||
162 | { | ||
163 | // XXX: Possibly we should fail outright here rather than continuing if a particular component of the | ||
164 | // coalesced object fails to load. | ||
165 | m_log.WarnFormat( | ||
166 | "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.", | ||
167 | i); | ||
168 | } | ||
169 | |||
170 | i++; | ||
157 | } | 171 | } |
158 | } | 172 | } |
159 | 173 | ||
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; | |||
37 | namespace OpenSim.Region.Framework.Scenes.Tests | 37 | namespace 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; | |||
41 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace 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; | |||
40 | namespace OpenSim.Region.Framework.Scenes.Tests | 40 | namespace 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; | |||
41 | namespace OpenSim.Region.Framework.Scenes.Tests | 41 | namespace 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; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Threading; | 31 | using System.Threading; |
32 | using Nini.Config; | ||
32 | using NUnit.Framework; | 33 | using NUnit.Framework; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using 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..52ad538 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |||
@@ -33,22 +33,24 @@ using NUnit.Framework; | |||
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Region.CoreModules.Framework.InventoryAccess; | ||
36 | using OpenSim.Region.CoreModules.World.Permissions; | 37 | using OpenSim.Region.CoreModules.World.Permissions; |
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using OpenSim.Services.Interfaces; | ||
38 | using OpenSim.Tests.Common; | 40 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 41 | using OpenSim.Tests.Common.Mock; |
40 | 42 | ||
41 | namespace OpenSim.Region.Framework.Scenes.Tests | 43 | namespace 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", false); | ||
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; | |||
40 | namespace OpenSim.Region.Framework.Scenes.Tests | 40 | namespace 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; | |||
40 | namespace OpenSim.Region.Framework.Scenes.Tests | 40 | namespace 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; | |||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 42 | namespace 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; | |||
43 | namespace OpenSim.Region.Framework.Scenes.Tests | 43 | namespace 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..6e0ea7d 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; | |||
50 | namespace OpenSim.Region.Framework.Tests | 50 | namespace 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() |
@@ -130,10 +130,10 @@ namespace OpenSim.Region.Framework.Tests | |||
130 | SceneObjectPart sop1 = sog1.RootPart; | 130 | SceneObjectPart sop1 = sog1.RootPart; |
131 | TaskInventoryItem sopItem1 | 131 | TaskInventoryItem sopItem1 |
132 | = TaskInventoryHelpers.AddNotecard( | 132 | = TaskInventoryHelpers.AddNotecard( |
133 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); | 133 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
134 | 134 | ||
135 | InventoryFolderBase folder | 135 | InventoryFolderBase folder |
136 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; | 136 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; |
137 | 137 | ||
138 | // Perform test | 138 | // Perform test |
139 | scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); | 139 | scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); |
@@ -162,7 +162,7 @@ namespace OpenSim.Region.Framework.Tests | |||
162 | SceneObjectPart sop1 = sog1.RootPart; | 162 | SceneObjectPart sop1 = sog1.RootPart; |
163 | TaskInventoryItem sopItem1 | 163 | TaskInventoryItem sopItem1 |
164 | = TaskInventoryHelpers.AddNotecard( | 164 | = TaskInventoryHelpers.AddNotecard( |
165 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); | 165 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
166 | 166 | ||
167 | // Perform test | 167 | // Perform test |
168 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); | 168 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 9457ebb..e50b4da 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Tests | |||
64 | Scene scene = new SceneHelpers().SetupScene(); | 64 | Scene scene = new SceneHelpers().SetupScene(); |
65 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | 65 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
66 | 66 | ||
67 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName); | 67 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName, false); |
68 | 68 | ||
69 | List<InventoryFolderBase> oneFolder | 69 | List<InventoryFolderBase> oneFolder |
70 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); | 70 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); |
@@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Tests | |||
73 | InventoryFolderBase firstRetrievedFolder = oneFolder[0]; | 73 | InventoryFolderBase firstRetrievedFolder = oneFolder[0]; |
74 | Assert.That(firstRetrievedFolder.Name, Is.EqualTo(foldersName)); | 74 | Assert.That(firstRetrievedFolder.Name, Is.EqualTo(foldersName)); |
75 | 75 | ||
76 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName); | 76 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName, false); |
77 | 77 | ||
78 | List<InventoryFolderBase> twoFolders | 78 | List<InventoryFolderBase> twoFolders |
79 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); | 79 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); |
@@ -121,7 +121,7 @@ namespace OpenSim.Region.Framework.Tests | |||
121 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | 121 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
122 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); | 122 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
123 | InventoryFolderBase folder1 | 123 | InventoryFolderBase folder1 |
124 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); | 124 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false); |
125 | 125 | ||
126 | scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); | 126 | scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); |
127 | 127 | ||
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; | |||
38 | namespace OpenSim.Region.Framework.Scenes.Tests | 38 | namespace 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 | } |