From 9671e43497c7bc09903d0ef34a45ee9ad1665927 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 01:02:58 +0000 Subject: Replace "scene debug true false true" console command with "scene debug scripting true" or other parameters as appropriate. This is to allow individual switching of scene debug settings and to provide flexibiltiy for additional settings. --- OpenSim/Region/Framework/Scenes/Scene.cs | 55 +++++++++++++++++--------------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 790ec63..f2200da 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1020,44 +1020,49 @@ namespace OpenSim.Region.Framework.Scenes } } - public void SetSceneCoreDebug(bool ScriptEngine, bool CollisionEvents, bool PhysicsEngine) + public void SetSceneCoreDebug(Dictionary options) { - if (m_scripts_enabled != !ScriptEngine) + if (options.ContainsKey("scripting")) { - if (ScriptEngine) + bool enableScripts = true; + if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts) { - m_log.Info("Stopping all Scripts in Scene"); - - EntityBase[] entities = Entities.GetEntities(); - foreach (EntityBase ent in entities) + if (!enableScripts) { - if (ent is SceneObjectGroup) - ((SceneObjectGroup)ent).RemoveScriptInstances(false); + m_log.Info("Stopping all Scripts in Scene"); + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) + { + if (ent is SceneObjectGroup) + ((SceneObjectGroup)ent).RemoveScriptInstances(false); + } } - } - else - { - m_log.Info("Starting all Scripts in Scene"); - - EntityBase[] entities = Entities.GetEntities(); - foreach (EntityBase ent in entities) + else { - if (ent is SceneObjectGroup) + m_log.Info("Starting all Scripts in Scene"); + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) { - SceneObjectGroup sog = (SceneObjectGroup)ent; - sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); - sog.ResumeScripts(); + if (ent is SceneObjectGroup) + { + SceneObjectGroup sog = (SceneObjectGroup)ent; + sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); + sog.ResumeScripts(); + } } } - } - m_scripts_enabled = !ScriptEngine; - m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); + m_scripts_enabled = enableScripts; + } } - if (m_physics_enabled != !PhysicsEngine) + if (options.ContainsKey("physics")) { - m_physics_enabled = !PhysicsEngine; + bool enablePhysics = false; + if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics) + m_physics_enabled = enablePhysics; } } -- cgit v1.1 From ab243f4a5794e6b7b9a414c2e1bb57d3d0abfb75 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 01:13:44 +0000 Subject: Incorporate scene teleporting debugging into "debug scene teleport true|false" command --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f2200da..e1e4ed5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Scenes #region Fields public bool EmergencyMonitoring = false; - public bool DEBUG = false; + public bool DebugTeleporting { get; private set; } public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; @@ -1064,6 +1064,9 @@ namespace OpenSim.Region.Framework.Scenes if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics) m_physics_enabled = enablePhysics; } + + if (options.ContainsKey("teleport")) + DebugTeleporting = true; } public int GetInaccurateNeighborCount() diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 704d12d..cf60c69 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3826,7 +3826,7 @@ namespace OpenSim.Region.Framework.Scenes ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); if (land != null) { - if (Scene.DEBUG) + if (Scene.DebugTeleporting) TeleportFlagsDebug(); // If we come in via login, landmark or map, we want to -- cgit v1.1 From de53aa32e0af4a14f6a0d0f27817b41e7befa62e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 01:27:09 +0000 Subject: Add Scene.DebugUpdates switch which, if turned on, will print out a warning when a frame updates takes longer than twice the desired time This is controlled via "debug scene updates true|false" on the region console. Also fix an oversight with "debug scene teleport true|false" --- OpenSim/Region/Framework/Scenes/Scene.cs | 42 ++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e1e4ed5..92c1060 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -65,8 +65,17 @@ namespace OpenSim.Region.Framework.Scenes #region Fields public bool EmergencyMonitoring = false; + + /// + /// Show debug information about teleports. + /// public bool DebugTeleporting { get; private set; } + /// + /// Show debug information about the scene loop. + /// + public bool DebugUpdates { get; private set; } + public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; public List NorthBorders = new List(); @@ -1060,13 +1069,24 @@ namespace OpenSim.Region.Framework.Scenes if (options.ContainsKey("physics")) { - bool enablePhysics = false; - if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics) + bool enablePhysics; + if (bool.TryParse(options["physics"], out enablePhysics)) m_physics_enabled = enablePhysics; } if (options.ContainsKey("teleport")) - DebugTeleporting = true; + { + bool enableTeleportDebugging; + if (bool.TryParse(options["teleport"], out enableTeleportDebugging)) + DebugTeleporting = enableTeleportDebugging; + } + + if (options.ContainsKey("updates")) + { + bool enableUpdateDebugging; + if (bool.TryParse(options["updates"], out enableUpdateDebugging)) + DebugUpdates = enableUpdateDebugging; + } } public int GetInaccurateNeighborCount() @@ -1390,7 +1410,7 @@ namespace OpenSim.Region.Framework.Scenes // Tell the watchdog that this thread is still alive Watchdog.UpdateThread(); -// previousFrameTick = m_lastFrameTick; + previousFrameTick = m_lastFrameTick; m_lastFrameTick = Util.EnvironmentTickCount(); maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); maintc = (int)(MinFrameTime * 1000) - maintc; @@ -1399,12 +1419,14 @@ namespace OpenSim.Region.Framework.Scenes Thread.Sleep(maintc); // Optionally warn if a frame takes double the amount of time that it should. -// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) -// m_log.WarnFormat( -// "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", -// Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), -// MinFrameTime * 1000, -// RegionInfo.RegionName); + if (DebugUpdates + && Util.EnvironmentTickCountSubtract( + m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) + m_log.WarnFormat( + "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", + Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), + MinFrameTime * 1000, + RegionInfo.RegionName); } } -- cgit v1.1 From 54a8a5baba4d7d3992cfe2c777c65eac812f7229 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 02:02:14 +0000 Subject: If "debug scene updates true" then print out to log when a garbage collection occurs. --- OpenSim/Region/Framework/Scenes/Scene.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 92c1060..76e632e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1085,7 +1085,10 @@ namespace OpenSim.Region.Framework.Scenes { bool enableUpdateDebugging; if (bool.TryParse(options["updates"], out enableUpdateDebugging)) + { DebugUpdates = enableUpdateDebugging; + GcNotify.Enabled = DebugUpdates; + } } } -- cgit v1.1 From 1a8769e6eff0eab750a528f27d127637edbd292b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 23:57:39 +0000 Subject: Instead of loading default avatar animations in both SLUtil and AvatarAnimations, load just in AvatarAnimations instead. This lets us remove the dependency of OpenSim.Framework.dll on data/avataranimations.xml, which is not necessary for ROBUST. This commit also takes care of the odd situation where animations are stored and used internally with uppercase names (e.g. "STAND") but scripts refer to them with lowercase names (e.g. "sit"). --- .../Framework/Scenes/Animation/AnimationSet.cs | 14 ++-- .../Framework/Scenes/Animation/AvatarAnimations.cs | 81 +++++++++++++++++----- .../Scenes/Animation/ScenePresenceAnimator.cs | 8 ++- 3 files changed, 79 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 9176d3d..240a424 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -27,8 +27,10 @@ using System; using System.Collections.Generic; -using OpenSim.Framework; +using System.Reflection; +using log4net; using OpenMetaverse; +using OpenSim.Framework; using Animation = OpenSim.Framework.Animation; @@ -37,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation [Serializable] public class AnimationSet { - public static AvatarAnimations Animations = new AvatarAnimations(); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); private List m_animations = new List(); @@ -132,9 +134,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation /// public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID) { - if (Animations.AnimsUUID.ContainsKey(anim)) +// m_log.DebugFormat( +// "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}", +// anim, sequenceNum, objectID); + + if (AvatarAnimations.AnimsUUID.ContainsKey(anim)) { - return SetDefaultAnimation(Animations.AnimsUUID[anim], sequenceNum, objectID); + return SetDefaultAnimation(AvatarAnimations.AnimsUUID[anim], sequenceNum, objectID); } return false; } diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs index 659c3a5..ec928f4 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs @@ -26,38 +26,83 @@ */ using System.Collections.Generic; +using System.Reflection; using System.Xml; +using log4net; using OpenMetaverse; namespace OpenSim.Region.Framework.Scenes.Animation { public class AvatarAnimations { - public Dictionary AnimsUUID = new Dictionary(); - public Dictionary AnimsNames = new Dictionary(); - public Dictionary AnimStateNames = new Dictionary(); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public AvatarAnimations() + public static readonly string DefaultAnimationsPath = "data/avataranimations.xml"; + + public static Dictionary AnimsUUID = new Dictionary(); + public static Dictionary AnimsNames = new Dictionary(); + public static Dictionary AnimStateNames = new Dictionary(); + + static AvatarAnimations() + { + LoadAnimations(DefaultAnimationsPath); + } + + /// + /// Load the default SL avatar animations. + /// + /// + private static void LoadAnimations(string path) { - using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) +// Dictionary animations = new Dictionary(); + + using (XmlTextReader reader = new XmlTextReader(path)) { XmlDocument doc = new XmlDocument(); doc.Load(reader); - foreach (XmlNode nod in doc.DocumentElement.ChildNodes) - { - if (nod.Attributes["name"] != null) +// if (doc.DocumentElement != null) +// { + foreach (XmlNode nod in doc.DocumentElement.ChildNodes) { - string name = (string)nod.Attributes["name"].Value; - UUID id = (UUID)nod.InnerText; - string animState = (string)nod.Attributes["state"].Value; - - AnimsUUID.Add(name, id); - AnimsNames.Add(id, name); - if (animState != "") - AnimStateNames.Add(id, animState); + if (nod.Attributes["name"] != null) + { + string name = nod.Attributes["name"].Value; + UUID id = (UUID)nod.InnerText; + string animState = (string)nod.Attributes["state"].Value; + + AnimsUUID.Add(name, id); + AnimsNames.Add(id, name); + if (animState != "") + AnimStateNames.Add(id, animState); + +// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState); + } } - } +// } + } + +// return animations; + } + + /// + /// Get the default avatar animation with the given name. + /// + /// + /// + public static UUID GetDefaultAnimation(string name) + { +// m_log.DebugFormat( +// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name); + + if (AnimsUUID.ContainsKey(name)) + { +// m_log.DebugFormat( +// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name); + + return AnimsUUID[name]; } + + return UUID.Zero; } } -} +} \ 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..9038ebc 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 if (m_scenePresence.IsChildAgent) return; - UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); + // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations + // are referenced with lower case names! + UUID animID = AvatarAnimations.GetDefaultAnimation(name.ToUpper()); if (animID == UUID.Zero) return; @@ -121,7 +123,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_scenePresence.IsChildAgent) return; - UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); + // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations + // are referenced with lower case names! + UUID animID = AvatarAnimations.GetDefaultAnimation(name); if (animID == UUID.Zero) return; -- cgit v1.1 From 9949ac2f9f448faaa873b98451c6025d687358a2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Mar 2012 00:10:41 +0000 Subject: refactor: Rename AvatarAnimations -> DefaultAvatarAnimations for code clarity since non-default animations are handled completely separately from this class --- .../Framework/Scenes/Animation/AnimationSet.cs | 4 +- .../Framework/Scenes/Animation/AvatarAnimations.cs | 108 --------------------- .../Scenes/Animation/DefaultAvatarAnimations.cs | 108 +++++++++++++++++++++ .../Scenes/Animation/ScenePresenceAnimator.cs | 4 +- 4 files changed, 112 insertions(+), 112 deletions(-) delete mode 100644 OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs create mode 100644 OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 240a424..33041e9 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -138,9 +138,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation // "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}", // anim, sequenceNum, objectID); - if (AvatarAnimations.AnimsUUID.ContainsKey(anim)) + if (DefaultAvatarAnimations.AnimsUUID.ContainsKey(anim)) { - return SetDefaultAnimation(AvatarAnimations.AnimsUUID[anim], sequenceNum, objectID); + return SetDefaultAnimation(DefaultAvatarAnimations.AnimsUUID[anim], sequenceNum, objectID); } return false; } diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs deleted file mode 100644 index ec928f4..0000000 --- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using System.Reflection; -using System.Xml; -using log4net; -using OpenMetaverse; - -namespace OpenSim.Region.Framework.Scenes.Animation -{ - public class AvatarAnimations - { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public static readonly string DefaultAnimationsPath = "data/avataranimations.xml"; - - public static Dictionary AnimsUUID = new Dictionary(); - public static Dictionary AnimsNames = new Dictionary(); - public static Dictionary AnimStateNames = new Dictionary(); - - static AvatarAnimations() - { - LoadAnimations(DefaultAnimationsPath); - } - - /// - /// Load the default SL avatar animations. - /// - /// - private static void LoadAnimations(string path) - { -// Dictionary animations = new Dictionary(); - - using (XmlTextReader reader = new XmlTextReader(path)) - { - XmlDocument doc = new XmlDocument(); - doc.Load(reader); -// if (doc.DocumentElement != null) -// { - foreach (XmlNode nod in doc.DocumentElement.ChildNodes) - { - if (nod.Attributes["name"] != null) - { - string name = nod.Attributes["name"].Value; - UUID id = (UUID)nod.InnerText; - string animState = (string)nod.Attributes["state"].Value; - - AnimsUUID.Add(name, id); - AnimsNames.Add(id, name); - if (animState != "") - AnimStateNames.Add(id, animState); - -// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState); - } - } -// } - } - -// return animations; - } - - /// - /// Get the default avatar animation with the given name. - /// - /// - /// - public static UUID GetDefaultAnimation(string name) - { -// m_log.DebugFormat( -// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name); - - if (AnimsUUID.ContainsKey(name)) - { -// m_log.DebugFormat( -// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name); - - return AnimsUUID[name]; - } - - return UUID.Zero; - } - } -} \ No newline at end of file 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 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System.Collections.Generic; +using System.Reflection; +using System.Xml; +using log4net; +using OpenMetaverse; + +namespace OpenSim.Region.Framework.Scenes.Animation +{ + public class DefaultAvatarAnimations + { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public static readonly string DefaultAnimationsPath = "data/avataranimations.xml"; + + public static Dictionary AnimsUUID = new Dictionary(); + public static Dictionary AnimsNames = new Dictionary(); + public static Dictionary AnimStateNames = new Dictionary(); + + static DefaultAvatarAnimations() + { + LoadAnimations(DefaultAnimationsPath); + } + + /// + /// Load the default SL avatar animations. + /// + /// + private static void LoadAnimations(string path) + { +// Dictionary animations = new Dictionary(); + + using (XmlTextReader reader = new XmlTextReader(path)) + { + XmlDocument doc = new XmlDocument(); + doc.Load(reader); +// if (doc.DocumentElement != null) +// { + foreach (XmlNode nod in doc.DocumentElement.ChildNodes) + { + if (nod.Attributes["name"] != null) + { + string name = nod.Attributes["name"].Value; + UUID id = (UUID)nod.InnerText; + string animState = (string)nod.Attributes["state"].Value; + + AnimsUUID.Add(name, id); + AnimsNames.Add(id, name); + if (animState != "") + AnimStateNames.Add(id, animState); + +// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState); + } + } +// } + } + +// return animations; + } + + /// + /// Get the default avatar animation with the given name. + /// + /// + /// + public static UUID GetDefaultAnimation(string name) + { +// m_log.DebugFormat( +// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name); + + if (AnimsUUID.ContainsKey(name)) + { +// m_log.DebugFormat( +// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name); + + return AnimsUUID[name]; + } + + return UUID.Zero; + } + } +} \ 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 9038ebc..cded9be 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -99,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations // are referenced with lower case names! - UUID animID = AvatarAnimations.GetDefaultAnimation(name.ToUpper()); + UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper()); if (animID == UUID.Zero) return; @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations // are referenced with lower case names! - UUID animID = AvatarAnimations.GetDefaultAnimation(name); + UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name); if (animID == UUID.Zero) return; -- cgit v1.1 From 6146e7ef258b10888ad7464b72b75cca701e02c9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 22 Mar 2012 12:57:12 -0700 Subject: Simple build permissions feature. NOTE: EXPERIMENTAL, DISABLED BY DEFAULT. Turns out that this can't be expressed by cascading Permission modules, so I did it as per this patch. --- OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index e1fedf4..a4605c4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -90,6 +90,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool TeleportHandler(UUID userID, Scene scene); public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); + public delegate void SendLandPropertiesHandler(UUID userID, ILandObject realLand, out ILandObject landToSend); #endregion public class ScenePermissions @@ -157,6 +158,7 @@ namespace OpenSim.Region.Framework.Scenes public event TeleportHandler OnTeleport; public event ControlPrimMediaHandler OnControlPrimMedia; public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; + public event SendLandPropertiesHandler OnSendLandProperties; #endregion #region Object Permission Checks @@ -1098,5 +1100,20 @@ namespace OpenSim.Region.Framework.Scenes } return true; } + + public void LandObjectForClient(UUID userID, ILandObject realLand, out ILandObject landToSend) + { + landToSend = realLand; + SendLandPropertiesHandler handler = OnSendLandProperties; + if (handler != null) + { + Delegate[] list = handler.GetInvocationList(); + foreach (SendLandPropertiesHandler h in list) + { + h(userID, realLand, out landToSend); + } + } + } + } } -- cgit v1.1 From 45b588cf008c514f461bf43c168dcdc9902b7bb9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 22 Mar 2012 20:10:38 +0000 Subject: Revert "Simple build permissions feature. NOTE: EXPERIMENTAL, DISABLED BY DEFAULT. Turns out that this can't be expressed by cascading Permission modules, so I did it as per this patch." This reverts commit 6146e7ef258b10888ad7464b72b75cca701e02c9. --- OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index a4605c4..e1fedf4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -90,7 +90,6 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool TeleportHandler(UUID userID, Scene scene); public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); - public delegate void SendLandPropertiesHandler(UUID userID, ILandObject realLand, out ILandObject landToSend); #endregion public class ScenePermissions @@ -158,7 +157,6 @@ namespace OpenSim.Region.Framework.Scenes public event TeleportHandler OnTeleport; public event ControlPrimMediaHandler OnControlPrimMedia; public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; - public event SendLandPropertiesHandler OnSendLandProperties; #endregion #region Object Permission Checks @@ -1100,20 +1098,5 @@ namespace OpenSim.Region.Framework.Scenes } return true; } - - public void LandObjectForClient(UUID userID, ILandObject realLand, out ILandObject landToSend) - { - landToSend = realLand; - SendLandPropertiesHandler handler = OnSendLandProperties; - if (handler != null) - { - Delegate[] list = handler.GetInvocationList(); - foreach (SendLandPropertiesHandler h in list) - { - h(userID, realLand, out landToSend); - } - } - } - } } -- cgit v1.1