aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs63
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs108
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs97
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
6 files changed, 190 insertions, 102 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
index 9176d3d..33041e9 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
@@ -27,8 +27,10 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Framework; 30using System.Reflection;
31using log4net;
31using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework;
32 34
33using Animation = OpenSim.Framework.Animation; 35using Animation = OpenSim.Framework.Animation;
34 36
@@ -37,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
37 [Serializable] 39 [Serializable]
38 public class AnimationSet 40 public class AnimationSet
39 { 41 {
40 public static AvatarAnimations Animations = new AvatarAnimations(); 42// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 43
42 private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); 44 private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation();
43 private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>(); 45 private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>();
@@ -132,9 +134,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
132 /// </summary> 134 /// </summary>
133 public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID) 135 public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID)
134 { 136 {
135 if (Animations.AnimsUUID.ContainsKey(anim)) 137// m_log.DebugFormat(
138// "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}",
139// anim, sequenceNum, objectID);
140
141 if (DefaultAvatarAnimations.AnimsUUID.ContainsKey(anim))
136 { 142 {
137 return SetDefaultAnimation(Animations.AnimsUUID[anim], sequenceNum, objectID); 143 return SetDefaultAnimation(DefaultAvatarAnimations.AnimsUUID[anim], sequenceNum, objectID);
138 } 144 }
139 return false; 145 return false;
140 } 146 }
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs
deleted file mode 100644
index 659c3a5..0000000
--- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29using System.Xml;
30using OpenMetaverse;
31
32namespace OpenSim.Region.Framework.Scenes.Animation
33{
34 public class AvatarAnimations
35 {
36 public Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
37 public Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
38 public Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
39
40 public AvatarAnimations()
41 {
42 using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
43 {
44 XmlDocument doc = new XmlDocument();
45 doc.Load(reader);
46 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
47 {
48 if (nod.Attributes["name"] != null)
49 {
50 string name = (string)nod.Attributes["name"].Value;
51 UUID id = (UUID)nod.InnerText;
52 string animState = (string)nod.Attributes["state"].Value;
53
54 AnimsUUID.Add(name, id);
55 AnimsNames.Add(id, name);
56 if (animState != "")
57 AnimStateNames.Add(id, animState);
58 }
59 }
60 }
61 }
62 }
63}
diff --git a/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs
new file mode 100644
index 0000000..c2b0468
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs
@@ -0,0 +1,108 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29using System.Reflection;
30using System.Xml;
31using log4net;
32using OpenMetaverse;
33
34namespace OpenSim.Region.Framework.Scenes.Animation
35{
36 public class DefaultAvatarAnimations
37 {
38// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
40 public static readonly string DefaultAnimationsPath = "data/avataranimations.xml";
41
42 public static Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
43 public static Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
44 public static Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
45
46 static DefaultAvatarAnimations()
47 {
48 LoadAnimations(DefaultAnimationsPath);
49 }
50
51 /// <summary>
52 /// Load the default SL avatar animations.
53 /// </summary>
54 /// <returns></returns>
55 private static void LoadAnimations(string path)
56 {
57// Dictionary<string, UUID> animations = new Dictionary<string, UUID>();
58
59 using (XmlTextReader reader = new XmlTextReader(path))
60 {
61 XmlDocument doc = new XmlDocument();
62 doc.Load(reader);
63// if (doc.DocumentElement != null)
64// {
65 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
66 {
67 if (nod.Attributes["name"] != null)
68 {
69 string name = nod.Attributes["name"].Value;
70 UUID id = (UUID)nod.InnerText;
71 string animState = (string)nod.Attributes["state"].Value;
72
73 AnimsUUID.Add(name, id);
74 AnimsNames.Add(id, name);
75 if (animState != "")
76 AnimStateNames.Add(id, animState);
77
78// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState);
79 }
80 }
81// }
82 }
83
84// return animations;
85 }
86
87 /// <summary>
88 /// Get the default avatar animation with the given name.
89 /// </summary>
90 /// <param name="name"></param>
91 /// <returns></returns>
92 public static UUID GetDefaultAnimation(string name)
93 {
94// m_log.DebugFormat(
95// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name);
96
97 if (AnimsUUID.ContainsKey(name))
98 {
99// m_log.DebugFormat(
100// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name);
101
102 return AnimsUUID[name];
103 }
104
105 return UUID.Zero;
106 }
107 }
108} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 3584cda..cded9be 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -97,7 +97,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
97 if (m_scenePresence.IsChildAgent) 97 if (m_scenePresence.IsChildAgent)
98 return; 98 return;
99 99
100 UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); 100 // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
101 // are referenced with lower case names!
102 UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper());
101 if (animID == UUID.Zero) 103 if (animID == UUID.Zero)
102 return; 104 return;
103 105
@@ -121,7 +123,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
121 if (m_scenePresence.IsChildAgent) 123 if (m_scenePresence.IsChildAgent)
122 return; 124 return;
123 125
124 UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); 126 // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
127 // are referenced with lower case names!
128 UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name);
125 if (animID == UUID.Zero) 129 if (animID == UUID.Zero)
126 return; 130 return;
127 131
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 44ee453..44a738e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -65,7 +65,16 @@ namespace OpenSim.Region.Framework.Scenes
65 #region Fields 65 #region Fields
66 66
67 public bool EmergencyMonitoring = false; 67 public bool EmergencyMonitoring = false;
68 public bool DEBUG = false; 68
69 /// <summary>
70 /// Show debug information about teleports.
71 /// </summary>
72 public bool DebugTeleporting { get; private set; }
73
74 /// <summary>
75 /// Show debug information about the scene loop.
76 /// </summary>
77 public bool DebugUpdates { get; private set; }
69 78
70 public SynchronizeSceneHandler SynchronizeScene; 79 public SynchronizeSceneHandler SynchronizeScene;
71 public SimStatsReporter StatsReporter; 80 public SimStatsReporter StatsReporter;
@@ -1053,44 +1062,66 @@ namespace OpenSim.Region.Framework.Scenes
1053 } 1062 }
1054 } 1063 }
1055 1064
1056 public void SetSceneCoreDebug(bool ScriptEngine, bool CollisionEvents, bool PhysicsEngine) 1065 public void SetSceneCoreDebug(Dictionary<string, string> options)
1057 { 1066 {
1058 if (m_scripts_enabled != !ScriptEngine) 1067 if (options.ContainsKey("scripting"))
1059 { 1068 {
1060 if (ScriptEngine) 1069 bool enableScripts = true;
1070 if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts)
1061 { 1071 {
1062 m_log.Info("Stopping all Scripts in Scene"); 1072 if (!enableScripts)
1063
1064 EntityBase[] entities = Entities.GetEntities();
1065 foreach (EntityBase ent in entities)
1066 { 1073 {
1067 if (ent is SceneObjectGroup) 1074 m_log.Info("Stopping all Scripts in Scene");
1068 ((SceneObjectGroup)ent).RemoveScriptInstances(false); 1075
1076 EntityBase[] entities = Entities.GetEntities();
1077 foreach (EntityBase ent in entities)
1078 {
1079 if (ent is SceneObjectGroup)
1080 ((SceneObjectGroup)ent).RemoveScriptInstances(false);
1081 }
1069 } 1082 }
1070 } 1083 else
1071 else
1072 {
1073 m_log.Info("Starting all Scripts in Scene");
1074
1075 EntityBase[] entities = Entities.GetEntities();
1076 foreach (EntityBase ent in entities)
1077 { 1084 {
1078 if (ent is SceneObjectGroup) 1085 m_log.Info("Starting all Scripts in Scene");
1086
1087 EntityBase[] entities = Entities.GetEntities();
1088 foreach (EntityBase ent in entities)
1079 { 1089 {
1080 SceneObjectGroup sog = (SceneObjectGroup)ent; 1090 if (ent is SceneObjectGroup)
1081 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); 1091 {
1082 sog.ResumeScripts(); 1092 SceneObjectGroup sog = (SceneObjectGroup)ent;
1093 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
1094 sog.ResumeScripts();
1095 }
1083 } 1096 }
1084 } 1097 }
1098
1099 m_scripts_enabled = enableScripts;
1085 } 1100 }
1101 }
1086 1102
1087 m_scripts_enabled = !ScriptEngine; 1103 if (options.ContainsKey("physics"))
1088 m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); 1104 {
1105 bool enablePhysics;
1106 if (bool.TryParse(options["physics"], out enablePhysics))
1107 m_physics_enabled = enablePhysics;
1108 }
1109
1110 if (options.ContainsKey("teleport"))
1111 {
1112 bool enableTeleportDebugging;
1113 if (bool.TryParse(options["teleport"], out enableTeleportDebugging))
1114 DebugTeleporting = enableTeleportDebugging;
1089 } 1115 }
1090 1116
1091 if (m_physics_enabled != !PhysicsEngine) 1117 if (options.ContainsKey("updates"))
1092 { 1118 {
1093 m_physics_enabled = !PhysicsEngine; 1119 bool enableUpdateDebugging;
1120 if (bool.TryParse(options["updates"], out enableUpdateDebugging))
1121 {
1122 DebugUpdates = enableUpdateDebugging;
1123 GcNotify.Enabled = DebugUpdates;
1124 }
1094 } 1125 }
1095 } 1126 }
1096 1127
@@ -1427,7 +1458,7 @@ namespace OpenSim.Region.Framework.Scenes
1427 // Tell the watchdog that this thread is still alive 1458 // Tell the watchdog that this thread is still alive
1428 Watchdog.UpdateThread(); 1459 Watchdog.UpdateThread();
1429 1460
1430// previousFrameTick = m_lastFrameTick; 1461 previousFrameTick = m_lastFrameTick;
1431 m_lastFrameTick = Util.EnvironmentTickCount(); 1462 m_lastFrameTick = Util.EnvironmentTickCount();
1432 maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); 1463 maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc);
1433 maintc = (int)(MinFrameTime * 1000) - maintc; 1464 maintc = (int)(MinFrameTime * 1000) - maintc;
@@ -1442,12 +1473,14 @@ namespace OpenSim.Region.Framework.Scenes
1442 m_firstHeartbeat = false; 1473 m_firstHeartbeat = false;
1443 1474
1444 // Optionally warn if a frame takes double the amount of time that it should. 1475 // Optionally warn if a frame takes double the amount of time that it should.
1445// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) 1476 if (DebugUpdates
1446// m_log.WarnFormat( 1477 && Util.EnvironmentTickCountSubtract(
1447// "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", 1478 m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2))
1448// Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), 1479 m_log.WarnFormat(
1449// MinFrameTime * 1000, 1480 "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
1450// RegionInfo.RegionName); 1481 Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
1482 MinFrameTime * 1000,
1483 RegionInfo.RegionName);
1451 } 1484 }
1452 } 1485 }
1453 1486
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0847994..2346c60 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3920,7 +3920,7 @@ namespace OpenSim.Region.Framework.Scenes
3920 ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); 3920 ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
3921 if (land != null) 3921 if (land != null)
3922 { 3922 {
3923 if (Scene.DEBUG) 3923 if (Scene.DebugTeleporting)
3924 TeleportFlagsDebug(); 3924 TeleportFlagsDebug();
3925 3925
3926 // If we come in via login, landmark or map, we want to 3926 // If we come in via login, landmark or map, we want to